diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/enterprises/[enterprise]/copilot/billing/seats/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/enterprises/[enterprise]/copilot/billing/seats/route.ts new file mode 100644 index 00000000..6ec0966f --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/enterprises/[enterprise]/copilot/billing/seats/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../../generated/api.github.com.yaml/enterprises/[enterprise]/copilot/billing/seats/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/enterprises/[enterprise]/copilot/usage/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/enterprises/[enterprise]/copilot/usage/route.ts new file mode 100644 index 00000000..afbfcaac --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/enterprises/[enterprise]/copilot/usage/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../generated/api.github.com.yaml/enterprises/[enterprise]/copilot/usage/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/enterprises/[enterprise]/team/[team_slug]/copilot/usage/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/enterprises/[enterprise]/team/[team_slug]/copilot/usage/route.ts new file mode 100644 index 00000000..8e6b07ff --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/enterprises/[enterprise]/team/[team_slug]/copilot/usage/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../../../generated/api.github.com.yaml/enterprises/[enterprise]/team/[team_slug]/copilot/usage/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/attestations/[subject_digest]/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/attestations/[subject_digest]/route.ts new file mode 100644 index 00000000..c03feaba --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/attestations/[subject_digest]/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../generated/api.github.com.yaml/orgs/[org]/attestations/[subject_digest]/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/attach/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/attach/route.ts new file mode 100644 index 00000000..b79e6577 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/attach/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../../../generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/attach/route" + +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/defaults/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/defaults/route.ts new file mode 100644 index 00000000..d320f02e --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/defaults/route.ts @@ -0,0 +1,6 @@ +import { _PUT } from "../../../../../../../../generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/defaults/route" + +export const PUT = _PUT(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/repositories/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/repositories/route.ts new file mode 100644 index 00000000..b73dc2bf --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/repositories/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../../../generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/repositories/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/route.ts new file mode 100644 index 00000000..e27e562b --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/route.ts @@ -0,0 +1,18 @@ +import { + _GET, + _PATCH, + _DELETE, +} from "../../../../../../../generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/route" + +export const GET = _GET(async ({ params }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) +export const PATCH = _PATCH(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) +export const DELETE = _DELETE(async ({ params }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/defaults/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/defaults/route.ts new file mode 100644 index 00000000..dc8c0994 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/defaults/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../../generated/api.github.com.yaml/orgs/[org]/code-security/configurations/defaults/route" + +export const GET = _GET(async ({ params }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/detach/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/detach/route.ts new file mode 100644 index 00000000..c4c2fcba --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/detach/route.ts @@ -0,0 +1,6 @@ +import { _DELETE } from "../../../../../../../generated/api.github.com.yaml/orgs/[org]/code-security/configurations/detach/route" + +export const DELETE = _DELETE(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/route.ts new file mode 100644 index 00000000..a470efd6 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/code-security/configurations/route.ts @@ -0,0 +1,13 @@ +import { + _GET, + _POST, +} from "../../../../../../generated/api.github.com.yaml/orgs/[org]/code-security/configurations/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/copilot/usage/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/copilot/usage/route.ts new file mode 100644 index 00000000..66c73656 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/copilot/usage/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../generated/api.github.com.yaml/orgs/[org]/copilot/usage/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/route.ts index 29882d01..f3a93268 100644 --- a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/route.ts +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/route.ts @@ -1,18 +1,6 @@ -import { - _GET, - _PATCH, - _DELETE, -} from "../../../../../../generated/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/route" +import { _GET } from "../../../../../../generated/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/route" export const GET = _GET(async ({ params }, respond, context) => { // TODO: implementation return respond.withStatus(501).body({ message: "not implemented" } as any) }) -export const PATCH = _PATCH(async ({ params, body }, respond, context) => { - // TODO: implementation - return respond.withStatus(501).body({ message: "not implemented" } as any) -}) -export const DELETE = _DELETE(async ({ params }, respond, context) => { - // TODO: implementation - return respond.withStatus(501).body({ message: "not implemented" } as any) -}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/organization-roles/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/organization-roles/route.ts index afcfc6c5..05525277 100644 --- a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/organization-roles/route.ts +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/organization-roles/route.ts @@ -1,13 +1,6 @@ -import { - _GET, - _POST, -} from "../../../../../generated/api.github.com.yaml/orgs/[org]/organization-roles/route" +import { _GET } from "../../../../../generated/api.github.com.yaml/orgs/[org]/organization-roles/route" export const GET = _GET(async ({ params }, respond, context) => { // TODO: implementation return respond.withStatus(501).body({ message: "not implemented" } as any) }) -export const POST = _POST(async ({ params, body }, respond, context) => { - // TODO: implementation - return respond.withStatus(501).body({ message: "not implemented" } as any) -}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/team/[team_slug]/copilot/usage/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/team/[team_slug]/copilot/usage/route.ts new file mode 100644 index 00000000..d97f1ac0 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/team/[team_slug]/copilot/usage/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../../../generated/api.github.com.yaml/orgs/[org]/team/[team_slug]/copilot/usage/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/attestations/[subject_digest]/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/attestations/[subject_digest]/route.ts new file mode 100644 index 00000000..5bb7a65f --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/attestations/[subject_digest]/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../../generated/api.github.com.yaml/repos/[owner]/[repo]/attestations/[subject_digest]/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/attestations/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/attestations/route.ts new file mode 100644 index 00000000..cba0e915 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/attestations/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../generated/api.github.com.yaml/repos/[owner]/[repo]/attestations/route" + +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/[codeql_variant_analysis_id]/repos/[repo_owner]/[repo_name]/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/[codeql_variant_analysis_id]/repos/[repo_owner]/[repo_name]/route.ts new file mode 100644 index 00000000..54ef8f63 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/[codeql_variant_analysis_id]/repos/[repo_owner]/[repo_name]/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../../../../../../../generated/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/[codeql_variant_analysis_id]/repos/[repo_owner]/[repo_name]/route" + +export const GET = _GET(async ({ params }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/[codeql_variant_analysis_id]/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/[codeql_variant_analysis_id]/route.ts new file mode 100644 index 00000000..d0dfd9e4 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/[codeql_variant_analysis_id]/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../../../../generated/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/[codeql_variant_analysis_id]/route" + +export const GET = _GET(async ({ params }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/route.ts new file mode 100644 index 00000000..d1181ea9 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../../../generated/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/route" + +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/code-security-configuration/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/code-security-configuration/route.ts new file mode 100644 index 00000000..93d6689c --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/code-security-configuration/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../generated/api.github.com.yaml/repos/[owner]/[repo]/code-security-configuration/route" + +export const GET = _GET(async ({ params }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/secret-scanning/push-protection-bypasses/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/secret-scanning/push-protection-bypasses/route.ts new file mode 100644 index 00000000..2c694fd0 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/repos/[owner]/[repo]/secret-scanning/push-protection-bypasses/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../../generated/api.github.com.yaml/repos/[owner]/[repo]/secret-scanning/push-protection-bypasses/route" + +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/organization-fine-grained-permissions/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/user/[account_id]/route.ts similarity index 58% rename from integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/organization-fine-grained-permissions/route.ts rename to integration-tests/typescript-nextjs/src/app/api.github.com.yaml/user/[account_id]/route.ts index ba4ce52a..0bf911e1 100644 --- a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/orgs/[org]/organization-fine-grained-permissions/route.ts +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/user/[account_id]/route.ts @@ -1,4 +1,4 @@ -import { _GET } from "../../../../../generated/api.github.com.yaml/orgs/[org]/organization-fine-grained-permissions/route" +import { _GET } from "../../../../generated/api.github.com.yaml/user/[account_id]/route" export const GET = _GET(async ({ params }, respond, context) => { // TODO: implementation diff --git a/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/users/[username]/attestations/[subject_digest]/route.ts b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/users/[username]/attestations/[subject_digest]/route.ts new file mode 100644 index 00000000..951a818d --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/api.github.com.yaml/users/[username]/attestations/[subject_digest]/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../generated/api.github.com.yaml/users/[username]/attestations/[subject_digest]/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/manufacturers/[manufacturerId]/operations/[operationId]/route.ts b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/manufacturers/[manufacturerId]/operations/[operationId]/route.ts new file mode 100644 index 00000000..993204d7 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/manufacturers/[manufacturerId]/operations/[operationId]/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../generated/azure-core-data-plane-service.tsp/manufacturers/[manufacturerId]/operations/[operationId]/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/manufacturers/[manufacturerId]/route.ts b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/manufacturers/[manufacturerId]/route.ts new file mode 100644 index 00000000..8db1e744 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/manufacturers/[manufacturerId]/route.ts @@ -0,0 +1,18 @@ +import { + _PUT, + _GET, + _DELETE, +} from "../../../../generated/azure-core-data-plane-service.tsp/manufacturers/[manufacturerId]/route" + +export const PUT = _PUT(async ({ params, query, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) +export const DELETE = _DELETE(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/manufacturers/route.ts b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/manufacturers/route.ts new file mode 100644 index 00000000..5f08326c --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/manufacturers/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../generated/azure-core-data-plane-service.tsp/manufacturers/route" + +export const GET = _GET(async ({ query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/service-status/route.ts b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/service-status/route.ts new file mode 100644 index 00000000..3ac8a074 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/service-status/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../generated/azure-core-data-plane-service.tsp/service-status/route" + +export const GET = _GET(async ({ query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetId]/repairs/[operationId]/route.ts b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetId]/repairs/[operationId]/route.ts new file mode 100644 index 00000000..05be6dbf --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetId]/repairs/[operationId]/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../generated/azure-core-data-plane-service.tsp/widgets/[widgetId]/repairs/[operationId]/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/analytics/current/route.ts b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/analytics/current/route.ts new file mode 100644 index 00000000..7bc081b7 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/analytics/current/route.ts @@ -0,0 +1,15 @@ +import { + _GET, + _PATCH, +} from "../../../../../../generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/analytics/current/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) +export const PATCH = _PATCH( + async ({ params, query, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) + }, +) diff --git a/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/operations/[operationId]/route.ts b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/operations/[operationId]/route.ts new file mode 100644 index 00000000..b15f1922 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/operations/[operationId]/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/operations/[operationId]/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/[widgetPartName]/operations/[operationId]/route.ts b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/[widgetPartName]/operations/[operationId]/route.ts new file mode 100644 index 00000000..3f8f5360 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/[widgetPartName]/operations/[operationId]/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../../../generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/[widgetPartName]/operations/[operationId]/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/[widgetPartName]/route.ts b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/[widgetPartName]/route.ts new file mode 100644 index 00000000..e9ed6070 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/[widgetPartName]/route.ts @@ -0,0 +1,13 @@ +import { + _GET, + _DELETE, +} from "../../../../../../generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/[widgetPartName]/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) +export const DELETE = _DELETE(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/route.ts b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/route.ts new file mode 100644 index 00000000..6c6dbe13 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/route.ts @@ -0,0 +1,13 @@ +import { + _POST, + _GET, +} from "../../../../../generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/route" + +export const POST = _POST(async ({ params, query, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts:reorderParts/route.ts b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts:reorderParts/route.ts new file mode 100644 index 00000000..e28913ba --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts:reorderParts/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts:reorderParts/route" + +export const POST = _POST(async ({ params, query, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/route.ts b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/route.ts new file mode 100644 index 00000000..a0a5f7cf --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]/route.ts @@ -0,0 +1,20 @@ +import { + _PATCH, + _GET, + _DELETE, +} from "../../../../generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/route" + +export const PATCH = _PATCH( + async ({ params, query, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) + }, +) +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) +export const DELETE = _DELETE(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]:scheduleRepairs/route.ts b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]:scheduleRepairs/route.ts new file mode 100644 index 00000000..a7bda81b --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/[widgetName]:scheduleRepairs/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../generated/azure-core-data-plane-service.tsp/widgets/[widgetName]:scheduleRepairs/route" + +export const POST = _POST(async ({ params, query, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/route.ts b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/route.ts new file mode 100644 index 00000000..257268aa --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-core-data-plane-service.tsp/widgets/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../generated/azure-core-data-plane-service.tsp/widgets/route" + +export const GET = _GET(async ({ query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-resource-manager.tsp/providers/Microsoft.ContosoProviderHub/operations/route.ts b/integration-tests/typescript-nextjs/src/app/azure-resource-manager.tsp/providers/Microsoft.ContosoProviderHub/operations/route.ts new file mode 100644 index 00000000..c4046248 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-resource-manager.tsp/providers/Microsoft.ContosoProviderHub/operations/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../generated/azure-resource-manager.tsp/providers/Microsoft.ContosoProviderHub/operations/route" + +export const GET = _GET(async ({ query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-resource-manager.tsp/subscriptions/[subscriptionId]/providers/Microsoft.ContosoProviderHub/employees/route.ts b/integration-tests/typescript-nextjs/src/app/azure-resource-manager.tsp/subscriptions/[subscriptionId]/providers/Microsoft.ContosoProviderHub/employees/route.ts new file mode 100644 index 00000000..bef60392 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-resource-manager.tsp/subscriptions/[subscriptionId]/providers/Microsoft.ContosoProviderHub/employees/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../../generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/providers/Microsoft.ContosoProviderHub/employees/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/[employeeName]/move/route.ts b/integration-tests/typescript-nextjs/src/app/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/[employeeName]/move/route.ts new file mode 100644 index 00000000..901c56a3 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/[employeeName]/move/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../../../../../../generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/[employeeName]/move/route" + +export const POST = _POST(async ({ params, query, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/[employeeName]/route.ts b/integration-tests/typescript-nextjs/src/app/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/[employeeName]/route.ts new file mode 100644 index 00000000..600534c4 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/[employeeName]/route.ts @@ -0,0 +1,25 @@ +import { + _GET, + _PUT, + _PATCH, + _DELETE, +} from "../../../../../../../../../../generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/[employeeName]/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) +export const PUT = _PUT(async ({ params, query, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) +export const PATCH = _PATCH( + async ({ params, query, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) + }, +) +export const DELETE = _DELETE(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/route.ts b/integration-tests/typescript-nextjs/src/app/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/route.ts new file mode 100644 index 00000000..b049d4d1 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../../../../generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/enrollments/[enrollmentId]/route.ts b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/enrollments/[enrollmentId]/route.ts new file mode 100644 index 00000000..4b84b994 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/enrollments/[enrollmentId]/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../../../generated/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/enrollments/[enrollmentId]/route" + +export const GET = _GET(async ({ params }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/enrollments/route.ts b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/enrollments/route.ts new file mode 100644 index 00000000..57e7cc6d --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/enrollments/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../../generated/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/enrollments/route" + +export const GET = _GET(async ({ params }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/route.ts b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/route.ts new file mode 100644 index 00000000..b42b4f67 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../generated/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/route" + +export const GET = _GET(async ({ params, query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/authenticators/route.ts b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/authenticators/route.ts new file mode 100644 index 00000000..d4b665ef --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/authenticators/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../generated/okta.idp.yaml/idp/myaccount/authenticators/route" + +export const GET = _GET(async ({ query }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/okta-applications/route.ts b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/okta-applications/route.ts new file mode 100644 index 00000000..c87c1b62 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/okta-applications/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../generated/okta.idp.yaml/idp/myaccount/okta-applications/route" + +export const GET = _GET(async ({}, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/organization/route.ts b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/organization/route.ts new file mode 100644 index 00000000..509b9e6e --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/organization/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../generated/okta.idp.yaml/idp/myaccount/organization/route" + +export const GET = _GET(async ({}, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/password/route.ts b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/password/route.ts new file mode 100644 index 00000000..b03f6834 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/password/route.ts @@ -0,0 +1,23 @@ +import { + _GET, + _POST, + _PUT, + _DELETE, +} from "../../../../../generated/okta.idp.yaml/idp/myaccount/password/route" + +export const GET = _GET(async ({}, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) +export const POST = _POST(async ({ body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) +export const PUT = _PUT(async ({ body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) +export const DELETE = _DELETE(async ({}, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/sessions/route.ts b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/sessions/route.ts new file mode 100644 index 00000000..c0f6eabd --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/okta.idp.yaml/idp/myaccount/sessions/route.ts @@ -0,0 +1,6 @@ +import { _DELETE } from "../../../../../generated/okta.idp.yaml/idp/myaccount/sessions/route" + +export const DELETE = _DELETE(async ({}, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/challenge/route.ts b/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/challenge/route.ts new file mode 100644 index 00000000..9437f188 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/challenge/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../generated/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/challenge/route" + +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/logout/route.ts b/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/logout/route.ts index c903537b..06c63a5a 100644 --- a/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/logout/route.ts +++ b/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/logout/route.ts @@ -1,6 +1,13 @@ -import { _GET } from "../../../../../../generated/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/logout/route" +import { + _GET, + _POST, +} from "../../../../../../generated/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/logout/route" export const GET = _GET(async ({ params, query }, respond, context) => { // TODO: implementation return respond.withStatus(501).body({ message: "not implemented" } as any) }) +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/oob-authenticate/route.ts b/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/oob-authenticate/route.ts new file mode 100644 index 00000000..7a651720 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/oob-authenticate/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../generated/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/oob-authenticate/route" + +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/v1/challenge/route.ts b/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/v1/challenge/route.ts new file mode 100644 index 00000000..b7dffd2e --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/v1/challenge/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../generated/okta.oauth.yaml/oauth2/v1/challenge/route" + +export const POST = _POST(async ({ body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/v1/global-token-revocation/route.ts b/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/v1/global-token-revocation/route.ts new file mode 100644 index 00000000..b1098f5f --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/v1/global-token-revocation/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../generated/okta.oauth.yaml/oauth2/v1/global-token-revocation/route" + +export const POST = _POST(async ({ body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/v1/logout/route.ts b/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/v1/logout/route.ts index ac3e65a5..cc47178d 100644 --- a/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/v1/logout/route.ts +++ b/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/v1/logout/route.ts @@ -1,6 +1,13 @@ -import { _GET } from "../../../../../generated/okta.oauth.yaml/oauth2/v1/logout/route" +import { + _GET, + _POST, +} from "../../../../../generated/okta.oauth.yaml/oauth2/v1/logout/route" export const GET = _GET(async ({ query }, respond, context) => { // TODO: implementation return respond.withStatus(501).body({ message: "not implemented" } as any) }) +export const POST = _POST(async ({ body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/v1/oob-authenticate/route.ts b/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/v1/oob-authenticate/route.ts new file mode 100644 index 00000000..fd9a7cbb --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/okta.oauth.yaml/oauth2/v1/oob-authenticate/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../generated/okta.oauth.yaml/oauth2/v1/oob-authenticate/route" + +export const POST = _POST(async ({ body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/billing/alerts/[id]/activate/route.ts b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/billing/alerts/[id]/activate/route.ts new file mode 100644 index 00000000..7d186012 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/billing/alerts/[id]/activate/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../../generated/stripe.yaml/v1/billing/alerts/[id]/activate/route" + +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/billing/alerts/[id]/archive/route.ts b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/billing/alerts/[id]/archive/route.ts new file mode 100644 index 00000000..95fcbd8d --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/billing/alerts/[id]/archive/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../../generated/stripe.yaml/v1/billing/alerts/[id]/archive/route" + +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/billing/alerts/[id]/deactivate/route.ts b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/billing/alerts/[id]/deactivate/route.ts new file mode 100644 index 00000000..c2df29c6 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/billing/alerts/[id]/deactivate/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../../generated/stripe.yaml/v1/billing/alerts/[id]/deactivate/route" + +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/billing/alerts/[id]/route.ts b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/billing/alerts/[id]/route.ts new file mode 100644 index 00000000..96170ac5 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/billing/alerts/[id]/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../generated/stripe.yaml/v1/billing/alerts/[id]/route" + +export const GET = _GET(async ({ params, query, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/billing/alerts/route.ts b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/billing/alerts/route.ts new file mode 100644 index 00000000..e3a2f287 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/billing/alerts/route.ts @@ -0,0 +1,13 @@ +import { + _GET, + _POST, +} from "../../../../../generated/stripe.yaml/v1/billing/alerts/route" + +export const GET = _GET(async ({ query, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) +export const POST = _POST(async ({ body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/checkout/sessions/[session]/route.ts b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/checkout/sessions/[session]/route.ts index e9d8a5e6..b31fa8ca 100644 --- a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/checkout/sessions/[session]/route.ts +++ b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/checkout/sessions/[session]/route.ts @@ -1,6 +1,13 @@ -import { _GET } from "../../../../../../generated/stripe.yaml/v1/checkout/sessions/[session]/route" +import { + _GET, + _POST, +} from "../../../../../../generated/stripe.yaml/v1/checkout/sessions/[session]/route" export const GET = _GET(async ({ params, query, body }, respond, context) => { // TODO: implementation return respond.withStatus(501).body({ message: "not implemented" } as any) }) +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/invoices/[invoice]/add_lines/route.ts b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/invoices/[invoice]/add_lines/route.ts new file mode 100644 index 00000000..bab4631c --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/invoices/[invoice]/add_lines/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../generated/stripe.yaml/v1/invoices/[invoice]/add_lines/route" + +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/invoices/[invoice]/remove_lines/route.ts b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/invoices/[invoice]/remove_lines/route.ts new file mode 100644 index 00000000..b2ab978a --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/invoices/[invoice]/remove_lines/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../generated/stripe.yaml/v1/invoices/[invoice]/remove_lines/route" + +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/invoices/[invoice]/update_lines/route.ts b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/invoices/[invoice]/update_lines/route.ts new file mode 100644 index 00000000..7ba625cb --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/invoices/[invoice]/update_lines/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../generated/stripe.yaml/v1/invoices/[invoice]/update_lines/route" + +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/issuing/settlements/route.ts b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/issuing/settlements/route.ts deleted file mode 100644 index d08220ce..00000000 --- a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/issuing/settlements/route.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { _GET } from "../../../../../generated/stripe.yaml/v1/issuing/settlements/route" - -export const GET = _GET(async ({ query, body }, respond, context) => { - // TODO: implementation - return respond.withStatus(501).body({ message: "not implemented" } as any) -}) diff --git a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/tax/calculations/[calculation]/route.ts b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/tax/calculations/[calculation]/route.ts new file mode 100644 index 00000000..eb45e63b --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/tax/calculations/[calculation]/route.ts @@ -0,0 +1,6 @@ +import { _GET } from "../../../../../../generated/stripe.yaml/v1/tax/calculations/[calculation]/route" + +export const GET = _GET(async ({ params, query, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/test_helpers/issuing/authorizations/[authorization]/finalize_amount/route.ts b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/test_helpers/issuing/authorizations/[authorization]/finalize_amount/route.ts new file mode 100644 index 00000000..c06f5d55 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/test_helpers/issuing/authorizations/[authorization]/finalize_amount/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../../../generated/stripe.yaml/v1/test_helpers/issuing/authorizations/[authorization]/finalize_amount/route" + +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/test_helpers/issuing/settlements/route.ts b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/test_helpers/issuing/settlements/route.ts new file mode 100644 index 00000000..febea8e3 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/test_helpers/issuing/settlements/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../generated/stripe.yaml/v1/test_helpers/issuing/settlements/route" + +export const POST = _POST(async ({ body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/test_helpers/treasury/outbound_payments/[id]/route.ts b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/test_helpers/treasury/outbound_payments/[id]/route.ts new file mode 100644 index 00000000..1eb2502c --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/test_helpers/treasury/outbound_payments/[id]/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../../generated/stripe.yaml/v1/test_helpers/treasury/outbound_payments/[id]/route" + +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/test_helpers/treasury/outbound_transfers/[outbound_transfer]/route.ts b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/test_helpers/treasury/outbound_transfers/[outbound_transfer]/route.ts new file mode 100644 index 00000000..5f6aef04 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/app/stripe.yaml/v1/test_helpers/treasury/outbound_transfers/[outbound_transfer]/route.ts @@ -0,0 +1,6 @@ +import { _POST } from "../../../../../../../generated/stripe.yaml/v1/test_helpers/treasury/outbound_transfers/[outbound_transfer]/route" + +export const POST = _POST(async ({ params, body }, respond, context) => { + // TODO: implementation + return respond.withStatus(501).body({ message: "not implemented" } as any) +}) diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/clients/client.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/clients/client.ts index 80acf5fe..619fba42 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/clients/client.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/clients/client.ts @@ -69,7 +69,13 @@ import { t_code_scanning_ref_full, 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, @@ -98,7 +104,9 @@ import { t_contributor_activity, t_copilot_organization_details, t_copilot_seat_details, + t_copilot_usage_metrics, t_custom_deployment_rule_app, + t_custom_property, t_custom_property_value, t_dependabot_alert, t_dependabot_alert_with_repository, @@ -168,7 +176,6 @@ import { t_minimal_repository, t_oidc_custom_sub, t_oidc_custom_sub_repo, - t_org_custom_property, t_org_hook, t_org_membership, t_org_repo_custom_property_values, @@ -176,7 +183,6 @@ import { t_organization_actions_secret, t_organization_actions_variable, t_organization_dependabot_secret, - t_organization_fine_grained_permission, t_organization_full, t_organization_invitation, t_organization_programmatic_access_grant, @@ -250,10 +256,14 @@ import { t_secret_scanning_alert_resolution_comment, t_secret_scanning_alert_state, t_secret_scanning_location, + t_secret_scanning_push_protection_bypass, + t_secret_scanning_push_protection_bypass_placeholder_id, + t_secret_scanning_push_protection_bypass_reason, t_security_advisory_ecosystems, t_selected_actions, t_short_blob, t_short_branch, + t_sigstore_bundle_0, t_simple_classroom, t_simple_classroom_assignment, t_simple_user, @@ -273,6 +283,7 @@ import { t_team_membership, t_team_project, t_team_repository, + t_team_role_assignment, t_team_simple, t_thread, t_thread_subscription, @@ -280,6 +291,7 @@ import { 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, @@ -311,11 +323,12 @@ export class ApiClient extends AbstractFetchClient { async metaRoot( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async securityAdvisoriesListGlobalAdvisories( @@ -338,7 +351,7 @@ export class ApiClient extends AbstractFetchClient { sort?: "updated" | "published" } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_global_advisory[]> @@ -347,6 +360,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/advisories` + const headers = this._headers({}, opts.headers) const query = this._query({ ghsa_id: p["ghsaId"], type: p["type"], @@ -366,7 +380,11 @@ export class ApiClient extends AbstractFetchClient { sort: p["sort"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async securityAdvisoriesGetGlobalAdvisory( @@ -374,22 +392,24 @@ export class ApiClient extends AbstractFetchClient { ghsaId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/advisories/${p["ghsaId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async appsGetAuthenticated( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/app` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async appsCreateFromManifest( @@ -397,7 +417,7 @@ export class ApiClient extends AbstractFetchClient { code: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -415,17 +435,19 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/app-manifests/${p["code"]}/conversions` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async appsGetWebhookConfigForApp( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/app/hook/config` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async appsUpdateWebhookConfigForApp( @@ -438,15 +460,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/app/hook/config` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -458,7 +483,7 @@ export class ApiClient extends AbstractFetchClient { redelivery?: boolean } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_hook_delivery_item[]> @@ -467,13 +492,18 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/app/hook/deliveries` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], cursor: p["cursor"], redelivery: p["redelivery"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async appsGetWebhookDelivery( @@ -481,7 +511,7 @@ export class ApiClient extends AbstractFetchClient { deliveryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_hook_delivery> @@ -490,8 +520,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/app/hook/deliveries/${p["deliveryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async appsRedeliverWebhookDelivery( @@ -499,7 +530,7 @@ export class ApiClient extends AbstractFetchClient { deliveryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -514,8 +545,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/app/hook/deliveries/${p["deliveryId"]}/attempts` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async appsListInstallationRequestsForAuthenticatedApp( @@ -524,7 +556,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_integration_installation_request[]> @@ -533,9 +565,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/app/installation-requests` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async appsListInstallations( @@ -546,9 +583,10 @@ export class ApiClient extends AbstractFetchClient { outdated?: string } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/app/installations` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"], @@ -556,7 +594,11 @@ export class ApiClient extends AbstractFetchClient { outdated: p["outdated"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async appsGetInstallation( @@ -564,13 +606,14 @@ export class ApiClient extends AbstractFetchClient { installationId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/app/installations/${p["installationId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async appsDeleteInstallation( @@ -578,11 +621,12 @@ export class ApiClient extends AbstractFetchClient { installationId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/app/installations/${p["installationId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async appsCreateInstallationAccessToken( @@ -595,7 +639,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_installation_token> @@ -607,14 +651,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/app/installations/${p["installationId"]}/access_tokens` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async appsSuspendInstallation( @@ -622,12 +665,13 @@ export class ApiClient extends AbstractFetchClient { installationId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/app/installations/${p["installationId"]}/suspended` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async appsUnsuspendInstallation( @@ -635,12 +679,13 @@ export class ApiClient extends AbstractFetchClient { installationId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/app/installations/${p["installationId"]}/suspended` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async appsDeleteAuthorization( @@ -651,17 +696,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/applications/${p["clientId"]}/grant` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -674,7 +722,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_authorization> @@ -683,14 +731,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/applications/${p["clientId"]}/token` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async appsResetToken( @@ -701,17 +748,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/applications/${p["clientId"]}/token` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -724,17 +774,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/applications/${p["clientId"]}/token` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -752,7 +805,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_authorization> @@ -763,14 +816,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/applications/${p["clientId"]}/token/scoped` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async appsGetBySlug( @@ -778,7 +830,7 @@ export class ApiClient extends AbstractFetchClient { appSlug: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_integration> @@ -787,8 +839,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/apps/${p["appSlug"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async classroomGetAnAssignment( @@ -796,15 +849,16 @@ export class ApiClient extends AbstractFetchClient { assignmentId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_classroom_assignment> | Res<404, t_basic_error> > > { const url = this.basePath + `/assignments/${p["assignmentId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async classroomListAcceptedAssigmentsForAnAssignment( @@ -814,13 +868,18 @@ export class ApiClient extends AbstractFetchClient { perPage?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/assignments/${p["assignmentId"]}/accepted_assignments` + const headers = this._headers({}, opts.headers) const query = this._query({ page: p["page"], per_page: p["perPage"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async classroomGetAssignmentGrades( @@ -828,15 +887,16 @@ export class ApiClient extends AbstractFetchClient { assignmentId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_classroom_assignment_grade[]> | Res<404, t_basic_error> > > { const url = this.basePath + `/assignments/${p["assignmentId"]}/grades` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async classroomListClassrooms( @@ -845,12 +905,17 @@ export class ApiClient extends AbstractFetchClient { perPage?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/classrooms` + const headers = this._headers({}, opts.headers) const query = this._query({ page: p["page"], per_page: p["perPage"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async classroomGetAClassroom( @@ -858,13 +923,14 @@ export class ApiClient extends AbstractFetchClient { classroomId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/classrooms/${p["classroomId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async classroomListAssignmentsForAClassroom( @@ -874,23 +940,29 @@ export class ApiClient extends AbstractFetchClient { perPage?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/classrooms/${p["classroomId"]}/assignments` + const headers = this._headers({}, opts.headers) const query = this._query({ page: p["page"], per_page: p["perPage"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codesOfConductGetAllCodesOfConduct( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<304, void>> > { const url = this.basePath + `/codes_of_conduct` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codesOfConductGetConductCode( @@ -898,20 +970,21 @@ export class ApiClient extends AbstractFetchClient { key: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_code_of_conduct> | Res<304, void> | Res<404, t_basic_error> > > { const url = this.basePath + `/codes_of_conduct/${p["key"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async emojisGet( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -924,8 +997,79 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/emojis` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) + } + + async copilotListCopilotSeatsForEnterprise( + p: { + enterprise: string + page?: number + perPage?: number + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 200, + { + seats?: t_copilot_seat_details[] + total_seats?: number + } + > + | Res<401, t_basic_error> + | Res<403, t_basic_error> + | Res<404, t_basic_error> + | Res<500, t_basic_error> + > + > { + const url = + this.basePath + `/enterprises/${p["enterprise"]}/copilot/billing/seats` + const headers = this._headers({}, opts.headers) + const query = this._query({ page: p["page"], per_page: p["perPage"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async copilotUsageMetricsForEnterprise( + p: { + enterprise: string + since?: string + until?: string + page?: number + perPage?: number + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_copilot_usage_metrics[]> + | Res<401, t_basic_error> + | Res<403, t_basic_error> + | Res<404, t_basic_error> + | Res<500, t_basic_error> + > + > { + const url = this.basePath + `/enterprises/${p["enterprise"]}/copilot/usage` + const headers = this._headers({}, opts.headers) + const query = this._query({ + since: p["since"], + until: p["until"], + page: p["page"], + per_page: p["perPage"], + }) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async dependabotListAlertsForEnterprise( @@ -945,7 +1089,7 @@ export class ApiClient extends AbstractFetchClient { perPage?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_dependabot_alert_with_repository[]> @@ -957,6 +1101,7 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/enterprises/${p["enterprise"]}/dependabot/alerts` + const headers = this._headers({}, opts.headers) const query = this._query({ state: p["state"], severity: p["severity"], @@ -972,7 +1117,11 @@ export class ApiClient extends AbstractFetchClient { per_page: p["perPage"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async secretScanningListAlertsForEnterprise( @@ -989,7 +1138,7 @@ export class ApiClient extends AbstractFetchClient { validity?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_organization_secret_scanning_alert[]> @@ -1006,6 +1155,7 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/enterprises/${p["enterprise"]}/secret-scanning/alerts` + const headers = this._headers({}, opts.headers) const query = this._query({ state: p["state"], secret_type: p["secretType"], @@ -1018,7 +1168,49 @@ export class ApiClient extends AbstractFetchClient { validity: p["validity"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async copilotUsageMetricsForEnterpriseTeam( + p: { + enterprise: string + teamSlug: string + since?: string + until?: string + page?: number + perPage?: number + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_copilot_usage_metrics[]> + | Res<401, t_basic_error> + | Res<403, t_basic_error> + | Res<404, t_basic_error> + | Res<500, t_basic_error> + > + > { + const url = + this.basePath + + `/enterprises/${p["enterprise"]}/team/${p["teamSlug"]}/copilot/usage` + const headers = this._headers({}, opts.headers) + const query = this._query({ + since: p["since"], + until: p["until"], + page: p["page"], + per_page: p["perPage"], + }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async activityListPublicEvents( @@ -1027,7 +1219,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_event[]> @@ -1044,18 +1236,24 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/events` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async activityGetFeeds( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/feeds` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async gistsList( @@ -1065,20 +1263,25 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_base_gist[]> | Res<304, void> | Res<403, t_basic_error> > > { const url = this.basePath + `/gists` + const headers = this._headers({}, opts.headers) const query = this._query({ since: p["since"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async gistsCreate( @@ -1096,7 +1299,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_gist_simple> @@ -1107,14 +1310,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/gists` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async gistsListPublic( @@ -1124,7 +1326,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_base_gist[]> @@ -1134,13 +1336,18 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/gists/public` + const headers = this._headers({}, opts.headers) const query = this._query({ since: p["since"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async gistsListStarred( @@ -1150,7 +1357,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_base_gist[]> @@ -1160,13 +1367,18 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/gists/starred` + const headers = this._headers({}, opts.headers) const query = this._query({ since: p["since"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async gistsGet( @@ -1174,7 +1386,7 @@ export class ApiClient extends AbstractFetchClient { gistId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_gist_simple> @@ -1195,8 +1407,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/gists/${p["gistId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async gistsUpdate( @@ -1215,7 +1428,7 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_gist_simple> @@ -1224,12 +1437,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/gists/${p["gistId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -1239,7 +1455,7 @@ export class ApiClient extends AbstractFetchClient { gistId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -1249,8 +1465,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/gists/${p["gistId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async gistsListComments( @@ -1260,7 +1477,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_gist_comment[]> @@ -1270,9 +1487,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/gists/${p["gistId"]}/comments` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async gistsCreateComment( @@ -1283,7 +1505,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_gist_comment> @@ -1293,14 +1515,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/gists/${p["gistId"]}/comments` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async gistsGetComment( @@ -1309,7 +1530,7 @@ export class ApiClient extends AbstractFetchClient { commentId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_gist_comment> @@ -1331,8 +1552,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/gists/${p["gistId"]}/comments/${p["commentId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async gistsUpdateComment( @@ -1344,18 +1566,21 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/gists/${p["gistId"]}/comments/${p["commentId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -1366,7 +1591,7 @@ export class ApiClient extends AbstractFetchClient { commentId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -1377,8 +1602,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/gists/${p["gistId"]}/comments/${p["commentId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async gistsListCommits( @@ -1388,7 +1614,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_gist_commit[]> @@ -1398,9 +1624,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/gists/${p["gistId"]}/commits` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async gistsListForks( @@ -1410,7 +1641,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_gist_simple[]> @@ -1420,9 +1651,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/gists/${p["gistId"]}/forks` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async gistsFork( @@ -1430,7 +1666,7 @@ export class ApiClient extends AbstractFetchClient { gistId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_base_gist> @@ -1441,8 +1677,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/gists/${p["gistId"]}/forks` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async gistsCheckIsStarred( @@ -1450,7 +1687,7 @@ export class ApiClient extends AbstractFetchClient { gistId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -1460,8 +1697,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/gists/${p["gistId"]}/star` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async gistsStar( @@ -1469,7 +1707,7 @@ export class ApiClient extends AbstractFetchClient { gistId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -1479,8 +1717,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/gists/${p["gistId"]}/star` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async gistsUnstar( @@ -1488,7 +1727,7 @@ export class ApiClient extends AbstractFetchClient { gistId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -1498,8 +1737,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/gists/${p["gistId"]}/star` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async gistsGetRevision( @@ -1508,7 +1748,7 @@ export class ApiClient extends AbstractFetchClient { sha: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_gist_simple> @@ -1518,17 +1758,19 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/gists/${p["gistId"]}/${p["sha"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async gitignoreGetAllTemplates( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<304, void>>> { const url = this.basePath + `/gitignore/templates` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async gitignoreGetTemplate( @@ -1536,13 +1778,14 @@ export class ApiClient extends AbstractFetchClient { name: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<304, void>> > { const url = this.basePath + `/gitignore/templates/${p["name"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async appsListReposAccessibleToInstallation( @@ -1551,7 +1794,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -1568,18 +1811,24 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/installation/repositories` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async appsRevokeInstallationAccessToken( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/installation/token` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async issuesList( @@ -1604,7 +1853,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_issue[]> @@ -1614,6 +1863,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/issues` + const headers = this._headers({}, opts.headers) const query = this._query({ filter: p["filter"], state: p["state"], @@ -1629,7 +1879,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async licensesGetAllCommonlyUsed( @@ -1639,18 +1893,23 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<304, void>> > { const url = this.basePath + `/licenses` + const headers = this._headers({}, opts.headers) const query = this._query({ featured: p["featured"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async licensesGet( @@ -1658,7 +1917,7 @@ export class ApiClient extends AbstractFetchClient { license: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_license> @@ -1668,8 +1927,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/licenses/${p["license"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async markdownRender( @@ -1681,17 +1941,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<304, void>>> { const url = this.basePath + `/markdown` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async markdownRenderRaw( @@ -1699,17 +1958,16 @@ export class ApiClient extends AbstractFetchClient { requestBody?: string } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<304, void>>> { const url = this.basePath + `/markdown/raw` - const headers = this._headers({ "Content-Type": "text/plain" }) + const headers = this._headers( + { "Content-Type": "text/plain" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async appsGetSubscriptionPlanForAccount( @@ -1717,7 +1975,7 @@ export class ApiClient extends AbstractFetchClient { accountId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_marketplace_purchase> @@ -1727,8 +1985,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/marketplace_listing/accounts/${p["accountId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async appsListPlans( @@ -1737,7 +1996,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_marketplace_listing_plan[]> @@ -1746,9 +2005,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/marketplace_listing/plans` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async appsListAccountsForPlan( @@ -1760,7 +2024,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_marketplace_purchase[]> @@ -1771,6 +2035,7 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/marketplace_listing/plans/${p["planId"]}/accounts` + const headers = this._headers({}, opts.headers) const query = this._query({ sort: p["sort"], direction: p["direction"], @@ -1778,7 +2043,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async appsGetSubscriptionPlanForAccountStubbed( @@ -1786,7 +2055,7 @@ export class ApiClient extends AbstractFetchClient { accountId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_marketplace_purchase> @@ -1796,8 +2065,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/marketplace_listing/stubbed/accounts/${p["accountId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async appsListPlansStubbed( @@ -1806,16 +2076,21 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_marketplace_listing_plan[]> | Res<401, t_basic_error> > > { const url = this.basePath + `/marketplace_listing/stubbed/plans` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async appsListAccountsForPlanStubbed( @@ -1827,7 +2102,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_marketplace_purchase[]> | Res<401, t_basic_error> @@ -1836,6 +2111,7 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/marketplace_listing/stubbed/plans/${p["planId"]}/accounts` + const headers = this._headers({}, opts.headers) const query = this._query({ sort: p["sort"], direction: p["direction"], @@ -1843,16 +2119,21 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async metaGet( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<304, void>>> { const url = this.basePath + `/meta` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async activityListPublicEventsForRepoNetwork( @@ -1863,7 +2144,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_event[]> @@ -1874,9 +2155,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/networks/${p["owner"]}/${p["repo"]}/events` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async activityListNotificationsForAuthenticatedUser( @@ -1889,7 +2175,7 @@ export class ApiClient extends AbstractFetchClient { perPage?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_thread[]> @@ -1900,6 +2186,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/notifications` + const headers = this._headers({}, opts.headers) const query = this._query({ all: p["all"], participating: p["participating"], @@ -1909,7 +2196,11 @@ export class ApiClient extends AbstractFetchClient { per_page: p["perPage"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async activityMarkNotificationsAsRead( @@ -1920,7 +2211,7 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -1936,14 +2227,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/notifications` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async activityGetThread( @@ -1951,7 +2241,7 @@ export class ApiClient extends AbstractFetchClient { threadId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_thread> @@ -1961,8 +2251,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/notifications/threads/${p["threadId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async activityMarkThreadAsRead( @@ -1970,15 +2261,16 @@ export class ApiClient extends AbstractFetchClient { threadId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<205, void> | Res<304, void> | Res<403, t_basic_error> > > { const url = this.basePath + `/notifications/threads/${p["threadId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PATCH", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PATCH", ...opts, headers }, timeout) } async activityMarkThreadAsDone( @@ -1986,11 +2278,12 @@ export class ApiClient extends AbstractFetchClient { threadId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/notifications/threads/${p["threadId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async activityGetThreadSubscriptionForAuthenticatedUser( @@ -1998,7 +2291,7 @@ export class ApiClient extends AbstractFetchClient { threadId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_thread_subscription> @@ -2009,8 +2302,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/notifications/threads/${p["threadId"]}/subscription` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async activitySetThreadSubscription( @@ -2021,7 +2315,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_thread_subscription> @@ -2032,14 +2326,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/notifications/threads/${p["threadId"]}/subscription` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async activityDeleteThreadSubscription( @@ -2047,7 +2340,7 @@ export class ApiClient extends AbstractFetchClient { threadId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -2058,8 +2351,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/notifications/threads/${p["threadId"]}/subscription` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async metaGetOctocat( @@ -2067,12 +2361,17 @@ export class ApiClient extends AbstractFetchClient { s?: string } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/octocat` + const headers = this._headers({}, opts.headers) const query = this._query({ s: p["s"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsList( @@ -2081,14 +2380,19 @@ export class ApiClient extends AbstractFetchClient { perPage?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<304, void>> > { const url = this.basePath + `/organizations` + const headers = this._headers({}, opts.headers) const query = this._query({ since: p["since"], per_page: p["perPage"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsGet( @@ -2096,13 +2400,14 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/orgs/${p["org"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsUpdate( @@ -2141,7 +2446,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_organization_full> @@ -2150,12 +2455,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -2165,7 +2473,7 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -2179,8 +2487,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsGetActionsCacheUsageForOrg( @@ -2188,13 +2497,14 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse> > { const url = this.basePath + `/orgs/${p["org"]}/actions/cache/usage` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsGetActionsCacheUsageByRepoForOrg( @@ -2204,7 +2514,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -2218,9 +2528,14 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/actions/cache/usage-by-repository` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async oidcGetOidcCustomSubTemplateForOrg( @@ -2228,12 +2543,13 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/oidc/customization/sub` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async oidcUpdateOidcCustomSubTemplateForOrg( @@ -2242,7 +2558,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_oidc_custom_sub }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_empty_object> @@ -2252,14 +2568,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/actions/oidc/customization/sub` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsGetGithubActionsPermissionsOrganization( @@ -2267,11 +2582,12 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/permissions` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsSetGithubActionsPermissionsOrganization( @@ -2283,17 +2599,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/permissions` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsListSelectedRepositoriesEnabledGithubActionsOrganization( @@ -2303,7 +2618,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -2317,9 +2632,14 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/actions/permissions/repositories` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsSetSelectedRepositoriesEnabledGithubActionsOrganization( @@ -2330,18 +2650,17 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/permissions/repositories` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsEnableSelectedRepositoryGithubActionsOrganization( @@ -2350,13 +2669,14 @@ export class ApiClient extends AbstractFetchClient { repositoryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/permissions/repositories/${p["repositoryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async actionsDisableSelectedRepositoryGithubActionsOrganization( @@ -2365,13 +2685,14 @@ export class ApiClient extends AbstractFetchClient { repositoryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/permissions/repositories/${p["repositoryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsGetAllowedActionsOrganization( @@ -2379,12 +2700,13 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/permissions/selected-actions` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsSetAllowedActionsOrganization( @@ -2393,18 +2715,17 @@ export class ApiClient extends AbstractFetchClient { requestBody?: t_selected_actions }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/permissions/selected-actions` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsGetGithubActionsDefaultWorkflowPermissionsOrganization( @@ -2412,13 +2733,14 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse> > { const url = this.basePath + `/orgs/${p["org"]}/actions/permissions/workflow` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsSetGithubActionsDefaultWorkflowPermissionsOrganization( @@ -2427,17 +2749,16 @@ export class ApiClient extends AbstractFetchClient { requestBody?: t_actions_set_default_workflow_permissions }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/permissions/workflow` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsListSelfHostedRunnersForOrg( @@ -2448,7 +2769,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -2461,13 +2782,18 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/actions/runners` + const headers = this._headers({}, opts.headers) const query = this._query({ name: p["name"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsListRunnerApplicationsForOrg( @@ -2475,11 +2801,12 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/runners/downloads` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsGenerateRunnerJitconfigForOrg( @@ -2493,7 +2820,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -2509,14 +2836,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/actions/runners/generate-jitconfig` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async actionsCreateRegistrationTokenForOrg( @@ -2524,12 +2850,13 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/runners/registration-token` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async actionsCreateRemoveTokenForOrg( @@ -2537,11 +2864,12 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/runners/remove-token` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async actionsGetSelfHostedRunnerForOrg( @@ -2550,12 +2878,13 @@ export class ApiClient extends AbstractFetchClient { runnerId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/runners/${p["runnerId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsDeleteSelfHostedRunnerFromOrg( @@ -2564,12 +2893,13 @@ export class ApiClient extends AbstractFetchClient { runnerId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/runners/${p["runnerId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsListLabelsForSelfHostedRunnerForOrg( @@ -2578,7 +2908,7 @@ export class ApiClient extends AbstractFetchClient { runnerId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -2594,8 +2924,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/actions/runners/${p["runnerId"]}/labels` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsAddCustomLabelsToSelfHostedRunnerForOrg( @@ -2607,7 +2938,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -2624,14 +2955,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/actions/runners/${p["runnerId"]}/labels` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async actionsSetCustomLabelsForSelfHostedRunnerForOrg( @@ -2643,7 +2973,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -2660,14 +2990,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/actions/runners/${p["runnerId"]}/labels` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrg( @@ -2676,7 +3005,7 @@ export class ApiClient extends AbstractFetchClient { runnerId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -2692,8 +3021,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/actions/runners/${p["runnerId"]}/labels` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsRemoveCustomLabelFromSelfHostedRunnerForOrg( @@ -2703,7 +3033,7 @@ export class ApiClient extends AbstractFetchClient { name: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -2720,8 +3050,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/actions/runners/${p["runnerId"]}/labels/${p["name"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsListOrgSecrets( @@ -2731,7 +3062,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -2744,9 +3075,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/actions/secrets` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsGetOrgPublicKey( @@ -2754,11 +3090,12 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/secrets/public-key` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsGetOrgSecret( @@ -2767,12 +3104,13 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsCreateOrUpdateOrgSecret( @@ -2787,18 +3125,17 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<204, void>>> { const url = this.basePath + `/orgs/${p["org"]}/actions/secrets/${p["secretName"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsDeleteOrgSecret( @@ -2807,12 +3144,13 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsListSelectedReposForOrgSecret( @@ -2823,7 +3161,7 @@ export class ApiClient extends AbstractFetchClient { perPage?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -2838,9 +3176,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/actions/secrets/${p["secretName"]}/repositories` + const headers = this._headers({}, opts.headers) const query = this._query({ page: p["page"], per_page: p["perPage"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsSetSelectedReposForOrgSecret( @@ -2852,19 +3195,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/secrets/${p["secretName"]}/repositories` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsAddSelectedRepoToOrgSecret( @@ -2874,13 +3216,14 @@ export class ApiClient extends AbstractFetchClient { repositoryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<409, void>>> { const url = this.basePath + `/orgs/${p["org"]}/actions/secrets/${p["secretName"]}/repositories/${p["repositoryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async actionsRemoveSelectedRepoFromOrgSecret( @@ -2890,13 +3233,14 @@ export class ApiClient extends AbstractFetchClient { repositoryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<409, void>>> { const url = this.basePath + `/orgs/${p["org"]}/actions/secrets/${p["secretName"]}/repositories/${p["repositoryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsListOrgVariables( @@ -2906,7 +3250,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -2919,9 +3263,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/actions/variables` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsCreateOrgVariable( @@ -2935,17 +3284,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/variables` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async actionsGetOrgVariable( @@ -2954,12 +3302,13 @@ export class ApiClient extends AbstractFetchClient { name: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/variables/${p["name"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsUpdateOrgVariable( @@ -2974,16 +3323,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/variables/${p["name"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -2994,12 +3346,13 @@ export class ApiClient extends AbstractFetchClient { name: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/actions/variables/${p["name"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsListSelectedReposForOrgVariable( @@ -3010,7 +3363,7 @@ export class ApiClient extends AbstractFetchClient { perPage?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -3026,9 +3379,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/actions/variables/${p["name"]}/repositories` + const headers = this._headers({}, opts.headers) const query = this._query({ page: p["page"], per_page: p["perPage"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsSetSelectedReposForOrgVariable( @@ -3040,19 +3398,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<409, void>>> { const url = this.basePath + `/orgs/${p["org"]}/actions/variables/${p["name"]}/repositories` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsAddSelectedRepoToOrgVariable( @@ -3062,13 +3419,14 @@ export class ApiClient extends AbstractFetchClient { repositoryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<409, void>>> { const url = this.basePath + `/orgs/${p["org"]}/actions/variables/${p["name"]}/repositories/${p["repositoryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async actionsRemoveSelectedRepoFromOrgVariable( @@ -3078,13 +3436,61 @@ export class ApiClient extends AbstractFetchClient { repositoryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<409, void>>> { const url = this.basePath + `/orgs/${p["org"]}/actions/variables/${p["name"]}/repositories/${p["repositoryId"]}` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) + } + + async orgsListAttestations( + p: { + perPage?: number + before?: string + after?: string + org: string + subjectDigest: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + Res< + 200, + { + attestations?: { + bundle?: { + dsseEnvelope?: { + [key: string]: unknown | undefined + } + mediaType?: string + verificationMaterial?: { + [key: string]: unknown | undefined + } + } + repository_id?: number + }[] + } + > + > + > { + const url = + this.basePath + `/orgs/${p["org"]}/attestations/${p["subjectDigest"]}` + const headers = this._headers({}, opts.headers) + const query = this._query({ + per_page: p["perPage"], + before: p["before"], + after: p["after"], + }) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsListBlockedUsers( @@ -3094,12 +3500,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/blocks` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsCheckBlockedUser( @@ -3108,11 +3519,12 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/orgs/${p["org"]}/blocks/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsBlockUser( @@ -3121,13 +3533,14 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/orgs/${p["org"]}/blocks/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async orgsUnblockUser( @@ -3136,11 +3549,12 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/blocks/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async codeScanningListAlertsForOrg( @@ -3158,7 +3572,7 @@ export class ApiClient extends AbstractFetchClient { severity?: t_code_scanning_alert_severity }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_code_scanning_organization_alert_items[]> @@ -3174,6 +3588,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/code-scanning/alerts` + const headers = this._headers({}, opts.headers) const query = this._query({ tool_name: p["toolName"], tool_guid: p["toolGuid"], @@ -3187,7 +3602,336 @@ export class ApiClient extends AbstractFetchClient { severity: p["severity"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async codeSecurityGetConfigurationsForOrg( + p: { + org: string + targetType?: "global" | "all" + perPage?: number + before?: string + after?: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_code_security_configuration[]> + | Res<403, t_basic_error> + | Res<404, t_basic_error> + > + > { + const url = this.basePath + `/orgs/${p["org"]}/code-security/configurations` + const headers = this._headers({}, opts.headers) + const query = this._query({ + target_type: p["targetType"], + per_page: p["perPage"], + before: p["before"], + after: p["after"], + }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async codeSecurityCreateConfiguration( + p: { + org: string + requestBody: { + advanced_security?: "enabled" | "disabled" + code_scanning_default_setup?: "enabled" | "disabled" | "not_set" + dependabot_alerts?: "enabled" | "disabled" | "not_set" + dependabot_security_updates?: "enabled" | "disabled" | "not_set" + dependency_graph?: "enabled" | "disabled" | "not_set" + dependency_graph_autosubmit_action?: "enabled" | "disabled" | "not_set" + dependency_graph_autosubmit_action_options?: { + labeled_runners?: boolean + } + description: string + enforcement?: "enforced" | "unenforced" + name: string + private_vulnerability_reporting?: "enabled" | "disabled" | "not_set" + secret_scanning?: "enabled" | "disabled" | "not_set" + secret_scanning_push_protection?: "enabled" | "disabled" | "not_set" + secret_scanning_validity_checks?: "enabled" | "disabled" | "not_set" + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise>> { + const url = this.basePath + `/orgs/${p["org"]}/code-security/configurations` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async codeSecurityGetDefaultConfigurations( + p: { + org: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_code_security_default_configurations> + | Res<304, void> + | Res<403, t_basic_error> + | Res<404, t_basic_error> + > + > { + const url = + this.basePath + `/orgs/${p["org"]}/code-security/configurations/defaults` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) + } + + async codeSecurityDetachConfiguration( + p: { + org: string + requestBody: { + selected_repository_ids?: number[] + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<204, void> + | Res<400, t_scim_error> + | Res<403, t_basic_error> + | Res<404, t_basic_error> + | Res<409, t_basic_error> + > + > { + const url = + this.basePath + `/orgs/${p["org"]}/code-security/configurations/detach` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url, + { method: "DELETE", body, ...opts, headers }, + timeout, + ) + } + + async codeSecurityGetConfiguration( + p: { + org: string + configurationId: number + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_code_security_configuration> + | Res<304, void> + | Res<403, t_basic_error> + | Res<404, t_basic_error> + > + > { + const url = + this.basePath + + `/orgs/${p["org"]}/code-security/configurations/${p["configurationId"]}` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) + } + + async codeSecurityUpdateConfiguration( + p: { + org: string + configurationId: number + requestBody: { + advanced_security?: "enabled" | "disabled" + code_scanning_default_setup?: "enabled" | "disabled" | "not_set" + dependabot_alerts?: "enabled" | "disabled" | "not_set" + dependabot_security_updates?: "enabled" | "disabled" | "not_set" + dependency_graph?: "enabled" | "disabled" | "not_set" + dependency_graph_autosubmit_action?: "enabled" | "disabled" | "not_set" + dependency_graph_autosubmit_action_options?: { + labeled_runners?: boolean + } + description?: string + enforcement?: "enforced" | "unenforced" + name?: string + private_vulnerability_reporting?: "enabled" | "disabled" | "not_set" + secret_scanning?: "enabled" | "disabled" | "not_set" + secret_scanning_push_protection?: "enabled" | "disabled" | "not_set" + secret_scanning_validity_checks?: "enabled" | "disabled" | "not_set" + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res<204, void>> + > { + const url = + this.basePath + + `/orgs/${p["org"]}/code-security/configurations/${p["configurationId"]}` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url, + { method: "PATCH", body, ...opts, headers }, + timeout, + ) + } + + async codeSecurityDeleteConfiguration( + p: { + org: string + configurationId: number + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<204, void> + | Res<400, t_scim_error> + | Res<403, t_basic_error> + | Res<404, t_basic_error> + | Res<409, t_basic_error> + > + > { + const url = + this.basePath + + `/orgs/${p["org"]}/code-security/configurations/${p["configurationId"]}` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) + } + + async codeSecurityAttachConfiguration( + p: { + org: string + configurationId: number + requestBody: { + scope: "all" | "public" | "private_or_internal" | "selected" + selected_repository_ids?: number[] + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + Res< + 202, + { + [key: string]: unknown | undefined + } + > + > + > { + const url = + this.basePath + + `/orgs/${p["org"]}/code-security/configurations/${p["configurationId"]}/attach` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async codeSecuritySetConfigurationAsDefault( + p: { + org: string + configurationId: number + requestBody: { + default_for_new_repos?: + | "all" + | "none" + | "private_and_internal" + | "public" + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 200, + { + configuration?: t_code_security_configuration + default_for_new_repos?: + | "all" + | "none" + | "private_and_internal" + | "public" + } + > + | Res<403, t_basic_error> + | Res<404, t_basic_error> + > + > { + const url = + this.basePath + + `/orgs/${p["org"]}/code-security/configurations/${p["configurationId"]}/defaults` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) + } + + async codeSecurityGetRepositoriesForConfiguration( + p: { + org: string + configurationId: number + perPage?: number + before?: string + after?: string + status?: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_code_security_configuration_repositories[]> + | Res<403, t_basic_error> + | Res<404, t_basic_error> + > + > { + const url = + this.basePath + + `/orgs/${p["org"]}/code-security/configurations/${p["configurationId"]}/repositories` + const headers = this._headers({}, opts.headers) + const query = this._query({ + per_page: p["perPage"], + before: p["before"], + after: p["after"], + status: p["status"], + }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codespacesListInOrganization( @@ -3197,7 +3941,7 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -3215,9 +3959,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/codespaces` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codespacesSetCodespacesAccess( @@ -3233,7 +3982,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -3245,14 +3994,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/codespaces/access` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async codespacesSetCodespacesAccessUsers( @@ -3263,7 +4011,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -3276,14 +4024,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/codespaces/access/selected_users` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async codespacesDeleteCodespacesAccessUsers( @@ -3294,7 +4041,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -3307,12 +4054,15 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/codespaces/access/selected_users` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -3324,7 +4074,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -3337,9 +4087,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/codespaces/secrets` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codespacesGetOrgPublicKey( @@ -3347,12 +4102,13 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/codespaces/secrets/public-key` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codespacesGetOrgSecret( @@ -3361,12 +4117,13 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/codespaces/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codespacesCreateOrUpdateOrgSecret( @@ -3381,7 +4138,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_empty_object> @@ -3392,14 +4149,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/codespaces/secrets/${p["secretName"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async codespacesDeleteOrgSecret( @@ -3408,12 +4164,13 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/orgs/${p["org"]}/codespaces/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async codespacesListSelectedReposForOrgSecret( @@ -3424,7 +4181,7 @@ export class ApiClient extends AbstractFetchClient { perPage?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -3440,9 +4197,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/codespaces/secrets/${p["secretName"]}/repositories` + const headers = this._headers({}, opts.headers) const query = this._query({ page: p["page"], per_page: p["perPage"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codespacesSetSelectedReposForOrgSecret( @@ -3454,7 +4216,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<404, t_basic_error> | Res<409, void> @@ -3463,14 +4225,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/codespaces/secrets/${p["secretName"]}/repositories` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async codespacesAddSelectedRepoToOrgSecret( @@ -3480,7 +4241,7 @@ export class ApiClient extends AbstractFetchClient { repositoryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -3492,8 +4253,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/codespaces/secrets/${p["secretName"]}/repositories/${p["repositoryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async codespacesRemoveSelectedRepoFromOrgSecret( @@ -3503,7 +4265,7 @@ export class ApiClient extends AbstractFetchClient { repositoryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -3515,8 +4277,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/codespaces/secrets/${p["secretName"]}/repositories/${p["repositoryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async copilotGetCopilotOrganizationDetails( @@ -3524,7 +4287,7 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_copilot_organization_details> @@ -3536,8 +4299,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/copilot/billing` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async copilotListCopilotSeats( @@ -3547,7 +4311,7 @@ export class ApiClient extends AbstractFetchClient { perPage?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -3564,9 +4328,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/copilot/billing/seats` + const headers = this._headers({}, opts.headers) const query = this._query({ page: p["page"], per_page: p["perPage"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async copilotAddCopilotSeatsForTeams( @@ -3577,7 +4346,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -3595,14 +4364,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/copilot/billing/selected_teams` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async copilotCancelCopilotSeatAssignmentForTeams( @@ -3613,7 +4381,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -3631,12 +4399,15 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/copilot/billing/selected_teams` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -3649,7 +4420,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -3667,14 +4438,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/copilot/billing/selected_users` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async copilotCancelCopilotSeatAssignmentForUsers( @@ -3685,7 +4455,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -3703,12 +4473,50 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/copilot/billing/selected_users` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, + timeout, + ) + } + + async copilotUsageMetricsForOrg( + p: { + org: string + since?: string + until?: string + page?: number + perPage?: number + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_copilot_usage_metrics[]> + | Res<401, t_basic_error> + | Res<403, t_basic_error> + | Res<404, t_basic_error> + | Res<500, t_basic_error> + > + > { + const url = this.basePath + `/orgs/${p["org"]}/copilot/usage` + const headers = this._headers({}, opts.headers) + const query = this._query({ + since: p["since"], + until: p["until"], + page: p["page"], + per_page: p["perPage"], + }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, timeout, ) } @@ -3730,7 +4538,7 @@ export class ApiClient extends AbstractFetchClient { perPage?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_dependabot_alert_with_repository[]> @@ -3742,6 +4550,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/dependabot/alerts` + const headers = this._headers({}, opts.headers) const query = this._query({ state: p["state"], severity: p["severity"], @@ -3757,7 +4566,11 @@ export class ApiClient extends AbstractFetchClient { per_page: p["perPage"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async dependabotListOrgSecrets( @@ -3767,7 +4580,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -3780,9 +4593,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/dependabot/secrets` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async dependabotGetOrgPublicKey( @@ -3790,12 +4608,13 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/dependabot/secrets/public-key` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async dependabotGetOrgSecret( @@ -3804,12 +4623,13 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/dependabot/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async dependabotCreateOrUpdateOrgSecret( @@ -3824,18 +4644,17 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<204, void>>> { const url = this.basePath + `/orgs/${p["org"]}/dependabot/secrets/${p["secretName"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async dependabotDeleteOrgSecret( @@ -3844,12 +4663,13 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/dependabot/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async dependabotListSelectedReposForOrgSecret( @@ -3860,7 +4680,7 @@ export class ApiClient extends AbstractFetchClient { perPage?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -3875,9 +4695,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/dependabot/secrets/${p["secretName"]}/repositories` + const headers = this._headers({}, opts.headers) const query = this._query({ page: p["page"], per_page: p["perPage"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async dependabotSetSelectedReposForOrgSecret( @@ -3889,19 +4714,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/dependabot/secrets/${p["secretName"]}/repositories` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async dependabotAddSelectedRepoToOrgSecret( @@ -3911,13 +4735,14 @@ export class ApiClient extends AbstractFetchClient { repositoryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<409, void>>> { const url = this.basePath + `/orgs/${p["org"]}/dependabot/secrets/${p["secretName"]}/repositories/${p["repositoryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async dependabotRemoveSelectedRepoFromOrgSecret( @@ -3927,13 +4752,14 @@ export class ApiClient extends AbstractFetchClient { repositoryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<409, void>>> { const url = this.basePath + `/orgs/${p["org"]}/dependabot/secrets/${p["secretName"]}/repositories/${p["repositoryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async packagesListDockerMigrationConflictingPackagesForOrganization( @@ -3941,15 +4767,16 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_package[]> | Res<401, t_basic_error> | Res<403, t_basic_error> > > { const url = this.basePath + `/orgs/${p["org"]}/docker/conflicts` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async activityListPublicOrgEvents( @@ -3959,12 +4786,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/events` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsListFailedInvitations( @@ -3974,16 +4806,21 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_organization_invitation[]> | Res<404, t_basic_error> > > { const url = this.basePath + `/orgs/${p["org"]}/failed_invitations` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsListWebhooks( @@ -3993,14 +4830,19 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/orgs/${p["org"]}/hooks` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsCreateWebhook( @@ -4021,7 +4863,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_org_hook> @@ -4030,14 +4872,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/hooks` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async orgsGetWebhook( @@ -4046,13 +4887,14 @@ export class ApiClient extends AbstractFetchClient { hookId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/orgs/${p["org"]}/hooks/${p["hookId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsUpdateWebhook( @@ -4072,7 +4914,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_org_hook> @@ -4081,12 +4923,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/hooks/${p["hookId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -4097,11 +4942,12 @@ export class ApiClient extends AbstractFetchClient { hookId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/orgs/${p["org"]}/hooks/${p["hookId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async orgsGetWebhookConfigForOrg( @@ -4110,11 +4956,12 @@ export class ApiClient extends AbstractFetchClient { hookId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/hooks/${p["hookId"]}/config` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsUpdateWebhookConfigForOrg( @@ -4129,15 +4976,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/hooks/${p["hookId"]}/config` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -4151,7 +5001,7 @@ export class ApiClient extends AbstractFetchClient { redelivery?: boolean }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_hook_delivery_item[]> @@ -4161,13 +5011,18 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/hooks/${p["hookId"]}/deliveries` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], cursor: p["cursor"], redelivery: p["redelivery"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsGetWebhookDelivery( @@ -4177,7 +5032,7 @@ export class ApiClient extends AbstractFetchClient { deliveryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_hook_delivery> @@ -4188,8 +5043,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/hooks/${p["hookId"]}/deliveries/${p["deliveryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsRedeliverWebhookDelivery( @@ -4199,7 +5055,7 @@ export class ApiClient extends AbstractFetchClient { deliveryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -4215,8 +5071,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/hooks/${p["hookId"]}/deliveries/${p["deliveryId"]}/attempts` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async orgsPingWebhook( @@ -4225,11 +5082,12 @@ export class ApiClient extends AbstractFetchClient { hookId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/orgs/${p["org"]}/hooks/${p["hookId"]}/pings` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async appsGetOrgInstallation( @@ -4237,11 +5095,12 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/installation` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsListAppInstallations( @@ -4251,7 +5110,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -4264,9 +5123,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/installations` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async interactionsGetRestrictionsForOrg( @@ -4274,13 +5138,14 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse> > { const url = this.basePath + `/orgs/${p["org"]}/interaction-limits` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async interactionsSetRestrictionsForOrg( @@ -4289,21 +5154,20 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_interaction_limit }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_interaction_limit_response> | Res<422, t_validation_error> > > { const url = this.basePath + `/orgs/${p["org"]}/interaction-limits` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async interactionsRemoveRestrictionsForOrg( @@ -4311,11 +5175,12 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/interaction-limits` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async orgsListPendingInvitations( @@ -4332,13 +5197,14 @@ export class ApiClient extends AbstractFetchClient { invitationSource?: "all" | "member" | "scim" }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_organization_invitation[]> | Res<404, t_basic_error> > > { const url = this.basePath + `/orgs/${p["org"]}/invitations` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"], @@ -4346,7 +5212,11 @@ export class ApiClient extends AbstractFetchClient { invitation_source: p["invitationSource"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsCreateInvitation( @@ -4360,7 +5230,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_organization_invitation> @@ -4369,14 +5239,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/invitations` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async orgsCancelInvitation( @@ -4385,7 +5254,7 @@ export class ApiClient extends AbstractFetchClient { invitationId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<404, t_basic_error> | Res<422, t_validation_error> @@ -4393,8 +5262,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/invitations/${p["invitationId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async orgsListInvitationTeams( @@ -4405,13 +5275,18 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/orgs/${p["org"]}/invitations/${p["invitationId"]}/teams` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async issuesListForOrg( @@ -4433,11 +5308,12 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/orgs/${p["org"]}/issues` + const headers = this._headers({}, opts.headers) const query = this._query({ filter: p["filter"], state: p["state"], @@ -4449,7 +5325,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsListMembers( @@ -4461,11 +5341,12 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/orgs/${p["org"]}/members` + const headers = this._headers({}, opts.headers) const query = this._query({ filter: p["filter"], role: p["role"], @@ -4473,7 +5354,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsCheckMembershipForUser( @@ -4482,13 +5367,14 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<302, void> | Res<404, void>> > { const url = this.basePath + `/orgs/${p["org"]}/members/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsRemoveMember( @@ -4497,11 +5383,12 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<403, t_basic_error>>> { const url = this.basePath + `/orgs/${p["org"]}/members/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async codespacesGetCodespacesForUserInOrg( @@ -4512,7 +5399,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -4531,9 +5418,14 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/members/${p["username"]}/codespaces` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codespacesDeleteFromOrganization( @@ -4543,7 +5435,7 @@ export class ApiClient extends AbstractFetchClient { codespaceName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -4562,8 +5454,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/members/${p["username"]}/codespaces/${p["codespaceName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async codespacesStopInOrganization( @@ -4573,7 +5466,7 @@ export class ApiClient extends AbstractFetchClient { codespaceName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_codespace> @@ -4587,8 +5480,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/members/${p["username"]}/codespaces/${p["codespaceName"]}/stop` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async copilotGetCopilotSeatDetailsForUser( @@ -4597,7 +5491,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_copilot_seat_details> @@ -4610,8 +5504,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/members/${p["username"]}/copilot` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsGetMembershipForUser( @@ -4620,7 +5515,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_org_membership> @@ -4629,8 +5524,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/memberships/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsSetMembershipForUser( @@ -4642,7 +5538,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_org_membership> @@ -4651,14 +5547,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/memberships/${p["username"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async orgsRemoveMembershipForUser( @@ -4667,15 +5562,16 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<403, t_basic_error> | Res<404, t_basic_error> > > { const url = this.basePath + `/orgs/${p["org"]}/memberships/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async migrationsListForOrg( @@ -4686,16 +5582,21 @@ export class ApiClient extends AbstractFetchClient { exclude?: "repositories"[] }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/migrations` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"], exclude: p["exclude"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async migrationsStartForOrg( @@ -4714,7 +5615,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_migration> @@ -4723,14 +5624,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/migrations` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async migrationsGetStatusForOrg( @@ -4740,15 +5640,20 @@ export class ApiClient extends AbstractFetchClient { exclude?: "repositories"[] }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/orgs/${p["org"]}/migrations/${p["migrationId"]}` + const headers = this._headers({}, opts.headers) const query = this._query({ exclude: p["exclude"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async migrationsDownloadArchiveForOrg( @@ -4757,12 +5662,13 @@ export class ApiClient extends AbstractFetchClient { migrationId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/orgs/${p["org"]}/migrations/${p["migrationId"]}/archive` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async migrationsDeleteArchiveForOrg( @@ -4771,12 +5677,13 @@ export class ApiClient extends AbstractFetchClient { migrationId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/orgs/${p["org"]}/migrations/${p["migrationId"]}/archive` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async migrationsUnlockRepoForOrg( @@ -4786,13 +5693,14 @@ export class ApiClient extends AbstractFetchClient { repoName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/orgs/${p["org"]}/migrations/${p["migrationId"]}/repos/${p["repoName"]}/lock` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async migrationsListReposForOrg( @@ -4803,7 +5711,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_minimal_repository[]> | Res<404, t_basic_error> @@ -4812,28 +5720,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/migrations/${p["migrationId"]}/repositories` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) - } - - async orgsListOrganizationFineGrainedPermissions( - p: { - org: string - }, - timeout?: number, - opts?: RequestInit, - ): Promise< - TypedFetchResponse< - | Res<200, t_organization_fine_grained_permission[]> - | Res<404, t_basic_error> - | Res<422, t_validation_error> - > - > { - const url = - this.basePath + `/orgs/${p["org"]}/organization-fine-grained-permissions` - - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsListOrgRoles( @@ -4841,7 +5735,7 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -4856,38 +5750,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/organization-roles` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) - } - - async orgsCreateCustomOrganizationRole( - p: { - org: string - requestBody: { - description?: string - name: string - permissions: string[] - } - }, - timeout?: number, - opts?: RequestInit, - ): Promise< - TypedFetchResponse< - | Res<201, t_organization_role> - | Res<404, t_basic_error> - | Res<409, t_basic_error> - | Res<422, t_validation_error> - > - > { - const url = this.basePath + `/orgs/${p["org"]}/organization-roles` - const headers = this._headers({ "Content-Type": "application/json" }) - const body = JSON.stringify(p.requestBody) - - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsRevokeAllOrgRolesTeam( @@ -4896,13 +5761,14 @@ export class ApiClient extends AbstractFetchClient { teamSlug: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/organization-roles/teams/${p["teamSlug"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async orgsAssignTeamToOrgRole( @@ -4912,15 +5778,16 @@ export class ApiClient extends AbstractFetchClient { roleId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, void> | Res<422, void>> > { const url = this.basePath + `/orgs/${p["org"]}/organization-roles/teams/${p["teamSlug"]}/${p["roleId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async orgsRevokeOrgRoleTeam( @@ -4930,13 +5797,14 @@ export class ApiClient extends AbstractFetchClient { roleId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/organization-roles/teams/${p["teamSlug"]}/${p["roleId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async orgsRevokeAllOrgRolesUser( @@ -4945,13 +5813,14 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/organization-roles/users/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async orgsAssignUserToOrgRole( @@ -4961,15 +5830,16 @@ export class ApiClient extends AbstractFetchClient { roleId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, void> | Res<422, void>> > { const url = this.basePath + `/orgs/${p["org"]}/organization-roles/users/${p["username"]}/${p["roleId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async orgsRevokeOrgRoleUser( @@ -4979,13 +5849,14 @@ export class ApiClient extends AbstractFetchClient { roleId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/organization-roles/users/${p["username"]}/${p["roleId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async orgsGetOrgRole( @@ -4994,64 +5865,19 @@ export class ApiClient extends AbstractFetchClient { roleId: number }, timeout?: number, - opts?: RequestInit, - ): Promise< - TypedFetchResponse< - | Res<200, t_organization_role> - | Res<404, t_basic_error> - | Res<422, t_validation_error> - > - > { - const url = - this.basePath + `/orgs/${p["org"]}/organization-roles/${p["roleId"]}` - - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) - } - - async orgsPatchCustomOrganizationRole( - p: { - org: string - roleId: number - requestBody: { - description?: string - name?: string - permissions?: string[] - } - }, - timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_organization_role> | Res<404, t_basic_error> - | Res<409, t_basic_error> | Res<422, t_validation_error> > > { const url = this.basePath + `/orgs/${p["org"]}/organization-roles/${p["roleId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) - const body = JSON.stringify(p.requestBody) - - return this._fetch( - url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, - timeout, - ) - } - - async orgsDeleteCustomOrganizationRole( - p: { - org: string - roleId: number - }, - timeout?: number, - opts?: RequestInit, - ): Promise>> { - const url = - this.basePath + `/orgs/${p["org"]}/organization-roles/${p["roleId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsListOrgRoleTeams( @@ -5062,16 +5888,23 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< - TypedFetchResponse | Res<404, void> | Res<422, void>> + TypedFetchResponse< + Res<200, t_team_role_assignment[]> | Res<404, void> | Res<422, void> + > > { const url = this.basePath + `/orgs/${p["org"]}/organization-roles/${p["roleId"]}/teams` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsListOrgRoleUsers( @@ -5082,18 +5915,23 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< - Res<200, t_simple_user[]> | Res<404, void> | Res<422, void> + Res<200, t_user_role_assignment[]> | Res<404, void> | Res<422, void> > > { const url = this.basePath + `/orgs/${p["org"]}/organization-roles/${p["roleId"]}/users` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsListOutsideCollaborators( @@ -5104,16 +5942,21 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/outside_collaborators` + const headers = this._headers({}, opts.headers) const query = this._query({ filter: p["filter"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsConvertMemberToOutsideCollaborator( @@ -5125,7 +5968,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<202, EmptyObject> @@ -5136,14 +5979,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/outside_collaborators/${p["username"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async orgsRemoveOutsideCollaborator( @@ -5152,7 +5994,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -5167,8 +6009,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/outside_collaborators/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async packagesListPackagesForOrganization( @@ -5186,7 +6029,7 @@ export class ApiClient extends AbstractFetchClient { perPage?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_package[]> @@ -5196,6 +6039,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/packages` + const headers = this._headers({}, opts.headers) const query = this._query({ package_type: p["packageType"], visibility: p["visibility"], @@ -5203,7 +6047,11 @@ export class ApiClient extends AbstractFetchClient { per_page: p["perPage"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async packagesGetPackageForOrganization( @@ -5219,13 +6067,14 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/packages/${p["packageType"]}/${p["packageName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async packagesDeletePackageForOrg( @@ -5241,7 +6090,7 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -5253,8 +6102,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/packages/${p["packageType"]}/${p["packageName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async packagesRestorePackageForOrg( @@ -5271,7 +6121,7 @@ export class ApiClient extends AbstractFetchClient { token?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -5283,11 +6133,12 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/packages/${p["packageType"]}/${p["packageName"]}/restore` + const headers = this._headers({}, opts.headers) const query = this._query({ token: p["token"] }) return this._fetch( url + query, - { method: "POST", ...(opts ?? {}) }, + { method: "POST", ...opts, headers }, timeout, ) } @@ -5308,7 +6159,7 @@ export class ApiClient extends AbstractFetchClient { state?: "active" | "deleted" }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_package_version[]> @@ -5320,13 +6171,18 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/packages/${p["packageType"]}/${p["packageName"]}/versions` + const headers = this._headers({}, opts.headers) const query = this._query({ page: p["page"], per_page: p["perPage"], state: p["state"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async packagesGetPackageVersionForOrganization( @@ -5343,13 +6199,14 @@ export class ApiClient extends AbstractFetchClient { packageVersionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/packages/${p["packageType"]}/${p["packageName"]}/versions/${p["packageVersionId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async packagesDeletePackageVersionForOrg( @@ -5366,7 +6223,7 @@ export class ApiClient extends AbstractFetchClient { packageVersionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -5378,8 +6235,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/packages/${p["packageType"]}/${p["packageName"]}/versions/${p["packageVersionId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async packagesRestorePackageVersionForOrg( @@ -5396,7 +6254,7 @@ export class ApiClient extends AbstractFetchClient { packageVersionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -5408,8 +6266,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/packages/${p["packageType"]}/${p["packageName"]}/versions/${p["packageVersionId"]}/restore` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async orgsListPatGrantRequests( @@ -5426,7 +6285,7 @@ export class ApiClient extends AbstractFetchClient { lastUsedAfter?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_organization_programmatic_access_grant_request[]> @@ -5438,6 +6297,7 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/personal-access-token-requests` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"], @@ -5450,7 +6310,11 @@ export class ApiClient extends AbstractFetchClient { last_used_after: p["lastUsedAfter"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsReviewPatGrantRequestsInBulk( @@ -5463,7 +6327,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -5480,14 +6344,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/personal-access-token-requests` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async orgsReviewPatGrantRequest( @@ -5500,7 +6363,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -5513,14 +6376,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/personal-access-token-requests/${p["patRequestId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async orgsListPatGrantRequestRepositories( @@ -5531,7 +6393,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_minimal_repository[]> @@ -5543,9 +6405,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/personal-access-token-requests/${p["patRequestId"]}/repositories` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsListPatGrants( @@ -5562,7 +6429,7 @@ export class ApiClient extends AbstractFetchClient { lastUsedAfter?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_organization_programmatic_access_grant[]> @@ -5573,6 +6440,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/personal-access-tokens` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"], @@ -5585,7 +6453,11 @@ export class ApiClient extends AbstractFetchClient { last_used_after: p["lastUsedAfter"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsUpdatePatAccesses( @@ -5597,7 +6469,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -5613,14 +6485,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/personal-access-tokens` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async orgsUpdatePatAccess( @@ -5632,7 +6503,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -5644,14 +6515,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/orgs/${p["org"]}/personal-access-tokens/${p["patId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async orgsListPatGrantRepositories( @@ -5662,7 +6532,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_minimal_repository[]> @@ -5674,9 +6544,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/personal-access-tokens/${p["patId"]}/repositories` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async projectsListForOrg( @@ -5687,20 +6562,25 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_project[]> | Res<422, t_validation_error_simple> > > { const url = this.basePath + `/orgs/${p["org"]}/projects` + const headers = this._headers({}, opts.headers) const query = this._query({ state: p["state"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async projectsCreateForOrg( @@ -5712,7 +6592,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_project> @@ -5724,14 +6604,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/projects` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async orgsGetAllCustomProperties( @@ -5739,42 +6618,46 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< - | Res<200, t_org_custom_property[]> + | Res<200, t_custom_property[]> | Res<403, t_basic_error> | Res<404, t_basic_error> > > { const url = this.basePath + `/orgs/${p["org"]}/properties/schema` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsCreateOrUpdateCustomProperties( p: { org: string requestBody: { - properties: t_org_custom_property[] + properties: t_custom_property[] } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< - | Res<200, t_org_custom_property[]> + | Res<200, t_custom_property[]> | Res<403, t_basic_error> | Res<404, t_basic_error> > > { const url = this.basePath + `/orgs/${p["org"]}/properties/schema` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -5785,10 +6668,10 @@ export class ApiClient extends AbstractFetchClient { customPropertyName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< - | Res<200, t_org_custom_property> + | Res<200, t_custom_property> | Res<403, t_basic_error> | Res<404, t_basic_error> > @@ -5796,8 +6679,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/properties/schema/${p["customPropertyName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsCreateOrUpdateCustomProperty( @@ -5809,14 +6693,14 @@ export class ApiClient extends AbstractFetchClient { default_value?: string | string[] | null description?: string | null required?: boolean - value_type: "string" | "single_select" + value_type: "string" | "single_select" | "multi_select" | "true_false" } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< - | Res<200, t_org_custom_property> + | Res<200, t_custom_property> | Res<403, t_basic_error> | Res<404, t_basic_error> > @@ -5824,14 +6708,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/properties/schema/${p["customPropertyName"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async orgsRemoveCustomProperty( @@ -5840,7 +6723,7 @@ export class ApiClient extends AbstractFetchClient { customPropertyName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<403, t_basic_error> | Res<404, t_basic_error> @@ -5849,8 +6732,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/properties/schema/${p["customPropertyName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async orgsListCustomPropertiesValuesForRepos( @@ -5861,7 +6745,7 @@ export class ApiClient extends AbstractFetchClient { repositoryQuery?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_org_repo_custom_property_values[]> @@ -5870,13 +6754,18 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/properties/values` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"], repository_query: p["repositoryQuery"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsCreateOrUpdateCustomPropertiesValuesForRepos( @@ -5888,7 +6777,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -5898,12 +6787,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/properties/values` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -5915,12 +6807,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/public_members` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsCheckPublicMembershipForUser( @@ -5929,12 +6826,13 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, void>>> { const url = this.basePath + `/orgs/${p["org"]}/public_members/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsSetPublicMembershipForAuthenticatedUser( @@ -5943,12 +6841,13 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<403, t_basic_error>>> { const url = this.basePath + `/orgs/${p["org"]}/public_members/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async orgsRemovePublicMembershipForAuthenticatedUser( @@ -5957,12 +6856,13 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/public_members/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposListForOrg( @@ -5975,9 +6875,10 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/repos` + const headers = this._headers({}, opts.headers) const query = this._query({ type: p["type"], sort: p["sort"], @@ -5986,7 +6887,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposCreateInOrg( @@ -6023,7 +6928,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_full_repository> @@ -6032,14 +6937,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/repos` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposGetOrgRulesets( @@ -6049,7 +6953,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_repository_ruleset[]> @@ -6058,9 +6962,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/rulesets` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposCreateOrgRuleset( @@ -6072,11 +6981,11 @@ export class ApiClient extends AbstractFetchClient { enforcement: t_repository_rule_enforcement name: string rules?: t_repository_rule[] - target?: "branch" | "tag" + target?: "branch" | "tag" | "push" } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_repository_ruleset> @@ -6085,19 +6994,19 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/rulesets` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposGetOrgRuleSuites( p: { org: string + ref?: string repositoryName?: number timePeriod?: "hour" | "day" | "week" | "month" actorName?: string @@ -6106,7 +7015,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_rule_suites> @@ -6115,7 +7024,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/rulesets/rule-suites` + const headers = this._headers({}, opts.headers) const query = this._query({ + ref: p["ref"], repository_name: p["repositoryName"], time_period: p["timePeriod"], actor_name: p["actorName"], @@ -6124,7 +7035,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetOrgRuleSuite( @@ -6133,7 +7048,7 @@ export class ApiClient extends AbstractFetchClient { ruleSuiteId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_rule_suite> | Res<404, t_basic_error> | Res<500, t_basic_error> @@ -6142,8 +7057,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/rulesets/rule-suites/${p["ruleSuiteId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposGetOrgRuleset( @@ -6152,7 +7068,7 @@ export class ApiClient extends AbstractFetchClient { rulesetId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_repository_ruleset> @@ -6161,8 +7077,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/rulesets/${p["rulesetId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposUpdateOrgRuleset( @@ -6175,11 +7092,11 @@ export class ApiClient extends AbstractFetchClient { enforcement?: t_repository_rule_enforcement name?: string rules?: t_repository_rule[] - target?: "branch" | "tag" + target?: "branch" | "tag" | "push" } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_repository_ruleset> @@ -6188,14 +7105,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/rulesets/${p["rulesetId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async reposDeleteOrgRuleset( @@ -6204,15 +7120,16 @@ export class ApiClient extends AbstractFetchClient { rulesetId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<404, t_basic_error> | Res<500, t_basic_error> > > { const url = this.basePath + `/orgs/${p["org"]}/rulesets/${p["rulesetId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async secretScanningListAlertsForOrg( @@ -6230,7 +7147,7 @@ export class ApiClient extends AbstractFetchClient { validity?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_organization_secret_scanning_alert[]> @@ -6246,6 +7163,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/secret-scanning/alerts` + const headers = this._headers({}, opts.headers) const query = this._query({ state: p["state"], secret_type: p["secretType"], @@ -6259,7 +7177,11 @@ export class ApiClient extends AbstractFetchClient { validity: p["validity"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async securityAdvisoriesListOrgRepositoryAdvisories( @@ -6273,7 +7195,7 @@ export class ApiClient extends AbstractFetchClient { state?: "triage" | "draft" | "published" | "closed" }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_repository_advisory[]> @@ -6282,6 +7204,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/security-advisories` + const headers = this._headers({}, opts.headers) const query = this._query({ direction: p["direction"], sort: p["sort"], @@ -6291,7 +7214,11 @@ export class ApiClient extends AbstractFetchClient { state: p["state"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsListSecurityManagerTeams( @@ -6299,11 +7226,12 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/security-managers` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsAddSecurityManagerTeam( @@ -6312,13 +7240,14 @@ export class ApiClient extends AbstractFetchClient { teamSlug: string }, timeout?: number, - opts?: RequestInit, - ): Promise | Res<409, void>>> { + opts: RequestInit = {}, + ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/security-managers/teams/${p["teamSlug"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async orgsRemoveSecurityManagerTeam( @@ -6327,13 +7256,14 @@ export class ApiClient extends AbstractFetchClient { teamSlug: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/security-managers/teams/${p["teamSlug"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async billingGetGithubActionsBillingOrg( @@ -6341,11 +7271,12 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/settings/billing/actions` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async billingGetGithubPackagesBillingOrg( @@ -6353,11 +7284,12 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/settings/billing/packages` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async billingGetSharedStorageBillingOrg( @@ -6365,12 +7297,50 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/settings/billing/shared-storage` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) + } + + async copilotUsageMetricsForTeam( + p: { + org: string + teamSlug: string + since?: string + until?: string + page?: number + perPage?: number + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_copilot_usage_metrics[]> + | Res<401, t_basic_error> + | Res<403, t_basic_error> + | Res<404, t_basic_error> + | Res<500, t_basic_error> + > + > { + const url = + this.basePath + `/orgs/${p["org"]}/team/${p["teamSlug"]}/copilot/usage` + const headers = this._headers({}, opts.headers) + const query = this._query({ + since: p["since"], + until: p["until"], + page: p["page"], + per_page: p["perPage"], + }) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsList( @@ -6380,12 +7350,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<403, t_basic_error>>> { const url = this.basePath + `/orgs/${p["org"]}/teams` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsCreate( @@ -6405,7 +7380,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_team_full> @@ -6414,14 +7389,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/teams` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async teamsGetByName( @@ -6430,13 +7404,14 @@ export class ApiClient extends AbstractFetchClient { teamSlug: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async teamsUpdateInOrg( @@ -6455,7 +7430,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_team_full> @@ -6466,12 +7441,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -6482,11 +7460,12 @@ export class ApiClient extends AbstractFetchClient { teamSlug: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async teamsListDiscussionsInOrg( @@ -6499,10 +7478,11 @@ export class ApiClient extends AbstractFetchClient { pinned?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions` + const headers = this._headers({}, opts.headers) const query = this._query({ direction: p["direction"], per_page: p["perPage"], @@ -6510,7 +7490,11 @@ export class ApiClient extends AbstractFetchClient { pinned: p["pinned"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsCreateDiscussionInOrg( @@ -6524,18 +7508,17 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async teamsGetDiscussionInOrg( @@ -6545,13 +7528,14 @@ export class ApiClient extends AbstractFetchClient { discussionNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions/${p["discussionNumber"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async teamsUpdateDiscussionInOrg( @@ -6565,17 +7549,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions/${p["discussionNumber"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -6587,13 +7574,14 @@ export class ApiClient extends AbstractFetchClient { discussionNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions/${p["discussionNumber"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async teamsListDiscussionCommentsInOrg( @@ -6606,18 +7594,23 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions/${p["discussionNumber"]}/comments` + const headers = this._headers({}, opts.headers) const query = this._query({ direction: p["direction"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsCreateDiscussionCommentInOrg( @@ -6630,19 +7623,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions/${p["discussionNumber"]}/comments` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async teamsGetDiscussionCommentInOrg( @@ -6653,13 +7645,14 @@ export class ApiClient extends AbstractFetchClient { commentNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions/${p["discussionNumber"]}/comments/${p["commentNumber"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async teamsUpdateDiscussionCommentInOrg( @@ -6673,17 +7666,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions/${p["discussionNumber"]}/comments/${p["commentNumber"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -6696,13 +7692,14 @@ export class ApiClient extends AbstractFetchClient { commentNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions/${p["discussionNumber"]}/comments/${p["commentNumber"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reactionsListForTeamDiscussionCommentInOrg( @@ -6724,18 +7721,23 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions/${p["discussionNumber"]}/comments/${p["commentNumber"]}/reactions` + const headers = this._headers({}, opts.headers) const query = this._query({ content: p["content"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reactionsCreateForTeamDiscussionCommentInOrg( @@ -6757,19 +7759,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<201, t_reaction>>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions/${p["discussionNumber"]}/comments/${p["commentNumber"]}/reactions` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reactionsDeleteForTeamDiscussionComment( @@ -6781,13 +7782,14 @@ export class ApiClient extends AbstractFetchClient { reactionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions/${p["discussionNumber"]}/comments/${p["commentNumber"]}/reactions/${p["reactionId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reactionsListForTeamDiscussionInOrg( @@ -6808,18 +7810,23 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions/${p["discussionNumber"]}/reactions` + const headers = this._headers({}, opts.headers) const query = this._query({ content: p["content"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reactionsCreateForTeamDiscussionInOrg( @@ -6840,19 +7847,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<201, t_reaction>>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions/${p["discussionNumber"]}/reactions` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reactionsDeleteForTeamDiscussion( @@ -6863,13 +7869,14 @@ export class ApiClient extends AbstractFetchClient { reactionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/discussions/${p["discussionNumber"]}/reactions/${p["reactionId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async teamsListPendingInvitationsInOrg( @@ -6880,13 +7887,18 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/invitations` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsListMembersInOrg( @@ -6898,17 +7910,22 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/members` + const headers = this._headers({}, opts.headers) const query = this._query({ role: p["role"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsGetMembershipForUserInOrg( @@ -6918,13 +7935,14 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, void>>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/memberships/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async teamsAddOrUpdateMembershipForUserInOrg( @@ -6937,7 +7955,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_team_membership> | Res<403, void> | Res<422, void> @@ -6946,14 +7964,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/memberships/${p["username"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async teamsRemoveMembershipForUserInOrg( @@ -6963,13 +7980,14 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<403, void>>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/memberships/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async teamsListProjectsInOrg( @@ -6980,13 +7998,18 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/projects` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsCheckPermissionsForProjectInOrg( @@ -6996,13 +8019,14 @@ export class ApiClient extends AbstractFetchClient { projectId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, void>>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/projects/${p["projectId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async teamsAddOrUpdateProjectPermissionsInOrg( @@ -7015,7 +8039,7 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -7031,14 +8055,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/projects/${p["projectId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async teamsRemoveProjectInOrg( @@ -7048,13 +8071,14 @@ export class ApiClient extends AbstractFetchClient { projectId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/projects/${p["projectId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async teamsListReposInOrg( @@ -7065,12 +8089,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/repos` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsCheckPermissionsForRepoInOrg( @@ -7081,7 +8110,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_team_repository> | Res<204, void> | Res<404, void> @@ -7090,8 +8119,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/repos/${p["owner"]}/${p["repo"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async teamsAddOrUpdateRepoPermissionsInOrg( @@ -7105,19 +8135,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/repos/${p["owner"]}/${p["repo"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async teamsRemoveRepoInOrg( @@ -7128,13 +8157,14 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/repos/${p["owner"]}/${p["repo"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async teamsListChildInOrg( @@ -7145,12 +8175,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/orgs/${p["org"]}/teams/${p["teamSlug"]}/teams` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsEnableOrDisableSecurityProductOnAllOrgRepos( @@ -7170,19 +8205,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<422, void>>> { const url = this.basePath + `/orgs/${p["org"]}/${p["securityProduct"]}/${p["enablement"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async projectsGetCard( @@ -7190,7 +8224,7 @@ export class ApiClient extends AbstractFetchClient { cardId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_project_card> @@ -7201,8 +8235,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/columns/cards/${p["cardId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async projectsUpdateCard( @@ -7214,7 +8249,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_project_card> @@ -7226,12 +8261,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/columns/cards/${p["cardId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -7241,7 +8279,7 @@ export class ApiClient extends AbstractFetchClient { cardId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -7259,8 +8297,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/columns/cards/${p["cardId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async projectsMoveCard( @@ -7272,7 +8311,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, EmptyObject> @@ -7307,14 +8346,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/columns/cards/${p["cardId"]}/moves` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async projectsGetColumn( @@ -7322,7 +8360,7 @@ export class ApiClient extends AbstractFetchClient { columnId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_project_column> @@ -7333,8 +8371,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/columns/${p["columnId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async projectsUpdateColumn( @@ -7345,7 +8384,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_project_column> @@ -7355,12 +8394,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/columns/${p["columnId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -7370,7 +8412,7 @@ export class ApiClient extends AbstractFetchClient { columnId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -7380,8 +8422,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/columns/${p["columnId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async projectsListCards( @@ -7392,7 +8435,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_project_card[]> @@ -7402,13 +8445,18 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/columns/${p["columnId"]}/cards` + const headers = this._headers({}, opts.headers) const query = this._query({ archived_state: p["archivedState"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async projectsCreateCard( @@ -7424,7 +8472,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_project_card> @@ -7447,14 +8495,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/columns/${p["columnId"]}/cards` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async projectsMoveColumn( @@ -7465,7 +8512,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, EmptyObject> @@ -7476,14 +8523,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/columns/${p["columnId"]}/moves` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async projectsGet( @@ -7491,7 +8537,7 @@ export class ApiClient extends AbstractFetchClient { projectId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_project> @@ -7501,8 +8547,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/${p["projectId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async projectsUpdate( @@ -7517,7 +8564,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_project> @@ -7537,12 +8584,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/${p["projectId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -7552,7 +8602,7 @@ export class ApiClient extends AbstractFetchClient { projectId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -7571,8 +8621,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/${p["projectId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async projectsListCollaborators( @@ -7583,7 +8634,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_simple_user[]> @@ -7595,13 +8646,18 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/${p["projectId"]}/collaborators` + const headers = this._headers({}, opts.headers) const query = this._query({ affiliation: p["affiliation"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async projectsAddCollaborator( @@ -7613,7 +8669,7 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -7627,14 +8683,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/projects/${p["projectId"]}/collaborators/${p["username"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async projectsRemoveCollaborator( @@ -7643,7 +8698,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -7657,8 +8712,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/projects/${p["projectId"]}/collaborators/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async projectsGetPermissionForUser( @@ -7667,7 +8723,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_project_collaborator_permission> @@ -7681,8 +8737,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/projects/${p["projectId"]}/collaborators/${p["username"]}/permission` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async projectsListColumns( @@ -7692,7 +8749,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_project_column[]> @@ -7702,9 +8759,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/${p["projectId"]}/columns` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async projectsCreateColumn( @@ -7715,7 +8777,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_project_column> @@ -7726,27 +8788,27 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/projects/${p["projectId"]}/columns` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async rateLimitGet( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_rate_limit_overview> | Res<304, void> | Res<404, t_basic_error> > > { const url = this.basePath + `/rate_limit` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposGet( @@ -7755,7 +8817,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_full_repository> @@ -7765,8 +8827,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposUpdate( @@ -7800,6 +8863,9 @@ export class ApiClient extends AbstractFetchClient { secret_scanning?: { status?: string } + secret_scanning_non_provider_patterns?: { + status?: string + } secret_scanning_push_protection?: { status?: string } @@ -7812,7 +8878,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_full_repository> @@ -7823,12 +8889,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -7839,7 +8908,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -7855,8 +8924,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsListArtifactsForRepo( @@ -7868,7 +8938,7 @@ export class ApiClient extends AbstractFetchClient { name?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -7882,13 +8952,18 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/artifacts` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"], name: p["name"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsGetArtifact( @@ -7898,13 +8973,14 @@ export class ApiClient extends AbstractFetchClient { artifactId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/artifacts/${p["artifactId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsDeleteArtifact( @@ -7914,13 +8990,14 @@ export class ApiClient extends AbstractFetchClient { artifactId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/artifacts/${p["artifactId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsDownloadArtifact( @@ -7931,13 +9008,14 @@ export class ApiClient extends AbstractFetchClient { archiveFormat: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<410, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/artifacts/${p["artifactId"]}/${p["archiveFormat"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsGetActionsCacheUsage( @@ -7946,14 +9024,15 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/cache/usage` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsGetActionsCacheList( @@ -7968,10 +9047,11 @@ export class ApiClient extends AbstractFetchClient { direction?: "asc" | "desc" }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/caches` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"], @@ -7981,7 +9061,11 @@ export class ApiClient extends AbstractFetchClient { direction: p["direction"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsDeleteActionsCacheByKey( @@ -7992,15 +9076,16 @@ export class ApiClient extends AbstractFetchClient { ref?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/caches` + const headers = this._headers({}, opts.headers) const query = this._query({ key: p["key"], ref: p["ref"] }) return this._fetch( url + query, - { method: "DELETE", ...(opts ?? {}) }, + { method: "DELETE", ...opts, headers }, timeout, ) } @@ -8012,13 +9097,14 @@ export class ApiClient extends AbstractFetchClient { cacheId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/caches/${p["cacheId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsGetJobForWorkflowRun( @@ -8028,13 +9114,14 @@ export class ApiClient extends AbstractFetchClient { jobId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/jobs/${p["jobId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsDownloadJobLogsForWorkflowRun( @@ -8044,13 +9131,14 @@ export class ApiClient extends AbstractFetchClient { jobId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/jobs/${p["jobId"]}/logs` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsReRunJobForWorkflowRun( @@ -8063,21 +9151,20 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<403, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/jobs/${p["jobId"]}/rerun` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async actionsGetCustomOidcSubClaimForRepo( @@ -8086,7 +9173,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_oidc_custom_sub_repo> @@ -8097,8 +9184,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/oidc/customization/sub` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsSetCustomOidcSubClaimForRepo( @@ -8111,7 +9199,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_empty_object> @@ -8123,14 +9211,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/oidc/customization/sub` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsListRepoOrganizationSecrets( @@ -8141,7 +9228,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -8156,9 +9243,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/organization-secrets` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsListRepoOrganizationVariables( @@ -8169,7 +9261,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -8184,9 +9276,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/organization-variables` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsGetGithubActionsPermissionsRepository( @@ -8195,12 +9292,13 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/permissions` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsSetGithubActionsPermissionsRepository( @@ -8213,18 +9311,17 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/permissions` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsGetWorkflowAccessToRepository( @@ -8233,15 +9330,16 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/permissions/access` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsSetWorkflowAccessToRepository( @@ -8251,19 +9349,18 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_actions_workflow_access_to_repository }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/permissions/access` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsGetAllowedActionsRepository( @@ -8272,13 +9369,14 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/permissions/selected-actions` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsSetAllowedActionsRepository( @@ -8288,19 +9386,18 @@ export class ApiClient extends AbstractFetchClient { requestBody?: t_selected_actions }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/permissions/selected-actions` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsGetGithubActionsDefaultWorkflowPermissionsRepository( @@ -8309,15 +9406,16 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/permissions/workflow` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsSetGithubActionsDefaultWorkflowPermissionsRepository( @@ -8327,19 +9425,18 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_actions_set_default_workflow_permissions }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<409, void>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/permissions/workflow` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsListSelfHostedRunnersForRepo( @@ -8351,7 +9448,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -8365,13 +9462,18 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runners` + const headers = this._headers({}, opts.headers) const query = this._query({ name: p["name"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsListRunnerApplicationsForRepo( @@ -8380,13 +9482,14 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runners/downloads` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsGenerateRunnerJitconfigForRepo( @@ -8401,7 +9504,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -8418,14 +9521,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runners/generate-jitconfig` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async actionsCreateRegistrationTokenForRepo( @@ -8434,13 +9536,14 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runners/registration-token` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async actionsCreateRemoveTokenForRepo( @@ -8449,13 +9552,14 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runners/remove-token` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async actionsGetSelfHostedRunnerForRepo( @@ -8465,13 +9569,14 @@ export class ApiClient extends AbstractFetchClient { runnerId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runners/${p["runnerId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsDeleteSelfHostedRunnerFromRepo( @@ -8481,13 +9586,14 @@ export class ApiClient extends AbstractFetchClient { runnerId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runners/${p["runnerId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsListLabelsForSelfHostedRunnerForRepo( @@ -8497,7 +9603,7 @@ export class ApiClient extends AbstractFetchClient { runnerId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -8513,8 +9619,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runners/${p["runnerId"]}/labels` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsAddCustomLabelsToSelfHostedRunnerForRepo( @@ -8527,7 +9634,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -8544,14 +9651,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runners/${p["runnerId"]}/labels` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async actionsSetCustomLabelsForSelfHostedRunnerForRepo( @@ -8564,7 +9670,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -8581,14 +9687,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runners/${p["runnerId"]}/labels` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepo( @@ -8598,7 +9703,7 @@ export class ApiClient extends AbstractFetchClient { runnerId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -8614,8 +9719,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runners/${p["runnerId"]}/labels` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsRemoveCustomLabelFromSelfHostedRunnerForRepo( @@ -8626,7 +9732,7 @@ export class ApiClient extends AbstractFetchClient { name: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -8643,8 +9749,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runners/${p["runnerId"]}/labels/${p["name"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsListWorkflowRunsForRepo( @@ -8677,7 +9784,7 @@ export class ApiClient extends AbstractFetchClient { headSha?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -8690,6 +9797,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs` + const headers = this._headers({}, opts.headers) const query = this._query({ actor: p["actor"], branch: p["branch"], @@ -8703,7 +9811,11 @@ export class ApiClient extends AbstractFetchClient { head_sha: p["headSha"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsGetWorkflowRun( @@ -8714,16 +9826,21 @@ export class ApiClient extends AbstractFetchClient { excludePullRequests?: boolean }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}` + const headers = this._headers({}, opts.headers) const query = this._query({ exclude_pull_requests: p["excludePullRequests"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsDeleteWorkflowRun( @@ -8733,13 +9850,14 @@ export class ApiClient extends AbstractFetchClient { runId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsGetReviewsForRun( @@ -8749,13 +9867,14 @@ export class ApiClient extends AbstractFetchClient { runId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/approvals` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsApproveWorkflowRun( @@ -8765,7 +9884,7 @@ export class ApiClient extends AbstractFetchClient { runId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_empty_object> @@ -8776,8 +9895,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/approve` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async actionsListWorkflowRunArtifacts( @@ -8790,7 +9910,7 @@ export class ApiClient extends AbstractFetchClient { name?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -8805,13 +9925,18 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/artifacts` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"], name: p["name"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsGetWorkflowRunAttempt( @@ -8823,16 +9948,21 @@ export class ApiClient extends AbstractFetchClient { excludePullRequests?: boolean }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/attempts/${p["attemptNumber"]}` + const headers = this._headers({}, opts.headers) const query = this._query({ exclude_pull_requests: p["excludePullRequests"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsListJobsForWorkflowRunAttempt( @@ -8845,7 +9975,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -8861,9 +9991,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/attempts/${p["attemptNumber"]}/jobs` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsDownloadWorkflowRunAttemptLogs( @@ -8874,13 +10009,14 @@ export class ApiClient extends AbstractFetchClient { attemptNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/attempts/${p["attemptNumber"]}/logs` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsCancelWorkflowRun( @@ -8890,15 +10026,16 @@ export class ApiClient extends AbstractFetchClient { runId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<409, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/cancel` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async actionsReviewCustomGatesForRun( @@ -8911,19 +10048,18 @@ export class ApiClient extends AbstractFetchClient { | t_review_custom_gates_state_required }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/deployment_protection_rule` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async actionsForceCancelWorkflowRun( @@ -8933,15 +10069,16 @@ export class ApiClient extends AbstractFetchClient { runId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<409, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/force-cancel` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async actionsListJobsForWorkflowRun( @@ -8954,7 +10091,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -8969,13 +10106,18 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/jobs` + const headers = this._headers({}, opts.headers) const query = this._query({ filter: p["filter"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsDownloadWorkflowRunLogs( @@ -8985,13 +10127,14 @@ export class ApiClient extends AbstractFetchClient { runId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/logs` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsDeleteWorkflowRunLogs( @@ -9001,7 +10144,7 @@ export class ApiClient extends AbstractFetchClient { runId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<403, t_basic_error> | Res<500, t_basic_error> @@ -9010,8 +10153,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/logs` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsGetPendingDeploymentsForRun( @@ -9021,13 +10165,14 @@ export class ApiClient extends AbstractFetchClient { runId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/pending_deployments` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsReviewPendingDeploymentsForRun( @@ -9042,19 +10187,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/pending_deployments` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async actionsReRunWorkflow( @@ -9067,19 +10211,18 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/rerun` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async actionsReRunWorkflowFailedJobs( @@ -9092,19 +10235,18 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/rerun-failed-jobs` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async actionsGetWorkflowRunUsage( @@ -9114,13 +10256,14 @@ export class ApiClient extends AbstractFetchClient { runId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/runs/${p["runId"]}/timing` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsListRepoSecrets( @@ -9131,7 +10274,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -9145,9 +10288,14 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/secrets` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsGetRepoPublicKey( @@ -9156,13 +10304,14 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/secrets/public-key` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsGetRepoSecret( @@ -9172,13 +10321,14 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsCreateOrUpdateRepoSecret( @@ -9192,19 +10342,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<204, void>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/secrets/${p["secretName"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsDeleteRepoSecret( @@ -9214,13 +10363,14 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsListRepoVariables( @@ -9231,7 +10381,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -9245,9 +10395,14 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/variables` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsCreateRepoVariable( @@ -9260,18 +10415,17 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/variables` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async actionsGetRepoVariable( @@ -9281,13 +10435,14 @@ export class ApiClient extends AbstractFetchClient { name: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/variables/${p["name"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsUpdateRepoVariable( @@ -9301,17 +10456,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/variables/${p["name"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -9323,13 +10481,14 @@ export class ApiClient extends AbstractFetchClient { name: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/variables/${p["name"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsListRepoWorkflows( @@ -9340,7 +10499,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -9354,9 +10513,14 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/workflows` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsGetWorkflow( @@ -9366,13 +10530,14 @@ export class ApiClient extends AbstractFetchClient { workflowId: number | string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/workflows/${p["workflowId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsDisableWorkflow( @@ -9382,13 +10547,14 @@ export class ApiClient extends AbstractFetchClient { workflowId: number | string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/workflows/${p["workflowId"]}/disable` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async actionsCreateWorkflowDispatch( @@ -9404,19 +10570,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/workflows/${p["workflowId"]}/dispatches` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async actionsEnableWorkflow( @@ -9426,13 +10591,14 @@ export class ApiClient extends AbstractFetchClient { workflowId: number | string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/workflows/${p["workflowId"]}/enable` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async actionsListWorkflowRuns( @@ -9466,7 +10632,7 @@ export class ApiClient extends AbstractFetchClient { headSha?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -9481,6 +10647,7 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/workflows/${p["workflowId"]}/runs` + const headers = this._headers({}, opts.headers) const query = this._query({ actor: p["actor"], branch: p["branch"], @@ -9494,7 +10661,11 @@ export class ApiClient extends AbstractFetchClient { head_sha: p["headSha"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsGetWorkflowUsage( @@ -9504,13 +10675,14 @@ export class ApiClient extends AbstractFetchClient { workflowId: number | string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/actions/workflows/${p["workflowId"]}/timing` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposListActivities( @@ -9533,13 +10705,14 @@ export class ApiClient extends AbstractFetchClient { | "merge_queue_merge" }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_activity[]> | Res<422, t_validation_error_simple> > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/activity` + const headers = this._headers({}, opts.headers) const query = this._query({ direction: p["direction"], per_page: p["perPage"], @@ -9551,7 +10724,11 @@ export class ApiClient extends AbstractFetchClient { activity_type: p["activityType"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async issuesListAssignees( @@ -9562,14 +10739,19 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/assignees` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async issuesCheckUserCanBeAssigned( @@ -9579,13 +10761,103 @@ export class ApiClient extends AbstractFetchClient { assignee: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/assignees/${p["assignee"]}` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) + } + + async reposCreateAttestation( + p: { + owner: string + repo: string + requestBody: { + bundle: { + dsseEnvelope?: { + [key: string]: unknown | undefined + } + mediaType?: string + verificationMaterial?: { + [key: string]: unknown | undefined + } + } + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 201, + { + id?: number + } + > + | Res<403, t_basic_error> + | Res<422, t_validation_error> + > + > { + const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/attestations` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async reposListAttestations( + p: { + owner: string + repo: string + perPage?: number + before?: string + after?: string + subjectDigest: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + Res< + 200, + { + attestations?: { + bundle?: { + dsseEnvelope?: { + [key: string]: unknown | undefined + } + mediaType?: string + verificationMaterial?: { + [key: string]: unknown | undefined + } + } + repository_id?: number + }[] + } + > + > + > { + const url = + this.basePath + + `/repos/${p["owner"]}/${p["repo"]}/attestations/${p["subjectDigest"]}` + const headers = this._headers({}, opts.headers) + const query = this._query({ + per_page: p["perPage"], + before: p["before"], + after: p["after"], + }) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposListAutolinks( @@ -9594,11 +10866,12 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/autolinks` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposCreateAutolink( @@ -9612,19 +10885,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/autolinks` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposGetAutolink( @@ -9634,15 +10906,16 @@ export class ApiClient extends AbstractFetchClient { autolinkId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/autolinks/${p["autolinkId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposDeleteAutolink( @@ -9652,13 +10925,14 @@ export class ApiClient extends AbstractFetchClient { autolinkId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/autolinks/${p["autolinkId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposCheckAutomatedSecurityFixes( @@ -9667,7 +10941,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_check_automated_security_fixes> | Res<404, void> @@ -9676,8 +10950,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/automated-security-fixes` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposEnableAutomatedSecurityFixes( @@ -9686,13 +10961,14 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/automated-security-fixes` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async reposDisableAutomatedSecurityFixes( @@ -9701,13 +10977,14 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/automated-security-fixes` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposListBranches( @@ -9719,18 +10996,23 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches` + const headers = this._headers({}, opts.headers) const query = this._query({ protected: p["protected"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetBranch( @@ -9740,7 +11022,7 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_branch_with_protection> @@ -9751,8 +11033,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposGetBranchProtection( @@ -9762,15 +11045,16 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposUpdateBranchProtection( @@ -9819,7 +11103,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_protected_branch> @@ -9831,14 +11115,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async reposDeleteBranchProtection( @@ -9848,13 +11131,14 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<403, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposGetAdminBranchProtection( @@ -9864,13 +11148,14 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/enforce_admins` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposSetAdminBranchProtection( @@ -9880,13 +11165,14 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/enforce_admins` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async reposDeleteAdminBranchProtection( @@ -9896,13 +11182,14 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/enforce_admins` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposGetPullRequestReviewProtection( @@ -9912,15 +11199,16 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/required_pull_request_reviews` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposUpdatePullRequestReviewProtection( @@ -9946,7 +11234,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_protected_branch_pull_request_review> @@ -9956,12 +11244,15 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/required_pull_request_reviews` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -9973,13 +11264,14 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/required_pull_request_reviews` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposGetCommitSignatureProtection( @@ -9989,7 +11281,7 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_protected_branch_admin_enforced> | Res<404, t_basic_error> @@ -9998,8 +11290,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/required_signatures` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposCreateCommitSignatureProtection( @@ -10009,7 +11302,7 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_protected_branch_admin_enforced> | Res<404, t_basic_error> @@ -10018,8 +11311,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/required_signatures` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async reposDeleteCommitSignatureProtection( @@ -10029,13 +11323,14 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/required_signatures` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposGetStatusChecksProtection( @@ -10045,7 +11340,7 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_status_check_policy> | Res<404, t_basic_error> @@ -10054,8 +11349,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/required_status_checks` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposUpdateStatusCheckProtection( @@ -10073,7 +11369,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_status_check_policy> @@ -10084,12 +11380,15 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/required_status_checks` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -10101,13 +11400,14 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/required_status_checks` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposGetAllStatusCheckContexts( @@ -10117,13 +11417,14 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/required_status_checks/contexts` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposAddStatusCheckContexts( @@ -10138,7 +11439,7 @@ export class ApiClient extends AbstractFetchClient { | string[] }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, string[]> @@ -10150,14 +11451,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/required_status_checks/contexts` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposSetStatusCheckContexts( @@ -10172,7 +11472,7 @@ export class ApiClient extends AbstractFetchClient { | string[] }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, string[]> @@ -10183,14 +11483,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/required_status_checks/contexts` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async reposRemoveStatusCheckContexts( @@ -10205,7 +11504,7 @@ export class ApiClient extends AbstractFetchClient { | string[] }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, string[]> @@ -10216,12 +11515,15 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/required_status_checks/contexts` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -10233,7 +11535,7 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_branch_restriction_policy> | Res<404, t_basic_error> @@ -10242,8 +11544,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/restrictions` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposDeleteAccessRestrictions( @@ -10253,13 +11556,14 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/restrictions` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposGetAppsWithAccessToProtectedBranch( @@ -10269,15 +11573,16 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/restrictions/apps` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposAddAppAccessRestrictions( @@ -10292,21 +11597,20 @@ export class ApiClient extends AbstractFetchClient { | string[] }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/restrictions/apps` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposSetAppAccessRestrictions( @@ -10321,21 +11625,20 @@ export class ApiClient extends AbstractFetchClient { | string[] }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/restrictions/apps` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async reposRemoveAppAccessRestrictions( @@ -10350,19 +11653,22 @@ export class ApiClient extends AbstractFetchClient { | string[] }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/restrictions/apps` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -10374,13 +11680,14 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/restrictions/teams` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposAddTeamAccessRestrictions( @@ -10395,21 +11702,20 @@ export class ApiClient extends AbstractFetchClient { | string[] }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/restrictions/teams` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposSetTeamAccessRestrictions( @@ -10424,21 +11730,20 @@ export class ApiClient extends AbstractFetchClient { | string[] }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/restrictions/teams` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async reposRemoveTeamAccessRestrictions( @@ -10453,19 +11758,22 @@ export class ApiClient extends AbstractFetchClient { | string[] }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/restrictions/teams` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -10477,15 +11785,16 @@ export class ApiClient extends AbstractFetchClient { branch: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/restrictions/users` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposAddUserAccessRestrictions( @@ -10500,21 +11809,20 @@ export class ApiClient extends AbstractFetchClient { | string[] }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/restrictions/users` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposSetUserAccessRestrictions( @@ -10529,21 +11837,20 @@ export class ApiClient extends AbstractFetchClient { | string[] }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/restrictions/users` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async reposRemoveUserAccessRestrictions( @@ -10558,19 +11865,22 @@ export class ApiClient extends AbstractFetchClient { | string[] }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/protection/restrictions/users` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -10585,7 +11895,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_branch_with_protection> @@ -10597,14 +11907,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/branches/${p["branch"]}/rename` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async checksCreate( @@ -10622,17 +11931,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/check-runs` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async checksGet( @@ -10642,13 +11950,14 @@ export class ApiClient extends AbstractFetchClient { checkRunId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/check-runs/${p["checkRunId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async checksUpdate( @@ -10707,17 +12016,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/check-runs/${p["checkRunId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -10731,14 +12043,19 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/check-runs/${p["checkRunId"]}/annotations` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async checksRerequestRun( @@ -10748,7 +12065,7 @@ export class ApiClient extends AbstractFetchClient { checkRunId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_empty_object> @@ -10760,8 +12077,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/check-runs/${p["checkRunId"]}/rerequest` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async checksCreateSuite( @@ -10773,19 +12091,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<201, t_check_suite>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/check-suites` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async checksSetSuitesPreferences( @@ -10800,17 +12117,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/check-suites/preferences` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -10822,13 +12142,14 @@ export class ApiClient extends AbstractFetchClient { checkSuiteId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/check-suites/${p["checkSuiteId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async checksListForSuite( @@ -10843,7 +12164,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -10858,6 +12179,7 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/check-suites/${p["checkSuiteId"]}/check-runs` + const headers = this._headers({}, opts.headers) const query = this._query({ check_name: p["checkName"], status: p["status"], @@ -10866,7 +12188,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async checksRerequestSuite( @@ -10876,13 +12202,14 @@ export class ApiClient extends AbstractFetchClient { checkSuiteId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/check-suites/${p["checkSuiteId"]}/rerequest` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async codeScanningListAlertsForRepo( @@ -10900,7 +12227,7 @@ export class ApiClient extends AbstractFetchClient { severity?: t_code_scanning_alert_severity }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_code_scanning_alert_items[]> @@ -10919,6 +12246,7 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/alerts` + const headers = this._headers({}, opts.headers) const query = this._query({ tool_name: p["toolName"], tool_guid: p["toolGuid"], @@ -10931,7 +12259,11 @@ export class ApiClient extends AbstractFetchClient { severity: p["severity"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codeScanningGetAlert( @@ -10941,7 +12273,7 @@ export class ApiClient extends AbstractFetchClient { alertNumber: t_alert_number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_code_scanning_alert> @@ -10961,8 +12293,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/alerts/${p["alertNumber"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codeScanningUpdateAlert( @@ -10977,7 +12310,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_code_scanning_alert> @@ -10996,12 +12329,15 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/alerts/${p["alertNumber"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -11016,7 +12352,7 @@ export class ApiClient extends AbstractFetchClient { ref?: t_code_scanning_ref }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_code_scanning_alert_instance[]> @@ -11035,13 +12371,18 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/alerts/${p["alertNumber"]}/instances` + const headers = this._headers({}, opts.headers) const query = this._query({ page: p["page"], per_page: p["perPage"], ref: p["ref"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codeScanningListRecentAnalyses( @@ -11058,7 +12399,7 @@ export class ApiClient extends AbstractFetchClient { sort?: "created" }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_code_scanning_analysis[]> @@ -11076,6 +12417,7 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/analyses` + const headers = this._headers({}, opts.headers) const query = this._query({ tool_name: p["toolName"], tool_guid: p["toolGuid"], @@ -11087,7 +12429,11 @@ export class ApiClient extends AbstractFetchClient { sort: p["sort"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codeScanningGetAnalysis( @@ -11097,7 +12443,7 @@ export class ApiClient extends AbstractFetchClient { analysisId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -11121,8 +12467,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/analyses/${p["analysisId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codeScanningDeleteAnalysis( @@ -11133,7 +12480,7 @@ export class ApiClient extends AbstractFetchClient { confirmDelete?: string | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_code_scanning_analysis_deletion> @@ -11153,11 +12500,12 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/analyses/${p["analysisId"]}` + const headers = this._headers({}, opts.headers) const query = this._query({ confirm_delete: p["confirmDelete"] }) return this._fetch( url + query, - { method: "DELETE", ...(opts ?? {}) }, + { method: "DELETE", ...opts, headers }, timeout, ) } @@ -11168,7 +12516,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_code_scanning_codeql_database[]> @@ -11187,8 +12535,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/codeql/databases` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codeScanningGetCodeqlDatabase( @@ -11198,7 +12547,7 @@ export class ApiClient extends AbstractFetchClient { language: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_code_scanning_codeql_database> @@ -11218,8 +12567,106 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/codeql/databases/${p["language"]}` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) + } + + async codeScanningCreateVariantAnalysis( + p: { + owner: string + repo: string + requestBody: EmptyObject + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<201, t_code_scanning_variant_analysis> + | Res<404, t_basic_error> + | Res<422, t_basic_error> + | Res< + 503, + { + code?: string + documentation_url?: string + message?: string + } + > + > + > { + const url = + this.basePath + + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/codeql/variant-analyses` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async codeScanningGetVariantAnalysis( + p: { + owner: string + repo: string + codeqlVariantAnalysisId: number + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_code_scanning_variant_analysis> + | Res<404, t_basic_error> + | Res< + 503, + { + code?: string + documentation_url?: string + message?: string + } + > + > + > { + const url = + this.basePath + + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/codeql/variant-analyses/${p["codeqlVariantAnalysisId"]}` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) + } + + async codeScanningGetVariantAnalysisRepoTask( + p: { + owner: string + repo: string + codeqlVariantAnalysisId: number + repoOwner: string + repoName: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_code_scanning_variant_analysis_repo_task> + | Res<404, t_basic_error> + | Res< + 503, + { + code?: string + documentation_url?: string + message?: string + } + > + > + > { + const url = + this.basePath + + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/codeql/variant-analyses/${p["codeqlVariantAnalysisId"]}/repos/${p["repoOwner"]}/${p["repoName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codeScanningGetDefaultSetup( @@ -11228,7 +12675,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_code_scanning_default_setup> @@ -11247,8 +12694,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/default-setup` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codeScanningUpdateDefaultSetup( @@ -11258,7 +12706,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_code_scanning_default_setup_update }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_empty_object> @@ -11279,12 +12727,15 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/default-setup` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -11304,7 +12755,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<202, t_code_scanning_sarifs_receipt> @@ -11324,14 +12775,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/sarifs` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async codeScanningGetSarif( @@ -11341,7 +12791,7 @@ export class ApiClient extends AbstractFetchClient { sarifId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_code_scanning_sarifs_status> @@ -11360,8 +12810,33 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/code-scanning/sarifs/${p["sarifId"]}` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) + } + + async codeSecurityGetConfigurationForRepository( + p: { + owner: string + repo: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_code_security_configuration_for_repository> + | Res<204, void> + | Res<304, void> + | Res<403, t_basic_error> + | Res<404, t_basic_error> + > + > { + const url = + this.basePath + + `/repos/${p["owner"]}/${p["repo"]}/code-security-configuration` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposCodeownersErrors( @@ -11371,15 +12846,20 @@ export class ApiClient extends AbstractFetchClient { ref?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, void>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/codeowners/errors` + const headers = this._headers({}, opts.headers) const query = this._query({ ref: p["ref"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codespacesListInRepositoryForAuthenticatedUser( @@ -11390,7 +12870,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -11407,9 +12887,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/codespaces` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codespacesCreateWithRepoForAuthenticatedUser( @@ -11431,7 +12916,7 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_codespace> @@ -11451,14 +12936,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/codespaces` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async codespacesListDevcontainersInRepositoryForAuthenticatedUser( @@ -11469,7 +12953,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -11493,9 +12977,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/codespaces/devcontainers` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codespacesRepoMachinesForAuthenticatedUser( @@ -11507,7 +12996,7 @@ export class ApiClient extends AbstractFetchClient { ref?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -11526,13 +13015,18 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/codespaces/machines` + const headers = this._headers({}, opts.headers) const query = this._query({ location: p["location"], client_ip: p["clientIp"], ref: p["ref"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codespacesPreFlightWithRepoForAuthenticatedUser( @@ -11543,7 +13037,7 @@ export class ApiClient extends AbstractFetchClient { clientIp?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -11563,9 +13057,14 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/codespaces/new` + const headers = this._headers({}, opts.headers) const query = this._query({ ref: p["ref"], client_ip: p["clientIp"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codespacesCheckPermissionsForDevcontainer( @@ -11576,7 +13075,7 @@ export class ApiClient extends AbstractFetchClient { devcontainerPath: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_codespaces_permissions_check_for_devcontainer> @@ -11597,12 +13096,17 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/codespaces/permissions_check` + const headers = this._headers({}, opts.headers) const query = this._query({ ref: p["ref"], devcontainer_path: p["devcontainerPath"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codespacesListRepoSecrets( @@ -11613,7 +13117,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -11627,9 +13131,14 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/codespaces/secrets` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codespacesGetRepoPublicKey( @@ -11638,13 +13147,14 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/codespaces/secrets/public-key` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codespacesGetRepoSecret( @@ -11654,13 +13164,14 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/codespaces/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codespacesCreateOrUpdateRepoSecret( @@ -11674,19 +13185,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<204, void>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/codespaces/secrets/${p["secretName"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async codespacesDeleteRepoSecret( @@ -11696,13 +13206,14 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/codespaces/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposListCollaborators( @@ -11715,12 +13226,13 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/collaborators` + const headers = this._headers({}, opts.headers) const query = this._query({ affiliation: p["affiliation"], permission: p["permission"], @@ -11728,7 +13240,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposCheckCollaborator( @@ -11738,13 +13254,14 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, void>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/collaborators/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposAddCollaborator( @@ -11757,7 +13274,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_repository_invitation> @@ -11769,14 +13286,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/collaborators/${p["username"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async reposRemoveCollaborator( @@ -11786,7 +13302,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<403, t_basic_error> | Res<422, t_validation_error> @@ -11795,8 +13311,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/collaborators/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposGetCollaboratorPermissionLevel( @@ -11806,7 +13323,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_repository_collaborator_permission> | Res<404, t_basic_error> @@ -11815,8 +13332,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/collaborators/${p["username"]}/permission` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposListCommitCommentsForRepo( @@ -11827,12 +13345,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/comments` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetCommitComment( @@ -11842,15 +13365,16 @@ export class ApiClient extends AbstractFetchClient { commentId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/comments/${p["commentId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposUpdateCommitComment( @@ -11863,19 +13387,22 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/comments/${p["commentId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -11887,13 +13414,14 @@ export class ApiClient extends AbstractFetchClient { commentId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/comments/${p["commentId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reactionsListForCommitComment( @@ -11914,20 +13442,25 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/comments/${p["commentId"]}/reactions` + const headers = this._headers({}, opts.headers) const query = this._query({ content: p["content"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reactionsCreateForCommitComment( @@ -11948,7 +13481,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_reaction> | Res<201, t_reaction> | Res<422, t_validation_error> @@ -11957,14 +13490,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/comments/${p["commentId"]}/reactions` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reactionsDeleteForCommitComment( @@ -11975,13 +13507,14 @@ export class ApiClient extends AbstractFetchClient { reactionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/comments/${p["commentId"]}/reactions/${p["reactionId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposListCommits( @@ -11998,7 +13531,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_commit[]> @@ -12009,6 +13542,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/commits` + const headers = this._headers({}, opts.headers) const query = this._query({ sha: p["sha"], path: p["path"], @@ -12020,7 +13554,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposListBranchesForHeadCommit( @@ -12030,7 +13568,7 @@ export class ApiClient extends AbstractFetchClient { commitSha: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_branch_short[]> @@ -12041,8 +13579,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/commits/${p["commitSha"]}/branches-where-head` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposListCommentsForCommit( @@ -12054,14 +13593,19 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/commits/${p["commitSha"]}/comments` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposCreateCommitComment( @@ -12077,7 +13621,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_commit_comment> @@ -12088,14 +13632,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/commits/${p["commitSha"]}/comments` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposListPullRequestsAssociatedWithCommit( @@ -12107,7 +13650,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_pull_request_simple[]> | Res<409, t_basic_error> @@ -12116,9 +13659,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/commits/${p["commitSha"]}/pulls` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetCommit( @@ -12130,7 +13678,7 @@ export class ApiClient extends AbstractFetchClient { ref: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_commit> @@ -12150,9 +13698,14 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/commits/${p["ref"]}` + const headers = this._headers({}, opts.headers) const query = this._query({ page: p["page"], per_page: p["perPage"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async checksListForRef( @@ -12168,7 +13721,7 @@ export class ApiClient extends AbstractFetchClient { appId?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -12183,6 +13736,7 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/commits/${p["ref"]}/check-runs` + const headers = this._headers({}, opts.headers) const query = this._query({ check_name: p["checkName"], status: p["status"], @@ -12192,7 +13746,11 @@ export class ApiClient extends AbstractFetchClient { app_id: p["appId"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async checksListSuitesForRef( @@ -12206,7 +13764,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -12221,6 +13779,7 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/commits/${p["ref"]}/check-suites` + const headers = this._headers({}, opts.headers) const query = this._query({ app_id: p["appId"], check_name: p["checkName"], @@ -12228,7 +13787,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetCombinedStatusForRef( @@ -12240,7 +13803,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_combined_commit_status> | Res<404, t_basic_error> @@ -12249,9 +13812,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/commits/${p["ref"]}/status` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposListCommitStatusesForRef( @@ -12263,16 +13831,21 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<301, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/commits/${p["ref"]}/statuses` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetCommunityProfileMetrics( @@ -12281,12 +13854,13 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/community/profile` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposCompareCommits( @@ -12298,7 +13872,7 @@ export class ApiClient extends AbstractFetchClient { basehead: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_commit_comparison> @@ -12317,9 +13891,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/compare/${p["basehead"]}` + const headers = this._headers({}, opts.headers) const query = this._query({ page: p["page"], per_page: p["perPage"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetContent( @@ -12330,7 +13909,7 @@ export class ApiClient extends AbstractFetchClient { ref?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -12341,15 +13920,21 @@ export class ApiClient extends AbstractFetchClient { | t_content_submodule > | Res<302, void> + | Res<304, void> | Res<403, t_basic_error> | Res<404, t_basic_error> > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/contents/${p["path"]}` + const headers = this._headers({}, opts.headers) const query = this._query({ ref: p["ref"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposCreateOrUpdateFileContents( @@ -12375,7 +13960,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_file_commit> @@ -12387,14 +13972,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/contents/${p["path"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async reposDeleteFile( @@ -12417,7 +14001,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_file_commit> @@ -12436,12 +14020,15 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/contents/${p["path"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -12455,7 +14042,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_contributor[]> @@ -12465,13 +14052,18 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/contributors` + const headers = this._headers({}, opts.headers) const query = this._query({ anon: p["anon"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async dependabotListAlertsForRepo( @@ -12494,7 +14086,7 @@ export class ApiClient extends AbstractFetchClient { last?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_dependabot_alert[]> @@ -12507,6 +14099,7 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/dependabot/alerts` + const headers = this._headers({}, opts.headers) const query = this._query({ state: p["state"], severity: p["severity"], @@ -12524,7 +14117,11 @@ export class ApiClient extends AbstractFetchClient { last: p["last"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async dependabotGetAlert( @@ -12534,7 +14131,7 @@ export class ApiClient extends AbstractFetchClient { alertNumber: t_alert_number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_dependabot_alert> @@ -12546,8 +14143,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/dependabot/alerts/${p["alertNumber"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async dependabotUpdateAlert( @@ -12567,7 +14165,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_dependabot_alert> @@ -12581,12 +14179,15 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/dependabot/alerts/${p["alertNumber"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -12599,7 +14200,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -12613,9 +14214,14 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/dependabot/secrets` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async dependabotGetRepoPublicKey( @@ -12624,13 +14230,14 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/dependabot/secrets/public-key` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async dependabotGetRepoSecret( @@ -12640,13 +14247,14 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/dependabot/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async dependabotCreateOrUpdateRepoSecret( @@ -12660,19 +14268,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<204, void>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/dependabot/secrets/${p["secretName"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async dependabotDeleteRepoSecret( @@ -12682,13 +14289,14 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/dependabot/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async dependencyGraphDiffRange( @@ -12699,7 +14307,7 @@ export class ApiClient extends AbstractFetchClient { name?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_dependency_graph_diff> @@ -12710,9 +14318,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/dependency-graph/compare/${p["basehead"]}` + const headers = this._headers({}, opts.headers) const query = this._query({ name: p["name"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async dependencyGraphExportSbom( @@ -12721,7 +14334,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_dependency_graph_spdx_sbom> @@ -12731,8 +14344,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/dependency-graph/sbom` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async dependencyGraphCreateRepositorySnapshot( @@ -12742,7 +14356,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_snapshot }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -12759,14 +14373,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/dependency-graph/snapshots` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposListDeployments( @@ -12781,9 +14394,10 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/deployments` + const headers = this._headers({}, opts.headers) const query = this._query({ sha: p["sha"], ref: p["ref"], @@ -12793,7 +14407,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposCreateDeployment( @@ -12817,7 +14435,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_deployment> @@ -12832,14 +14450,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/deployments` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposGetDeployment( @@ -12849,15 +14466,16 @@ export class ApiClient extends AbstractFetchClient { deploymentId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/deployments/${p["deploymentId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposDeleteDeployment( @@ -12867,7 +14485,7 @@ export class ApiClient extends AbstractFetchClient { deploymentId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -12878,8 +14496,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/deployments/${p["deploymentId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposListDeploymentStatuses( @@ -12891,7 +14510,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_deployment_status[]> | Res<404, t_basic_error> @@ -12900,9 +14519,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/deployments/${p["deploymentId"]}/statuses` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposCreateDeploymentStatus( @@ -12928,7 +14552,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<201, t_deployment_status> | Res<422, t_validation_error> @@ -12937,14 +14561,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/deployments/${p["deploymentId"]}/statuses` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposGetDeploymentStatus( @@ -12955,15 +14578,16 @@ export class ApiClient extends AbstractFetchClient { statusId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/deployments/${p["deploymentId"]}/statuses/${p["statusId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposCreateDispatchEvent( @@ -12978,21 +14602,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<404, t_basic_error> | Res<422, t_validation_error> > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/dispatches` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposGetAllEnvironments( @@ -13003,7 +14626,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -13016,9 +14639,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetEnvironment( @@ -13028,13 +14656,14 @@ export class ApiClient extends AbstractFetchClient { environmentName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposCreateOrUpdateEnvironment( @@ -13055,21 +14684,20 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async reposDeleteAnEnvironment( @@ -13079,13 +14707,14 @@ export class ApiClient extends AbstractFetchClient { environmentName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposListDeploymentBranchPolicies( @@ -13097,7 +14726,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -13112,9 +14741,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/deployment-branch-policies` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposCreateDeploymentBranchPolicy( @@ -13125,7 +14759,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_deployment_branch_policy_name_pattern_with_type }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_deployment_branch_policy> | Res<303, void> | Res<404, void> @@ -13134,14 +14768,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/deployment-branch-policies` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposGetDeploymentBranchPolicy( @@ -13152,13 +14785,14 @@ export class ApiClient extends AbstractFetchClient { branchPolicyId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/deployment-branch-policies/${p["branchPolicyId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposUpdateDeploymentBranchPolicy( @@ -13170,19 +14804,18 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_deployment_branch_policy_name_pattern }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/deployment-branch-policies/${p["branchPolicyId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async reposDeleteDeploymentBranchPolicy( @@ -13193,13 +14826,14 @@ export class ApiClient extends AbstractFetchClient { branchPolicyId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/deployment-branch-policies/${p["branchPolicyId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposGetAllDeploymentProtectionRules( @@ -13209,7 +14843,7 @@ export class ApiClient extends AbstractFetchClient { owner: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -13224,8 +14858,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/deployment_protection_rules` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposCreateDeploymentProtectionRule( @@ -13238,19 +14873,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/deployment_protection_rules` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposListCustomDeploymentRuleIntegrations( @@ -13262,7 +14896,7 @@ export class ApiClient extends AbstractFetchClient { perPage?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -13277,9 +14911,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/deployment_protection_rules/apps` + const headers = this._headers({}, opts.headers) const query = this._query({ page: p["page"], per_page: p["perPage"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetCustomDeploymentProtectionRule( @@ -13290,13 +14929,14 @@ export class ApiClient extends AbstractFetchClient { protectionRuleId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/deployment_protection_rules/${p["protectionRuleId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposDisableDeploymentProtectionRule( @@ -13307,13 +14947,14 @@ export class ApiClient extends AbstractFetchClient { protectionRuleId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/deployment_protection_rules/${p["protectionRuleId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsListEnvironmentSecrets( @@ -13325,7 +14966,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -13340,9 +14981,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/secrets` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsGetEnvironmentPublicKey( @@ -13352,13 +14998,14 @@ export class ApiClient extends AbstractFetchClient { environmentName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/secrets/public-key` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsGetEnvironmentSecret( @@ -13369,13 +15016,14 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsCreateOrUpdateEnvironmentSecret( @@ -13390,19 +15038,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<204, void>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/secrets/${p["secretName"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async actionsDeleteEnvironmentSecret( @@ -13413,13 +15060,14 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async actionsListEnvironmentVariables( @@ -13431,7 +15079,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -13446,9 +15094,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/variables` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async actionsCreateEnvironmentVariable( @@ -13462,19 +15115,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/variables` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async actionsGetEnvironmentVariable( @@ -13485,13 +15137,14 @@ export class ApiClient extends AbstractFetchClient { name: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/variables/${p["name"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async actionsUpdateEnvironmentVariable( @@ -13506,17 +15159,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/variables/${p["name"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -13529,13 +15185,14 @@ export class ApiClient extends AbstractFetchClient { environmentName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/environments/${p["environmentName"]}/variables/${p["name"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async activityListRepoEvents( @@ -13546,12 +15203,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/events` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposListForks( @@ -13563,20 +15225,25 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_minimal_repository[]> | Res<400, t_scim_error> > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/forks` + const headers = this._headers({}, opts.headers) const query = this._query({ sort: p["sort"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposCreateFork( @@ -13590,7 +15257,7 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<202, t_full_repository> @@ -13601,14 +15268,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/forks` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async gitCreateBlob( @@ -13621,7 +15287,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_short_blob> @@ -13632,14 +15298,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/git/blobs` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async gitGetBlob( @@ -13649,7 +15314,7 @@ export class ApiClient extends AbstractFetchClient { fileSha: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_blob> @@ -13662,8 +15327,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/git/blobs/${p["fileSha"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async gitCreateCommit( @@ -13688,7 +15354,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_git_commit> @@ -13698,14 +15364,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/git/commits` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async gitGetCommit( @@ -13715,7 +15380,7 @@ export class ApiClient extends AbstractFetchClient { commitSha: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_git_commit> | Res<404, t_basic_error> | Res<409, t_basic_error> @@ -13724,8 +15389,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/git/commits/${p["commitSha"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async gitListMatchingRefs( @@ -13735,15 +15401,16 @@ export class ApiClient extends AbstractFetchClient { ref: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<409, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/git/matching-refs/${p["ref"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async gitGetRef( @@ -13753,7 +15420,7 @@ export class ApiClient extends AbstractFetchClient { ref: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_git_ref> | Res<404, t_basic_error> | Res<409, t_basic_error> @@ -13761,8 +15428,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/git/ref/${p["ref"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async gitCreateRef( @@ -13775,7 +15443,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_git_ref> @@ -13784,14 +15452,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/git/refs` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async gitUpdateRef( @@ -13805,7 +15472,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_git_ref> @@ -13815,12 +15482,15 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/git/refs/${p["ref"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -13832,7 +15502,7 @@ export class ApiClient extends AbstractFetchClient { ref: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<409, t_basic_error> | Res<422, t_validation_error> @@ -13840,8 +15510,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/git/refs/${p["ref"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async gitCreateTag( @@ -13861,7 +15532,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_git_tag> @@ -13870,14 +15541,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/git/tags` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async gitGetTag( @@ -13887,7 +15557,7 @@ export class ApiClient extends AbstractFetchClient { tagSha: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_git_tag> | Res<404, t_basic_error> | Res<409, t_basic_error> @@ -13896,8 +15566,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/git/tags/${p["tagSha"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async gitCreateTree( @@ -13916,7 +15587,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_git_tree> @@ -13927,14 +15598,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/git/trees` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async gitGetTree( @@ -13945,7 +15615,7 @@ export class ApiClient extends AbstractFetchClient { recursive?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_git_tree> @@ -13957,9 +15627,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/git/trees/${p["treeSha"]}` + const headers = this._headers({}, opts.headers) const query = this._query({ recursive: p["recursive"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposListWebhooks( @@ -13970,12 +15645,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/hooks` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposCreateWebhook( @@ -13995,7 +15675,7 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_hook> @@ -14005,14 +15685,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/hooks` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposGetWebhook( @@ -14022,12 +15701,13 @@ export class ApiClient extends AbstractFetchClient { hookId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/hooks/${p["hookId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposUpdateWebhook( @@ -14044,7 +15724,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_hook> | Res<404, t_basic_error> | Res<422, t_validation_error> @@ -14052,12 +15732,15 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/hooks/${p["hookId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -14069,12 +15752,13 @@ export class ApiClient extends AbstractFetchClient { hookId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/hooks/${p["hookId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposGetWebhookConfigForRepo( @@ -14084,13 +15768,14 @@ export class ApiClient extends AbstractFetchClient { hookId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/hooks/${p["hookId"]}/config` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposUpdateWebhookConfigForRepo( @@ -14106,17 +15791,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/hooks/${p["hookId"]}/config` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -14131,7 +15819,7 @@ export class ApiClient extends AbstractFetchClient { redelivery?: boolean }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_hook_delivery_item[]> @@ -14142,13 +15830,18 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/hooks/${p["hookId"]}/deliveries` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], cursor: p["cursor"], redelivery: p["redelivery"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetWebhookDelivery( @@ -14159,7 +15852,7 @@ export class ApiClient extends AbstractFetchClient { deliveryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_hook_delivery> @@ -14170,8 +15863,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/hooks/${p["hookId"]}/deliveries/${p["deliveryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposRedeliverWebhookDelivery( @@ -14182,7 +15876,7 @@ export class ApiClient extends AbstractFetchClient { deliveryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -14198,8 +15892,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/hooks/${p["hookId"]}/deliveries/${p["deliveryId"]}/attempts` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async reposPingWebhook( @@ -14209,13 +15904,14 @@ export class ApiClient extends AbstractFetchClient { hookId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/hooks/${p["hookId"]}/pings` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async reposTestPushWebhook( @@ -14225,13 +15921,14 @@ export class ApiClient extends AbstractFetchClient { hookId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/hooks/${p["hookId"]}/tests` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async migrationsGetImportStatus( @@ -14240,15 +15937,16 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_import> | Res<404, t_basic_error> | Res<503, t_basic_error> > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/import` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async migrationsStartImport( @@ -14264,7 +15962,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_import> @@ -14274,14 +15972,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/import` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async migrationsUpdateImport( @@ -14296,15 +15993,18 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<503, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/import` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -14315,11 +16015,12 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<503, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/import` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async migrationsGetCommitAuthors( @@ -14329,7 +16030,7 @@ export class ApiClient extends AbstractFetchClient { since?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_porter_author[]> @@ -14339,9 +16040,14 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/import/authors` + const headers = this._headers({}, opts.headers) const query = this._query({ since: p["since"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async migrationsMapCommitAuthor( @@ -14355,7 +16061,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_porter_author> @@ -14367,12 +16073,15 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/import/authors/${p["authorId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -14383,7 +16092,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_porter_large_file[]> | Res<503, t_basic_error> @@ -14391,8 +16100,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/import/large_files` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async migrationsSetLfsPreference( @@ -14404,7 +16114,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_import> @@ -14413,12 +16123,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/import/lfs` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -14429,7 +16142,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_installation> @@ -14438,8 +16151,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/installation` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async interactionsGetRestrictionsForRepo( @@ -14448,14 +16162,15 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/interaction-limits` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async interactionsSetRestrictionsForRepo( @@ -14465,20 +16180,19 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_interaction_limit }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<409, void>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/interaction-limits` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async interactionsRemoveRestrictionsForRepo( @@ -14487,12 +16201,13 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<409, void>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/interaction-limits` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposListInvitations( @@ -14503,12 +16218,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/invitations` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposUpdateInvitation( @@ -14521,17 +16241,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/invitations/${p["invitationId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -14543,13 +16266,14 @@ export class ApiClient extends AbstractFetchClient { invitationId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/invitations/${p["invitationId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async issuesListForRepo( @@ -14569,7 +16293,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_issue[]> @@ -14579,6 +16303,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues` + const headers = this._headers({}, opts.headers) const query = this._query({ milestone: p["milestone"], state: p["state"], @@ -14593,7 +16318,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async issuesCreate( @@ -14618,7 +16347,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_issue> @@ -14638,14 +16367,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async issuesListCommentsForRepo( @@ -14659,7 +16387,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_issue_comment[]> @@ -14669,6 +16397,7 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/comments` + const headers = this._headers({}, opts.headers) const query = this._query({ sort: p["sort"], direction: p["direction"], @@ -14677,7 +16406,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async issuesGetComment( @@ -14687,15 +16420,16 @@ export class ApiClient extends AbstractFetchClient { commentId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/comments/${p["commentId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async issuesUpdateComment( @@ -14708,19 +16442,22 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/comments/${p["commentId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -14732,13 +16469,14 @@ export class ApiClient extends AbstractFetchClient { commentId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/comments/${p["commentId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reactionsListForIssueComment( @@ -14759,20 +16497,25 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/comments/${p["commentId"]}/reactions` + const headers = this._headers({}, opts.headers) const query = this._query({ content: p["content"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reactionsCreateForIssueComment( @@ -14793,7 +16536,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_reaction> | Res<201, t_reaction> | Res<422, t_validation_error> @@ -14802,14 +16545,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/comments/${p["commentId"]}/reactions` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reactionsDeleteForIssueComment( @@ -14820,13 +16562,14 @@ export class ApiClient extends AbstractFetchClient { reactionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/comments/${p["commentId"]}/reactions/${p["reactionId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async issuesListEventsForRepo( @@ -14837,15 +16580,20 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/events` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async issuesGetEvent( @@ -14855,7 +16603,7 @@ export class ApiClient extends AbstractFetchClient { eventId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_issue_event> @@ -14867,8 +16615,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/events/${p["eventId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async issuesGet( @@ -14878,7 +16627,7 @@ export class ApiClient extends AbstractFetchClient { issueNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_issue> @@ -14891,8 +16640,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async issuesUpdate( @@ -14920,7 +16670,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_issue> @@ -14942,12 +16692,15 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -14962,19 +16715,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/assignees` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async issuesRemoveAssignees( @@ -14987,17 +16739,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/assignees` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -15010,13 +16765,14 @@ export class ApiClient extends AbstractFetchClient { assignee: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/assignees/${p["assignee"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async issuesListComments( @@ -15029,7 +16785,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_issue_comment[]> @@ -15040,13 +16796,18 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/comments` + const headers = this._headers({}, opts.headers) const query = this._query({ since: p["since"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async issuesCreateComment( @@ -15059,7 +16820,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_issue_comment> @@ -15072,14 +16833,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/comments` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async issuesListEvents( @@ -15091,7 +16851,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issue_event_for_issue[]> | Res<410, t_basic_error> @@ -15100,9 +16860,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/events` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async issuesListLabelsOnIssue( @@ -15114,7 +16879,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_label[]> @@ -15126,9 +16891,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/labels` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async issuesAddLabels( @@ -15152,7 +16922,7 @@ export class ApiClient extends AbstractFetchClient { | string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_label[]> @@ -15165,14 +16935,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/labels` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async issuesSetLabels( @@ -15196,7 +16965,7 @@ export class ApiClient extends AbstractFetchClient { | string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_label[]> @@ -15209,14 +16978,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/labels` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async issuesRemoveAllLabels( @@ -15226,7 +16994,7 @@ export class ApiClient extends AbstractFetchClient { issueNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -15238,8 +17006,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/labels` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async issuesRemoveLabel( @@ -15250,7 +17019,7 @@ export class ApiClient extends AbstractFetchClient { name: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_label[]> @@ -15262,8 +17031,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/labels/${p["name"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async issuesLock( @@ -15276,7 +17046,7 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -15289,14 +17059,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/lock` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async issuesUnlock( @@ -15306,7 +17075,7 @@ export class ApiClient extends AbstractFetchClient { issueNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<403, t_basic_error> | Res<404, t_basic_error> @@ -15315,8 +17084,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/lock` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reactionsListForIssue( @@ -15337,7 +17107,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_reaction[]> | Res<404, t_basic_error> | Res<410, t_basic_error> @@ -15346,13 +17116,18 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/reactions` + const headers = this._headers({}, opts.headers) const query = this._query({ content: p["content"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reactionsCreateForIssue( @@ -15373,7 +17148,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_reaction> | Res<201, t_reaction> | Res<422, t_validation_error> @@ -15382,14 +17157,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/reactions` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reactionsDeleteForIssue( @@ -15400,13 +17174,14 @@ export class ApiClient extends AbstractFetchClient { reactionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/reactions/${p["reactionId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async issuesListEventsForTimeline( @@ -15418,7 +17193,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_timeline_issue_events[]> @@ -15429,9 +17204,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/issues/${p["issueNumber"]}/timeline` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposListDeployKeys( @@ -15442,12 +17222,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/keys` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposCreateDeployKey( @@ -15461,19 +17246,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/keys` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposGetDeployKey( @@ -15483,14 +17267,15 @@ export class ApiClient extends AbstractFetchClient { keyId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/keys/${p["keyId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposDeleteDeployKey( @@ -15500,12 +17285,13 @@ export class ApiClient extends AbstractFetchClient { keyId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/keys/${p["keyId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async issuesListLabelsForRepo( @@ -15516,14 +17302,19 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/labels` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async issuesCreateLabel( @@ -15537,21 +17328,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<201, t_label> | Res<404, t_basic_error> | Res<422, t_validation_error> > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/labels` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async issuesGetLabel( @@ -15561,12 +17351,13 @@ export class ApiClient extends AbstractFetchClient { name: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/labels/${p["name"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async issuesUpdateLabel( @@ -15581,16 +17372,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/labels/${p["name"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -15602,12 +17396,13 @@ export class ApiClient extends AbstractFetchClient { name: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/labels/${p["name"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposListLanguages( @@ -15616,11 +17411,12 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/languages` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async licensesGetForRepo( @@ -15630,14 +17426,19 @@ export class ApiClient extends AbstractFetchClient { ref?: t_code_scanning_ref }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/license` + const headers = this._headers({}, opts.headers) const query = this._query({ ref: p["ref"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposMergeUpstream( @@ -15649,7 +17450,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_merged_upstream> | Res<409, void> | Res<422, void> @@ -15657,14 +17458,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/merge-upstream` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposMerge( @@ -15678,7 +17478,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_commit> @@ -15689,15 +17489,14 @@ export class ApiClient extends AbstractFetchClient { | Res<422, t_validation_error> > > { - const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/merges` - const headers = this._headers({ "Content-Type": "application/json" }) - const body = JSON.stringify(p.requestBody) - - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, + const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/merges` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async issuesListMilestones( @@ -15711,11 +17510,12 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/milestones` + const headers = this._headers({}, opts.headers) const query = this._query({ state: p["state"], sort: p["sort"], @@ -15724,7 +17524,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async issuesCreateMilestone( @@ -15739,7 +17543,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_milestone> @@ -15748,14 +17552,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/milestones` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async issuesGetMilestone( @@ -15765,15 +17568,16 @@ export class ApiClient extends AbstractFetchClient { milestoneNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/milestones/${p["milestoneNumber"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async issuesUpdateMilestone( @@ -15789,17 +17593,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/milestones/${p["milestoneNumber"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -15811,13 +17618,14 @@ export class ApiClient extends AbstractFetchClient { milestoneNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/milestones/${p["milestoneNumber"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async issuesListLabelsForMilestone( @@ -15829,14 +17637,19 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/milestones/${p["milestoneNumber"]}/labels` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async activityListRepoNotificationsForAuthenticatedUser( @@ -15851,10 +17664,11 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/notifications` + const headers = this._headers({}, opts.headers) const query = this._query({ all: p["all"], participating: p["participating"], @@ -15864,7 +17678,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async activityMarkRepoNotificationsAsRead( @@ -15876,7 +17694,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -15891,14 +17709,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/notifications` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async reposGetPages( @@ -15907,11 +17724,12 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pages` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposCreatePagesSite( @@ -15927,21 +17745,20 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<201, t_page> | Res<409, t_basic_error> | Res<422, t_validation_error> > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pages` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposUpdateInformationAboutPagesSite( @@ -15963,7 +17780,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -15973,14 +17790,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pages` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async reposDeletePagesSite( @@ -15989,7 +17805,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -15999,8 +17815,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pages` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposListPagesBuilds( @@ -16011,12 +17828,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pages/builds` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposRequestPagesBuild( @@ -16025,11 +17847,12 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pages/builds` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async reposGetLatestPagesBuild( @@ -16038,12 +17861,13 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pages/builds/latest` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposGetPagesBuild( @@ -16053,13 +17877,14 @@ export class ApiClient extends AbstractFetchClient { buildId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pages/builds/${p["buildId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposCreatePagesDeployment( @@ -16075,7 +17900,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_page_deployment> @@ -16086,14 +17911,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pages/deployments` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposGetPagesDeployment( @@ -16103,7 +17927,7 @@ export class ApiClient extends AbstractFetchClient { pagesDeploymentId: number | string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_pages_deployment_status> | Res<404, t_basic_error> @@ -16112,8 +17936,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pages/deployments/${p["pagesDeploymentId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposCancelPagesDeployment( @@ -16123,13 +17948,14 @@ export class ApiClient extends AbstractFetchClient { pagesDeploymentId: number | string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pages/deployments/${p["pagesDeploymentId"]}/cancel` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async reposGetPagesHealthCheck( @@ -16138,7 +17964,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_pages_health_check> @@ -16149,8 +17975,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pages/health` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposCheckPrivateVulnerabilityReporting( @@ -16159,7 +17986,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -16174,8 +18001,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/private-vulnerability-reporting` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposEnablePrivateVulnerabilityReporting( @@ -16184,13 +18012,14 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<422, t_scim_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/private-vulnerability-reporting` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async reposDisablePrivateVulnerabilityReporting( @@ -16199,13 +18028,14 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<422, t_scim_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/private-vulnerability-reporting` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async projectsListForRepo( @@ -16217,7 +18047,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_project[]> @@ -16229,13 +18059,18 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/projects` + const headers = this._headers({}, opts.headers) const query = this._query({ state: p["state"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async projectsCreateForRepo( @@ -16248,7 +18083,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_project> @@ -16260,14 +18095,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/projects` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposGetCustomPropertiesValues( @@ -16276,7 +18110,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_custom_property_value[]> @@ -16286,8 +18120,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/properties/values` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposCreateOrUpdateCustomPropertiesValues( @@ -16299,7 +18134,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -16310,12 +18145,15 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/properties/values` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -16333,7 +18171,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_pull_request_simple[]> @@ -16342,6 +18180,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls` + const headers = this._headers({}, opts.headers) const query = this._query({ state: p["state"], head: p["head"], @@ -16352,7 +18191,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async pullsCreate( @@ -16371,7 +18214,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_pull_request> @@ -16380,14 +18223,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async pullsListReviewCommentsForRepo( @@ -16401,10 +18243,11 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/comments` + const headers = this._headers({}, opts.headers) const query = this._query({ sort: p["sort"], direction: p["direction"], @@ -16413,7 +18256,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async pullsGetReviewComment( @@ -16423,7 +18270,7 @@ export class ApiClient extends AbstractFetchClient { commentId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_pull_request_review_comment> | Res<404, t_basic_error> @@ -16432,8 +18279,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/comments/${p["commentId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async pullsUpdateReviewComment( @@ -16446,17 +18294,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/comments/${p["commentId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -16468,13 +18319,14 @@ export class ApiClient extends AbstractFetchClient { commentId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/comments/${p["commentId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reactionsListForPullRequestReviewComment( @@ -16495,20 +18347,25 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/comments/${p["commentId"]}/reactions` + const headers = this._headers({}, opts.headers) const query = this._query({ content: p["content"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reactionsCreateForPullRequestReviewComment( @@ -16529,7 +18386,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_reaction> | Res<201, t_reaction> | Res<422, t_validation_error> @@ -16538,14 +18395,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/comments/${p["commentId"]}/reactions` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reactionsDeleteForPullRequestComment( @@ -16556,13 +18412,14 @@ export class ApiClient extends AbstractFetchClient { reactionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/comments/${p["commentId"]}/reactions/${p["reactionId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async pullsGet( @@ -16572,7 +18429,7 @@ export class ApiClient extends AbstractFetchClient { pullNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_pull_request> @@ -16593,8 +18450,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async pullsUpdate( @@ -16611,7 +18469,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_pull_request> @@ -16622,12 +18480,15 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -16651,7 +18512,7 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_codespace> @@ -16672,14 +18533,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/codespaces` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async pullsListReviewComments( @@ -16694,11 +18554,12 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/comments` + const headers = this._headers({}, opts.headers) const query = this._query({ sort: p["sort"], direction: p["direction"], @@ -16707,7 +18568,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async pullsCreateReviewComment( @@ -16729,7 +18594,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_pull_request_review_comment> @@ -16740,14 +18605,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/comments` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async pullsCreateReplyForReviewComment( @@ -16761,7 +18625,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<201, t_pull_request_review_comment> | Res<404, t_basic_error> @@ -16770,14 +18634,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/comments/${p["commentId"]}/replies` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async pullsListCommits( @@ -16789,14 +18652,19 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/commits` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async pullsListFiles( @@ -16808,7 +18676,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_diff_entry[]> @@ -16827,9 +18695,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/files` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async pullsCheckIfMerged( @@ -16839,13 +18712,14 @@ export class ApiClient extends AbstractFetchClient { pullNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, void>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/merge` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async pullsMerge( @@ -16861,7 +18735,7 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_pull_request_merge_result> @@ -16887,14 +18761,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/merge` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async pullsListRequestedReviewers( @@ -16904,13 +18777,14 @@ export class ApiClient extends AbstractFetchClient { pullNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/requested_reviewers` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async pullsRequestReviewers( @@ -16924,7 +18798,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<201, t_pull_request_simple> | Res<403, t_basic_error> | Res<422, void> @@ -16933,14 +18807,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/requested_reviewers` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async pullsRemoveRequestedReviewers( @@ -16954,7 +18827,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_pull_request_simple> | Res<422, t_validation_error> @@ -16963,12 +18836,15 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/requested_reviewers` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -16982,14 +18858,19 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/reviews` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async pullsCreateReview( @@ -17013,7 +18894,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_pull_request_review> @@ -17024,14 +18905,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/reviews` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async pullsGetReview( @@ -17042,7 +18922,7 @@ export class ApiClient extends AbstractFetchClient { reviewId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_pull_request_review> | Res<404, t_basic_error> @@ -17051,8 +18931,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/reviews/${p["reviewId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async pullsUpdateReview( @@ -17066,7 +18947,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_pull_request_review> | Res<422, t_validation_error_simple> @@ -17075,14 +18956,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/reviews/${p["reviewId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async pullsDeletePendingReview( @@ -17093,7 +18973,7 @@ export class ApiClient extends AbstractFetchClient { reviewId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_pull_request_review> @@ -17104,8 +18984,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/reviews/${p["reviewId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async pullsListCommentsForReview( @@ -17118,16 +18999,21 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/reviews/${p["reviewId"]}/comments` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async pullsDismissReview( @@ -17142,7 +19028,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_pull_request_review> @@ -17153,14 +19039,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/reviews/${p["reviewId"]}/dismissals` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async pullsSubmitReview( @@ -17175,7 +19060,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_pull_request_review> @@ -17187,14 +19072,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/reviews/${p["reviewId"]}/events` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async pullsUpdateBranch( @@ -17207,7 +19091,7 @@ export class ApiClient extends AbstractFetchClient { } | null }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -17224,14 +19108,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/pulls/${p["pullNumber"]}/update-branch` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async reposGetReadme( @@ -17241,18 +19124,24 @@ export class ApiClient extends AbstractFetchClient { ref?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_content_file> + | Res<304, void> | Res<404, t_basic_error> | Res<422, t_validation_error> > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/readme` + const headers = this._headers({}, opts.headers) const query = this._query({ ref: p["ref"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetReadmeInDirectory( @@ -17263,7 +19152,7 @@ export class ApiClient extends AbstractFetchClient { ref?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_content_file> @@ -17273,9 +19162,14 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/readme/${p["dir"]}` + const headers = this._headers({}, opts.headers) const query = this._query({ ref: p["ref"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposListReleases( @@ -17286,14 +19180,19 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposCreateRelease( @@ -17313,7 +19212,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_release> @@ -17322,14 +19221,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposGetReleaseAsset( @@ -17339,7 +19237,7 @@ export class ApiClient extends AbstractFetchClient { assetId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_release_asset> | Res<302, void> | Res<404, t_basic_error> @@ -17348,8 +19246,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases/assets/${p["assetId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposUpdateReleaseAsset( @@ -17364,17 +19263,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases/assets/${p["assetId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -17386,13 +19288,14 @@ export class ApiClient extends AbstractFetchClient { assetId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases/assets/${p["assetId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposGenerateReleaseNotes( @@ -17407,7 +19310,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_release_notes_content> | Res<404, t_basic_error> @@ -17416,14 +19319,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases/generate-notes` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposGetLatestRelease( @@ -17432,12 +19334,13 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases/latest` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposGetReleaseByTag( @@ -17447,15 +19350,16 @@ export class ApiClient extends AbstractFetchClient { tag: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases/tags/${p["tag"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposGetRelease( @@ -17465,13 +19369,14 @@ export class ApiClient extends AbstractFetchClient { releaseId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<401, void>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases/${p["releaseId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposUpdateRelease( @@ -17491,19 +19396,22 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases/${p["releaseId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -17515,13 +19423,14 @@ export class ApiClient extends AbstractFetchClient { releaseId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases/${p["releaseId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposListReleaseAssets( @@ -17533,14 +19442,19 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases/${p["releaseId"]}/assets` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposUploadReleaseAsset( @@ -17553,20 +19467,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<422, void>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases/${p["releaseId"]}/assets` - const headers = this._headers({ - "Content-Type": "application/octet-stream", - }) + const headers = this._headers( + { "Content-Type": "application/octet-stream" }, + opts.headers, + ) const query = this._query({ name: p["name"], label: p["label"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "POST", headers, body, ...(opts ?? {}) }, + { method: "POST", body, ...opts, headers }, timeout, ) } @@ -17581,20 +19496,25 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases/${p["releaseId"]}/reactions` + const headers = this._headers({}, opts.headers) const query = this._query({ content: p["content"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reactionsCreateForRelease( @@ -17607,7 +19527,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_reaction> | Res<201, t_reaction> | Res<422, t_validation_error> @@ -17616,14 +19536,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases/${p["releaseId"]}/reactions` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reactionsDeleteForRelease( @@ -17634,13 +19553,14 @@ export class ApiClient extends AbstractFetchClient { reactionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/releases/${p["releaseId"]}/reactions/${p["reactionId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposGetBranchRules( @@ -17652,14 +19572,19 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/rules/branches/${p["branch"]}` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetRepoRulesets( @@ -17671,7 +19596,7 @@ export class ApiClient extends AbstractFetchClient { includesParents?: boolean }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_repository_ruleset[]> @@ -17680,13 +19605,18 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/rulesets` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"], includes_parents: p["includesParents"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposCreateRepoRuleset( @@ -17699,11 +19629,11 @@ export class ApiClient extends AbstractFetchClient { enforcement: t_repository_rule_enforcement name: string rules?: t_repository_rule[] - target?: "branch" | "tag" + target?: "branch" | "tag" | "push" } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_repository_ruleset> @@ -17712,14 +19642,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/rulesets` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposGetRepoRuleSuites( @@ -17734,7 +19663,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_rule_suites> @@ -17744,6 +19673,7 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/rulesets/rule-suites` + const headers = this._headers({}, opts.headers) const query = this._query({ ref: p["ref"], time_period: p["timePeriod"], @@ -17753,7 +19683,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetRepoRuleSuite( @@ -17763,7 +19697,7 @@ export class ApiClient extends AbstractFetchClient { ruleSuiteId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_rule_suite> | Res<404, t_basic_error> | Res<500, t_basic_error> @@ -17772,8 +19706,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/rulesets/rule-suites/${p["ruleSuiteId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposGetRepoRuleset( @@ -17784,7 +19719,7 @@ export class ApiClient extends AbstractFetchClient { includesParents?: boolean }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_repository_ruleset> @@ -17795,9 +19730,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/rulesets/${p["rulesetId"]}` + const headers = this._headers({}, opts.headers) const query = this._query({ includes_parents: p["includesParents"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposUpdateRepoRuleset( @@ -17811,11 +19751,11 @@ export class ApiClient extends AbstractFetchClient { enforcement?: t_repository_rule_enforcement name?: string rules?: t_repository_rule[] - target?: "branch" | "tag" + target?: "branch" | "tag" | "push" } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_repository_ruleset> @@ -17826,14 +19766,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/rulesets/${p["rulesetId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async reposDeleteRepoRuleset( @@ -17843,7 +19782,7 @@ export class ApiClient extends AbstractFetchClient { rulesetId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<404, t_basic_error> | Res<500, t_basic_error> @@ -17852,8 +19791,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/rulesets/${p["rulesetId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async secretScanningListAlertsForRepo( @@ -17872,7 +19812,7 @@ export class ApiClient extends AbstractFetchClient { validity?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_secret_scanning_alert[]> @@ -17889,6 +19829,7 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/secret-scanning/alerts` + const headers = this._headers({}, opts.headers) const query = this._query({ state: p["state"], secret_type: p["secretType"], @@ -17902,7 +19843,11 @@ export class ApiClient extends AbstractFetchClient { validity: p["validity"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async secretScanningGetAlert( @@ -17912,7 +19857,7 @@ export class ApiClient extends AbstractFetchClient { alertNumber: t_alert_number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_secret_scanning_alert> @@ -17931,8 +19876,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/secret-scanning/alerts/${p["alertNumber"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async secretScanningUpdateAlert( @@ -17947,13 +19893,53 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_secret_scanning_alert> + | Res<400, void> + | Res<404, void> + | Res<422, void> + | Res< + 503, + { + code?: string + documentation_url?: string + message?: string + } + > + > + > { + const url = + this.basePath + + `/repos/${p["owner"]}/${p["repo"]}/secret-scanning/alerts/${p["alertNumber"]}` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url, + { method: "PATCH", body, ...opts, headers }, + timeout, + ) + } + + async secretScanningListLocationsForAlert( + p: { + owner: string + repo: string + alertNumber: t_alert_number + page?: number + perPage?: number + }, + timeout?: number, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< - | Res<200, t_secret_scanning_alert> - | Res<400, void> + | Res<200, t_secret_scanning_location[]> | Res<404, void> - | Res<422, void> | Res< 503, { @@ -17966,31 +19952,34 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + - `/repos/${p["owner"]}/${p["repo"]}/secret-scanning/alerts/${p["alertNumber"]}` - const headers = this._headers({ "Content-Type": "application/json" }) - const body = JSON.stringify(p.requestBody) + `/repos/${p["owner"]}/${p["repo"]}/secret-scanning/alerts/${p["alertNumber"]}/locations` + const headers = this._headers({}, opts.headers) + const query = this._query({ page: p["page"], per_page: p["perPage"] }) return this._fetch( - url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + url + query, + { method: "GET", ...opts, headers }, timeout, ) } - async secretScanningListLocationsForAlert( + async secretScanningCreatePushProtectionBypass( p: { owner: string repo: string - alertNumber: t_alert_number - page?: number - perPage?: number + requestBody: { + placeholder_id: t_secret_scanning_push_protection_bypass_placeholder_id + reason: t_secret_scanning_push_protection_bypass_reason + } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< - | Res<200, t_secret_scanning_location[]> + | Res<200, t_secret_scanning_push_protection_bypass> + | Res<403, void> | Res<404, void> + | Res<422, void> | Res< 503, { @@ -18003,10 +19992,14 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + - `/repos/${p["owner"]}/${p["repo"]}/secret-scanning/alerts/${p["alertNumber"]}/locations` - const query = this._query({ page: p["page"], per_page: p["perPage"] }) + `/repos/${p["owner"]}/${p["repo"]}/secret-scanning/push-protection-bypasses` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async securityAdvisoriesListRepositoryAdvisories( @@ -18021,7 +20014,7 @@ export class ApiClient extends AbstractFetchClient { state?: "triage" | "draft" | "published" | "closed" }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_repository_advisory[]> @@ -18031,6 +20024,7 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/security-advisories` + const headers = this._headers({}, opts.headers) const query = this._query({ direction: p["direction"], sort: p["sort"], @@ -18040,7 +20034,11 @@ export class ApiClient extends AbstractFetchClient { state: p["state"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async securityAdvisoriesCreateRepositoryAdvisory( @@ -18050,7 +20048,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_repository_advisory_create }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_repository_advisory> @@ -18061,14 +20059,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/security-advisories` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async securityAdvisoriesCreatePrivateVulnerabilityReport( @@ -18078,7 +20075,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_private_vulnerability_report_create }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_repository_advisory> @@ -18090,14 +20087,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/security-advisories/reports` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async securityAdvisoriesGetRepositoryAdvisory( @@ -18107,7 +20103,7 @@ export class ApiClient extends AbstractFetchClient { ghsaId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_repository_advisory> @@ -18118,8 +20114,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/security-advisories/${p["ghsaId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async securityAdvisoriesUpdateRepositoryAdvisory( @@ -18130,7 +20127,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_repository_advisory_update }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_repository_advisory> @@ -18142,12 +20139,15 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/security-advisories/${p["ghsaId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -18159,7 +20159,7 @@ export class ApiClient extends AbstractFetchClient { ghsaId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -18177,8 +20177,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/security-advisories/${p["ghsaId"]}/cve` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async securityAdvisoriesCreateFork( @@ -18188,7 +20189,7 @@ export class ApiClient extends AbstractFetchClient { ghsaId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<202, t_full_repository> @@ -18201,8 +20202,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/security-advisories/${p["ghsaId"]}/forks` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async activityListStargazersForRepo( @@ -18213,16 +20215,21 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_simple_user[] | t_stargazer[]> | Res<422, t_validation_error> > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/stargazers` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetCodeFrequencyStats( @@ -18231,7 +20238,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_code_frequency_stat[]> @@ -18247,8 +20254,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/stats/code_frequency` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposGetCommitActivityStats( @@ -18257,7 +20265,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_commit_activity[]> @@ -18272,8 +20280,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/stats/commit_activity` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposGetContributorsStats( @@ -18282,7 +20291,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_contributor_activity[]> @@ -18297,8 +20306,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/stats/contributors` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposGetParticipationStats( @@ -18307,7 +20317,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_participation_stats> | Res<404, t_basic_error> @@ -18315,8 +20325,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/stats/participation` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposGetPunchCardStats( @@ -18325,14 +20336,15 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<204, void>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/stats/punch_card` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposCreateCommitStatus( @@ -18348,18 +20360,17 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/statuses/${p["sha"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async activityListWatchersForRepo( @@ -18370,12 +20381,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/subscribers` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async activityGetRepoSubscription( @@ -18384,7 +20400,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_repository_subscription> @@ -18393,8 +20409,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/subscription` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async activitySetRepoSubscription( @@ -18407,17 +20424,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/subscription` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async activityDeleteRepoSubscription( @@ -18426,11 +20442,12 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/subscription` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposListTags( @@ -18441,12 +20458,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/tags` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposListTagProtection( @@ -18455,7 +20477,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_tag_protection[]> @@ -18465,8 +20487,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/tags/protection` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposCreateTagProtection( @@ -18478,7 +20501,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_tag_protection> @@ -18488,14 +20511,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/tags/protection` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposDeleteTagProtection( @@ -18505,7 +20527,7 @@ export class ApiClient extends AbstractFetchClient { tagProtectionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<403, t_basic_error> | Res<404, t_basic_error> @@ -18514,8 +20536,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/tags/protection/${p["tagProtectionId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposDownloadTarballArchive( @@ -18525,12 +20548,13 @@ export class ApiClient extends AbstractFetchClient { ref: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/tarball/${p["ref"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposListTeams( @@ -18541,12 +20565,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/teams` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetAllTopics( @@ -18557,12 +20586,17 @@ export class ApiClient extends AbstractFetchClient { perPage?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/topics` + const headers = this._headers({}, opts.headers) const query = this._query({ page: p["page"], per_page: p["perPage"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposReplaceAllTopics( @@ -18574,7 +20608,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_topic> @@ -18583,14 +20617,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/topics` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async reposGetClones( @@ -18600,15 +20633,20 @@ export class ApiClient extends AbstractFetchClient { per?: "day" | "week" }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<403, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/traffic/clones` + const headers = this._headers({}, opts.headers) const query = this._query({ per: p["per"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposGetTopPaths( @@ -18617,14 +20655,15 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<403, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/traffic/popular/paths` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposGetTopReferrers( @@ -18633,15 +20672,16 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<403, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/traffic/popular/referrers` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposGetViews( @@ -18651,15 +20691,20 @@ export class ApiClient extends AbstractFetchClient { per?: "day" | "week" }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<403, t_basic_error>> > { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/traffic/views` + const headers = this._headers({}, opts.headers) const query = this._query({ per: p["per"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposTransfer( @@ -18673,17 +20718,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/transfer` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposCheckVulnerabilityAlerts( @@ -18692,12 +20736,13 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, void>>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/vulnerability-alerts` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposEnableVulnerabilityAlerts( @@ -18706,12 +20751,13 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/vulnerability-alerts` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async reposDisableVulnerabilityAlerts( @@ -18720,12 +20766,13 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/vulnerability-alerts` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reposDownloadZipballArchive( @@ -18735,12 +20782,13 @@ export class ApiClient extends AbstractFetchClient { ref: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["owner"]}/${p["repo"]}/zipball/${p["ref"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async reposCreateUsingTemplate( @@ -18756,19 +20804,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/repos/${p["templateOwner"]}/${p["templateRepo"]}/generate` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposListPublic( @@ -18776,7 +20823,7 @@ export class ApiClient extends AbstractFetchClient { since?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_minimal_repository[]> @@ -18785,9 +20832,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/repositories` + const headers = this._headers({}, opts.headers) const query = this._query({ since: p["since"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async searchCode( @@ -18799,7 +20851,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -18824,6 +20876,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/search/code` + const headers = this._headers({}, opts.headers) const query = this._query({ q: p["q"], sort: p["sort"], @@ -18832,7 +20885,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async searchCommits( @@ -18844,7 +20901,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -18859,6 +20916,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/search/commits` + const headers = this._headers({}, opts.headers) const query = this._query({ q: p["q"], sort: p["sort"], @@ -18867,7 +20925,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async searchIssuesAndPullRequests( @@ -18890,7 +20952,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -18915,6 +20977,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/search/issues` + const headers = this._headers({}, opts.headers) const query = this._query({ q: p["q"], sort: p["sort"], @@ -18923,7 +20986,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async searchLabels( @@ -18936,7 +21003,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -18954,6 +21021,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/search/labels` + const headers = this._headers({}, opts.headers) const query = this._query({ repository_id: p["repositoryId"], q: p["q"], @@ -18963,7 +21031,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async searchRepos( @@ -18975,7 +21047,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -18999,6 +21071,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/search/repositories` + const headers = this._headers({}, opts.headers) const query = this._query({ q: p["q"], sort: p["sort"], @@ -19007,7 +21080,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async searchTopics( @@ -19017,7 +21094,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -19032,13 +21109,18 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/search/topics` + const headers = this._headers({}, opts.headers) const query = this._query({ q: p["q"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async searchUsers( @@ -19050,7 +21132,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -19074,6 +21156,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/search/users` + const headers = this._headers({}, opts.headers) const query = this._query({ q: p["q"], sort: p["sort"], @@ -19082,7 +21165,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsGetLegacy( @@ -19090,13 +21177,14 @@ export class ApiClient extends AbstractFetchClient { teamId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/teams/${p["teamId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async teamsUpdateLegacy( @@ -19114,7 +21202,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_team_full> @@ -19125,12 +21213,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/teams/${p["teamId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -19140,15 +21231,16 @@ export class ApiClient extends AbstractFetchClient { teamId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<404, t_basic_error> | Res<422, t_validation_error> > > { const url = this.basePath + `/teams/${p["teamId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async teamsListDiscussionsLegacy( @@ -19159,16 +21251,21 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/discussions` + const headers = this._headers({}, opts.headers) const query = this._query({ direction: p["direction"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsCreateDiscussionLegacy( @@ -19181,17 +21278,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/discussions` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async teamsGetDiscussionLegacy( @@ -19200,13 +21296,14 @@ export class ApiClient extends AbstractFetchClient { discussionNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/discussions/${p["discussionNumber"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async teamsUpdateDiscussionLegacy( @@ -19219,17 +21316,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/discussions/${p["discussionNumber"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -19240,13 +21340,14 @@ export class ApiClient extends AbstractFetchClient { discussionNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/discussions/${p["discussionNumber"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async teamsListDiscussionCommentsLegacy( @@ -19258,18 +21359,23 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/discussions/${p["discussionNumber"]}/comments` + const headers = this._headers({}, opts.headers) const query = this._query({ direction: p["direction"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsCreateDiscussionCommentLegacy( @@ -19281,19 +21387,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/discussions/${p["discussionNumber"]}/comments` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async teamsGetDiscussionCommentLegacy( @@ -19303,13 +21408,14 @@ export class ApiClient extends AbstractFetchClient { commentNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/discussions/${p["discussionNumber"]}/comments/${p["commentNumber"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async teamsUpdateDiscussionCommentLegacy( @@ -19322,17 +21428,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/discussions/${p["discussionNumber"]}/comments/${p["commentNumber"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -19344,13 +21453,14 @@ export class ApiClient extends AbstractFetchClient { commentNumber: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/discussions/${p["discussionNumber"]}/comments/${p["commentNumber"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async reactionsListForTeamDiscussionCommentLegacy( @@ -19371,18 +21481,23 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/discussions/${p["discussionNumber"]}/comments/${p["commentNumber"]}/reactions` + const headers = this._headers({}, opts.headers) const query = this._query({ content: p["content"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reactionsCreateForTeamDiscussionCommentLegacy( @@ -19403,19 +21518,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/discussions/${p["discussionNumber"]}/comments/${p["commentNumber"]}/reactions` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reactionsListForTeamDiscussionLegacy( @@ -19435,18 +21549,23 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/discussions/${p["discussionNumber"]}/reactions` + const headers = this._headers({}, opts.headers) const query = this._query({ content: p["content"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reactionsCreateForTeamDiscussionLegacy( @@ -19466,19 +21585,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/discussions/${p["discussionNumber"]}/reactions` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async teamsListPendingInvitationsLegacy( @@ -19488,12 +21606,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/invitations` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsListMembersLegacy( @@ -19504,18 +21627,23 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/teams/${p["teamId"]}/members` + const headers = this._headers({}, opts.headers) const query = this._query({ role: p["role"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsGetMemberLegacy( @@ -19524,11 +21652,12 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, void>>> { const url = this.basePath + `/teams/${p["teamId"]}/members/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async teamsAddMemberLegacy( @@ -19537,15 +21666,16 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<403, t_basic_error> | Res<404, void> | Res<422, void> > > { const url = this.basePath + `/teams/${p["teamId"]}/members/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async teamsRemoveMemberLegacy( @@ -19554,11 +21684,12 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, void>>> { const url = this.basePath + `/teams/${p["teamId"]}/members/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async teamsGetMembershipForUserLegacy( @@ -19567,14 +21698,15 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/teams/${p["teamId"]}/memberships/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async teamsAddOrUpdateMembershipForUserLegacy( @@ -19586,7 +21718,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_team_membership> @@ -19597,14 +21729,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/teams/${p["teamId"]}/memberships/${p["username"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async teamsRemoveMembershipForUserLegacy( @@ -19613,12 +21744,13 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<403, void>>> { const url = this.basePath + `/teams/${p["teamId"]}/memberships/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async teamsListProjectsLegacy( @@ -19628,14 +21760,19 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<404, t_basic_error>> > { const url = this.basePath + `/teams/${p["teamId"]}/projects` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsCheckPermissionsForProjectLegacy( @@ -19644,12 +21781,13 @@ export class ApiClient extends AbstractFetchClient { projectId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, void>>> { const url = this.basePath + `/teams/${p["teamId"]}/projects/${p["projectId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async teamsAddOrUpdateProjectPermissionsLegacy( @@ -19661,7 +21799,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -19678,14 +21816,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/teams/${p["teamId"]}/projects/${p["projectId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async teamsRemoveProjectLegacy( @@ -19694,7 +21831,7 @@ export class ApiClient extends AbstractFetchClient { projectId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<404, t_basic_error> | Res<422, t_validation_error> @@ -19702,8 +21839,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/teams/${p["teamId"]}/projects/${p["projectId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async teamsListReposLegacy( @@ -19713,16 +21851,21 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_minimal_repository[]> | Res<404, t_basic_error> > > { const url = this.basePath + `/teams/${p["teamId"]}/repos` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsCheckPermissionsForRepoLegacy( @@ -19732,7 +21875,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_team_repository> | Res<204, void> | Res<404, void> @@ -19740,8 +21883,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/teams/${p["teamId"]}/repos/${p["owner"]}/${p["repo"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async teamsAddOrUpdateRepoPermissionsLegacy( @@ -19754,7 +21898,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<403, t_basic_error> | Res<422, t_validation_error> @@ -19762,14 +21906,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/teams/${p["teamId"]}/repos/${p["owner"]}/${p["repo"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async teamsRemoveRepoLegacy( @@ -19779,12 +21922,13 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/teams/${p["teamId"]}/repos/${p["owner"]}/${p["repo"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async teamsListChildLegacy( @@ -19794,7 +21938,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_team[]> @@ -19804,14 +21948,19 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/teams/${p["teamId"]}/teams` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersGetAuthenticated( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_private_user | t_public_user> @@ -19821,8 +21970,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async usersUpdateAuthenticated( @@ -19839,7 +21989,7 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_private_user> @@ -19851,12 +22001,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -19867,7 +22020,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_simple_user[]> @@ -19878,9 +22031,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/blocks` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersCheckBlocked( @@ -19888,7 +22046,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -19899,8 +22057,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/blocks/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async usersBlock( @@ -19908,7 +22067,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -19920,8 +22079,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/blocks/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async usersUnblock( @@ -19929,7 +22089,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -19940,8 +22100,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/blocks/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async codespacesListForAuthenticatedUser( @@ -19951,7 +22112,7 @@ export class ApiClient extends AbstractFetchClient { repositoryId?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -19969,13 +22130,18 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/codespaces` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"], repository_id: p["repositoryId"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codespacesCreateForAuthenticatedUser( @@ -20009,7 +22175,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_codespace> @@ -20028,14 +22194,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/codespaces` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async codespacesListSecretsForAuthenticatedUser( @@ -20044,7 +22209,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res< @@ -20057,18 +22222,24 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/codespaces/secrets` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async codespacesGetPublicKeyForAuthenticatedUser( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/user/codespaces/secrets/public-key` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codespacesGetSecretForAuthenticatedUser( @@ -20076,11 +22247,12 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/user/codespaces/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codespacesCreateOrUpdateSecretForAuthenticatedUser( @@ -20093,7 +22265,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_empty_object> @@ -20103,14 +22275,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/codespaces/secrets/${p["secretName"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async codespacesDeleteSecretForAuthenticatedUser( @@ -20118,11 +22289,12 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/user/codespaces/secrets/${p["secretName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async codespacesListRepositoriesForSecretForAuthenticatedUser( @@ -20130,7 +22302,7 @@ export class ApiClient extends AbstractFetchClient { secretName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -20148,8 +22320,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/user/codespaces/secrets/${p["secretName"]}/repositories` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codespacesSetRepositoriesForSecretForAuthenticatedUser( @@ -20160,7 +22333,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -20172,14 +22345,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/user/codespaces/secrets/${p["secretName"]}/repositories` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async codespacesAddRepositoryForSecretForAuthenticatedUser( @@ -20188,7 +22360,7 @@ export class ApiClient extends AbstractFetchClient { repositoryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -20201,8 +22373,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/user/codespaces/secrets/${p["secretName"]}/repositories/${p["repositoryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async codespacesRemoveRepositoryForSecretForAuthenticatedUser( @@ -20211,7 +22384,7 @@ export class ApiClient extends AbstractFetchClient { repositoryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -20224,8 +22397,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/user/codespaces/secrets/${p["secretName"]}/repositories/${p["repositoryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async codespacesGetForAuthenticatedUser( @@ -20233,7 +22407,7 @@ export class ApiClient extends AbstractFetchClient { codespaceName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_codespace> @@ -20245,8 +22419,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/codespaces/${p["codespaceName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codespacesUpdateForAuthenticatedUser( @@ -20259,7 +22434,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_codespace> @@ -20269,12 +22444,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/codespaces/${p["codespaceName"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -20284,7 +22462,7 @@ export class ApiClient extends AbstractFetchClient { codespaceName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -20301,8 +22479,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/codespaces/${p["codespaceName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async codespacesExportForAuthenticatedUser( @@ -20310,7 +22489,7 @@ export class ApiClient extends AbstractFetchClient { codespaceName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<202, t_codespace_export_details> @@ -20322,8 +22501,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/codespaces/${p["codespaceName"]}/exports` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async codespacesGetExportDetailsForAuthenticatedUser( @@ -20332,7 +22512,7 @@ export class ApiClient extends AbstractFetchClient { exportId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_codespace_export_details> | Res<404, t_basic_error> @@ -20341,8 +22521,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/user/codespaces/${p["codespaceName"]}/exports/${p["exportId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codespacesCodespaceMachinesForAuthenticatedUser( @@ -20350,7 +22531,7 @@ export class ApiClient extends AbstractFetchClient { codespaceName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -20369,8 +22550,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/user/codespaces/${p["codespaceName"]}/machines` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async codespacesPublishForAuthenticatedUser( @@ -20382,7 +22564,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_codespace_with_full_repository> @@ -20393,14 +22575,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/codespaces/${p["codespaceName"]}/publish` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async codespacesStartForAuthenticatedUser( @@ -20408,7 +22589,7 @@ export class ApiClient extends AbstractFetchClient { codespaceName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_codespace> @@ -20423,8 +22604,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/codespaces/${p["codespaceName"]}/start` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async codespacesStopForAuthenticatedUser( @@ -20432,7 +22614,7 @@ export class ApiClient extends AbstractFetchClient { codespaceName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_codespace> @@ -20443,17 +22625,19 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/codespaces/${p["codespaceName"]}/stop` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async packagesListDockerMigrationConflictingPackagesForAuthenticatedUser( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/user/docker/conflicts` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async usersSetPrimaryEmailVisibilityForAuthenticatedUser( @@ -20463,7 +22647,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_email[]> @@ -20475,12 +22659,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/email/visibility` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -20491,7 +22678,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_email[]> @@ -20502,9 +22689,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/emails` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersAddEmailForAuthenticatedUser( @@ -20517,7 +22709,7 @@ export class ApiClient extends AbstractFetchClient { | string } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_email[]> @@ -20529,14 +22721,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/emails` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async usersDeleteEmailForAuthenticatedUser( @@ -20549,7 +22740,7 @@ export class ApiClient extends AbstractFetchClient { | string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -20561,12 +22752,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/emails` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -20577,7 +22771,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_simple_user[]> @@ -20587,9 +22781,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/followers` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersListFollowedByAuthenticatedUser( @@ -20598,7 +22797,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_simple_user[]> @@ -20608,9 +22807,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/following` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersCheckPersonIsFollowedByAuthenticated( @@ -20618,7 +22822,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -20629,8 +22833,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/following/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async usersFollow( @@ -20638,7 +22843,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -20649,8 +22854,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/following/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async usersUnfollow( @@ -20658,7 +22864,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -20669,8 +22875,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/following/${p["username"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async usersListGpgKeysForAuthenticatedUser( @@ -20679,7 +22886,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_gpg_key[]> @@ -20690,9 +22897,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/gpg_keys` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersCreateGpgKeyForAuthenticatedUser( @@ -20703,7 +22915,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_gpg_key> @@ -20715,14 +22927,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/gpg_keys` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async usersGetGpgKeyForAuthenticatedUser( @@ -20730,7 +22941,7 @@ export class ApiClient extends AbstractFetchClient { gpgKeyId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_gpg_key> @@ -20741,8 +22952,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/gpg_keys/${p["gpgKeyId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async usersDeleteGpgKeyForAuthenticatedUser( @@ -20750,7 +22962,7 @@ export class ApiClient extends AbstractFetchClient { gpgKeyId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -20762,8 +22974,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/gpg_keys/${p["gpgKeyId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async appsListInstallationsForAuthenticatedUser( @@ -20772,7 +22985,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -20788,9 +23001,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/installations` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async appsListInstallationReposForAuthenticatedUser( @@ -20800,7 +23018,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -20818,9 +23036,14 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/user/installations/${p["installationId"]}/repositories` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async appsAddRepoToInstallationForAuthenticatedUser( @@ -20829,7 +23052,7 @@ export class ApiClient extends AbstractFetchClient { repositoryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -20841,8 +23064,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/user/installations/${p["installationId"]}/repositories/${p["repositoryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async appsRemoveRepoFromInstallationForAuthenticatedUser( @@ -20851,7 +23075,7 @@ export class ApiClient extends AbstractFetchClient { repositoryId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -20864,21 +23088,23 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/user/installations/${p["installationId"]}/repositories/${p["repositoryId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async interactionsGetRestrictionsForAuthenticatedUser( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_interaction_limit_response | EmptyObject> | Res<204, void> > > { const url = this.basePath + `/user/interaction-limits` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async interactionsSetRestrictionsForAuthenticatedUser( @@ -20886,30 +23112,30 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_interaction_limit }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_interaction_limit_response> | Res<422, t_validation_error> > > { const url = this.basePath + `/user/interaction-limits` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async interactionsRemoveRestrictionsForAuthenticatedUser( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/user/interaction-limits` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async issuesListForAuthenticatedUser( @@ -20930,13 +23156,14 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issue[]> | Res<304, void> | Res<404, t_basic_error> > > { const url = this.basePath + `/user/issues` + const headers = this._headers({}, opts.headers) const query = this._query({ filter: p["filter"], state: p["state"], @@ -20948,7 +23175,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersListPublicSshKeysForAuthenticatedUser( @@ -20957,7 +23188,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_key[]> @@ -20968,9 +23199,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/keys` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersCreatePublicSshKeyForAuthenticatedUser( @@ -20981,7 +23217,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_key> @@ -20993,14 +23229,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/keys` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async usersGetPublicSshKeyForAuthenticatedUser( @@ -21008,7 +23243,7 @@ export class ApiClient extends AbstractFetchClient { keyId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_key> @@ -21019,8 +23254,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/keys/${p["keyId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async usersDeletePublicSshKeyForAuthenticatedUser( @@ -21028,7 +23264,7 @@ export class ApiClient extends AbstractFetchClient { keyId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -21039,8 +23275,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/keys/${p["keyId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async appsListSubscriptionsForAuthenticatedUser( @@ -21049,7 +23286,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_user_marketplace_purchase[]> @@ -21059,9 +23296,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/marketplace_purchases` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async appsListSubscriptionsForAuthenticatedUserStubbed( @@ -21070,7 +23312,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_user_marketplace_purchase[]> @@ -21079,9 +23321,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/marketplace_purchases/stubbed` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsListMembershipsForAuthenticatedUser( @@ -21091,7 +23338,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_org_membership[]> @@ -21102,13 +23349,18 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/memberships/orgs` + const headers = this._headers({}, opts.headers) const query = this._query({ state: p["state"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsGetMembershipForAuthenticatedUser( @@ -21116,7 +23368,7 @@ export class ApiClient extends AbstractFetchClient { org: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_org_membership> @@ -21125,8 +23377,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/memberships/orgs/${p["org"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async orgsUpdateMembershipForAuthenticatedUser( @@ -21137,7 +23390,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_org_membership> @@ -21147,12 +23400,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/memberships/orgs/${p["org"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -21163,7 +23419,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_migration[]> @@ -21173,9 +23429,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/migrations` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async migrationsStartForAuthenticatedUser( @@ -21193,7 +23454,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_migration> @@ -21204,14 +23465,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/migrations` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async migrationsGetStatusForAuthenticatedUser( @@ -21220,7 +23480,7 @@ export class ApiClient extends AbstractFetchClient { exclude?: string[] }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_migration> @@ -21231,9 +23491,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/migrations/${p["migrationId"]}` + const headers = this._headers({}, opts.headers) const query = this._query({ exclude: p["exclude"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async migrationsGetArchiveForAuthenticatedUser( @@ -21241,7 +23506,7 @@ export class ApiClient extends AbstractFetchClient { migrationId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<302, void> @@ -21251,8 +23516,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/migrations/${p["migrationId"]}/archive` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async migrationsDeleteArchiveForAuthenticatedUser( @@ -21260,7 +23526,7 @@ export class ApiClient extends AbstractFetchClient { migrationId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -21271,8 +23537,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/migrations/${p["migrationId"]}/archive` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async migrationsUnlockRepoForAuthenticatedUser( @@ -21281,7 +23548,7 @@ export class ApiClient extends AbstractFetchClient { repoName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -21294,8 +23561,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/user/migrations/${p["migrationId"]}/repos/${p["repoName"]}/lock` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async migrationsListReposForAuthenticatedUser( @@ -21305,7 +23573,7 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_minimal_repository[]> | Res<404, t_basic_error> @@ -21313,9 +23581,14 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/user/migrations/${p["migrationId"]}/repositories` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsListForAuthenticatedUser( @@ -21324,7 +23597,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_organization_simple[]> @@ -21334,9 +23607,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/orgs` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async packagesListPackagesForAuthenticatedUser( @@ -21353,9 +23631,10 @@ export class ApiClient extends AbstractFetchClient { perPage?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<400, void>>> { const url = this.basePath + `/user/packages` + const headers = this._headers({}, opts.headers) const query = this._query({ package_type: p["packageType"], visibility: p["visibility"], @@ -21363,7 +23642,11 @@ export class ApiClient extends AbstractFetchClient { per_page: p["perPage"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async packagesGetPackageForAuthenticatedUser( @@ -21378,12 +23661,13 @@ export class ApiClient extends AbstractFetchClient { packageName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/user/packages/${p["packageType"]}/${p["packageName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async packagesDeletePackageForAuthenticatedUser( @@ -21398,7 +23682,7 @@ export class ApiClient extends AbstractFetchClient { packageName: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -21409,8 +23693,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/user/packages/${p["packageType"]}/${p["packageName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async packagesRestorePackageForAuthenticatedUser( @@ -21426,7 +23711,7 @@ export class ApiClient extends AbstractFetchClient { token?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -21438,11 +23723,12 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/user/packages/${p["packageType"]}/${p["packageName"]}/restore` + const headers = this._headers({}, opts.headers) const query = this._query({ token: p["token"] }) return this._fetch( url + query, - { method: "POST", ...(opts ?? {}) }, + { method: "POST", ...opts, headers }, timeout, ) } @@ -21462,7 +23748,7 @@ export class ApiClient extends AbstractFetchClient { state?: "active" | "deleted" }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_package_version[]> @@ -21474,13 +23760,18 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/user/packages/${p["packageType"]}/${p["packageName"]}/versions` + const headers = this._headers({}, opts.headers) const query = this._query({ page: p["page"], per_page: p["perPage"], state: p["state"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async packagesGetPackageVersionForAuthenticatedUser( @@ -21496,13 +23787,14 @@ export class ApiClient extends AbstractFetchClient { packageVersionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/user/packages/${p["packageType"]}/${p["packageName"]}/versions/${p["packageVersionId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async packagesDeletePackageVersionForAuthenticatedUser( @@ -21518,7 +23810,7 @@ export class ApiClient extends AbstractFetchClient { packageVersionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -21530,8 +23822,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/user/packages/${p["packageType"]}/${p["packageName"]}/versions/${p["packageVersionId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async packagesRestorePackageVersionForAuthenticatedUser( @@ -21547,7 +23840,7 @@ export class ApiClient extends AbstractFetchClient { packageVersionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -21559,8 +23852,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/user/packages/${p["packageType"]}/${p["packageName"]}/versions/${p["packageVersionId"]}/restore` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async projectsCreateForAuthenticatedUser( @@ -21571,7 +23865,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_project> @@ -21582,14 +23876,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/projects` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async usersListPublicEmailsForAuthenticatedUser( @@ -21598,7 +23891,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_email[]> @@ -21609,9 +23902,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/public_emails` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposListForAuthenticatedUser( @@ -21627,7 +23925,7 @@ export class ApiClient extends AbstractFetchClient { before?: string } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_repository[]> @@ -21638,6 +23936,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/repos` + const headers = this._headers({}, opts.headers) const query = this._query({ visibility: p["visibility"], affiliation: p["affiliation"], @@ -21650,7 +23949,11 @@ export class ApiClient extends AbstractFetchClient { before: p["before"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposCreateForAuthenticatedUser( @@ -21682,7 +23985,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_full_repository> @@ -21695,14 +23998,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/repos` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async reposListInvitationsForAuthenticatedUser( @@ -21711,7 +24013,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_repository_invitation[]> @@ -21722,9 +24024,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/repository_invitations` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposAcceptInvitationForAuthenticatedUser( @@ -21732,7 +24039,7 @@ export class ApiClient extends AbstractFetchClient { invitationId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -21744,8 +24051,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/user/repository_invitations/${p["invitationId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PATCH", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PATCH", ...opts, headers }, timeout) } async reposDeclineInvitationForAuthenticatedUser( @@ -21753,7 +24061,7 @@ export class ApiClient extends AbstractFetchClient { invitationId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -21765,8 +24073,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/user/repository_invitations/${p["invitationId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async usersListSocialAccountsForAuthenticatedUser( @@ -21775,7 +24084,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_social_account[]> @@ -21786,9 +24095,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/social_accounts` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersAddSocialAccountForAuthenticatedUser( @@ -21798,7 +24112,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_social_account[]> @@ -21810,14 +24124,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/social_accounts` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async usersDeleteSocialAccountForAuthenticatedUser( @@ -21827,7 +24140,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -21839,12 +24152,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/social_accounts` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -21855,7 +24171,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_ssh_signing_key[]> @@ -21866,9 +24182,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/ssh_signing_keys` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersCreateSshSigningKeyForAuthenticatedUser( @@ -21879,7 +24200,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_ssh_signing_key> @@ -21891,14 +24212,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/ssh_signing_keys` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async usersGetSshSigningKeyForAuthenticatedUser( @@ -21906,7 +24226,7 @@ export class ApiClient extends AbstractFetchClient { sshSigningKeyId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_ssh_signing_key> @@ -21917,8 +24237,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/ssh_signing_keys/${p["sshSigningKeyId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async usersDeleteSshSigningKeyForAuthenticatedUser( @@ -21926,7 +24247,7 @@ export class ApiClient extends AbstractFetchClient { sshSigningKeyId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -21937,8 +24258,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/ssh_signing_keys/${p["sshSigningKeyId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async activityListReposStarredByAuthenticatedUser( @@ -21949,7 +24271,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_starred_repository[]> @@ -21959,6 +24281,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/starred` + const headers = this._headers({}, opts.headers) const query = this._query({ sort: p["sort"], direction: p["direction"], @@ -21966,7 +24289,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async activityCheckRepoIsStarredByAuthenticatedUser( @@ -21975,7 +24302,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -21986,8 +24313,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/starred/${p["owner"]}/${p["repo"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async activityStarRepoForAuthenticatedUser( @@ -21996,7 +24324,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -22007,8 +24335,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/starred/${p["owner"]}/${p["repo"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "PUT", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "PUT", ...opts, headers }, timeout) } async activityUnstarRepoForAuthenticatedUser( @@ -22017,7 +24346,7 @@ export class ApiClient extends AbstractFetchClient { repo: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -22028,8 +24357,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/starred/${p["owner"]}/${p["repo"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async activityListWatchedReposForAuthenticatedUser( @@ -22038,7 +24368,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_minimal_repository[]> @@ -22048,9 +24378,14 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/subscriptions` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async teamsListForAuthenticatedUser( @@ -22059,7 +24394,7 @@ export class ApiClient extends AbstractFetchClient { page?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_team_full[]> @@ -22069,9 +24404,31 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/user/teams` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async usersGetById( + p: { + accountId: number + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + Res<200, t_private_user | t_public_user> | Res<404, t_basic_error> + > + > { + const url = this.basePath + `/user/${p["accountId"]}` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async usersList( @@ -22080,12 +24437,17 @@ export class ApiClient extends AbstractFetchClient { perPage?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<304, void>>> { const url = this.basePath + `/users` + const headers = this._headers({}, opts.headers) const query = this._query({ since: p["since"], per_page: p["perPage"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersGetByUsername( @@ -22093,15 +24455,59 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_private_user | t_public_user> | Res<404, t_basic_error> > > { const url = this.basePath + `/users/${p["username"]}` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) + } + + async usersListAttestations( + p: { + perPage?: number + before?: string + after?: string + username: string + subjectDigest: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 200, + { + attestations?: { + bundle?: t_sigstore_bundle_0 + repository_id?: number + }[] + } + > + | Res<201, t_empty_object> + | Res<204, void> + | Res<404, t_basic_error> + > + > { + const url = + this.basePath + + `/users/${p["username"]}/attestations/${p["subjectDigest"]}` + const headers = this._headers({}, opts.headers) + const query = this._query({ + per_page: p["perPage"], + before: p["before"], + after: p["after"], + }) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async packagesListDockerMigrationConflictingPackagesForUser( @@ -22109,15 +24515,16 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_package[]> | Res<401, t_basic_error> | Res<403, t_basic_error> > > { const url = this.basePath + `/users/${p["username"]}/docker/conflicts` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async activityListEventsForAuthenticatedUser( @@ -22127,12 +24534,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/events` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async activityListOrgEventsForAuthenticatedUser( @@ -22143,13 +24555,18 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/events/orgs/${p["org"]}` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async activityListPublicEventsForUser( @@ -22159,12 +24576,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/events/public` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersListFollowersForUser( @@ -22174,12 +24596,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/followers` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersListFollowingForUser( @@ -22189,12 +24616,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/following` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersCheckFollowingForUser( @@ -22203,12 +24635,13 @@ export class ApiClient extends AbstractFetchClient { targetUser: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, void>>> { const url = this.basePath + `/users/${p["username"]}/following/${p["targetUser"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async gistsListForUser( @@ -22219,18 +24652,23 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/users/${p["username"]}/gists` + const headers = this._headers({}, opts.headers) const query = this._query({ since: p["since"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersListGpgKeysForUser( @@ -22240,12 +24678,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/gpg_keys` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersGetContextForUser( @@ -22255,7 +24698,7 @@ export class ApiClient extends AbstractFetchClient { subjectId?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_hovercard> @@ -22264,12 +24707,17 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/users/${p["username"]}/hovercard` + const headers = this._headers({}, opts.headers) const query = this._query({ subject_type: p["subjectType"], subject_id: p["subjectId"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async appsGetUserInstallation( @@ -22277,11 +24725,12 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/installation` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async usersListPublicKeysForUser( @@ -22291,12 +24740,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/keys` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async orgsListForUser( @@ -22306,12 +24760,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/orgs` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async packagesListPackagesForUser( @@ -22329,7 +24788,7 @@ export class ApiClient extends AbstractFetchClient { perPage?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_package[]> @@ -22339,6 +24798,7 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/users/${p["username"]}/packages` + const headers = this._headers({}, opts.headers) const query = this._query({ package_type: p["packageType"], visibility: p["visibility"], @@ -22346,7 +24806,11 @@ export class ApiClient extends AbstractFetchClient { per_page: p["perPage"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async packagesGetPackageForUser( @@ -22362,13 +24826,14 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/packages/${p["packageType"]}/${p["packageName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async packagesDeletePackageForUser( @@ -22384,7 +24849,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -22396,8 +24861,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/users/${p["username"]}/packages/${p["packageType"]}/${p["packageName"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async packagesRestorePackageForUser( @@ -22414,7 +24880,7 @@ export class ApiClient extends AbstractFetchClient { token?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -22426,11 +24892,12 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/users/${p["username"]}/packages/${p["packageType"]}/${p["packageName"]}/restore` + const headers = this._headers({}, opts.headers) const query = this._query({ token: p["token"] }) return this._fetch( url + query, - { method: "POST", ...(opts ?? {}) }, + { method: "POST", ...opts, headers }, timeout, ) } @@ -22448,7 +24915,7 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_package_version[]> @@ -22460,8 +24927,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/users/${p["username"]}/packages/${p["packageType"]}/${p["packageName"]}/versions` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async packagesGetPackageVersionForUser( @@ -22478,13 +24946,14 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/packages/${p["packageType"]}/${p["packageName"]}/versions/${p["packageVersionId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async packagesDeletePackageVersionForUser( @@ -22501,7 +24970,7 @@ export class ApiClient extends AbstractFetchClient { packageVersionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -22513,8 +24982,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/users/${p["username"]}/packages/${p["packageType"]}/${p["packageName"]}/versions/${p["packageVersionId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async packagesRestorePackageVersionForUser( @@ -22531,7 +25001,7 @@ export class ApiClient extends AbstractFetchClient { packageVersionId: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -22543,8 +25013,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/users/${p["username"]}/packages/${p["packageType"]}/${p["packageName"]}/versions/${p["packageVersionId"]}/restore` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async projectsListForUser( @@ -22555,18 +25026,23 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<422, t_validation_error>> > { const url = this.basePath + `/users/${p["username"]}/projects` + const headers = this._headers({}, opts.headers) const query = this._query({ state: p["state"], per_page: p["perPage"], page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async activityListReceivedEventsForUser( @@ -22576,12 +25052,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/received_events` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async activityListReceivedPublicEventsForUser( @@ -22591,12 +25072,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/received_events/public` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async reposListForUser( @@ -22609,9 +25095,10 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/repos` + const headers = this._headers({}, opts.headers) const query = this._query({ type: p["type"], sort: p["sort"], @@ -22620,7 +25107,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async billingGetGithubActionsBillingUser( @@ -22628,12 +25119,13 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/settings/billing/actions` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async billingGetGithubPackagesBillingUser( @@ -22641,12 +25133,13 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/settings/billing/packages` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async billingGetSharedStorageBillingUser( @@ -22654,12 +25147,13 @@ export class ApiClient extends AbstractFetchClient { username: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/settings/billing/shared-storage` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async usersListSocialAccountsForUser( @@ -22669,12 +25163,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/social_accounts` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async usersListSshSigningKeysForUser( @@ -22684,12 +25183,17 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/ssh_signing_keys` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async activityListReposStarredByUser( @@ -22701,11 +25205,12 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse> > { const url = this.basePath + `/users/${p["username"]}/starred` + const headers = this._headers({}, opts.headers) const query = this._query({ sort: p["sort"], direction: p["direction"], @@ -22713,7 +25218,11 @@ export class ApiClient extends AbstractFetchClient { page: p["page"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async activityListReposWatchedByUser( @@ -22723,29 +25232,36 @@ export class ApiClient extends AbstractFetchClient { page?: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/users/${p["username"]}/subscriptions` + const headers = this._headers({}, opts.headers) const query = this._query({ per_page: p["perPage"], page: p["page"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async metaGetAllVersions( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<404, t_basic_error>>> { const url = this.basePath + `/versions` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async metaGetZen( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/zen` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/enterprises/[enterprise]/copilot/billing/seats/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/enterprises/[enterprise]/copilot/billing/seats/route.ts new file mode 100644 index 00000000..a8dc50ca --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/enterprises/[enterprise]/copilot/billing/seats/route.ts @@ -0,0 +1,108 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CopilotListCopilotSeatsForEnterpriseParamSchema, + t_CopilotListCopilotSeatsForEnterpriseQuerySchema, + t_basic_error, + t_copilot_seat_details, +} from "../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type CopilotListCopilotSeatsForEnterpriseResponder = { + with200(): KoaRuntimeResponse<{ + seats?: t_copilot_seat_details[] + total_seats?: number + }> + with401(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse + with500(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type CopilotListCopilotSeatsForEnterprise = ( + params: Params< + t_CopilotListCopilotSeatsForEnterpriseParamSchema, + t_CopilotListCopilotSeatsForEnterpriseQuerySchema, + void + >, + respond: CopilotListCopilotSeatsForEnterpriseResponder, + ctx: { request: NextRequest }, +) => Promise> + +const copilotListCopilotSeatsForEnterpriseParamSchema = z.object({ + enterprise: z.string(), +}) + +const copilotListCopilotSeatsForEnterpriseQuerySchema = z.object({ + page: z.coerce.number().optional(), + per_page: z.coerce.number().optional(), +}) + +export const _GET = + (implementation: CopilotListCopilotSeatsForEnterprise) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + copilotListCopilotSeatsForEnterpriseParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + copilotListCopilotSeatsForEnterpriseQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse<{ + seats?: t_copilot_seat_details[] + total_seats?: number + }>(200) + }, + with401() { + return new KoaRuntimeResponse(401) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + with500() { + return new KoaRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/enterprises/[enterprise]/copilot/usage/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/enterprises/[enterprise]/copilot/usage/route.ts new file mode 100644 index 00000000..4b00c02d --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/enterprises/[enterprise]/copilot/usage/route.ts @@ -0,0 +1,104 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CopilotUsageMetricsForEnterpriseParamSchema, + t_CopilotUsageMetricsForEnterpriseQuerySchema, + t_basic_error, + t_copilot_usage_metrics, +} from "../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type CopilotUsageMetricsForEnterpriseResponder = { + with200(): KoaRuntimeResponse + with401(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse + with500(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type CopilotUsageMetricsForEnterprise = ( + params: Params< + t_CopilotUsageMetricsForEnterpriseParamSchema, + t_CopilotUsageMetricsForEnterpriseQuerySchema, + void + >, + respond: CopilotUsageMetricsForEnterpriseResponder, + ctx: { request: NextRequest }, +) => Promise> + +const copilotUsageMetricsForEnterpriseParamSchema = z.object({ + enterprise: z.string(), +}) + +const copilotUsageMetricsForEnterpriseQuerySchema = z.object({ + since: z.string().optional(), + until: z.string().optional(), + page: z.coerce.number().optional(), + per_page: z.coerce.number().optional(), +}) + +export const _GET = + (implementation: CopilotUsageMetricsForEnterprise) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + copilotUsageMetricsForEnterpriseParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + copilotUsageMetricsForEnterpriseQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with401() { + return new KoaRuntimeResponse(401) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + with500() { + return new KoaRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/enterprises/[enterprise]/team/[team_slug]/copilot/usage/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/enterprises/[enterprise]/team/[team_slug]/copilot/usage/route.ts new file mode 100644 index 00000000..376a69c3 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/enterprises/[enterprise]/team/[team_slug]/copilot/usage/route.ts @@ -0,0 +1,105 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CopilotUsageMetricsForEnterpriseTeamParamSchema, + t_CopilotUsageMetricsForEnterpriseTeamQuerySchema, + t_basic_error, + t_copilot_usage_metrics, +} from "../../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type CopilotUsageMetricsForEnterpriseTeamResponder = { + with200(): KoaRuntimeResponse + with401(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse + with500(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type CopilotUsageMetricsForEnterpriseTeam = ( + params: Params< + t_CopilotUsageMetricsForEnterpriseTeamParamSchema, + t_CopilotUsageMetricsForEnterpriseTeamQuerySchema, + void + >, + respond: CopilotUsageMetricsForEnterpriseTeamResponder, + ctx: { request: NextRequest }, +) => Promise> + +const copilotUsageMetricsForEnterpriseTeamParamSchema = z.object({ + enterprise: z.string(), + team_slug: z.string(), +}) + +const copilotUsageMetricsForEnterpriseTeamQuerySchema = z.object({ + since: z.string().optional(), + until: z.string().optional(), + page: z.coerce.number().optional(), + per_page: z.coerce.number().optional(), +}) + +export const _GET = + (implementation: CopilotUsageMetricsForEnterpriseTeam) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + copilotUsageMetricsForEnterpriseTeamParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + copilotUsageMetricsForEnterpriseTeamQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with401() { + return new KoaRuntimeResponse(401) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + with500() { + return new KoaRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/models.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/models.ts index f0ccfb2e..e6f26470 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/models.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/models.ts @@ -174,7 +174,9 @@ export type t_allowed_actions = "all" | "local_only" | "selected" export type t_api_overview = { actions?: string[] + actions_macos?: string[] api?: string[] + copilot?: string[] dependabot?: string[] domains?: { actions?: string[] @@ -357,11 +359,11 @@ export type t_base_gist = { } | undefined } - forks?: EmptyObject[] + forks?: unknown[] forks_url: string git_pull_url: string git_push_url: string - history?: EmptyObject[] + history?: unknown[] html_url: string id: string node_id: string @@ -974,6 +976,82 @@ export type t_code_scanning_sarifs_status = { processing_status?: "pending" | "complete" | "failed" } +export type t_code_scanning_variant_analysis = { + actions_workflow_run_id?: number + actor: t_simple_user + completed_at?: string | null + controller_repo: t_simple_repository + created_at?: string + failure_reason?: + | "no_repos_queried" + | "actions_workflow_run_failed" + | "internal_error" + 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 + failure_message?: string + repository: t_code_scanning_variant_analysis_repository + result_count?: number + }[] + 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 + } + status: "in_progress" | "succeeded" | "failed" | "cancelled" + updated_at?: string +} + +export type t_code_scanning_variant_analysis_language = + | "cpp" + | "csharp" + | "go" + | "java" + | "javascript" + | "python" + | "ruby" + | "swift" + +export type t_code_scanning_variant_analysis_repo_task = { + analysis_status: t_code_scanning_variant_analysis_status + artifact_size_in_bytes?: number + artifact_url?: string + database_commit_sha?: string + failure_message?: string + repository: t_simple_repository + result_count?: number + source_location_prefix?: string +} + +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 git_url: string @@ -990,6 +1068,62 @@ export type t_code_search_result_item = { url: string } +export type t_code_security_configuration = { + advanced_security?: "enabled" | "disabled" + code_scanning_default_setup?: "enabled" | "disabled" | "not_set" + created_at?: string + dependabot_alerts?: "enabled" | "disabled" | "not_set" + dependabot_security_updates?: "enabled" | "disabled" | "not_set" + dependency_graph?: "enabled" | "disabled" | "not_set" + dependency_graph_autosubmit_action?: "enabled" | "disabled" | "not_set" + dependency_graph_autosubmit_action_options?: { + labeled_runners?: boolean + } + description?: string + enforcement?: "enforced" | "unenforced" + html_url?: string + id?: number + name?: string + private_vulnerability_reporting?: "enabled" | "disabled" | "not_set" + secret_scanning?: "enabled" | "disabled" | "not_set" + secret_scanning_push_protection?: "enabled" | "disabled" | "not_set" + secret_scanning_validity_checks?: "enabled" | "disabled" | "not_set" + target_type?: "global" | "organization" + updated_at?: string + url?: string +} + +export type t_code_security_configuration_for_repository = { + configuration?: t_code_security_configuration + status?: + | "attached" + | "attaching" + | "detached" + | "removed" + | "enforced" + | "failed" + | "updating" + | "removed_by_enterprise" +} + +export type t_code_security_configuration_repositories = { + repository?: t_simple_repository + status?: + | "attached" + | "attaching" + | "detached" + | "removed" + | "enforced" + | "failed" + | "updating" + | "removed_by_enterprise" +} + +export type t_code_security_default_configurations = { + configuration?: t_code_security_configuration + default_for_new_repos?: EmptyObject +}[] + export type t_codeowners_errors = { errors: { column: number @@ -1223,7 +1357,7 @@ export type t_combined_commit_status = { } export type t_commit = { - author: t_nullable_simple_user + author: t_simple_user | t_empty_object | null comments_url: string commit: { author: t_nullable_git_user @@ -1237,7 +1371,7 @@ export type t_commit = { url: string verification?: t_verification } - committer: t_nullable_simple_user + committer: t_simple_user | t_empty_object | null files?: t_diff_entry[] html_url: string node_id: string @@ -1506,15 +1640,40 @@ export type t_copilot_seat_breakdown = { } export type t_copilot_seat_details = { - assignee: t_simple_user | t_team | t_organization - assigning_team?: t_team | null + assignee: t_simple_user + assigning_team?: t_team | t_enterprise_team | null created_at: string last_activity_at?: string | null last_activity_editor?: string | null + organization?: t_organization_simple | null pending_cancellation_date?: string | null updated_at?: string } +export type t_copilot_usage_metrics = { + breakdown: + | { + acceptances_count?: number + active_users?: number + editor?: string + language?: string + lines_accepted?: number + lines_suggested?: number + suggestions_count?: number + [key: string]: unknown | undefined + }[] + | null + day: string + total_acceptances_count?: number + total_active_chat_users?: number + total_active_users?: number + total_chat_acceptances?: number + total_chat_turns?: number + total_lines_accepted?: number + total_lines_suggested?: number + total_suggestions_count?: number +} + export type t_custom_deployment_rule_app = { id: number integration_url: string @@ -1522,6 +1681,17 @@ export type t_custom_deployment_rule_app = { slug: string } +export type t_custom_property = { + allowed_values?: string[] | null + default_value?: string | string[] | null + description?: string | null + property_name: string + required?: boolean + url?: string + value_type: "string" | "single_select" | "multi_select" | "true_false" + values_editable_by?: "org_actors" | "org_and_repo_actors" | null +} + export type t_custom_property_value = { property_name: string value: string | string[] | null @@ -1690,6 +1860,7 @@ export type t_dependency_graph_spdx_sbom = { name: string packages: { SPDXID?: string + copyrightText?: string downloadLocation?: string externalRefs?: { referenceCategory: string @@ -1861,6 +2032,19 @@ export type t_enterprise = { website_url?: string | null } +export type t_enterprise_team = { + created_at: string + group_id?: number | null + 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 @@ -2198,11 +2382,11 @@ export type t_gist_simple = { } | undefined } - forks?: EmptyObject[] + forks?: unknown[] forks_url: string git_pull_url: string git_push_url: string - history?: EmptyObject[] + history?: unknown[] html_url: string id: string node_id: string @@ -2396,7 +2580,7 @@ export type t_gpg_key = { public_key?: string raw_key?: string | null revoked?: boolean - subkeys?: EmptyObject[] + subkeys?: unknown[] }[] } @@ -2442,6 +2626,7 @@ export type t_hook_delivery = { } status: string status_code: number + throttled_at?: string | null url?: string } @@ -2457,6 +2642,7 @@ export type t_hook_delivery_item = { repository_id: number | null status: string status_code: number + throttled_at?: string | null } export type t_hook_response = { @@ -2577,7 +2763,7 @@ export type t_integration = { slug?: string updated_at: string webhook_secret?: string | null -} +} | null export type t_integration_installation_request = { account: t_simple_user | t_enterprise @@ -3676,16 +3862,6 @@ export type t_oidc_custom_sub_repo = { use_default: boolean } -export type t_org_custom_property = { - allowed_values?: string[] | null - default_value?: string | string[] | null - description?: string | null - property_name: string - required?: boolean - value_type: "string" | "single_select" - values_editable_by?: "org_actors" | "org_and_repo_actors" | null -} - export type t_org_hook = { active: boolean config: { @@ -3732,44 +3908,6 @@ export type t_org_ruleset_conditions = | (t_repository_ruleset_conditions & t_repository_ruleset_conditions_repository_property_target) -export type t_organization = { - avatar_url: string - blog?: string - company?: string - created_at: string - description: string | null - email?: string - 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 - issues_url: string - location?: string - login: string - members_url: string - name?: string - node_id: string - plan?: { - filled_seats?: number - name?: string - private_repos?: number - seats?: number - space?: number - } - public_gists: number - public_members_url: string - public_repos: number - repos_url: string - type: string - updated_at: string - url: string -} - export type t_organization_actions_secret = { created_at: string name: string @@ -3795,11 +3933,6 @@ export type t_organization_dependabot_secret = { visibility: "all" | "private" | "selected" } -export type t_organization_fine_grained_permission = { - description: string - name: string -} - export type t_organization_full = { advanced_security_enabled_for_new_repositories?: boolean archived_at: string | null @@ -4229,6 +4362,7 @@ export type t_private_user = { login: string name: string | null node_id: string + notification_email?: string | null organizations_url: string owned_private_repos: number plan?: { @@ -4440,6 +4574,7 @@ export type t_public_user = { login: string name: string | null node_id: string + notification_email?: string | null organizations_url: string owned_private_repos?: number plan?: { @@ -5472,6 +5607,7 @@ export type t_repository_rule = | 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 @@ -5482,7 +5618,32 @@ export type t_repository_rule = | t_repository_rule_committer_email_pattern | t_repository_rule_branch_name_pattern | t_repository_rule_tag_name_pattern + | { + parameters?: { + restricted_file_paths: string[] + } + type: "file_path_restriction" + } + | { + parameters?: { + max_file_path_length: number + } + type: "max_file_path_length" + } + | { + parameters?: { + restricted_file_extensions: string[] + } + type: "file_extension_restriction" + } + | { + parameters?: { + max_file_size: number + } + type: "max_file_size" + } | t_repository_rule_workflows + | t_repository_rule_code_scanning export type t_repository_rule_branch_name_pattern = { parameters?: { @@ -5494,6 +5655,13 @@ export type t_repository_rule_branch_name_pattern = { type: "branch_name_pattern" } +export type t_repository_rule_code_scanning = { + parameters?: { + code_scanning_tools: t_repository_rule_params_code_scanning_tool[] + } + type: "code_scanning" +} + export type t_repository_rule_commit_author_email_pattern = { parameters?: { name?: string @@ -5537,6 +5705,7 @@ export type t_repository_rule_detailed = | (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) @@ -5549,13 +5718,38 @@ export type t_repository_rule_detailed = | (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_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_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 + } + 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 @@ -5596,6 +5790,7 @@ export type t_repository_rule_required_signatures = { export type t_repository_rule_required_status_checks = { parameters?: { + do_not_enforce_on_create?: boolean required_status_checks: t_repository_rule_params_status_check_configuration[] strict_required_status_checks_policy: boolean } @@ -5627,6 +5822,7 @@ export type t_repository_rule_update = { export type t_repository_rule_workflows = { parameters?: { + do_not_enforce_on_create?: boolean workflows: t_repository_rule_params_workflow_file_reference[] } type: "workflows" @@ -5652,13 +5848,19 @@ export type t_repository_ruleset = { rules?: t_repository_rule[] source: string source_type?: "Repository" | "Organization" - target?: "branch" | "tag" + target?: "branch" | "tag" | "push" updated_at?: string } export type t_repository_ruleset_bypass_actor = { - actor_id: number - actor_type: "Integration" | "OrganizationAdmin" | "RepositoryRole" | "Team" + actor_id?: number | null + actor_type: + | "Integration" + | "OrganizationAdmin" + | "RepositoryRole" + | "Team" + | "DeployKey" + | "EnterpriseTeam" bypass_mode: "always" | "pull_request" } @@ -5686,6 +5888,7 @@ export type t_repository_ruleset_conditions_repository_name_target = { export type t_repository_ruleset_conditions_repository_property_spec = { name: string property_values: string[] + source?: "custom" | "system" } export type t_repository_ruleset_conditions_repository_property_target = { @@ -6049,6 +6252,19 @@ export type t_secret_scanning_location_wiki_commit = { start_line: number } +export type t_secret_scanning_push_protection_bypass = { + expire_at?: string | null + reason?: t_secret_scanning_push_protection_bypass_reason + token_type?: string +} + +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_security_advisory_credit_types = | "analyst" | "finder" @@ -6086,6 +6302,9 @@ export type t_security_and_analysis = { secret_scanning?: { status?: "enabled" | "disabled" } + secret_scanning_non_provider_patterns?: { + status?: "enabled" | "disabled" + } secret_scanning_push_protection?: { status?: "enabled" | "disabled" } @@ -6115,6 +6334,42 @@ export type t_short_branch = { protection_url?: string } +export type t_sigstore_bundle_0 = { + dsseEnvelope?: { + payload?: string + payloadType?: string + signatures?: { + keyid?: string + sig?: string + }[] + } + mediaType?: string + verificationMaterial?: { + timestampVerificationData?: string | null + tlogEntries?: { + canonicalizedBody?: string + inclusionPromise?: { + signedEntryTimestamp?: string + } + inclusionProof?: string | null + integratedTime?: string + kindVersion?: { + kind?: string + version?: string + } + logId?: { + keyId?: string + } + logIndex?: string + }[] + x509CertificateChain?: { + certificates?: { + rawBytes?: string + }[] + } + } +} + export type t_simple_classroom = { archived: boolean id: number @@ -6637,6 +6892,29 @@ export type t_team_repository = { web_commit_signoff_required?: boolean } +export type t_team_role_assignment = { + description: string | null + html_url: string + id: number + members_url: string + name: string + node_id: string + notification_setting?: string + parent: t_nullable_team_simple + permission: string + permissions?: { + admin: boolean + maintain: boolean + pull: boolean + push: boolean + triage: boolean + } + privacy?: string + repositories_url: string + slug: string + url: string +} + export type t_team_simple = { description: string | null html_url: string @@ -6919,6 +7197,30 @@ export type t_user_marketplace_purchase = { updated_at: string | null } +export type t_user_role_assignment = { + avatar_url: string + email?: string | null + 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 + node_id: string + organizations_url: string + received_events_url: string + repos_url: string + site_admin: boolean + starred_at?: string + starred_url: string + subscriptions_url: string + type: string + url: string +} + export type t_user_search_result_item = { avatar_url: string bio?: string | null @@ -8806,6 +9108,13 @@ export type t_ClassroomListClassroomsQuerySchema = { per_page?: number } +export type t_CodeScanningCreateVariantAnalysisBodySchema = EmptyObject + +export type t_CodeScanningCreateVariantAnalysisParamSchema = { + owner: string + repo: string +} + export type t_CodeScanningDeleteAnalysisParamSchema = { analysis_id: number owner: string @@ -8845,6 +9154,20 @@ export type t_CodeScanningGetSarifParamSchema = { 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 @@ -8959,6 +9282,122 @@ export type t_CodeScanningUploadSarifParamSchema = { repo: string } +export type t_CodeSecurityAttachConfigurationBodySchema = { + scope: "all" | "public" | "private_or_internal" | "selected" + selected_repository_ids?: number[] +} + +export type t_CodeSecurityAttachConfigurationParamSchema = { + configuration_id: number + org: string +} + +export type t_CodeSecurityCreateConfigurationBodySchema = { + advanced_security?: "enabled" | "disabled" + code_scanning_default_setup?: "enabled" | "disabled" | "not_set" + dependabot_alerts?: "enabled" | "disabled" | "not_set" + dependabot_security_updates?: "enabled" | "disabled" | "not_set" + dependency_graph?: "enabled" | "disabled" | "not_set" + dependency_graph_autosubmit_action?: "enabled" | "disabled" | "not_set" + dependency_graph_autosubmit_action_options?: { + labeled_runners?: boolean + } + description: string + enforcement?: "enforced" | "unenforced" + name: string + private_vulnerability_reporting?: "enabled" | "disabled" | "not_set" + secret_scanning?: "enabled" | "disabled" | "not_set" + secret_scanning_push_protection?: "enabled" | "disabled" | "not_set" + secret_scanning_validity_checks?: "enabled" | "disabled" | "not_set" +} + +export type t_CodeSecurityCreateConfigurationParamSchema = { + org: string +} + +export type t_CodeSecurityDeleteConfigurationParamSchema = { + configuration_id: number + org: string +} + +export type t_CodeSecurityDetachConfigurationBodySchema = { + selected_repository_ids?: number[] +} + +export type t_CodeSecurityDetachConfigurationParamSchema = { + org: string +} + +export type t_CodeSecurityGetConfigurationParamSchema = { + configuration_id: number + org: string +} + +export type t_CodeSecurityGetConfigurationForRepositoryParamSchema = { + owner: string + repo: string +} + +export type t_CodeSecurityGetConfigurationsForOrgParamSchema = { + org: string +} + +export type t_CodeSecurityGetConfigurationsForOrgQuerySchema = { + after?: string + before?: string + per_page?: number + target_type?: "global" | "all" +} + +export type t_CodeSecurityGetDefaultConfigurationsParamSchema = { + org: string +} + +export type t_CodeSecurityGetRepositoriesForConfigurationParamSchema = { + configuration_id: number + org: string +} + +export type t_CodeSecurityGetRepositoriesForConfigurationQuerySchema = { + after?: string + before?: string + per_page?: number + status?: string +} + +export type t_CodeSecuritySetConfigurationAsDefaultBodySchema = { + default_for_new_repos?: "all" | "none" | "private_and_internal" | "public" +} + +export type t_CodeSecuritySetConfigurationAsDefaultParamSchema = { + configuration_id: number + org: string +} + +export type t_CodeSecurityUpdateConfigurationBodySchema = { + advanced_security?: "enabled" | "disabled" + code_scanning_default_setup?: "enabled" | "disabled" | "not_set" + dependabot_alerts?: "enabled" | "disabled" | "not_set" + dependabot_security_updates?: "enabled" | "disabled" | "not_set" + dependency_graph?: "enabled" | "disabled" | "not_set" + dependency_graph_autosubmit_action?: "enabled" | "disabled" | "not_set" + dependency_graph_autosubmit_action_options?: { + labeled_runners?: boolean + } + description?: string + enforcement?: "enforced" | "unenforced" + name?: string + private_vulnerability_reporting?: "enabled" | "disabled" | "not_set" + secret_scanning?: "enabled" | "disabled" | "not_set" + secret_scanning_push_protection?: "enabled" | "disabled" | "not_set" + secret_scanning_validity_checks?: "enabled" | "disabled" | "not_set" +} + +export type t_CodeSecurityUpdateConfigurationParamSchema = { + configuration_id: number + org: string +} + export type t_CodesOfConductGetConductCodeParamSchema = { key: string } @@ -9400,6 +9839,61 @@ export type t_CopilotListCopilotSeatsQuerySchema = { per_page?: number } +export type t_CopilotListCopilotSeatsForEnterpriseParamSchema = { + enterprise: string +} + +export type t_CopilotListCopilotSeatsForEnterpriseQuerySchema = { + page?: number + per_page?: number +} + +export type t_CopilotUsageMetricsForEnterpriseParamSchema = { + enterprise: string +} + +export type t_CopilotUsageMetricsForEnterpriseQuerySchema = { + page?: number + per_page?: number + since?: string + until?: string +} + +export type t_CopilotUsageMetricsForEnterpriseTeamParamSchema = { + enterprise: string + team_slug: string +} + +export type t_CopilotUsageMetricsForEnterpriseTeamQuerySchema = { + page?: number + per_page?: number + since?: string + until?: string +} + +export type t_CopilotUsageMetricsForOrgParamSchema = { + org: string +} + +export type t_CopilotUsageMetricsForOrgQuerySchema = { + page?: number + per_page?: number + since?: string + until?: string +} + +export type t_CopilotUsageMetricsForTeamParamSchema = { + org: string + team_slug: string +} + +export type t_CopilotUsageMetricsForTeamQuerySchema = { + page?: number + per_page?: number + since?: string + until?: string +} + export type t_DependabotAddSelectedRepoToOrgSecretParamSchema = { org: string repository_id: number @@ -10655,16 +11149,6 @@ export type t_OrgsConvertMemberToOutsideCollaboratorParamSchema = { username: string } -export type t_OrgsCreateCustomOrganizationRoleBodySchema = { - description?: string - name: string - permissions: string[] -} - -export type t_OrgsCreateCustomOrganizationRoleParamSchema = { - org: string -} - export type t_OrgsCreateInvitationBodySchema = { email?: string invitee_id?: number @@ -10677,7 +11161,7 @@ export type t_OrgsCreateInvitationParamSchema = { } export type t_OrgsCreateOrUpdateCustomPropertiesBodySchema = { - properties: t_org_custom_property[] + properties: t_custom_property[] } export type t_OrgsCreateOrUpdateCustomPropertiesParamSchema = { @@ -10698,7 +11182,7 @@ export type t_OrgsCreateOrUpdateCustomPropertyBodySchema = { default_value?: string | string[] | null description?: string | null required?: boolean - value_type: "string" | "single_select" + value_type: "string" | "single_select" | "multi_select" | "true_false" } export type t_OrgsCreateOrUpdateCustomPropertyParamSchema = { @@ -10728,11 +11212,6 @@ export type t_OrgsDeleteParamSchema = { org: string } -export type t_OrgsDeleteCustomOrganizationRoleParamSchema = { - org: string - role_id: number -} - export type t_OrgsDeleteWebhookParamSchema = { hook_id: number org: string @@ -10812,6 +11291,17 @@ export type t_OrgsListAppInstallationsQuerySchema = { per_page?: number } +export type t_OrgsListAttestationsParamSchema = { + org: string + subject_digest: string +} + +export type t_OrgsListAttestationsQuerySchema = { + after?: string + before?: string + per_page?: number +} + export type t_OrgsListBlockedUsersParamSchema = { org: string } @@ -10905,10 +11395,6 @@ export type t_OrgsListOrgRolesParamSchema = { org: string } -export type t_OrgsListOrganizationFineGrainedPermissionsParamSchema = { - org: string -} - export type t_OrgsListOutsideCollaboratorsParamSchema = { org: string } @@ -11020,17 +11506,6 @@ export type t_OrgsListWebhooksQuerySchema = { per_page?: number } -export type t_OrgsPatchCustomOrganizationRoleBodySchema = { - description?: string - name?: string - permissions?: string[] -} - -export type t_OrgsPatchCustomOrganizationRoleParamSchema = { - org: string - role_id: number -} - export type t_OrgsPingWebhookParamSchema = { hook_id: number org: string @@ -12404,6 +12879,23 @@ export type t_ReposCompareCommitsQuerySchema = { per_page?: number } +export type t_ReposCreateAttestationBodySchema = { + bundle: { + dsseEnvelope?: { + [key: string]: unknown | undefined + } + mediaType?: string + verificationMaterial?: { + [key: string]: unknown | undefined + } + } +} + +export type t_ReposCreateAttestationParamSchema = { + owner: string + repo: string +} + export type t_ReposCreateAutolinkBodySchema = { is_alphanumeric?: boolean key_prefix: string @@ -12662,7 +13154,7 @@ export type t_ReposCreateOrgRulesetBodySchema = { enforcement: t_repository_rule_enforcement name: string rules?: t_repository_rule[] - target?: "branch" | "tag" + target?: "branch" | "tag" | "push" } export type t_ReposCreateOrgRulesetParamSchema = { @@ -12718,7 +13210,7 @@ export type t_ReposCreateRepoRulesetBodySchema = { enforcement: t_repository_rule_enforcement name: string rules?: t_repository_rule[] - target?: "branch" | "tag" + target?: "branch" | "tag" | "push" } export type t_ReposCreateRepoRulesetParamSchema = { @@ -13198,6 +13690,7 @@ export type t_ReposGetOrgRuleSuitesQuerySchema = { actor_name?: string page?: number per_page?: number + ref?: string repository_name?: number rule_suite_result?: "pass" | "fail" | "bypass" | "all" time_period?: "hour" | "day" | "week" | "month" @@ -13411,6 +13904,18 @@ export type t_ReposListActivitiesQuerySchema = { time_period?: "day" | "week" | "month" | "quarter" | "year" } +export type t_ReposListAttestationsParamSchema = { + owner: string + repo: string + subject_digest: string +} + +export type t_ReposListAttestationsQuerySchema = { + after?: string + before?: string + per_page?: number +} + export type t_ReposListAutolinksParamSchema = { owner: string repo: string @@ -13936,6 +14441,9 @@ export type t_ReposUpdateBodySchema = { secret_scanning?: { status?: string } + secret_scanning_non_provider_patterns?: { + status?: string + } secret_scanning_push_protection?: { status?: string } @@ -14054,7 +14562,7 @@ export type t_ReposUpdateOrgRulesetBodySchema = { enforcement?: t_repository_rule_enforcement name?: string rules?: t_repository_rule[] - target?: "branch" | "tag" + target?: "branch" | "tag" | "push" } export type t_ReposUpdateOrgRulesetParamSchema = { @@ -14120,7 +14628,7 @@ export type t_ReposUpdateRepoRulesetBodySchema = { enforcement?: t_repository_rule_enforcement name?: string rules?: t_repository_rule[] - target?: "branch" | "tag" + target?: "branch" | "tag" | "push" } export type t_ReposUpdateRepoRulesetParamSchema = { @@ -14250,6 +14758,16 @@ export type t_SearchUsersQuerySchema = { sort?: "followers" | "repositories" | "joined" } +export type t_SecretScanningCreatePushProtectionBypassBodySchema = { + placeholder_id: t_secret_scanning_push_protection_bypass_placeholder_id + reason: t_secret_scanning_push_protection_bypass_reason +} + +export type t_SecretScanningCreatePushProtectionBypassParamSchema = { + owner: string + repo: string +} + export type t_SecretScanningGetAlertParamSchema = { alert_number: t_alert_number owner: string @@ -15047,6 +15565,10 @@ export type t_UsersFollowParamSchema = { username: string } +export type t_UsersGetByIdParamSchema = { + account_id: number +} + export type t_UsersGetByUsernameParamSchema = { username: string } @@ -15077,6 +15599,17 @@ export type t_UsersListQuerySchema = { since?: number } +export type t_UsersListAttestationsParamSchema = { + subject_digest: string + username: string +} + +export type t_UsersListAttestationsQuerySchema = { + after?: string + before?: string + per_page?: number +} + export type t_UsersListBlockedByAuthenticatedUserQuerySchema = { page?: number per_page?: number diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/attestations/[subject_digest]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/attestations/[subject_digest]/route.ts new file mode 100644 index 00000000..a0e6f4bb --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/attestations/[subject_digest]/route.ts @@ -0,0 +1,112 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_OrgsListAttestationsParamSchema, + t_OrgsListAttestationsQuerySchema, +} from "../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type OrgsListAttestationsResponder = { + with200(): KoaRuntimeResponse<{ + attestations?: { + bundle?: { + dsseEnvelope?: { + [key: string]: unknown | undefined + } + mediaType?: string + verificationMaterial?: { + [key: string]: unknown | undefined + } + } + repository_id?: number + }[] + }> +} & KoaRuntimeResponder + +export type OrgsListAttestations = ( + params: Params< + t_OrgsListAttestationsParamSchema, + t_OrgsListAttestationsQuerySchema, + void + >, + respond: OrgsListAttestationsResponder, + ctx: { request: NextRequest }, +) => Promise> + +const orgsListAttestationsParamSchema = z.object({ + org: z.string(), + subject_digest: z.string(), +}) + +const orgsListAttestationsQuerySchema = z.object({ + per_page: z.coerce.number().optional(), + before: z.string().optional(), + after: z.string().optional(), +}) + +export const _GET = + (implementation: OrgsListAttestations) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + orgsListAttestationsParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + orgsListAttestationsQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse<{ + attestations?: { + bundle?: { + dsseEnvelope?: { + [key: string]: unknown | undefined + } + mediaType?: string + verificationMaterial?: { + [key: string]: unknown | undefined + } + } + repository_id?: number + }[] + }>(200) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/attach/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/attach/route.ts new file mode 100644 index 00000000..529cb5b4 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/attach/route.ts @@ -0,0 +1,89 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CodeSecurityAttachConfigurationBodySchema, + t_CodeSecurityAttachConfigurationParamSchema, +} from "../../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type CodeSecurityAttachConfigurationResponder = { + with202(): KoaRuntimeResponse<{ + [key: string]: unknown | undefined + }> +} & KoaRuntimeResponder + +export type CodeSecurityAttachConfiguration = ( + params: Params< + t_CodeSecurityAttachConfigurationParamSchema, + void, + t_CodeSecurityAttachConfigurationBodySchema + >, + respond: CodeSecurityAttachConfigurationResponder, + ctx: { request: NextRequest }, +) => Promise> + +const codeSecurityAttachConfigurationParamSchema = z.object({ + org: z.string(), + configuration_id: z.coerce.number(), +}) + +const codeSecurityAttachConfigurationBodySchema = z.object({ + scope: z.enum(["all", "public", "private_or_internal", "selected"]), + selected_repository_ids: z.array(z.coerce.number()).optional(), +}) + +export const _POST = + (implementation: CodeSecurityAttachConfiguration) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + codeSecurityAttachConfigurationParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + codeSecurityAttachConfigurationBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with202() { + return new KoaRuntimeResponse<{ + [key: string]: unknown | undefined + }>(202) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/defaults/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/defaults/route.ts new file mode 100644 index 00000000..fa49ec2a --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/defaults/route.ts @@ -0,0 +1,106 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CodeSecuritySetConfigurationAsDefaultBodySchema, + t_CodeSecuritySetConfigurationAsDefaultParamSchema, + t_basic_error, + t_code_security_configuration, +} from "../../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type CodeSecuritySetConfigurationAsDefaultResponder = { + with200(): KoaRuntimeResponse<{ + configuration?: t_code_security_configuration + default_for_new_repos?: "all" | "none" | "private_and_internal" | "public" + }> + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type CodeSecuritySetConfigurationAsDefault = ( + params: Params< + t_CodeSecuritySetConfigurationAsDefaultParamSchema, + void, + t_CodeSecuritySetConfigurationAsDefaultBodySchema + >, + respond: CodeSecuritySetConfigurationAsDefaultResponder, + ctx: { request: NextRequest }, +) => Promise> + +const codeSecuritySetConfigurationAsDefaultParamSchema = z.object({ + org: z.string(), + configuration_id: z.coerce.number(), +}) + +const codeSecuritySetConfigurationAsDefaultBodySchema = z.object({ + default_for_new_repos: z + .enum(["all", "none", "private_and_internal", "public"]) + .optional(), +}) + +export const _PUT = + (implementation: CodeSecuritySetConfigurationAsDefault) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + codeSecuritySetConfigurationAsDefaultParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + codeSecuritySetConfigurationAsDefaultBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse<{ + configuration?: t_code_security_configuration + default_for_new_repos?: + | "all" + | "none" + | "private_and_internal" + | "public" + }>(200) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/repositories/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/repositories/route.ts new file mode 100644 index 00000000..d129c061 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/repositories/route.ts @@ -0,0 +1,99 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CodeSecurityGetRepositoriesForConfigurationParamSchema, + t_CodeSecurityGetRepositoriesForConfigurationQuerySchema, + t_basic_error, + t_code_security_configuration_repositories, +} from "../../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type CodeSecurityGetRepositoriesForConfigurationResponder = { + with200(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type CodeSecurityGetRepositoriesForConfiguration = ( + params: Params< + t_CodeSecurityGetRepositoriesForConfigurationParamSchema, + t_CodeSecurityGetRepositoriesForConfigurationQuerySchema, + void + >, + respond: CodeSecurityGetRepositoriesForConfigurationResponder, + ctx: { request: NextRequest }, +) => Promise> + +const codeSecurityGetRepositoriesForConfigurationParamSchema = z.object({ + org: z.string(), + configuration_id: z.coerce.number(), +}) + +const codeSecurityGetRepositoriesForConfigurationQuerySchema = z.object({ + per_page: z.coerce.number().optional(), + before: z.string().optional(), + after: z.string().optional(), + status: z.string().optional(), +}) + +export const _GET = + (implementation: CodeSecurityGetRepositoriesForConfiguration) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + codeSecurityGetRepositoriesForConfigurationParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + codeSecurityGetRepositoriesForConfigurationQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse< + t_code_security_configuration_repositories[] + >(200) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/route.ts new file mode 100644 index 00000000..c1739f70 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/[configuration_id]/route.ts @@ -0,0 +1,253 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CodeSecurityDeleteConfigurationParamSchema, + t_CodeSecurityGetConfigurationParamSchema, + t_CodeSecurityUpdateConfigurationBodySchema, + t_CodeSecurityUpdateConfigurationParamSchema, + t_basic_error, + t_code_security_configuration, + t_scim_error, +} from "../../../../../models" +import { PermissiveBoolean } from "../../../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type CodeSecurityGetConfigurationResponder = { + with200(): KoaRuntimeResponse + with304(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type CodeSecurityGetConfiguration = ( + params: Params, + respond: CodeSecurityGetConfigurationResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type CodeSecurityUpdateConfigurationResponder = { + with200(): KoaRuntimeResponse + with204(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type CodeSecurityUpdateConfiguration = ( + params: Params< + t_CodeSecurityUpdateConfigurationParamSchema, + void, + t_CodeSecurityUpdateConfigurationBodySchema + >, + respond: CodeSecurityUpdateConfigurationResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type CodeSecurityDeleteConfigurationResponder = { + with204(): KoaRuntimeResponse + with400(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse + with409(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type CodeSecurityDeleteConfiguration = ( + params: Params, + respond: CodeSecurityDeleteConfigurationResponder, + ctx: { request: NextRequest }, +) => Promise> + +const codeSecurityGetConfigurationParamSchema = z.object({ + org: z.string(), + configuration_id: z.coerce.number(), +}) + +export const _GET = + (implementation: CodeSecurityGetConfiguration) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + codeSecurityGetConfigurationParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with304() { + return new KoaRuntimeResponse(304) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +const codeSecurityUpdateConfigurationParamSchema = z.object({ + org: z.string(), + configuration_id: z.coerce.number(), +}) + +const codeSecurityUpdateConfigurationBodySchema = z.object({ + name: z.string().optional(), + description: z.string().max(255).optional(), + advanced_security: z.enum(["enabled", "disabled"]).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(), + 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(), + private_vulnerability_reporting: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + enforcement: z.enum(["enforced", "unenforced"]).optional(), +}) + +export const _PATCH = + (implementation: CodeSecurityUpdateConfiguration) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + codeSecurityUpdateConfigurationParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + codeSecurityUpdateConfigurationBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with204() { + return new KoaRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +const codeSecurityDeleteConfigurationParamSchema = z.object({ + org: z.string(), + configuration_id: z.coerce.number(), +}) + +export const _DELETE = + (implementation: CodeSecurityDeleteConfiguration) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + codeSecurityDeleteConfigurationParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: undefined, + } + + const responder = { + with204() { + return new KoaRuntimeResponse(204) + }, + with400() { + return new KoaRuntimeResponse(400) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + with409() { + return new KoaRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-fine-grained-permissions/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/defaults/route.ts similarity index 62% rename from integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-fine-grained-permissions/route.ts rename to integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/defaults/route.ts index ff4e7d6c..f6a845f8 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-fine-grained-permissions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/defaults/route.ts @@ -3,11 +3,10 @@ /* eslint-disable */ import { - t_OrgsListOrganizationFineGrainedPermissionsParamSchema, + t_CodeSecurityGetDefaultConfigurationsParamSchema, t_basic_error, - t_organization_fine_grained_permission, - t_validation_error, -} from "../../../models" + t_code_security_default_configurations, +} from "../../../../../models" import { KoaRuntimeError, RequestInputType, @@ -21,35 +20,32 @@ import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" import { NextRequest } from "next/server" import { z } from "zod" -export type OrgsListOrganizationFineGrainedPermissionsResponder = { - with200(): KoaRuntimeResponse +export type CodeSecurityGetDefaultConfigurationsResponder = { + with200(): KoaRuntimeResponse + with304(): KoaRuntimeResponse + with403(): KoaRuntimeResponse with404(): KoaRuntimeResponse - with422(): KoaRuntimeResponse } & KoaRuntimeResponder -export type OrgsListOrganizationFineGrainedPermissions = ( - params: Params< - t_OrgsListOrganizationFineGrainedPermissionsParamSchema, - void, - void - >, - respond: OrgsListOrganizationFineGrainedPermissionsResponder, +export type CodeSecurityGetDefaultConfigurations = ( + params: Params, + respond: CodeSecurityGetDefaultConfigurationsResponder, ctx: { request: NextRequest }, ) => Promise> -const orgsListOrganizationFineGrainedPermissionsParamSchema = z.object({ +const codeSecurityGetDefaultConfigurationsParamSchema = z.object({ org: z.string(), }) export const _GET = - (implementation: OrgsListOrganizationFineGrainedPermissions) => + (implementation: CodeSecurityGetDefaultConfigurations) => async ( request: NextRequest, { params }: { params: unknown }, ): Promise => { const input = { params: parseRequestInput( - orgsListOrganizationFineGrainedPermissionsParamSchema, + codeSecurityGetDefaultConfigurationsParamSchema, params, RequestInputType.RouteParam, ), @@ -60,16 +56,19 @@ export const _GET = const responder = { with200() { - return new KoaRuntimeResponse( + return new KoaRuntimeResponse( 200, ) }, + with304() { + return new KoaRuntimeResponse(304) + }, + with403() { + return new KoaRuntimeResponse(403) + }, with404() { return new KoaRuntimeResponse(404) }, - with422() { - return new KoaRuntimeResponse(422) - }, withStatus(status: StatusCode) { return new KoaRuntimeResponse(status) }, diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/detach/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/detach/route.ts new file mode 100644 index 00000000..44274f48 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/detach/route.ts @@ -0,0 +1,99 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CodeSecurityDetachConfigurationBodySchema, + t_CodeSecurityDetachConfigurationParamSchema, + t_basic_error, + t_scim_error, +} from "../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type CodeSecurityDetachConfigurationResponder = { + with204(): KoaRuntimeResponse + with400(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse + with409(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type CodeSecurityDetachConfiguration = ( + params: Params< + t_CodeSecurityDetachConfigurationParamSchema, + void, + t_CodeSecurityDetachConfigurationBodySchema + >, + respond: CodeSecurityDetachConfigurationResponder, + ctx: { request: NextRequest }, +) => Promise> + +const codeSecurityDetachConfigurationParamSchema = z.object({ org: z.string() }) + +const codeSecurityDetachConfigurationBodySchema = z.object({ + selected_repository_ids: z.array(z.coerce.number()).optional(), +}) + +export const _DELETE = + (implementation: CodeSecurityDetachConfiguration) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + codeSecurityDetachConfigurationParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + codeSecurityDetachConfigurationBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with204() { + return new KoaRuntimeResponse(204) + }, + with400() { + return new KoaRuntimeResponse(400) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + with409() { + return new KoaRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/route.ts new file mode 100644 index 00000000..44405f10 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/code-security/configurations/route.ts @@ -0,0 +1,187 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CodeSecurityCreateConfigurationBodySchema, + t_CodeSecurityCreateConfigurationParamSchema, + t_CodeSecurityGetConfigurationsForOrgParamSchema, + t_CodeSecurityGetConfigurationsForOrgQuerySchema, + t_basic_error, + t_code_security_configuration, +} from "../../../../models" +import { PermissiveBoolean } from "../../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type CodeSecurityGetConfigurationsForOrgResponder = { + with200(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type CodeSecurityGetConfigurationsForOrg = ( + params: Params< + t_CodeSecurityGetConfigurationsForOrgParamSchema, + t_CodeSecurityGetConfigurationsForOrgQuerySchema, + void + >, + respond: CodeSecurityGetConfigurationsForOrgResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type CodeSecurityCreateConfigurationResponder = { + with201(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type CodeSecurityCreateConfiguration = ( + params: Params< + t_CodeSecurityCreateConfigurationParamSchema, + void, + t_CodeSecurityCreateConfigurationBodySchema + >, + respond: CodeSecurityCreateConfigurationResponder, + ctx: { request: NextRequest }, +) => Promise> + +const codeSecurityGetConfigurationsForOrgParamSchema = z.object({ + org: z.string(), +}) + +const codeSecurityGetConfigurationsForOrgQuerySchema = z.object({ + target_type: z.enum(["global", "all"]).optional(), + per_page: z.coerce.number().optional(), + before: z.string().optional(), + after: z.string().optional(), +}) + +export const _GET = + (implementation: CodeSecurityGetConfigurationsForOrg) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + codeSecurityGetConfigurationsForOrgParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + codeSecurityGetConfigurationsForOrgQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +const codeSecurityCreateConfigurationParamSchema = z.object({ org: z.string() }) + +const codeSecurityCreateConfigurationBodySchema = z.object({ + name: z.string(), + description: z.string().max(255), + advanced_security: z.enum(["enabled", "disabled"]).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(), + 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(), + private_vulnerability_reporting: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + enforcement: z.enum(["enforced", "unenforced"]).optional(), +}) + +export const _POST = + (implementation: CodeSecurityCreateConfiguration) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + codeSecurityCreateConfigurationParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + codeSecurityCreateConfigurationBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with201() { + return new KoaRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/copilot/usage/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/copilot/usage/route.ts new file mode 100644 index 00000000..faeae871 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/copilot/usage/route.ts @@ -0,0 +1,102 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CopilotUsageMetricsForOrgParamSchema, + t_CopilotUsageMetricsForOrgQuerySchema, + t_basic_error, + t_copilot_usage_metrics, +} from "../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type CopilotUsageMetricsForOrgResponder = { + with200(): KoaRuntimeResponse + with401(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse + with500(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type CopilotUsageMetricsForOrg = ( + params: Params< + t_CopilotUsageMetricsForOrgParamSchema, + t_CopilotUsageMetricsForOrgQuerySchema, + void + >, + respond: CopilotUsageMetricsForOrgResponder, + ctx: { request: NextRequest }, +) => Promise> + +const copilotUsageMetricsForOrgParamSchema = z.object({ org: z.string() }) + +const copilotUsageMetricsForOrgQuerySchema = z.object({ + since: z.string().optional(), + until: z.string().optional(), + page: z.coerce.number().optional(), + per_page: z.coerce.number().optional(), +}) + +export const _GET = + (implementation: CopilotUsageMetricsForOrg) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + copilotUsageMetricsForOrgParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + copilotUsageMetricsForOrgQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with401() { + return new KoaRuntimeResponse(401) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + with500() { + return new KoaRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/migrations/[migration_id]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/migrations/[migration_id]/route.ts index 847679b6..b597ed01 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/migrations/[migration_id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/migrations/[migration_id]/route.ts @@ -42,7 +42,12 @@ const migrationsGetStatusForOrgParamSchema = z.object({ }) const migrationsGetStatusForOrgQuerySchema = z.object({ - exclude: z.array(z.enum(["repositories"])).optional(), + exclude: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.enum(["repositories"])), + ) + .optional(), }) export const _GET = diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/migrations/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/migrations/route.ts index f996dba0..468d14b7 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/migrations/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/migrations/route.ts @@ -60,7 +60,12 @@ const migrationsListForOrgParamSchema = z.object({ org: z.string() }) const migrationsListForOrgQuerySchema = z.object({ per_page: z.coerce.number().optional(), page: z.coerce.number().optional(), - exclude: z.array(z.enum(["repositories"])).optional(), + exclude: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.enum(["repositories"])), + ) + .optional(), }) export const _GET = diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/route.ts index 135a8f22..7e5ed040 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/route.ts @@ -3,10 +3,7 @@ /* eslint-disable */ import { - t_OrgsDeleteCustomOrganizationRoleParamSchema, t_OrgsGetOrgRoleParamSchema, - t_OrgsPatchCustomOrganizationRoleBodySchema, - t_OrgsPatchCustomOrganizationRoleParamSchema, t_basic_error, t_organization_role, t_validation_error, @@ -36,33 +33,6 @@ export type OrgsGetOrgRole = ( ctx: { request: NextRequest }, ) => Promise> -export type OrgsPatchCustomOrganizationRoleResponder = { - with200(): KoaRuntimeResponse - with404(): KoaRuntimeResponse - with409(): KoaRuntimeResponse - with422(): KoaRuntimeResponse -} & KoaRuntimeResponder - -export type OrgsPatchCustomOrganizationRole = ( - params: Params< - t_OrgsPatchCustomOrganizationRoleParamSchema, - void, - t_OrgsPatchCustomOrganizationRoleBodySchema - >, - respond: OrgsPatchCustomOrganizationRoleResponder, - ctx: { request: NextRequest }, -) => Promise> - -export type OrgsDeleteCustomOrganizationRoleResponder = { - with204(): KoaRuntimeResponse -} & KoaRuntimeResponder - -export type OrgsDeleteCustomOrganizationRole = ( - params: Params, - respond: OrgsDeleteCustomOrganizationRoleResponder, - ctx: { request: NextRequest }, -) => Promise> - const orgsGetOrgRoleParamSchema = z.object({ org: z.string(), role_id: z.coerce.number(), @@ -110,106 +80,3 @@ export const _GET = ? Response.json(body, { status }) : new Response(undefined, { status }) } - -const orgsPatchCustomOrganizationRoleParamSchema = z.object({ - org: z.string(), - role_id: z.coerce.number(), -}) - -const orgsPatchCustomOrganizationRoleBodySchema = z.object({ - name: z.string().optional(), - description: z.string().optional(), - permissions: z.array(z.string()).optional(), -}) - -export const _PATCH = - (implementation: OrgsPatchCustomOrganizationRole) => - async ( - request: NextRequest, - { params }: { params: unknown }, - ): Promise => { - const input = { - params: parseRequestInput( - orgsPatchCustomOrganizationRoleParamSchema, - params, - RequestInputType.RouteParam, - ), - // TODO: this swallows repeated parameters - query: undefined, - body: parseRequestInput( - orgsPatchCustomOrganizationRoleBodySchema, - await request.json(), - RequestInputType.RequestBody, - ), - } - - const responder = { - with200() { - return new KoaRuntimeResponse(200) - }, - with404() { - return new KoaRuntimeResponse(404) - }, - with409() { - return new KoaRuntimeResponse(409) - }, - with422() { - return new KoaRuntimeResponse(422) - }, - withStatus(status: StatusCode) { - return new KoaRuntimeResponse(status) - }, - } - - const { status, body } = await implementation(input, responder, { request }) - .then((it) => it.unpack()) - .catch((err) => { - throw KoaRuntimeError.HandlerError(err) - }) - - return body !== undefined - ? Response.json(body, { status }) - : new Response(undefined, { status }) - } - -const orgsDeleteCustomOrganizationRoleParamSchema = z.object({ - org: z.string(), - role_id: z.coerce.number(), -}) - -export const _DELETE = - (implementation: OrgsDeleteCustomOrganizationRole) => - async ( - request: NextRequest, - { params }: { params: unknown }, - ): Promise => { - const input = { - params: parseRequestInput( - orgsDeleteCustomOrganizationRoleParamSchema, - params, - RequestInputType.RouteParam, - ), - // TODO: this swallows repeated parameters - query: undefined, - body: undefined, - } - - const responder = { - with204() { - return new KoaRuntimeResponse(204) - }, - withStatus(status: StatusCode) { - return new KoaRuntimeResponse(status) - }, - } - - const { status, body } = await implementation(input, responder, { request }) - .then((it) => it.unpack()) - .catch((err) => { - throw KoaRuntimeError.HandlerError(err) - }) - - return body !== undefined - ? Response.json(body, { status }) - : new Response(undefined, { status }) - } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/teams/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/teams/route.ts index 69c289c3..f4ef4d1a 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/teams/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/teams/route.ts @@ -5,7 +5,7 @@ import { t_OrgsListOrgRoleTeamsParamSchema, t_OrgsListOrgRoleTeamsQuerySchema, - t_team, + t_team_role_assignment, } from "../../../../../models" import { KoaRuntimeError, @@ -21,7 +21,7 @@ import { NextRequest } from "next/server" import { z } from "zod" export type OrgsListOrgRoleTeamsResponder = { - with200(): KoaRuntimeResponse + with200(): KoaRuntimeResponse with404(): KoaRuntimeResponse with422(): KoaRuntimeResponse } & KoaRuntimeResponder @@ -69,7 +69,7 @@ export const _GET = const responder = { with200() { - return new KoaRuntimeResponse(200) + return new KoaRuntimeResponse(200) }, with404() { return new KoaRuntimeResponse(404) diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/users/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/users/route.ts index 8e074fa4..7c9e7426 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/users/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/[role_id]/users/route.ts @@ -5,7 +5,7 @@ import { t_OrgsListOrgRoleUsersParamSchema, t_OrgsListOrgRoleUsersQuerySchema, - t_simple_user, + t_user_role_assignment, } from "../../../../../models" import { KoaRuntimeError, @@ -21,7 +21,7 @@ import { NextRequest } from "next/server" import { z } from "zod" export type OrgsListOrgRoleUsersResponder = { - with200(): KoaRuntimeResponse + with200(): KoaRuntimeResponse with404(): KoaRuntimeResponse with422(): KoaRuntimeResponse } & KoaRuntimeResponder @@ -69,7 +69,7 @@ export const _GET = const responder = { with200() { - return new KoaRuntimeResponse(200) + return new KoaRuntimeResponse(200) }, with404() { return new KoaRuntimeResponse(404) diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/route.ts index ce2b2023..02a701ff 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/organization-roles/route.ts @@ -3,8 +3,6 @@ /* eslint-disable */ import { - t_OrgsCreateCustomOrganizationRoleBodySchema, - t_OrgsCreateCustomOrganizationRoleParamSchema, t_OrgsListOrgRolesParamSchema, t_basic_error, t_organization_role, @@ -38,23 +36,6 @@ export type OrgsListOrgRoles = ( ctx: { request: NextRequest }, ) => Promise> -export type OrgsCreateCustomOrganizationRoleResponder = { - with201(): KoaRuntimeResponse - with404(): KoaRuntimeResponse - with409(): KoaRuntimeResponse - with422(): KoaRuntimeResponse -} & KoaRuntimeResponder - -export type OrgsCreateCustomOrganizationRole = ( - params: Params< - t_OrgsCreateCustomOrganizationRoleParamSchema, - void, - t_OrgsCreateCustomOrganizationRoleBodySchema - >, - respond: OrgsCreateCustomOrganizationRoleResponder, - ctx: { request: NextRequest }, -) => Promise> - const orgsListOrgRolesParamSchema = z.object({ org: z.string() }) export const _GET = @@ -102,63 +83,3 @@ export const _GET = ? Response.json(body, { status }) : new Response(undefined, { status }) } - -const orgsCreateCustomOrganizationRoleParamSchema = z.object({ - org: z.string(), -}) - -const orgsCreateCustomOrganizationRoleBodySchema = z.object({ - name: z.string(), - description: z.string().optional(), - permissions: z.array(z.string()), -}) - -export const _POST = - (implementation: OrgsCreateCustomOrganizationRole) => - async ( - request: NextRequest, - { params }: { params: unknown }, - ): Promise => { - const input = { - params: parseRequestInput( - orgsCreateCustomOrganizationRoleParamSchema, - params, - RequestInputType.RouteParam, - ), - // TODO: this swallows repeated parameters - query: undefined, - body: parseRequestInput( - orgsCreateCustomOrganizationRoleBodySchema, - await request.json(), - RequestInputType.RequestBody, - ), - } - - const responder = { - with201() { - return new KoaRuntimeResponse(201) - }, - with404() { - return new KoaRuntimeResponse(404) - }, - with409() { - return new KoaRuntimeResponse(409) - }, - with422() { - return new KoaRuntimeResponse(422) - }, - withStatus(status: StatusCode) { - return new KoaRuntimeResponse(status) - }, - } - - const { status, body } = await implementation(input, responder, { request }) - .then((it) => it.unpack()) - .catch((err) => { - throw KoaRuntimeError.HandlerError(err) - }) - - return body !== undefined - ? Response.json(body, { status }) - : new Response(undefined, { status }) - } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/personal-access-token-requests/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/personal-access-token-requests/route.ts index 859f6cfc..dc5b164a 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/personal-access-token-requests/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/personal-access-token-requests/route.ts @@ -71,7 +71,12 @@ const orgsListPatGrantRequestsQuerySchema = z.object({ page: z.coerce.number().optional(), sort: z.enum(["created_at"]).optional(), direction: z.enum(["asc", "desc"]).optional(), - owner: z.array(z.string()).max(10).optional(), + 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(), diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/personal-access-tokens/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/personal-access-tokens/route.ts index aaf88aed..588b9cea 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/personal-access-tokens/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/personal-access-tokens/route.ts @@ -69,7 +69,12 @@ const orgsListPatGrantsQuerySchema = z.object({ page: z.coerce.number().optional(), sort: z.enum(["created_at"]).optional(), direction: z.enum(["asc", "desc"]).optional(), - owner: z.array(z.string()).max(10).optional(), + 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(), diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/properties/schema/[custom_property_name]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/properties/schema/[custom_property_name]/route.ts index 6f62a3d1..138ea77c 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/properties/schema/[custom_property_name]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/properties/schema/[custom_property_name]/route.ts @@ -8,7 +8,7 @@ import { t_OrgsGetCustomPropertyParamSchema, t_OrgsRemoveCustomPropertyParamSchema, t_basic_error, - t_org_custom_property, + t_custom_property, } from "../../../../../models" import { PermissiveBoolean } from "../../../../../schemas" import { @@ -25,7 +25,7 @@ import { NextRequest } from "next/server" import { z } from "zod" export type OrgsGetCustomPropertyResponder = { - with200(): KoaRuntimeResponse + with200(): KoaRuntimeResponse with403(): KoaRuntimeResponse with404(): KoaRuntimeResponse } & KoaRuntimeResponder @@ -37,7 +37,7 @@ export type OrgsGetCustomProperty = ( ) => Promise> export type OrgsCreateOrUpdateCustomPropertyResponder = { - with200(): KoaRuntimeResponse + with200(): KoaRuntimeResponse with403(): KoaRuntimeResponse with404(): KoaRuntimeResponse } & KoaRuntimeResponder @@ -88,7 +88,7 @@ export const _GET = const responder = { with200() { - return new KoaRuntimeResponse(200) + return new KoaRuntimeResponse(200) }, with403() { return new KoaRuntimeResponse(403) @@ -118,7 +118,7 @@ const orgsCreateOrUpdateCustomPropertyParamSchema = z.object({ }) const orgsCreateOrUpdateCustomPropertyBodySchema = z.object({ - value_type: z.enum(["string", "single_select"]), + value_type: z.enum(["string", "single_select", "multi_select", "true_false"]), required: PermissiveBoolean.optional(), default_value: z .union([z.string(), z.array(z.string())]) @@ -151,7 +151,7 @@ export const _PUT = const responder = { with200() { - return new KoaRuntimeResponse(200) + return new KoaRuntimeResponse(200) }, with403() { return new KoaRuntimeResponse(403) diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/properties/schema/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/properties/schema/route.ts index 9c7bf7d2..5537db33 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/properties/schema/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/properties/schema/route.ts @@ -7,9 +7,9 @@ import { t_OrgsCreateOrUpdateCustomPropertiesParamSchema, t_OrgsGetAllCustomPropertiesParamSchema, t_basic_error, - t_org_custom_property, + t_custom_property, } from "../../../../models" -import { s_org_custom_property } from "../../../../schemas" +import { s_custom_property } from "../../../../schemas" import { KoaRuntimeError, RequestInputType, @@ -24,7 +24,7 @@ import { NextRequest } from "next/server" import { z } from "zod" export type OrgsGetAllCustomPropertiesResponder = { - with200(): KoaRuntimeResponse + with200(): KoaRuntimeResponse with403(): KoaRuntimeResponse with404(): KoaRuntimeResponse } & KoaRuntimeResponder @@ -36,7 +36,7 @@ export type OrgsGetAllCustomProperties = ( ) => Promise> export type OrgsCreateOrUpdateCustomPropertiesResponder = { - with200(): KoaRuntimeResponse + with200(): KoaRuntimeResponse with403(): KoaRuntimeResponse with404(): KoaRuntimeResponse } & KoaRuntimeResponder @@ -72,7 +72,7 @@ export const _GET = const responder = { with200() { - return new KoaRuntimeResponse(200) + return new KoaRuntimeResponse(200) }, with403() { return new KoaRuntimeResponse(403) @@ -101,7 +101,7 @@ const orgsCreateOrUpdateCustomPropertiesParamSchema = z.object({ }) const orgsCreateOrUpdateCustomPropertiesBodySchema = z.object({ - properties: z.array(s_org_custom_property).min(1).max(100), + properties: z.array(s_custom_property).min(1).max(100), }) export const _PATCH = @@ -127,7 +127,7 @@ export const _PATCH = const responder = { with200() { - return new KoaRuntimeResponse(200) + return new KoaRuntimeResponse(200) }, with403() { return new KoaRuntimeResponse(403) diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/repos/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/repos/route.ts index 02de679e..0092d73e 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/repos/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/repos/route.ts @@ -140,7 +140,7 @@ const reposCreateInOrgBodySchema = z.object({ .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.any()).optional(), + custom_properties: z.record(z.unknown()).optional(), }) export const _POST = diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/rulesets/[ruleset_id]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/rulesets/[ruleset_id]/route.ts index 7f3829b0..5dad69bd 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/rulesets/[ruleset_id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/rulesets/[ruleset_id]/route.ts @@ -125,7 +125,7 @@ const reposUpdateOrgRulesetParamSchema = z.object({ const reposUpdateOrgRulesetBodySchema = z .object({ name: z.string().optional(), - target: z.enum(["branch", "tag"]).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_org_ruleset_conditions.optional(), diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/rulesets/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/rulesets/route.ts index d69c3a64..ac7bae93 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/rulesets/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/rulesets/route.ts @@ -119,7 +119,7 @@ const reposCreateOrgRulesetParamSchema = z.object({ org: z.string() }) const reposCreateOrgRulesetBodySchema = z.object({ name: z.string(), - target: z.enum(["branch", "tag"]).optional(), + target: z.enum(["branch", "tag", "push"]).optional(), enforcement: s_repository_rule_enforcement, bypass_actors: z.array(s_repository_ruleset_bypass_actor).optional(), conditions: s_org_ruleset_conditions.optional(), diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/rulesets/rule-suites/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/rulesets/rule-suites/route.ts index 1d642859..1d6e6d30 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/rulesets/rule-suites/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/rulesets/rule-suites/route.ts @@ -40,6 +40,7 @@ export type ReposGetOrgRuleSuites = ( const reposGetOrgRuleSuitesParamSchema = z.object({ org: z.string() }) const reposGetOrgRuleSuitesQuerySchema = z.object({ + ref: z.string().optional(), repository_name: z.coerce.number().optional(), time_period: z.enum(["hour", "day", "week", "month"]).optional(), actor_name: z.string().optional(), diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/security-managers/teams/[team_slug]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/security-managers/teams/[team_slug]/route.ts index 4137bee3..083ac376 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/security-managers/teams/[team_slug]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/security-managers/teams/[team_slug]/route.ts @@ -21,7 +21,6 @@ import { z } from "zod" export type OrgsAddSecurityManagerTeamResponder = { with204(): KoaRuntimeResponse - with409(): KoaRuntimeResponse } & KoaRuntimeResponder export type OrgsAddSecurityManagerTeam = ( @@ -66,9 +65,6 @@ export const _PUT = with204() { return new KoaRuntimeResponse(204) }, - with409() { - return new KoaRuntimeResponse(409) - }, withStatus(status: StatusCode) { return new KoaRuntimeResponse(status) }, diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/team/[team_slug]/copilot/usage/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/team/[team_slug]/copilot/usage/route.ts new file mode 100644 index 00000000..0a9c6274 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/orgs/[org]/team/[team_slug]/copilot/usage/route.ts @@ -0,0 +1,105 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CopilotUsageMetricsForTeamParamSchema, + t_CopilotUsageMetricsForTeamQuerySchema, + t_basic_error, + t_copilot_usage_metrics, +} from "../../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type CopilotUsageMetricsForTeamResponder = { + with200(): KoaRuntimeResponse + with401(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse + with500(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type CopilotUsageMetricsForTeam = ( + params: Params< + t_CopilotUsageMetricsForTeamParamSchema, + t_CopilotUsageMetricsForTeamQuerySchema, + void + >, + respond: CopilotUsageMetricsForTeamResponder, + ctx: { request: NextRequest }, +) => Promise> + +const copilotUsageMetricsForTeamParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), +}) + +const copilotUsageMetricsForTeamQuerySchema = z.object({ + since: z.string().optional(), + until: z.string().optional(), + page: z.coerce.number().optional(), + per_page: z.coerce.number().optional(), +}) + +export const _GET = + (implementation: CopilotUsageMetricsForTeam) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + copilotUsageMetricsForTeamParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + copilotUsageMetricsForTeamQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with401() { + return new KoaRuntimeResponse(401) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + with500() { + return new KoaRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/actions/workflows/[workflow_id]/dispatches/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/actions/workflows/[workflow_id]/dispatches/route.ts index 7f519e46..f5a6c45f 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/actions/workflows/[workflow_id]/dispatches/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/actions/workflows/[workflow_id]/dispatches/route.ts @@ -41,7 +41,7 @@ const actionsCreateWorkflowDispatchParamSchema = z.object({ const actionsCreateWorkflowDispatchBodySchema = z.object({ ref: z.string(), - inputs: z.record(z.any()).optional(), + inputs: z.record(z.unknown()).optional(), }) export const _POST = diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/attestations/[subject_digest]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/attestations/[subject_digest]/route.ts new file mode 100644 index 00000000..0dabe536 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/attestations/[subject_digest]/route.ts @@ -0,0 +1,113 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_ReposListAttestationsParamSchema, + t_ReposListAttestationsQuerySchema, +} from "../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type ReposListAttestationsResponder = { + with200(): KoaRuntimeResponse<{ + attestations?: { + bundle?: { + dsseEnvelope?: { + [key: string]: unknown | undefined + } + mediaType?: string + verificationMaterial?: { + [key: string]: unknown | undefined + } + } + repository_id?: number + }[] + }> +} & KoaRuntimeResponder + +export type ReposListAttestations = ( + params: Params< + t_ReposListAttestationsParamSchema, + t_ReposListAttestationsQuerySchema, + void + >, + respond: ReposListAttestationsResponder, + ctx: { request: NextRequest }, +) => Promise> + +const reposListAttestationsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + subject_digest: z.string(), +}) + +const reposListAttestationsQuerySchema = z.object({ + per_page: z.coerce.number().optional(), + before: z.string().optional(), + after: z.string().optional(), +}) + +export const _GET = + (implementation: ReposListAttestations) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + reposListAttestationsParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + reposListAttestationsQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse<{ + attestations?: { + bundle?: { + dsseEnvelope?: { + [key: string]: unknown | undefined + } + mediaType?: string + verificationMaterial?: { + [key: string]: unknown | undefined + } + } + repository_id?: number + }[] + }>(200) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/attestations/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/attestations/route.ts new file mode 100644 index 00000000..99b451a3 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/attestations/route.ts @@ -0,0 +1,102 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_ReposCreateAttestationBodySchema, + t_ReposCreateAttestationParamSchema, + t_basic_error, + t_validation_error, +} from "../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type ReposCreateAttestationResponder = { + with201(): KoaRuntimeResponse<{ + id?: number + }> + with403(): KoaRuntimeResponse + with422(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type ReposCreateAttestation = ( + params: Params< + t_ReposCreateAttestationParamSchema, + void, + t_ReposCreateAttestationBodySchema + >, + respond: ReposCreateAttestationResponder, + ctx: { request: NextRequest }, +) => Promise> + +const reposCreateAttestationParamSchema = z.object({ + owner: z.string(), + repo: z.string(), +}) + +const reposCreateAttestationBodySchema = z.object({ + bundle: z.object({ + mediaType: z.string().optional(), + verificationMaterial: z.record(z.unknown()).optional(), + dsseEnvelope: z.record(z.unknown()).optional(), + }), +}) + +export const _POST = + (implementation: ReposCreateAttestation) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + reposCreateAttestationParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + reposCreateAttestationBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with201() { + return new KoaRuntimeResponse<{ + id?: number + }>(201) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with422() { + return new KoaRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/check-runs/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/check-runs/route.ts index 799be9d4..c6b2b2e4 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/check-runs/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/check-runs/route.ts @@ -36,10 +36,10 @@ const checksCreateParamSchema = z.object({ }) const checksCreateBodySchema = z.union([ - z.intersection(z.object({ status: z.object({}) }), z.record(z.any())), + z.intersection(z.object({ status: z.object({}) }), z.record(z.unknown())), z.intersection( z.object({ status: z.object({}).optional() }), - z.record(z.any()), + z.record(z.unknown()), ), ]) diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/[codeql_variant_analysis_id]/repos/[repo_owner]/[repo_name]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/[codeql_variant_analysis_id]/repos/[repo_owner]/[repo_name]/route.ts new file mode 100644 index 00000000..10e203bc --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/[codeql_variant_analysis_id]/repos/[repo_owner]/[repo_name]/route.ts @@ -0,0 +1,98 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CodeScanningGetVariantAnalysisRepoTaskParamSchema, + t_basic_error, + t_code_scanning_variant_analysis_repo_task, +} from "../../../../../../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type CodeScanningGetVariantAnalysisRepoTaskResponder = { + with200(): KoaRuntimeResponse + with404(): KoaRuntimeResponse + with503(): KoaRuntimeResponse<{ + code?: string + documentation_url?: string + message?: string + }> +} & KoaRuntimeResponder + +export type CodeScanningGetVariantAnalysisRepoTask = ( + params: Params< + t_CodeScanningGetVariantAnalysisRepoTaskParamSchema, + void, + void + >, + respond: CodeScanningGetVariantAnalysisRepoTaskResponder, + ctx: { request: NextRequest }, +) => Promise> + +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(), +}) + +export const _GET = + (implementation: CodeScanningGetVariantAnalysisRepoTask) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + codeScanningGetVariantAnalysisRepoTaskParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse( + 200, + ) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + with503() { + return new KoaRuntimeResponse<{ + code?: string + documentation_url?: string + message?: string + }>(503) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/[codeql_variant_analysis_id]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/[codeql_variant_analysis_id]/route.ts new file mode 100644 index 00000000..482449c0 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/[codeql_variant_analysis_id]/route.ts @@ -0,0 +1,90 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CodeScanningGetVariantAnalysisParamSchema, + t_basic_error, + t_code_scanning_variant_analysis, +} from "../../../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type CodeScanningGetVariantAnalysisResponder = { + with200(): KoaRuntimeResponse + with404(): KoaRuntimeResponse + with503(): KoaRuntimeResponse<{ + code?: string + documentation_url?: string + message?: string + }> +} & KoaRuntimeResponder + +export type CodeScanningGetVariantAnalysis = ( + params: Params, + respond: CodeScanningGetVariantAnalysisResponder, + ctx: { request: NextRequest }, +) => Promise> + +const codeScanningGetVariantAnalysisParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + codeql_variant_analysis_id: z.coerce.number(), +}) + +export const _GET = + (implementation: CodeScanningGetVariantAnalysis) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + codeScanningGetVariantAnalysisParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + with503() { + return new KoaRuntimeResponse<{ + code?: string + documentation_url?: string + message?: string + }>(503) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/route.ts new file mode 100644 index 00000000..1e62c654 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/code-scanning/codeql/variant-analyses/route.ts @@ -0,0 +1,108 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CodeScanningCreateVariantAnalysisBodySchema, + t_CodeScanningCreateVariantAnalysisParamSchema, + t_basic_error, + t_code_scanning_variant_analysis, +} from "../../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type CodeScanningCreateVariantAnalysisResponder = { + with201(): KoaRuntimeResponse + with404(): KoaRuntimeResponse + with422(): KoaRuntimeResponse + with503(): KoaRuntimeResponse<{ + code?: string + documentation_url?: string + message?: string + }> +} & KoaRuntimeResponder + +export type CodeScanningCreateVariantAnalysis = ( + params: Params< + t_CodeScanningCreateVariantAnalysisParamSchema, + void, + t_CodeScanningCreateVariantAnalysisBodySchema + >, + respond: CodeScanningCreateVariantAnalysisResponder, + ctx: { request: NextRequest }, +) => Promise> + +const codeScanningCreateVariantAnalysisParamSchema = z.object({ + owner: z.string(), + repo: z.string(), +}) + +const codeScanningCreateVariantAnalysisBodySchema = z.union([ + z.object({}), + z.object({}), + z.object({}), +]) + +export const _POST = + (implementation: CodeScanningCreateVariantAnalysis) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + codeScanningCreateVariantAnalysisParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + codeScanningCreateVariantAnalysisBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with201() { + return new KoaRuntimeResponse(201) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + with422() { + return new KoaRuntimeResponse(422) + }, + with503() { + return new KoaRuntimeResponse<{ + code?: string + documentation_url?: string + message?: string + }>(503) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/code-security-configuration/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/code-security-configuration/route.ts new file mode 100644 index 00000000..cd78bf72 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/code-security-configuration/route.ts @@ -0,0 +1,95 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CodeSecurityGetConfigurationForRepositoryParamSchema, + t_basic_error, + t_code_security_configuration_for_repository, +} from "../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type CodeSecurityGetConfigurationForRepositoryResponder = { + with200(): KoaRuntimeResponse + with204(): KoaRuntimeResponse + with304(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type CodeSecurityGetConfigurationForRepository = ( + params: Params< + t_CodeSecurityGetConfigurationForRepositoryParamSchema, + void, + void + >, + respond: CodeSecurityGetConfigurationForRepositoryResponder, + ctx: { request: NextRequest }, +) => Promise> + +const codeSecurityGetConfigurationForRepositoryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), +}) + +export const _GET = + (implementation: CodeSecurityGetConfigurationForRepository) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + codeSecurityGetConfigurationForRepositoryParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse( + 200, + ) + }, + with204() { + return new KoaRuntimeResponse(204) + }, + with304() { + return new KoaRuntimeResponse(304) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/contents/[path]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/contents/[path]/route.ts index 8081c457..0c6727f0 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/contents/[path]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/contents/[path]/route.ts @@ -38,6 +38,7 @@ export type ReposGetContentResponder = { | t_content_submodule > with302(): KoaRuntimeResponse + with304(): KoaRuntimeResponse with403(): KoaRuntimeResponse with404(): KoaRuntimeResponse } & KoaRuntimeResponder @@ -133,6 +134,9 @@ export const _GET = with302() { return new KoaRuntimeResponse(302) }, + with304() { + return new KoaRuntimeResponse(304) + }, with403() { return new KoaRuntimeResponse(403) }, diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/deployments/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/deployments/route.ts index 8cbaa76c..e414962e 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/deployments/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/deployments/route.ts @@ -122,7 +122,7 @@ const reposCreateDeploymentBodySchema = z.object({ task: z.string().optional(), auto_merge: PermissiveBoolean.optional(), required_contexts: z.array(z.string()).optional(), - payload: z.union([z.record(z.any()), z.string()]).optional(), + payload: z.union([z.record(z.unknown()), z.string()]).optional(), environment: z.string().optional(), description: z.string().nullable().optional(), transient_environment: PermissiveBoolean.optional(), diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/dispatches/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/dispatches/route.ts index b826c2e0..9fa0d8fa 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/dispatches/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/dispatches/route.ts @@ -44,7 +44,7 @@ const reposCreateDispatchEventParamSchema = z.object({ const reposCreateDispatchEventBodySchema = z.object({ event_type: z.string().min(1).max(100), - client_payload: z.record(z.any()).optional(), + client_payload: z.record(z.unknown()).optional(), }) export const _POST = diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/readme/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/readme/route.ts index 0b2a572b..3716708c 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/readme/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/readme/route.ts @@ -24,6 +24,7 @@ import { z } from "zod" export type ReposGetReadmeResponder = { with200(): KoaRuntimeResponse + with304(): KoaRuntimeResponse with404(): KoaRuntimeResponse with422(): KoaRuntimeResponse } & KoaRuntimeResponder @@ -70,6 +71,9 @@ export const _GET = with200() { return new KoaRuntimeResponse(200) }, + with304() { + return new KoaRuntimeResponse(304) + }, with404() { return new KoaRuntimeResponse(404) }, diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/route.ts index 212bc9d6..4ebfe126 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/route.ts @@ -138,6 +138,9 @@ const reposUpdateBodySchema = z secret_scanning_push_protection: z .object({ status: z.string().optional() }) .optional(), + secret_scanning_non_provider_patterns: z + .object({ status: z.string().optional() }) + .optional(), }) .nullable() .optional(), diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/rulesets/[ruleset_id]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/rulesets/[ruleset_id]/route.ts index 9bba3efb..ea685270 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/rulesets/[ruleset_id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/rulesets/[ruleset_id]/route.ts @@ -141,7 +141,7 @@ const reposUpdateRepoRulesetParamSchema = z.object({ const reposUpdateRepoRulesetBodySchema = z .object({ name: z.string().optional(), - target: z.enum(["branch", "tag"]).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(), diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/rulesets/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/rulesets/route.ts index 8e9a4f87..af926d5c 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/rulesets/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/rulesets/route.ts @@ -127,7 +127,7 @@ const reposCreateRepoRulesetParamSchema = z.object({ const reposCreateRepoRulesetBodySchema = z.object({ name: z.string(), - target: z.enum(["branch", "tag"]).optional(), + target: z.enum(["branch", "tag", "push"]).optional(), enforcement: s_repository_rule_enforcement, bypass_actors: z.array(s_repository_ruleset_bypass_actor).optional(), conditions: s_repository_ruleset_conditions.optional(), diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/secret-scanning/push-protection-bypasses/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/secret-scanning/push-protection-bypasses/route.ts new file mode 100644 index 00000000..fcf4e708 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/repos/[owner]/[repo]/secret-scanning/push-protection-bypasses/route.ts @@ -0,0 +1,116 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_SecretScanningCreatePushProtectionBypassBodySchema, + t_SecretScanningCreatePushProtectionBypassParamSchema, + t_secret_scanning_push_protection_bypass, +} from "../../../../../models" +import { + s_secret_scanning_push_protection_bypass_placeholder_id, + s_secret_scanning_push_protection_bypass_reason, +} from "../../../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type SecretScanningCreatePushProtectionBypassResponder = { + with200(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse + with422(): KoaRuntimeResponse + with503(): KoaRuntimeResponse<{ + code?: string + documentation_url?: string + message?: string + }> +} & KoaRuntimeResponder + +export type SecretScanningCreatePushProtectionBypass = ( + params: Params< + t_SecretScanningCreatePushProtectionBypassParamSchema, + void, + t_SecretScanningCreatePushProtectionBypassBodySchema + >, + respond: SecretScanningCreatePushProtectionBypassResponder, + ctx: { request: NextRequest }, +) => Promise> + +const secretScanningCreatePushProtectionBypassParamSchema = z.object({ + owner: z.string(), + repo: z.string(), +}) + +const secretScanningCreatePushProtectionBypassBodySchema = z.object({ + reason: s_secret_scanning_push_protection_bypass_reason, + placeholder_id: s_secret_scanning_push_protection_bypass_placeholder_id, +}) + +export const _POST = + (implementation: SecretScanningCreatePushProtectionBypass) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + secretScanningCreatePushProtectionBypassParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + secretScanningCreatePushProtectionBypassBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse( + 200, + ) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + with422() { + return new KoaRuntimeResponse(422) + }, + with503() { + return new KoaRuntimeResponse<{ + code?: string + documentation_url?: string + message?: string + }>(503) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/schemas.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/schemas.ts index 7ffcc6db..75a214e7 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/schemas.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/schemas.ts @@ -149,7 +149,9 @@ export const s_api_overview = z.object({ 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(), dependabot: z.array(z.string()).optional(), + copilot: z.array(z.string()).optional(), domains: z .object({ website: z.array(z.string()).optional(), @@ -463,13 +465,13 @@ export const s_code_scanning_alert_rule = z.object({ export const s_code_scanning_alert_rule_summary = z.object({ id: z.string().nullable().optional(), name: z.string().optional(), - tags: z.array(z.string()).nullable().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(), + tags: z.array(z.string()).nullable().optional(), }) export const s_code_scanning_alert_set_state = z.enum(["open", "dismissed"]) @@ -589,6 +591,79 @@ export const s_code_scanning_sarifs_status = z.object({ errors: z.array(z.string()).nullable().optional(), }) +export const s_code_scanning_variant_analysis_language = z.enum([ + "cpp", + "csharp", + "go", + "java", + "javascript", + "python", + "ruby", + "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"]).optional(), + description: z.string().optional(), + advanced_security: z.enum(["enabled", "disabled"]).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(), + 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(), + 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({ @@ -819,6 +894,34 @@ export const s_copilot_seat_breakdown = z.object({ inactive_this_cycle: z.coerce.number().optional(), }) +export const s_copilot_usage_metrics = z.object({ + day: z.string(), + total_suggestions_count: z.coerce.number().optional(), + total_acceptances_count: z.coerce.number().optional(), + total_lines_suggested: z.coerce.number().optional(), + total_lines_accepted: z.coerce.number().optional(), + total_active_users: z.coerce.number().optional(), + total_chat_acceptances: z.coerce.number().optional(), + total_chat_turns: z.coerce.number().optional(), + total_active_chat_users: z.coerce.number().optional(), + breakdown: z + .array( + z.intersection( + z.object({ + language: z.string().optional(), + editor: z.string().optional(), + suggestions_count: z.coerce.number().optional(), + acceptances_count: z.coerce.number().optional(), + lines_suggested: z.coerce.number().optional(), + lines_accepted: z.coerce.number().optional(), + active_users: z.coerce.number().optional(), + }), + z.record(z.unknown()), + ), + ) + .nullable(), +}) + export const s_custom_deployment_rule_app = z.object({ id: z.coerce.number(), slug: z.string(), @@ -826,6 +929,23 @@ export const s_custom_deployment_rule_app = z.object({ node_id: z.string(), }) +export const s_custom_property = z.object({ + property_name: z.string(), + url: z.string().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_value = z.object({ property_name: z.string(), value: z.union([z.string(), z.array(z.string())]).nullable(), @@ -891,6 +1011,7 @@ export const s_dependency_graph_spdx_sbom = z.object({ licenseConcluded: z.string().optional(), licenseDeclared: z.string().optional(), supplier: z.string().optional(), + copyrightText: z.string().optional(), externalRefs: z .array( z.object({ @@ -988,6 +1109,19 @@ export const s_enterprise = z.object({ 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.coerce.number().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({ @@ -1138,7 +1272,7 @@ export const s_gpg_key = z.object({ }), ) .optional(), - subkeys: z.array(z.object({})).optional(), + subkeys: z.array(z.unknown()).optional(), can_sign: PermissiveBoolean.optional(), can_encrypt_comms: PermissiveBoolean.optional(), can_encrypt_storage: PermissiveBoolean.optional(), @@ -1171,13 +1305,14 @@ export const s_hook_delivery = z.object({ 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.any()).nullable(), - payload: z.record(z.any()).nullable(), + headers: z.record(z.unknown()).nullable(), + payload: z.record(z.unknown()).nullable(), }), response: z.object({ - headers: z.record(z.any()).nullable(), + headers: z.record(z.unknown()).nullable(), payload: z.string().nullable(), }), }) @@ -1194,6 +1329,7 @@ export const s_hook_delivery_item = z.object({ 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({ @@ -1598,22 +1734,6 @@ export const s_oidc_custom_sub_repo = z.object({ include_claim_keys: z.array(z.string()).optional(), }) -export const s_org_custom_property = z.object({ - property_name: z.string(), - value_type: z.enum(["string", "single_select"]), - 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_org_hook = z.object({ id: z.coerce.number(), url: z.string(), @@ -1633,46 +1753,6 @@ export const s_org_hook = z.object({ type: z.string(), }) -export const s_organization = z.object({ - login: z.string(), - url: z.string(), - id: z.coerce.number(), - node_id: 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(), - blog: z.string().optional(), - html_url: z.string(), - name: z.string().optional(), - company: z.string().optional(), - location: z.string().optional(), - email: z.string().email().optional(), - has_organization_projects: PermissiveBoolean, - has_repository_projects: PermissiveBoolean, - is_verified: PermissiveBoolean.optional(), - public_repos: z.coerce.number(), - public_gists: z.coerce.number(), - followers: z.coerce.number(), - following: z.coerce.number(), - type: z.string(), - created_at: z.string().datetime({ offset: true }), - updated_at: z.string().datetime({ offset: true }), - plan: z - .object({ - name: z.string().optional(), - space: z.coerce.number().optional(), - private_repos: z.coerce.number().optional(), - filled_seats: z.coerce.number().optional(), - seats: z.coerce.number().optional(), - }) - .optional(), -}) - export const s_organization_actions_secret = z.object({ name: z.string(), created_at: z.string().datetime({ offset: true }), @@ -1698,11 +1778,6 @@ export const s_organization_dependabot_secret = z.object({ selected_repositories_url: z.string().optional(), }) -export const s_organization_fine_grained_permission = z.object({ - name: z.string(), - description: z.string(), -}) - export const s_organization_full = z.object({ login: z.string(), id: z.coerce.number(), @@ -1996,6 +2071,7 @@ export const s_private_user = z.object({ 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(), @@ -2075,6 +2151,7 @@ export const s_public_user = z.object({ 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(), @@ -2235,10 +2312,37 @@ export const s_repository_rule_enforcement = z.enum([ "evaluate", ]) +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(), @@ -2305,12 +2409,14 @@ export const s_repository_rule_update = z.object({ }) export const s_repository_ruleset_bypass_actor = z.object({ - actor_id: z.coerce.number(), + actor_id: z.coerce.number().nullable().optional(), actor_type: z.enum([ "Integration", "OrganizationAdmin", "RepositoryRole", "Team", + "DeployKey", + "EnterpriseTeam", ]), bypass_mode: z.enum(["always", "pull_request"]), }) @@ -2339,7 +2445,11 @@ export const s_repository_ruleset_conditions_repository_name_target = z.object({ }) export const s_repository_ruleset_conditions_repository_property_spec = - z.object({ name: z.string(), property_values: z.array(z.string()) }) + 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, @@ -2563,6 +2673,15 @@ export const s_secret_scanning_location_wiki_commit = z.object({ 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_security_advisory_credit_types = z.enum([ "analyst", "finder", @@ -2606,6 +2725,9 @@ export const s_security_and_analysis = z 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(), }) .nullable() @@ -2619,6 +2741,56 @@ export const s_selected_actions_url = z.string() export const s_short_blob = z.object({ url: z.string(), sha: z.string() }) +export const s_sigstore_bundle_0 = z.object({ + mediaType: z.string().optional(), + verificationMaterial: z + .object({ + x509CertificateChain: z + .object({ + certificates: z + .array(z.object({ rawBytes: z.string().optional() })) + .optional(), + }) + .optional(), + tlogEntries: z + .array( + z.object({ + logIndex: z.string().optional(), + logId: z.object({ keyId: z.string().optional() }).optional(), + kindVersion: z + .object({ + kind: z.string().optional(), + version: z.string().optional(), + }) + .optional(), + integratedTime: z.string().optional(), + inclusionPromise: z + .object({ signedEntryTimestamp: z.string().optional() }) + .optional(), + inclusionProof: z.string().nullable().optional(), + canonicalizedBody: z.string().optional(), + }), + ) + .optional(), + timestampVerificationData: z.string().nullable().optional(), + }) + .optional(), + dsseEnvelope: z + .object({ + payload: z.string().optional(), + payloadType: z.string().optional(), + signatures: z + .array( + z.object({ + sig: z.string().optional(), + keyid: z.string().optional(), + }), + ) + .optional(), + }) + .optional(), +}) + export const s_simple_classroom = z.object({ id: z.coerce.number(), name: z.string(), @@ -2868,6 +3040,30 @@ export const s_traffic = z.object({ count: z.coerce.number(), }) +export const s_user_role_assignment = 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(), +}) + export const s_validation_error = z.object({ message: z.string(), documentation_url: z.string(), @@ -3072,8 +3268,8 @@ export const s_base_gist = z.object({ comments_url: z.string(), owner: s_simple_user.optional(), truncated: PermissiveBoolean.optional(), - forks: z.array(z.object({})).optional(), - history: z.array(z.object({})).optional(), + forks: z.array(z.unknown()).optional(), + history: z.array(z.unknown()).optional(), }) export const s_classroom = z.object({ @@ -3127,6 +3323,27 @@ export const s_code_scanning_sarifs_receipt = z.object({ 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(), @@ -3142,8 +3359,8 @@ export const s_commit = z.object({ tree: z.object({ sha: z.string(), url: z.string() }), verification: s_verification.optional(), }), - author: s_nullable_simple_user, - committer: s_nullable_simple_user, + 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(), @@ -3227,7 +3444,7 @@ export const s_copilot_organization_details = z.intersection( "unconfigured", ]), }), - z.record(z.any()), + z.record(z.unknown()), ) export const s_dependabot_alert_security_vulnerability = z.object({ @@ -3365,34 +3582,36 @@ export const s_installation = z.object({ contact_email: z.string().nullable().optional(), }) -export const s_integration = z.object({ - id: z.coerce.number(), - slug: z.string().optional(), - node_id: z.string(), - owner: s_nullable_simple_user, - 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_id: z.string().optional(), - client_secret: z.string().optional(), - webhook_secret: z.string().nullable().optional(), - pem: z.string().optional(), -}) +export const s_integration = z + .object({ + id: z.coerce.number(), + slug: z.string().optional(), + node_id: z.string(), + owner: s_nullable_simple_user, + 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_id: z.string().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(), @@ -4455,10 +4674,20 @@ export const s_repository_collaborator_permission = z.object({ 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, ), @@ -4471,6 +4700,7 @@ 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(), @@ -4591,6 +4821,12 @@ export const s_secret_scanning_location = z.object({ .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_simple_classroom_assignment = z.object({ id: z.coerce.number(), public_repo: PermissiveBoolean, @@ -4889,6 +5125,31 @@ export const s_team_repository = z.object({ master_branch: z.string().optional(), }) +export const s_team_role_assignment = 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_timeline_reviewed_event = z.object({ event: z.string(), id: z.coerce.number(), @@ -5252,6 +5513,56 @@ export const s_code_scanning_organization_alert_items = z.object({ repository: s_simple_repository, }) +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(), @@ -5268,6 +5579,22 @@ export const s_code_search_result_item = z.object({ 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(), @@ -5417,8 +5744,9 @@ export const s_converted_note_to_issue_issue_event = z.object({ }) export const s_copilot_seat_details = z.object({ - assignee: z.union([s_simple_user, s_team, s_organization]), - assigning_team: s_team.nullable().optional(), + assignee: s_simple_user, + organization: s_organization_simple.nullable().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(), @@ -5467,7 +5795,7 @@ export const s_deployment = z.object({ sha: z.string(), ref: z.string(), task: z.string(), - payload: z.union([z.record(z.any()), z.string()]), + payload: z.union([z.record(z.unknown()), z.string()]), original_environment: z.string().optional(), environment: z.string(), description: z.string().nullable(), @@ -5681,7 +6009,7 @@ export const s_full_repository = z.object({ anonymous_access_enabled: PermissiveBoolean.optional(), code_of_conduct: s_code_of_conduct_simple.optional(), security_and_analysis: s_security_and_analysis.optional(), - custom_properties: z.record(z.any()).optional(), + custom_properties: z.record(z.unknown()).optional(), }) export const s_gist_simple = z.object({ @@ -5726,8 +6054,8 @@ export const s_gist_simple = z.object({ comments_url: z.string(), owner: s_nullable_simple_user.optional(), truncated: PermissiveBoolean.optional(), - forks: z.array(z.object({})).optional(), - history: z.array(z.object({})).optional(), + forks: z.array(z.unknown()).optional(), + history: z.array(z.unknown()).optional(), }) .nullable() .optional(), @@ -6818,6 +7146,7 @@ export const s_repository_rule = z.union([ 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, @@ -6828,7 +7157,32 @@ export const s_repository_rule = z.union([ s_repository_rule_committer_email_pattern, s_repository_rule_branch_name_pattern, s_repository_rule_tag_name_pattern, + z.object({ + type: z.enum(["file_path_restriction"]), + parameters: z + .object({ restricted_file_paths: z.array(z.string()) }) + .optional(), + }), + z.object({ + type: z.enum(["max_file_path_length"]), + parameters: z + .object({ max_file_path_length: z.coerce.number().min(1).max(256) }) + .optional(), + }), + z.object({ + type: z.enum(["file_extension_restriction"]), + parameters: z + .object({ restricted_file_extensions: z.array(z.string()) }) + .optional(), + }), + z.object({ + type: z.enum(["max_file_size"]), + parameters: z + .object({ max_file_size: z.coerce.number().min(1).max(100) }) + .optional(), + }), s_repository_rule_workflows, + s_repository_rule_code_scanning, ]) export const s_repository_rule_detailed = z.union([ @@ -6838,6 +7192,7 @@ export const s_repository_rule_detailed = z.union([ 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), @@ -6857,6 +7212,7 @@ export const s_repository_rule_detailed = z.union([ 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_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({ @@ -7343,7 +7699,7 @@ export const s_issue_event_for_issue = z.union([ export const s_repository_ruleset = z.object({ id: z.coerce.number(), name: z.string(), - target: z.enum(["branch", "tag"]).optional(), + target: z.enum(["branch", "tag", "push"]).optional(), source_type: z.enum(["Repository", "Organization"]).optional(), source: z.string(), enforcement: s_repository_rule_enforcement, diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/user/[account_id]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/user/[account_id]/route.ts new file mode 100644 index 00000000..48e3f9da --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/user/[account_id]/route.ts @@ -0,0 +1,75 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_UsersGetByIdParamSchema, + t_basic_error, + t_private_user, + t_public_user, +} from "../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type UsersGetByIdResponder = { + with200(): KoaRuntimeResponse + with404(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type UsersGetById = ( + params: Params, + respond: UsersGetByIdResponder, + ctx: { request: NextRequest }, +) => Promise> + +const usersGetByIdParamSchema = z.object({ account_id: z.coerce.number() }) + +export const _GET = + (implementation: UsersGetById) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + usersGetByIdParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/user/migrations/[migration_id]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/user/migrations/[migration_id]/route.ts index b53fca29..50c6c466 100644 --- a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/user/migrations/[migration_id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/user/migrations/[migration_id]/route.ts @@ -44,7 +44,12 @@ const migrationsGetStatusForAuthenticatedUserParamSchema = z.object({ }) const migrationsGetStatusForAuthenticatedUserQuerySchema = z.object({ - exclude: z.array(z.string()).optional(), + exclude: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()), + ) + .optional(), }) export const _GET = diff --git a/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/users/[username]/attestations/[subject_digest]/route.ts b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/users/[username]/attestations/[subject_digest]/route.ts new file mode 100644 index 00000000..22411720 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/api.github.com.yaml/users/[username]/attestations/[subject_digest]/route.ts @@ -0,0 +1,111 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_UsersListAttestationsParamSchema, + t_UsersListAttestationsQuerySchema, + t_basic_error, + t_empty_object, + t_sigstore_bundle_0, +} from "../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type UsersListAttestationsResponder = { + with200(): KoaRuntimeResponse<{ + attestations?: { + bundle?: t_sigstore_bundle_0 + repository_id?: number + }[] + }> + with201(): KoaRuntimeResponse + with204(): KoaRuntimeResponse + with404(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type UsersListAttestations = ( + params: Params< + t_UsersListAttestationsParamSchema, + t_UsersListAttestationsQuerySchema, + void + >, + respond: UsersListAttestationsResponder, + ctx: { request: NextRequest }, +) => Promise> + +const usersListAttestationsParamSchema = z.object({ + username: z.string(), + subject_digest: z.string(), +}) + +const usersListAttestationsQuerySchema = z.object({ + per_page: z.coerce.number().optional(), + before: z.string().optional(), + after: z.string().optional(), +}) + +export const _GET = + (implementation: UsersListAttestations) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + usersListAttestationsParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + usersListAttestationsQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse<{ + attestations?: { + bundle?: t_sigstore_bundle_0 + repository_id?: number + }[] + }>(200) + }, + with201() { + return new KoaRuntimeResponse(201) + }, + with204() { + return new KoaRuntimeResponse(204) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/clients/client.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/clients/client.ts new file mode 100644 index 00000000..437e4695 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/clients/client.ts @@ -0,0 +1,878 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_Error, + t_Azure_Core_Foundations_ErrorResponse, + t_Azure_Core_uuid, + t_Manufacturer, + t_OperationState, + t_PagedManufacturer, + t_PagedWidget, + t_PagedWidgetPart, + t_Widget, + t_WidgetAnalytics, + t_WidgetAnalyticsCreateOrUpdate, + t_WidgetCreateOrUpdate, + t_WidgetPart, + t_WidgetPartReorderRequest, + t_WidgetRepairRequest, + t_WidgetRepairState, +} from "../models" +import { + AbstractFetchClient, + AbstractFetchClientConfig, + Res, + StatusCode, + TypedFetchResponse, +} from "@nahkies/typescript-fetch-runtime/main" + +export interface ApiClientConfig extends AbstractFetchClientConfig {} + +export class ApiClient extends AbstractFetchClient { + constructor(config: ApiClientConfig) { + super(config) + } + + async serviceStatus( + p: { + apiVersion: string + xMsClientRequestId?: t_Azure_Core_uuid + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 200, + { + statusString: string + } + > + | Res + > + > { + const url = this.basePath + `/service-status` + const headers = this._headers( + { "x-ms-client-request-id": p["xMsClientRequestId"] }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async widgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatus( + p: { + apiVersion: string + widgetName: string + operationId: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 200, + | { + error?: t_Azure_Core_Foundations_Error + id: string + result?: t_Widget + status: t_OperationState + } + | { + error?: t_Azure_Core_Foundations_Error + id: string + status: t_OperationState + } + > + | Res + > + > { + const url = + this.basePath + + `/widgets/${p["widgetName"]}/operations/${p["operationId"]}` + const headers = this._headers({}, opts.headers) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async widgetsCreateOrUpdateWidget( + p: { + apiVersion: string + widgetName: string + repeatabilityRequestId?: string + repeatabilityFirstSent?: string + ifMatch?: string + ifNoneMatch?: string + ifUnmodifiedSince?: string + ifModifiedSince?: string + xMsClientRequestId?: t_Azure_Core_uuid + requestBody: t_WidgetCreateOrUpdate + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_Widget> + | Res<201, t_Widget> + | Res + > + > { + const url = this.basePath + `/widgets/${p["widgetName"]}` + const headers = this._headers( + { + "Content-Type": "application/merge-patch+json", + "Repeatability-Request-ID": p["repeatabilityRequestId"], + "Repeatability-First-Sent": p["repeatabilityFirstSent"], + "If-Match": p["ifMatch"], + "If-None-Match": p["ifNoneMatch"], + "If-Unmodified-Since": p["ifUnmodifiedSince"], + "If-Modified-Since": p["ifModifiedSince"], + "x-ms-client-request-id": p["xMsClientRequestId"], + }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url + query, + { method: "PATCH", body, ...opts, headers }, + timeout, + ) + } + + async widgetsGetWidget( + p: { + apiVersion: string + widgetName: string + ifMatch?: string + ifNoneMatch?: string + ifUnmodifiedSince?: string + ifModifiedSince?: string + xMsClientRequestId?: t_Azure_Core_uuid + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_Widget> + | Res + > + > { + const url = this.basePath + `/widgets/${p["widgetName"]}` + const headers = this._headers( + { + "If-Match": p["ifMatch"], + "If-None-Match": p["ifNoneMatch"], + "If-Unmodified-Since": p["ifUnmodifiedSince"], + "If-Modified-Since": p["ifModifiedSince"], + "x-ms-client-request-id": p["xMsClientRequestId"], + }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async widgetsDeleteWidget( + p: { + apiVersion: string + widgetName: string + repeatabilityRequestId?: string + repeatabilityFirstSent?: string + ifMatch?: string + ifNoneMatch?: string + ifUnmodifiedSince?: string + ifModifiedSince?: string + xMsClientRequestId?: t_Azure_Core_uuid + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 202, + { + error?: t_Azure_Core_Foundations_Error + id: string + status: t_OperationState + } + > + | Res + > + > { + const url = this.basePath + `/widgets/${p["widgetName"]}` + const headers = this._headers( + { + "Repeatability-Request-ID": p["repeatabilityRequestId"], + "Repeatability-First-Sent": p["repeatabilityFirstSent"], + "If-Match": p["ifMatch"], + "If-None-Match": p["ifNoneMatch"], + "If-Unmodified-Since": p["ifUnmodifiedSince"], + "If-Modified-Since": p["ifModifiedSince"], + "x-ms-client-request-id": p["xMsClientRequestId"], + }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "DELETE", ...opts, headers }, + timeout, + ) + } + + async widgetsListWidgets( + p: { + apiVersion: string + top?: number + skip?: number + maxpagesize?: number + select?: string[] + xMsClientRequestId?: t_Azure_Core_uuid + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_PagedWidget> + | Res + > + > { + const url = this.basePath + `/widgets` + const headers = this._headers( + { "x-ms-client-request-id": p["xMsClientRequestId"] }, + opts.headers, + ) + const query = this._query({ + "api-version": p["apiVersion"], + top: p["top"], + skip: p["skip"], + maxpagesize: p["maxpagesize"], + select: p["select"], + }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async widgetsGetAnalytics( + p: { + apiVersion: string + widgetName: string + ifMatch?: string + ifNoneMatch?: string + ifUnmodifiedSince?: string + ifModifiedSince?: string + xMsClientRequestId?: t_Azure_Core_uuid + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_WidgetAnalytics> + | Res + > + > { + const url = this.basePath + `/widgets/${p["widgetName"]}/analytics/current` + const headers = this._headers( + { + "If-Match": p["ifMatch"], + "If-None-Match": p["ifNoneMatch"], + "If-Unmodified-Since": p["ifUnmodifiedSince"], + "If-Modified-Since": p["ifModifiedSince"], + "x-ms-client-request-id": p["xMsClientRequestId"], + }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async widgetsUpdateAnalytics( + p: { + apiVersion: string + widgetName: string + repeatabilityRequestId?: string + repeatabilityFirstSent?: string + ifMatch?: string + ifNoneMatch?: string + ifUnmodifiedSince?: string + ifModifiedSince?: string + xMsClientRequestId?: t_Azure_Core_uuid + requestBody: t_WidgetAnalyticsCreateOrUpdate + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_WidgetAnalytics> + | Res<201, t_WidgetAnalytics> + | Res + > + > { + const url = this.basePath + `/widgets/${p["widgetName"]}/analytics/current` + const headers = this._headers( + { + "Content-Type": "application/merge-patch+json", + "Repeatability-Request-ID": p["repeatabilityRequestId"], + "Repeatability-First-Sent": p["repeatabilityFirstSent"], + "If-Match": p["ifMatch"], + "If-None-Match": p["ifNoneMatch"], + "If-Unmodified-Since": p["ifUnmodifiedSince"], + "If-Modified-Since": p["ifModifiedSince"], + "x-ms-client-request-id": p["xMsClientRequestId"], + }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url + query, + { method: "PATCH", body, ...opts, headers }, + timeout, + ) + } + + async widgetsGetRepairStatus( + p: { + apiVersion: string + widgetId: string + operationId: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 200, + { + error?: t_Azure_Core_Foundations_Error + id: string + result?: t_WidgetRepairRequest + status: t_OperationState + } + > + | Res + > + > { + const url = + this.basePath + `/widgets/${p["widgetId"]}/repairs/${p["operationId"]}` + const headers = this._headers({}, opts.headers) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async widgetsScheduleRepairs( + p: { + apiVersion: string + widgetName: string + repeatabilityRequestId?: string + repeatabilityFirstSent?: string + xMsClientRequestId?: t_Azure_Core_uuid + requestBody: t_WidgetRepairRequest + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 202, + { + error?: t_Azure_Core_Foundations_Error + id: string + result?: { + completedDateTime: string + createdDateTime: string + requestState: t_WidgetRepairState + scheduledDateTime: string + updatedDateTime: string + } + status: t_OperationState + } + > + | Res + > + > { + const url = this.basePath + `/widgets/${p["widgetName"]}:scheduleRepairs` + const headers = this._headers( + { + "Content-Type": "application/json", + "Repeatability-Request-ID": p["repeatabilityRequestId"], + "Repeatability-First-Sent": p["repeatabilityFirstSent"], + "x-ms-client-request-id": p["xMsClientRequestId"], + }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url + query, + { method: "POST", body, ...opts, headers }, + timeout, + ) + } + + async widgetPartsGetWidgetPartOperationStatus( + p: { + apiVersion: string + widgetName: string + widgetPartName: string + operationId: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 200, + { + error?: t_Azure_Core_Foundations_Error + id: string + result?: t_WidgetPart + status: t_OperationState + } + > + | Res + > + > { + const url = + this.basePath + + `/widgets/${p["widgetName"]}/parts/${p["widgetPartName"]}/operations/${p["operationId"]}` + const headers = this._headers({}, opts.headers) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async widgetPartsCreateWidgetPart( + p: { + apiVersion: string + widgetName: string + repeatabilityRequestId?: string + repeatabilityFirstSent?: string + ifMatch?: string + ifNoneMatch?: string + ifUnmodifiedSince?: string + ifModifiedSince?: string + xMsClientRequestId?: t_Azure_Core_uuid + requestBody: t_WidgetPart + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + Res<201, void> | Res + > + > { + const url = this.basePath + `/widgets/${p["widgetName"]}/parts` + const headers = this._headers( + { + "Content-Type": "application/json", + "Repeatability-Request-ID": p["repeatabilityRequestId"], + "Repeatability-First-Sent": p["repeatabilityFirstSent"], + "If-Match": p["ifMatch"], + "If-None-Match": p["ifNoneMatch"], + "If-Unmodified-Since": p["ifUnmodifiedSince"], + "If-Modified-Since": p["ifModifiedSince"], + "x-ms-client-request-id": p["xMsClientRequestId"], + }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url + query, + { method: "POST", body, ...opts, headers }, + timeout, + ) + } + + async widgetPartsListWidgetParts( + p: { + apiVersion: string + widgetName: string + xMsClientRequestId?: t_Azure_Core_uuid + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_PagedWidgetPart> + | Res + > + > { + const url = this.basePath + `/widgets/${p["widgetName"]}/parts` + const headers = this._headers( + { "x-ms-client-request-id": p["xMsClientRequestId"] }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async widgetPartsGetWidgetPart( + p: { + apiVersion: string + widgetName: string + widgetPartName: string + ifMatch?: string + ifNoneMatch?: string + ifUnmodifiedSince?: string + ifModifiedSince?: string + xMsClientRequestId?: t_Azure_Core_uuid + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_WidgetPart> + | Res + > + > { + const url = + this.basePath + `/widgets/${p["widgetName"]}/parts/${p["widgetPartName"]}` + const headers = this._headers( + { + "If-Match": p["ifMatch"], + "If-None-Match": p["ifNoneMatch"], + "If-Unmodified-Since": p["ifUnmodifiedSince"], + "If-Modified-Since": p["ifModifiedSince"], + "x-ms-client-request-id": p["xMsClientRequestId"], + }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async widgetPartsDeleteWidgetPart( + p: { + apiVersion: string + widgetName: string + widgetPartName: string + repeatabilityRequestId?: string + repeatabilityFirstSent?: string + ifMatch?: string + ifNoneMatch?: string + ifUnmodifiedSince?: string + ifModifiedSince?: string + xMsClientRequestId?: t_Azure_Core_uuid + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + Res<204, void> | Res + > + > { + const url = + this.basePath + `/widgets/${p["widgetName"]}/parts/${p["widgetPartName"]}` + const headers = this._headers( + { + "Repeatability-Request-ID": p["repeatabilityRequestId"], + "Repeatability-First-Sent": p["repeatabilityFirstSent"], + "If-Match": p["ifMatch"], + "If-None-Match": p["ifNoneMatch"], + "If-Unmodified-Since": p["ifUnmodifiedSince"], + "If-Modified-Since": p["ifModifiedSince"], + "x-ms-client-request-id": p["xMsClientRequestId"], + }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "DELETE", ...opts, headers }, + timeout, + ) + } + + async widgetPartsReorderParts( + p: { + apiVersion: string + widgetName: string + repeatabilityRequestId?: string + repeatabilityFirstSent?: string + xMsClientRequestId?: t_Azure_Core_uuid + requestBody: t_WidgetPartReorderRequest + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 202, + { + error?: t_Azure_Core_Foundations_Error + id: string + status: t_OperationState + } + > + | Res + > + > { + const url = this.basePath + `/widgets/${p["widgetName"]}/parts:reorderParts` + const headers = this._headers( + { + "Content-Type": "application/json", + "Repeatability-Request-ID": p["repeatabilityRequestId"], + "Repeatability-First-Sent": p["repeatabilityFirstSent"], + "x-ms-client-request-id": p["xMsClientRequestId"], + }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url + query, + { method: "POST", body, ...opts, headers }, + timeout, + ) + } + + async manufacturersGetManufacturerOperationStatus( + p: { + apiVersion: string + manufacturerId: string + operationId: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 200, + { + error?: t_Azure_Core_Foundations_Error + id: string + result?: t_Manufacturer + status: t_OperationState + } + > + | Res + > + > { + const url = + this.basePath + + `/manufacturers/${p["manufacturerId"]}/operations/${p["operationId"]}` + const headers = this._headers({}, opts.headers) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async manufacturersCreateManufacturer( + p: { + apiVersion: string + manufacturerId: string + repeatabilityRequestId?: string + repeatabilityFirstSent?: string + ifMatch?: string + ifNoneMatch?: string + ifUnmodifiedSince?: string + ifModifiedSince?: string + xMsClientRequestId?: t_Azure_Core_uuid + requestBody: t_Manufacturer + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_Manufacturer> + | Res<201, t_Manufacturer> + | Res + > + > { + const url = this.basePath + `/manufacturers/${p["manufacturerId"]}` + const headers = this._headers( + { + "Content-Type": "application/json", + "Repeatability-Request-ID": p["repeatabilityRequestId"], + "Repeatability-First-Sent": p["repeatabilityFirstSent"], + "If-Match": p["ifMatch"], + "If-None-Match": p["ifNoneMatch"], + "If-Unmodified-Since": p["ifUnmodifiedSince"], + "If-Modified-Since": p["ifModifiedSince"], + "x-ms-client-request-id": p["xMsClientRequestId"], + }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url + query, + { method: "PUT", body, ...opts, headers }, + timeout, + ) + } + + async manufacturersGetManufacturer( + p: { + apiVersion: string + manufacturerId: string + ifMatch?: string + ifNoneMatch?: string + ifUnmodifiedSince?: string + ifModifiedSince?: string + xMsClientRequestId?: t_Azure_Core_uuid + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_Manufacturer> + | Res + > + > { + const url = this.basePath + `/manufacturers/${p["manufacturerId"]}` + const headers = this._headers( + { + "If-Match": p["ifMatch"], + "If-None-Match": p["ifNoneMatch"], + "If-Unmodified-Since": p["ifUnmodifiedSince"], + "If-Modified-Since": p["ifModifiedSince"], + "x-ms-client-request-id": p["xMsClientRequestId"], + }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async manufacturersDeleteManufacturer( + p: { + apiVersion: string + manufacturerId: string + repeatabilityRequestId?: string + repeatabilityFirstSent?: string + ifMatch?: string + ifNoneMatch?: string + ifUnmodifiedSince?: string + ifModifiedSince?: string + xMsClientRequestId?: t_Azure_Core_uuid + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 202, + { + error?: t_Azure_Core_Foundations_Error + id: string + status: t_OperationState + } + > + | Res + > + > { + const url = this.basePath + `/manufacturers/${p["manufacturerId"]}` + const headers = this._headers( + { + "Repeatability-Request-ID": p["repeatabilityRequestId"], + "Repeatability-First-Sent": p["repeatabilityFirstSent"], + "If-Match": p["ifMatch"], + "If-None-Match": p["ifNoneMatch"], + "If-Unmodified-Since": p["ifUnmodifiedSince"], + "If-Modified-Since": p["ifModifiedSince"], + "x-ms-client-request-id": p["xMsClientRequestId"], + }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "DELETE", ...opts, headers }, + timeout, + ) + } + + async manufacturersListManufacturers( + p: { + apiVersion: string + xMsClientRequestId?: t_Azure_Core_uuid + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_PagedManufacturer> + | Res + > + > { + const url = this.basePath + `/manufacturers` + const headers = this._headers( + { "x-ms-client-request-id": p["xMsClientRequestId"] }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } +} diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/manufacturers/[manufacturerId]/operations/[operationId]/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/manufacturers/[manufacturerId]/operations/[operationId]/route.ts new file mode 100644 index 00000000..7a93ef1d --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/manufacturers/[manufacturerId]/operations/[operationId]/route.ts @@ -0,0 +1,106 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_Error, + t_Azure_Core_Foundations_ErrorResponse, + t_Manufacturer, + t_ManufacturersGetManufacturerOperationStatusParamSchema, + t_ManufacturersGetManufacturerOperationStatusQuerySchema, + t_OperationState, +} from "../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type ManufacturersGetManufacturerOperationStatusResponder = { + with200(): KoaRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error + id: string + result?: t_Manufacturer + status: t_OperationState + }> + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type ManufacturersGetManufacturerOperationStatus = ( + params: Params< + t_ManufacturersGetManufacturerOperationStatusParamSchema, + t_ManufacturersGetManufacturerOperationStatusQuerySchema, + void + >, + respond: ManufacturersGetManufacturerOperationStatusResponder, + ctx: { request: NextRequest }, +) => Promise> + +const manufacturersGetManufacturerOperationStatusParamSchema = z.object({ + manufacturerId: z.string(), + operationId: z.string(), +}) + +const manufacturersGetManufacturerOperationStatusQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +export const _GET = + (implementation: ManufacturersGetManufacturerOperationStatus) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + manufacturersGetManufacturerOperationStatusParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + manufacturersGetManufacturerOperationStatusQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error + id: string + result?: t_Manufacturer + status: t_OperationState + }>(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/manufacturers/[manufacturerId]/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/manufacturers/[manufacturerId]/route.ts new file mode 100644 index 00000000..0cb5ffd8 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/manufacturers/[manufacturerId]/route.ts @@ -0,0 +1,261 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_Error, + t_Azure_Core_Foundations_ErrorResponse, + t_Manufacturer, + t_ManufacturersCreateManufacturerBodySchema, + t_ManufacturersCreateManufacturerParamSchema, + t_ManufacturersCreateManufacturerQuerySchema, + t_ManufacturersDeleteManufacturerParamSchema, + t_ManufacturersDeleteManufacturerQuerySchema, + t_ManufacturersGetManufacturerParamSchema, + t_ManufacturersGetManufacturerQuerySchema, + t_OperationState, +} from "../../models" +import { s_Manufacturer } from "../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type ManufacturersCreateManufacturerResponder = { + with200(): KoaRuntimeResponse + with201(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type ManufacturersCreateManufacturer = ( + params: Params< + t_ManufacturersCreateManufacturerParamSchema, + t_ManufacturersCreateManufacturerQuerySchema, + t_ManufacturersCreateManufacturerBodySchema + >, + respond: ManufacturersCreateManufacturerResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type ManufacturersGetManufacturerResponder = { + with200(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type ManufacturersGetManufacturer = ( + params: Params< + t_ManufacturersGetManufacturerParamSchema, + t_ManufacturersGetManufacturerQuerySchema, + void + >, + respond: ManufacturersGetManufacturerResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type ManufacturersDeleteManufacturerResponder = { + with202(): KoaRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error + id: string + status: t_OperationState + }> + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type ManufacturersDeleteManufacturer = ( + params: Params< + t_ManufacturersDeleteManufacturerParamSchema, + t_ManufacturersDeleteManufacturerQuerySchema, + void + >, + respond: ManufacturersDeleteManufacturerResponder, + ctx: { request: NextRequest }, +) => Promise> + +const manufacturersCreateManufacturerParamSchema = z.object({ + manufacturerId: z.string(), +}) + +const manufacturersCreateManufacturerQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +const manufacturersCreateManufacturerBodySchema = s_Manufacturer + +export const _PUT = + (implementation: ManufacturersCreateManufacturer) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + manufacturersCreateManufacturerParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + manufacturersCreateManufacturerQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: parseRequestInput( + manufacturersCreateManufacturerBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with201() { + return new KoaRuntimeResponse(201) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +const manufacturersGetManufacturerParamSchema = z.object({ + manufacturerId: z.string(), +}) + +const manufacturersGetManufacturerQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +export const _GET = + (implementation: ManufacturersGetManufacturer) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + manufacturersGetManufacturerParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + manufacturersGetManufacturerQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +const manufacturersDeleteManufacturerParamSchema = z.object({ + manufacturerId: z.string(), +}) + +const manufacturersDeleteManufacturerQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +export const _DELETE = + (implementation: ManufacturersDeleteManufacturer) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + manufacturersDeleteManufacturerParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + manufacturersDeleteManufacturerQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with202() { + return new KoaRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error + id: string + status: t_OperationState + }>(202) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/manufacturers/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/manufacturers/route.ts new file mode 100644 index 00000000..03aa26b7 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/manufacturers/route.ts @@ -0,0 +1,80 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_ErrorResponse, + t_ManufacturersListManufacturersQuerySchema, + t_PagedManufacturer, +} from "../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type ManufacturersListManufacturersResponder = { + with200(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type ManufacturersListManufacturers = ( + params: Params, + respond: ManufacturersListManufacturersResponder, + ctx: { request: NextRequest }, +) => Promise> + +const manufacturersListManufacturersQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +export const _GET = + (implementation: ManufacturersListManufacturers) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: parseRequestInput( + manufacturersListManufacturersQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/models.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/models.ts new file mode 100644 index 00000000..0c85f4d5 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/models.ts @@ -0,0 +1,316 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +export type t_Azure_Core_Foundations_Error = { + code: string + details?: t_Azure_Core_Foundations_Error[] + innererror?: t_Azure_Core_Foundations_InnerError + message: string + target?: string +} + +export type t_Azure_Core_Foundations_ErrorResponse = { + error: t_Azure_Core_Foundations_Error +} + +export type t_Azure_Core_Foundations_InnerError = { + code?: string + innererror?: t_Azure_Core_Foundations_InnerError +} + +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_OperationState = + | "NotStarted" + | "Running" + | "Succeeded" + | "Failed" + | "Canceled" + | string + +export type t_PagedManufacturer = { + nextLink?: string + value: t_Manufacturer[] +} + +export type t_PagedWidget = { + nextLink?: string + value: t_Widget[] +} + +export type t_PagedWidgetPart = { + nextLink?: string + 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_WidgetAnalyticsCreateOrUpdate = { + repairCount?: number + useCount?: number +} + +export type t_WidgetColor = + | string + | "Black" + | "White" + | "Red" + | "Green" + | "Blue" + +export type t_WidgetCreateOrUpdate = { + color?: t_WidgetColor + manufacturerId?: string +} + +export type t_WidgetPart = { + readonly etag: t_Azure_Core_eTag + manufacturerId: string + readonly name: string + partId: string +} + +export type t_WidgetPartReorderRequest = { + signedOffBy: 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_ManufacturersCreateManufacturerBodySchema = { + address: string + readonly etag: t_Azure_Core_eTag + readonly id: string + name: string +} + +export type t_ManufacturersCreateManufacturerParamSchema = { + manufacturerId: string +} + +export type t_ManufacturersCreateManufacturerQuerySchema = { + "api-version": string +} + +export type t_ManufacturersDeleteManufacturerParamSchema = { + manufacturerId: string +} + +export type t_ManufacturersDeleteManufacturerQuerySchema = { + "api-version": string +} + +export type t_ManufacturersGetManufacturerParamSchema = { + manufacturerId: string +} + +export type t_ManufacturersGetManufacturerQuerySchema = { + "api-version": string +} + +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_ServiceStatusQuerySchema = { + "api-version": string +} + +export type t_WidgetPartsCreateWidgetPartBodySchema = { + readonly etag: t_Azure_Core_eTag + manufacturerId: string + readonly name: string + partId: string +} + +export type t_WidgetPartsCreateWidgetPartParamSchema = { + widgetName: string +} + +export type t_WidgetPartsCreateWidgetPartQuerySchema = { + "api-version": string +} + +export type t_WidgetPartsDeleteWidgetPartParamSchema = { + widgetName: string + widgetPartName: string +} + +export type t_WidgetPartsDeleteWidgetPartQuerySchema = { + "api-version": string +} + +export type t_WidgetPartsGetWidgetPartParamSchema = { + widgetName: string + widgetPartName: string +} + +export type t_WidgetPartsGetWidgetPartQuerySchema = { + "api-version": string +} + +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_WidgetPartsReorderPartsBodySchema = { + signedOffBy: string +} + +export type t_WidgetPartsReorderPartsParamSchema = { + widgetName: string +} + +export type t_WidgetPartsReorderPartsQuerySchema = { + "api-version": string +} + +export type t_WidgetsCreateOrUpdateWidgetBodySchema = { + color?: t_WidgetColor + manufacturerId?: string +} + +export type t_WidgetsCreateOrUpdateWidgetParamSchema = { + widgetName: string +} + +export type t_WidgetsCreateOrUpdateWidgetQuerySchema = { + "api-version": string +} + +export type t_WidgetsDeleteWidgetParamSchema = { + widgetName: string +} + +export type t_WidgetsDeleteWidgetQuerySchema = { + "api-version": string +} + +export type t_WidgetsGetAnalyticsParamSchema = { + widgetName: string +} + +export type t_WidgetsGetAnalyticsQuerySchema = { + "api-version": string +} + +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_WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusParamSchema = + { + operationId: string + widgetName: string + } + +export type t_WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusQuerySchema = + { + "api-version": string + } + +export type t_WidgetsListWidgetsQuerySchema = { + "api-version": string + maxpagesize?: number + select?: string[] + skip?: number + top?: number +} + +export type t_WidgetsScheduleRepairsBodySchema = { + completedDateTime: string + createdDateTime: string + requestState: t_WidgetRepairState + scheduledDateTime: string + updatedDateTime: string +} + +export type t_WidgetsScheduleRepairsParamSchema = { + widgetName: string +} + +export type t_WidgetsScheduleRepairsQuerySchema = { + "api-version": string +} + +export type t_WidgetsUpdateAnalyticsBodySchema = { + repairCount?: number + useCount?: number +} + +export type t_WidgetsUpdateAnalyticsParamSchema = { + widgetName: string +} + +export type t_WidgetsUpdateAnalyticsQuerySchema = { + "api-version": string +} diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/schemas.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/schemas.ts new file mode 100644 index 00000000..b7d8afa1 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/schemas.ts @@ -0,0 +1,116 @@ +/** 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_eTag = z.string() + +export const s_OperationState = z.union([ + z.enum(["NotStarted", "Running", "Succeeded", "Failed", "Canceled"]), + 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-nextjs/src/generated/azure-core-data-plane-service.tsp/service-status/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/service-status/route.ts new file mode 100644 index 00000000..5ea15fe9 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/service-status/route.ts @@ -0,0 +1,81 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_ErrorResponse, + t_ServiceStatusQuerySchema, +} from "../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type ServiceStatusResponder = { + with200(): KoaRuntimeResponse<{ + statusString: string + }> + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type ServiceStatus = ( + params: Params, + respond: ServiceStatusResponder, + ctx: { request: NextRequest }, +) => Promise> + +const serviceStatusQuerySchema = z.object({ "api-version": z.string().min(1) }) + +export const _GET = + (implementation: ServiceStatus) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: parseRequestInput( + serviceStatusQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse<{ + statusString: string + }>(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetId]/repairs/[operationId]/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetId]/repairs/[operationId]/route.ts new file mode 100644 index 00000000..60cb8f0b --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetId]/repairs/[operationId]/route.ts @@ -0,0 +1,106 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_Error, + t_Azure_Core_Foundations_ErrorResponse, + t_OperationState, + t_WidgetRepairRequest, + t_WidgetsGetRepairStatusParamSchema, + t_WidgetsGetRepairStatusQuerySchema, +} from "../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type WidgetsGetRepairStatusResponder = { + with200(): KoaRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error + id: string + result?: t_WidgetRepairRequest + status: t_OperationState + }> + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type WidgetsGetRepairStatus = ( + params: Params< + t_WidgetsGetRepairStatusParamSchema, + t_WidgetsGetRepairStatusQuerySchema, + void + >, + respond: WidgetsGetRepairStatusResponder, + ctx: { request: NextRequest }, +) => Promise> + +const widgetsGetRepairStatusParamSchema = z.object({ + widgetId: z.string(), + operationId: z.string(), +}) + +const widgetsGetRepairStatusQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +export const _GET = + (implementation: WidgetsGetRepairStatus) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + widgetsGetRepairStatusParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + widgetsGetRepairStatusQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error + id: string + result?: t_WidgetRepairRequest + status: t_OperationState + }>(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/analytics/current/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/analytics/current/route.ts new file mode 100644 index 00000000..e5924746 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/analytics/current/route.ts @@ -0,0 +1,174 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_ErrorResponse, + t_WidgetAnalytics, + t_WidgetsGetAnalyticsParamSchema, + t_WidgetsGetAnalyticsQuerySchema, + t_WidgetsUpdateAnalyticsBodySchema, + t_WidgetsUpdateAnalyticsParamSchema, + t_WidgetsUpdateAnalyticsQuerySchema, +} from "../../../../models" +import { s_WidgetAnalyticsCreateOrUpdate } from "../../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type WidgetsGetAnalyticsResponder = { + with200(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type WidgetsGetAnalytics = ( + params: Params< + t_WidgetsGetAnalyticsParamSchema, + t_WidgetsGetAnalyticsQuerySchema, + void + >, + respond: WidgetsGetAnalyticsResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type WidgetsUpdateAnalyticsResponder = { + with200(): KoaRuntimeResponse + with201(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type WidgetsUpdateAnalytics = ( + params: Params< + t_WidgetsUpdateAnalyticsParamSchema, + t_WidgetsUpdateAnalyticsQuerySchema, + t_WidgetsUpdateAnalyticsBodySchema + >, + respond: WidgetsUpdateAnalyticsResponder, + ctx: { request: NextRequest }, +) => Promise> + +const widgetsGetAnalyticsParamSchema = z.object({ widgetName: z.string() }) + +const widgetsGetAnalyticsQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +export const _GET = + (implementation: WidgetsGetAnalytics) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + widgetsGetAnalyticsParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + widgetsGetAnalyticsQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +const widgetsUpdateAnalyticsParamSchema = z.object({ widgetName: z.string() }) + +const widgetsUpdateAnalyticsQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +const widgetsUpdateAnalyticsBodySchema = s_WidgetAnalyticsCreateOrUpdate + +export const _PATCH = + (implementation: WidgetsUpdateAnalytics) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + widgetsUpdateAnalyticsParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + widgetsUpdateAnalyticsQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: parseRequestInput( + widgetsUpdateAnalyticsBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with201() { + return new KoaRuntimeResponse(201) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/operations/[operationId]/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/operations/[operationId]/route.ts new file mode 100644 index 00000000..9a17d2cc --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/operations/[operationId]/route.ts @@ -0,0 +1,121 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_Error, + t_Azure_Core_Foundations_ErrorResponse, + t_OperationState, + t_Widget, + t_WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusParamSchema, + t_WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusQuerySchema, +} from "../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusResponder = + { + with200(): KoaRuntimeResponse< + | { + error?: t_Azure_Core_Foundations_Error + id: string + result?: t_Widget + status: t_OperationState + } + | { + error?: t_Azure_Core_Foundations_Error + id: string + status: t_OperationState + } + > + withDefault( + status: StatusCode, + ): KoaRuntimeResponse + } & KoaRuntimeResponder + +export type WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatus = + ( + params: Params< + t_WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusParamSchema, + t_WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusQuerySchema, + void + >, + respond: WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusResponder, + ctx: { request: NextRequest }, + ) => Promise> + +const widgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusParamSchema = + z.object({ widgetName: z.string(), operationId: z.string() }) + +const widgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusQuerySchema = + z.object({ "api-version": z.string().min(1) }) + +export const _GET = + ( + implementation: WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatus, + ) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + widgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + widgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse< + | { + error?: t_Azure_Core_Foundations_Error + id: string + result?: t_Widget + status: t_OperationState + } + | { + error?: t_Azure_Core_Foundations_Error + id: string + status: t_OperationState + } + >(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/[widgetPartName]/operations/[operationId]/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/[widgetPartName]/operations/[operationId]/route.ts new file mode 100644 index 00000000..2c650f1f --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/[widgetPartName]/operations/[operationId]/route.ts @@ -0,0 +1,107 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_Error, + t_Azure_Core_Foundations_ErrorResponse, + t_OperationState, + t_WidgetPart, + t_WidgetPartsGetWidgetPartOperationStatusParamSchema, + t_WidgetPartsGetWidgetPartOperationStatusQuerySchema, +} from "../../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type WidgetPartsGetWidgetPartOperationStatusResponder = { + with200(): KoaRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error + id: string + result?: t_WidgetPart + status: t_OperationState + }> + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type WidgetPartsGetWidgetPartOperationStatus = ( + params: Params< + t_WidgetPartsGetWidgetPartOperationStatusParamSchema, + t_WidgetPartsGetWidgetPartOperationStatusQuerySchema, + void + >, + respond: WidgetPartsGetWidgetPartOperationStatusResponder, + ctx: { request: NextRequest }, +) => Promise> + +const widgetPartsGetWidgetPartOperationStatusParamSchema = z.object({ + widgetName: z.string(), + widgetPartName: z.string(), + operationId: z.string(), +}) + +const widgetPartsGetWidgetPartOperationStatusQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +export const _GET = + (implementation: WidgetPartsGetWidgetPartOperationStatus) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + widgetPartsGetWidgetPartOperationStatusParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + widgetPartsGetWidgetPartOperationStatusQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error + id: string + result?: t_WidgetPart + status: t_OperationState + }>(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/[widgetPartName]/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/[widgetPartName]/route.ts new file mode 100644 index 00000000..e338104a --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/[widgetPartName]/route.ts @@ -0,0 +1,168 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_ErrorResponse, + t_WidgetPart, + t_WidgetPartsDeleteWidgetPartParamSchema, + t_WidgetPartsDeleteWidgetPartQuerySchema, + t_WidgetPartsGetWidgetPartParamSchema, + t_WidgetPartsGetWidgetPartQuerySchema, +} from "../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type WidgetPartsGetWidgetPartResponder = { + with200(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type WidgetPartsGetWidgetPart = ( + params: Params< + t_WidgetPartsGetWidgetPartParamSchema, + t_WidgetPartsGetWidgetPartQuerySchema, + void + >, + respond: WidgetPartsGetWidgetPartResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type WidgetPartsDeleteWidgetPartResponder = { + with204(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type WidgetPartsDeleteWidgetPart = ( + params: Params< + t_WidgetPartsDeleteWidgetPartParamSchema, + t_WidgetPartsDeleteWidgetPartQuerySchema, + void + >, + respond: WidgetPartsDeleteWidgetPartResponder, + ctx: { request: NextRequest }, +) => Promise> + +const widgetPartsGetWidgetPartParamSchema = z.object({ + widgetName: z.string(), + widgetPartName: z.string(), +}) + +const widgetPartsGetWidgetPartQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +export const _GET = + (implementation: WidgetPartsGetWidgetPart) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + widgetPartsGetWidgetPartParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + widgetPartsGetWidgetPartQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +const widgetPartsDeleteWidgetPartParamSchema = z.object({ + widgetName: z.string(), + widgetPartName: z.string(), +}) + +const widgetPartsDeleteWidgetPartQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +export const _DELETE = + (implementation: WidgetPartsDeleteWidgetPart) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + widgetPartsDeleteWidgetPartParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + widgetPartsDeleteWidgetPartQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with204() { + return new KoaRuntimeResponse(204) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/route.ts new file mode 100644 index 00000000..5d70bfdb --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts/route.ts @@ -0,0 +1,174 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_ErrorResponse, + t_PagedWidgetPart, + t_WidgetPartsCreateWidgetPartBodySchema, + t_WidgetPartsCreateWidgetPartParamSchema, + t_WidgetPartsCreateWidgetPartQuerySchema, + t_WidgetPartsListWidgetPartsParamSchema, + t_WidgetPartsListWidgetPartsQuerySchema, +} from "../../../models" +import { s_WidgetPart } from "../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type WidgetPartsCreateWidgetPartResponder = { + with201(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type WidgetPartsCreateWidgetPart = ( + params: Params< + t_WidgetPartsCreateWidgetPartParamSchema, + t_WidgetPartsCreateWidgetPartQuerySchema, + t_WidgetPartsCreateWidgetPartBodySchema + >, + respond: WidgetPartsCreateWidgetPartResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type WidgetPartsListWidgetPartsResponder = { + with200(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type WidgetPartsListWidgetParts = ( + params: Params< + t_WidgetPartsListWidgetPartsParamSchema, + t_WidgetPartsListWidgetPartsQuerySchema, + void + >, + respond: WidgetPartsListWidgetPartsResponder, + ctx: { request: NextRequest }, +) => Promise> + +const widgetPartsCreateWidgetPartParamSchema = z.object({ + widgetName: z.string(), +}) + +const widgetPartsCreateWidgetPartQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +const widgetPartsCreateWidgetPartBodySchema = s_WidgetPart + +export const _POST = + (implementation: WidgetPartsCreateWidgetPart) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + widgetPartsCreateWidgetPartParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + widgetPartsCreateWidgetPartQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: parseRequestInput( + widgetPartsCreateWidgetPartBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with201() { + return new KoaRuntimeResponse(201) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +const widgetPartsListWidgetPartsParamSchema = z.object({ + widgetName: z.string(), +}) + +const widgetPartsListWidgetPartsQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +export const _GET = + (implementation: WidgetPartsListWidgetParts) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + widgetPartsListWidgetPartsParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + widgetPartsListWidgetPartsQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts:reorderParts/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts:reorderParts/route.ts new file mode 100644 index 00000000..6338d2d9 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/parts:reorderParts/route.ts @@ -0,0 +1,108 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_Error, + t_Azure_Core_Foundations_ErrorResponse, + t_OperationState, + t_WidgetPartsReorderPartsBodySchema, + t_WidgetPartsReorderPartsParamSchema, + t_WidgetPartsReorderPartsQuerySchema, +} from "../../../models" +import { s_WidgetPartReorderRequest } from "../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type WidgetPartsReorderPartsResponder = { + with202(): KoaRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error + id: string + status: t_OperationState + }> + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type WidgetPartsReorderParts = ( + params: Params< + t_WidgetPartsReorderPartsParamSchema, + t_WidgetPartsReorderPartsQuerySchema, + t_WidgetPartsReorderPartsBodySchema + >, + respond: WidgetPartsReorderPartsResponder, + ctx: { request: NextRequest }, +) => Promise> + +const widgetPartsReorderPartsParamSchema = z.object({ widgetName: z.string() }) + +const widgetPartsReorderPartsQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +const widgetPartsReorderPartsBodySchema = s_WidgetPartReorderRequest + +export const _POST = + (implementation: WidgetPartsReorderParts) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + widgetPartsReorderPartsParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + widgetPartsReorderPartsQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: parseRequestInput( + widgetPartsReorderPartsBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with202() { + return new KoaRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error + id: string + status: t_OperationState + }>(202) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/route.ts new file mode 100644 index 00000000..be60c35e --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]/route.ts @@ -0,0 +1,257 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_Error, + t_Azure_Core_Foundations_ErrorResponse, + t_OperationState, + t_Widget, + t_WidgetsCreateOrUpdateWidgetBodySchema, + t_WidgetsCreateOrUpdateWidgetParamSchema, + t_WidgetsCreateOrUpdateWidgetQuerySchema, + t_WidgetsDeleteWidgetParamSchema, + t_WidgetsDeleteWidgetQuerySchema, + t_WidgetsGetWidgetParamSchema, + t_WidgetsGetWidgetQuerySchema, +} from "../../models" +import { s_WidgetCreateOrUpdate } from "../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type WidgetsCreateOrUpdateWidgetResponder = { + with200(): KoaRuntimeResponse + with201(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type WidgetsCreateOrUpdateWidget = ( + params: Params< + t_WidgetsCreateOrUpdateWidgetParamSchema, + t_WidgetsCreateOrUpdateWidgetQuerySchema, + t_WidgetsCreateOrUpdateWidgetBodySchema + >, + respond: WidgetsCreateOrUpdateWidgetResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type WidgetsGetWidgetResponder = { + with200(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type WidgetsGetWidget = ( + params: Params< + t_WidgetsGetWidgetParamSchema, + t_WidgetsGetWidgetQuerySchema, + void + >, + respond: WidgetsGetWidgetResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type WidgetsDeleteWidgetResponder = { + with202(): KoaRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error + id: string + status: t_OperationState + }> + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type WidgetsDeleteWidget = ( + params: Params< + t_WidgetsDeleteWidgetParamSchema, + t_WidgetsDeleteWidgetQuerySchema, + void + >, + respond: WidgetsDeleteWidgetResponder, + ctx: { request: NextRequest }, +) => Promise> + +const widgetsCreateOrUpdateWidgetParamSchema = z.object({ + widgetName: z.string(), +}) + +const widgetsCreateOrUpdateWidgetQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +const widgetsCreateOrUpdateWidgetBodySchema = s_WidgetCreateOrUpdate + +export const _PATCH = + (implementation: WidgetsCreateOrUpdateWidget) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + widgetsCreateOrUpdateWidgetParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + widgetsCreateOrUpdateWidgetQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: parseRequestInput( + widgetsCreateOrUpdateWidgetBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with201() { + return new KoaRuntimeResponse(201) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +const widgetsGetWidgetParamSchema = z.object({ widgetName: z.string() }) + +const widgetsGetWidgetQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +export const _GET = + (implementation: WidgetsGetWidget) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + widgetsGetWidgetParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + widgetsGetWidgetQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +const widgetsDeleteWidgetParamSchema = z.object({ widgetName: z.string() }) + +const widgetsDeleteWidgetQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +export const _DELETE = + (implementation: WidgetsDeleteWidget) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + widgetsDeleteWidgetParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + widgetsDeleteWidgetQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with202() { + return new KoaRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error + id: string + status: t_OperationState + }>(202) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]:scheduleRepairs/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]:scheduleRepairs/route.ts new file mode 100644 index 00000000..28ddabbf --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/[widgetName]:scheduleRepairs/route.ts @@ -0,0 +1,123 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_Error, + t_Azure_Core_Foundations_ErrorResponse, + t_OperationState, + t_WidgetRepairState, + t_WidgetsScheduleRepairsBodySchema, + t_WidgetsScheduleRepairsParamSchema, + t_WidgetsScheduleRepairsQuerySchema, +} from "../../models" +import { s_WidgetRepairRequest } from "../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type WidgetsScheduleRepairsResponder = { + with202(): KoaRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error + id: string + result?: { + completedDateTime: string + createdDateTime: string + requestState: t_WidgetRepairState + scheduledDateTime: string + updatedDateTime: string + } + status: t_OperationState + }> + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type WidgetsScheduleRepairs = ( + params: Params< + t_WidgetsScheduleRepairsParamSchema, + t_WidgetsScheduleRepairsQuerySchema, + t_WidgetsScheduleRepairsBodySchema + >, + respond: WidgetsScheduleRepairsResponder, + ctx: { request: NextRequest }, +) => Promise> + +const widgetsScheduleRepairsParamSchema = z.object({ widgetName: z.string() }) + +const widgetsScheduleRepairsQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +const widgetsScheduleRepairsBodySchema = s_WidgetRepairRequest + +export const _POST = + (implementation: WidgetsScheduleRepairs) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + widgetsScheduleRepairsParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + widgetsScheduleRepairsQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: parseRequestInput( + widgetsScheduleRepairsBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with202() { + return new KoaRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error + id: string + result?: { + completedDateTime: string + createdDateTime: string + requestState: t_WidgetRepairState + scheduledDateTime: string + updatedDateTime: string + } + status: t_OperationState + }>(202) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/route.ts new file mode 100644 index 00000000..bff4f120 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-core-data-plane-service.tsp/widgets/route.ts @@ -0,0 +1,89 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_ErrorResponse, + t_PagedWidget, + t_WidgetsListWidgetsQuerySchema, +} from "../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type WidgetsListWidgetsResponder = { + with200(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type WidgetsListWidgets = ( + params: Params, + respond: WidgetsListWidgetsResponder, + ctx: { request: NextRequest }, +) => Promise> + +const widgetsListWidgetsQuerySchema = z.object({ + "api-version": z.string().min(1), + top: z.coerce.number().optional(), + skip: z.coerce.number().optional(), + maxpagesize: z.coerce.number().optional(), + select: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()), + ) + .optional(), +}) + +export const _GET = + (implementation: WidgetsListWidgets) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: parseRequestInput( + widgetsListWidgetsQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/clients/client.ts b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/clients/client.ts new file mode 100644 index 00000000..ab112d0e --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/clients/client.ts @@ -0,0 +1,263 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_uuid, + t_Azure_ResourceManager_CommonTypes_ErrorResponse, + t_Employee, + t_EmployeeListResult, + t_EmployeeUpdate, + t_MoveRequest, + t_MoveResponse, + t_OperationListResult, +} from "../models" +import { + AbstractFetchClient, + AbstractFetchClientConfig, + Res, + StatusCode, + TypedFetchResponse, +} from "@nahkies/typescript-fetch-runtime/main" + +export interface ApiClientConfig extends AbstractFetchClientConfig {} + +export class ApiClient extends AbstractFetchClient { + constructor(config: ApiClientConfig) { + super(config) + } + + async operationsList( + p: { + apiVersion: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_OperationListResult> + | Res + > + > { + const url = + this.basePath + `/providers/Microsoft.ContosoProviderHub/operations` + const headers = this._headers({}, opts.headers) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async employeesGet( + p: { + apiVersion: string + subscriptionId: t_Azure_Core_uuid + resourceGroupName: string + employeeName: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_Employee> + | Res + > + > { + const url = + this.basePath + + `/subscriptions/${p["subscriptionId"]}/resourceGroups/${p["resourceGroupName"]}/providers/Microsoft.ContosoProviderHub/employees/${p["employeeName"]}` + const headers = this._headers({}, opts.headers) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async employeesCreateOrUpdate( + p: { + apiVersion: string + subscriptionId: t_Azure_Core_uuid + resourceGroupName: string + employeeName: string + requestBody: t_Employee + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_Employee> + | Res<201, t_Employee> + | Res + > + > { + const url = + this.basePath + + `/subscriptions/${p["subscriptionId"]}/resourceGroups/${p["resourceGroupName"]}/providers/Microsoft.ContosoProviderHub/employees/${p["employeeName"]}` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url + query, + { method: "PUT", body, ...opts, headers }, + timeout, + ) + } + + async employeesUpdate( + p: { + apiVersion: string + subscriptionId: t_Azure_Core_uuid + resourceGroupName: string + employeeName: string + requestBody: t_EmployeeUpdate + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_Employee> + | Res + > + > { + const url = + this.basePath + + `/subscriptions/${p["subscriptionId"]}/resourceGroups/${p["resourceGroupName"]}/providers/Microsoft.ContosoProviderHub/employees/${p["employeeName"]}` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url + query, + { method: "PATCH", body, ...opts, headers }, + timeout, + ) + } + + async employeesDelete( + p: { + apiVersion: string + subscriptionId: t_Azure_Core_uuid + resourceGroupName: string + employeeName: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<202, void> + | Res<204, void> + | Res + > + > { + const url = + this.basePath + + `/subscriptions/${p["subscriptionId"]}/resourceGroups/${p["resourceGroupName"]}/providers/Microsoft.ContosoProviderHub/employees/${p["employeeName"]}` + const headers = this._headers({}, opts.headers) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "DELETE", ...opts, headers }, + timeout, + ) + } + + async employeesListByResourceGroup( + p: { + apiVersion: string + subscriptionId: t_Azure_Core_uuid + resourceGroupName: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_EmployeeListResult> + | Res + > + > { + const url = + this.basePath + + `/subscriptions/${p["subscriptionId"]}/resourceGroups/${p["resourceGroupName"]}/providers/Microsoft.ContosoProviderHub/employees` + const headers = this._headers({}, opts.headers) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async employeesListBySubscription( + p: { + apiVersion: string + subscriptionId: t_Azure_Core_uuid + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_EmployeeListResult> + | Res + > + > { + const url = + this.basePath + + `/subscriptions/${p["subscriptionId"]}/providers/Microsoft.ContosoProviderHub/employees` + const headers = this._headers({}, opts.headers) + const query = this._query({ "api-version": p["apiVersion"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async employeesMove( + p: { + apiVersion: string + subscriptionId: t_Azure_Core_uuid + resourceGroupName: string + employeeName: string + requestBody: t_MoveRequest + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_MoveResponse> + | Res + > + > { + const url = + this.basePath + + `/subscriptions/${p["subscriptionId"]}/resourceGroups/${p["resourceGroupName"]}/providers/Microsoft.ContosoProviderHub/employees/${p["employeeName"]}/move` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) + const query = this._query({ "api-version": p["apiVersion"] }) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url + query, + { method: "POST", body, ...opts, headers }, + timeout, + ) + } +} diff --git a/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/models.ts b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/models.ts new file mode 100644 index 00000000..6337858e --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/models.ts @@ -0,0 +1,178 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +export type EmptyObject = { [key: string]: never } + +export type t_ActionType = "Internal" | string + +export type t_Azure_Core_uuid = string + +export type t_Azure_ResourceManager_CommonTypes_ErrorAdditionalInfo = { + readonly info?: EmptyObject + readonly type?: string +} + +export type t_Azure_ResourceManager_CommonTypes_ErrorDetail = { + readonly additionalInfo?: t_Azure_ResourceManager_CommonTypes_ErrorAdditionalInfo[] + readonly code?: string + readonly details?: t_Azure_ResourceManager_CommonTypes_ErrorDetail[] + readonly message?: string + readonly target?: string +} + +export type t_Azure_ResourceManager_CommonTypes_ErrorResponse = { + error?: t_Azure_ResourceManager_CommonTypes_ErrorDetail +} + +export type t_Azure_ResourceManager_CommonTypes_Operation = { + actionType?: t_ActionType + readonly display?: t_Azure_ResourceManager_CommonTypes_OperationDisplay + readonly isDataAction?: boolean + readonly name?: string + readonly origin?: t_Origin +} + +export type t_Azure_ResourceManager_CommonTypes_OperationDisplay = { + readonly description?: string + readonly operation?: string + readonly provider?: string + readonly resource?: string +} + +export type t_Azure_ResourceManager_CommonTypes_Resource = { + readonly id?: string + readonly name?: string + readonly systemData?: t_Azure_ResourceManager_CommonTypes_SystemData + readonly type?: string +} + +export type t_Azure_ResourceManager_CommonTypes_SystemData = { + createdAt?: string + createdBy?: string + createdByType?: t_createdByType + lastModifiedAt?: string + lastModifiedBy?: string + lastModifiedByType?: t_createdByType +} + +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_Employee = t_Azure_ResourceManager_CommonTypes_TrackedResource + +export type t_EmployeeListResult = { + nextLink?: string + value: t_Employee[] +} + +export type t_EmployeeUpdate = + t_Azure_ResourceManager_CommonTypes_TrackedResourceUpdate + +export type t_MoveRequest = { + from: string + to: string +} + +export type t_MoveResponse = { + movingStatus: string +} + +export type t_OperationListResult = { + nextLink?: string + value: t_Azure_ResourceManager_CommonTypes_Operation[] +} + +export type t_Origin = "user" | "system" | "user,system" | string + +export type t_createdByType = + | "User" + | "Application" + | "ManagedIdentity" + | "Key" + | string + +export type t_EmployeesCreateOrUpdateBodySchema = + t_Azure_ResourceManager_CommonTypes_TrackedResource + +export type t_EmployeesCreateOrUpdateParamSchema = { + employeeName: string + resourceGroupName: string + subscriptionId: t_Azure_Core_uuid +} + +export type t_EmployeesCreateOrUpdateQuerySchema = { + "api-version": string +} + +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_EmployeesMoveBodySchema = { + from: string + to: string +} + +export type t_EmployeesMoveParamSchema = { + employeeName: string + resourceGroupName: string + subscriptionId: t_Azure_Core_uuid +} + +export type t_EmployeesMoveQuerySchema = { + "api-version": string +} + +export type t_EmployeesUpdateBodySchema = + t_Azure_ResourceManager_CommonTypes_TrackedResourceUpdate + +export type t_EmployeesUpdateParamSchema = { + employeeName: string + resourceGroupName: string + subscriptionId: t_Azure_Core_uuid +} + +export type t_EmployeesUpdateQuerySchema = { + "api-version": string +} + +export type t_OperationsListQuerySchema = { + "api-version": string +} diff --git a/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/providers/Microsoft.ContosoProviderHub/operations/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/providers/Microsoft.ContosoProviderHub/operations/route.ts new file mode 100644 index 00000000..72e052ea --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/providers/Microsoft.ContosoProviderHub/operations/route.ts @@ -0,0 +1,78 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_ResourceManager_CommonTypes_ErrorResponse, + t_OperationListResult, + t_OperationsListQuerySchema, +} from "../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type OperationsListResponder = { + with200(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type OperationsList = ( + params: Params, + respond: OperationsListResponder, + ctx: { request: NextRequest }, +) => Promise> + +const operationsListQuerySchema = z.object({ "api-version": z.string().min(1) }) + +export const _GET = + (implementation: OperationsList) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: parseRequestInput( + operationsListQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/schemas.ts b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/schemas.ts new file mode 100644 index 00000000..e461d1a5 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/schemas.ts @@ -0,0 +1,118 @@ +/** 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_ActionType = z.union([z.enum(["Internal"]), z.string()]) + +export const s_Azure_Core_uuid = 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_MoveRequest = z.object({ from: z.string(), to: z.string() }) + +export const s_MoveResponse = z.object({ movingStatus: z.string() }) + +export const s_Origin = z.union([ + z.enum(["user", "system", "user,system"]), + z.string(), +]) + +export const s_createdByType = z.union([ + z.enum(["User", "Application", "ManagedIdentity", "Key"]), + 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_Origin.optional(), + actionType: s_ActionType.optional(), +}) + +export const s_Azure_ResourceManager_CommonTypes_SystemData = z.object({ + createdBy: z.string().optional(), + createdByType: s_createdByType.optional(), + createdAt: z.string().datetime({ offset: true }).optional(), + lastModifiedBy: z.string().optional(), + lastModifiedByType: s_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: z.string().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-nextjs/src/generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/providers/Microsoft.ContosoProviderHub/employees/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/providers/Microsoft.ContosoProviderHub/employees/route.ts new file mode 100644 index 00000000..ffbb9690 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/providers/Microsoft.ContosoProviderHub/employees/route.ts @@ -0,0 +1,94 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_ResourceManager_CommonTypes_ErrorResponse, + t_EmployeeListResult, + t_EmployeesListBySubscriptionParamSchema, + t_EmployeesListBySubscriptionQuerySchema, +} from "../../../../../models" +import { s_Azure_Core_uuid } from "../../../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type EmployeesListBySubscriptionResponder = { + with200(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type EmployeesListBySubscription = ( + params: Params< + t_EmployeesListBySubscriptionParamSchema, + t_EmployeesListBySubscriptionQuerySchema, + void + >, + respond: EmployeesListBySubscriptionResponder, + ctx: { request: NextRequest }, +) => Promise> + +const employeesListBySubscriptionParamSchema = z.object({ + subscriptionId: s_Azure_Core_uuid, +}) + +const employeesListBySubscriptionQuerySchema = z.object({ + "api-version": z.string().min(1), +}) + +export const _GET = + (implementation: EmployeesListBySubscription) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + employeesListBySubscriptionParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + employeesListBySubscriptionQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/[employeeName]/move/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/[employeeName]/move/route.ts new file mode 100644 index 00000000..c69bc48b --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/[employeeName]/move/route.ts @@ -0,0 +1,108 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_ResourceManager_CommonTypes_ErrorResponse, + t_EmployeesMoveBodySchema, + t_EmployeesMoveParamSchema, + t_EmployeesMoveQuerySchema, + t_MoveResponse, +} from "../../../../../../../../../models" +import { + s_Azure_Core_uuid, + s_MoveRequest, +} from "../../../../../../../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type EmployeesMoveResponder = { + with200(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type EmployeesMove = ( + params: Params< + t_EmployeesMoveParamSchema, + t_EmployeesMoveQuerySchema, + t_EmployeesMoveBodySchema + >, + respond: EmployeesMoveResponder, + ctx: { request: NextRequest }, +) => Promise> + +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 employeesMoveBodySchema = s_MoveRequest + +export const _POST = + (implementation: EmployeesMove) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + employeesMoveParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + employeesMoveQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: parseRequestInput( + employeesMoveBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/[employeeName]/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/[employeeName]/route.ts new file mode 100644 index 00000000..6fa424fe --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/[employeeName]/route.ts @@ -0,0 +1,357 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_ResourceManager_CommonTypes_ErrorResponse, + t_Employee, + t_EmployeesCreateOrUpdateBodySchema, + t_EmployeesCreateOrUpdateParamSchema, + t_EmployeesCreateOrUpdateQuerySchema, + t_EmployeesDeleteParamSchema, + t_EmployeesDeleteQuerySchema, + t_EmployeesGetParamSchema, + t_EmployeesGetQuerySchema, + t_EmployeesUpdateBodySchema, + t_EmployeesUpdateParamSchema, + t_EmployeesUpdateQuerySchema, +} from "../../../../../../../../models" +import { + s_Azure_Core_uuid, + s_Employee, + s_EmployeeUpdate, +} from "../../../../../../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type EmployeesGetResponder = { + with200(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type EmployeesGet = ( + params: Params, + respond: EmployeesGetResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type EmployeesCreateOrUpdateResponder = { + with200(): KoaRuntimeResponse + with201(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type EmployeesCreateOrUpdate = ( + params: Params< + t_EmployeesCreateOrUpdateParamSchema, + t_EmployeesCreateOrUpdateQuerySchema, + t_EmployeesCreateOrUpdateBodySchema + >, + respond: EmployeesCreateOrUpdateResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type EmployeesUpdateResponder = { + with200(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type EmployeesUpdate = ( + params: Params< + t_EmployeesUpdateParamSchema, + t_EmployeesUpdateQuerySchema, + t_EmployeesUpdateBodySchema + >, + respond: EmployeesUpdateResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type EmployeesDeleteResponder = { + with202(): KoaRuntimeResponse + with204(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type EmployeesDelete = ( + params: Params< + t_EmployeesDeleteParamSchema, + t_EmployeesDeleteQuerySchema, + void + >, + respond: EmployeesDeleteResponder, + ctx: { request: NextRequest }, +) => Promise> + +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) }) + +export const _GET = + (implementation: EmployeesGet) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + employeesGetParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + employeesGetQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +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 employeesCreateOrUpdateBodySchema = s_Employee + +export const _PUT = + (implementation: EmployeesCreateOrUpdate) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + employeesCreateOrUpdateParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + employeesCreateOrUpdateQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: parseRequestInput( + employeesCreateOrUpdateBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with201() { + return new KoaRuntimeResponse(201) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +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 employeesUpdateBodySchema = s_EmployeeUpdate + +export const _PATCH = + (implementation: EmployeesUpdate) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + employeesUpdateParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + employeesUpdateQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: parseRequestInput( + employeesUpdateBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +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), +}) + +export const _DELETE = + (implementation: EmployeesDelete) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + employeesDeleteParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + employeesDeleteQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with202() { + return new KoaRuntimeResponse(202) + }, + with204() { + return new KoaRuntimeResponse(204) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/route.ts b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/route.ts new file mode 100644 index 00000000..a34ea32e --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/azure-resource-manager.tsp/subscriptions/[subscriptionId]/resourceGroups/[resourceGroupName]/providers/Microsoft.ContosoProviderHub/employees/route.ts @@ -0,0 +1,99 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_ResourceManager_CommonTypes_ErrorResponse, + t_EmployeeListResult, + t_EmployeesListByResourceGroupParamSchema, + t_EmployeesListByResourceGroupQuerySchema, +} from "../../../../../../../models" +import { s_Azure_Core_uuid } from "../../../../../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type EmployeesListByResourceGroupResponder = { + with200(): KoaRuntimeResponse + withDefault( + status: StatusCode, + ): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type EmployeesListByResourceGroup = ( + params: Params< + t_EmployeesListByResourceGroupParamSchema, + t_EmployeesListByResourceGroupQuerySchema, + void + >, + respond: EmployeesListByResourceGroupResponder, + ctx: { request: NextRequest }, +) => Promise> + +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), +}) + +export const _GET = + (implementation: EmployeesListByResourceGroup) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + employeesListByResourceGroupParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + employeesListByResourceGroupQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/clients/client.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/clients/client.ts index acbd6dda..fb2a668d 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/clients/client.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/clients/client.ts @@ -3,10 +3,16 @@ /* eslint-disable */ import { + EmptyObject, t_AppAuthenticatorEnrollment, t_AppAuthenticatorEnrollmentRequest, + t_Authenticator, + t_AuthenticatorEnrollment, t_Email, t_Error, + t_OktaApplication, + t_Organization, + t_PasswordResponse, t_Phone, t_Profile, t_PushNotificationChallenge, @@ -33,7 +39,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_AppAuthenticatorEnrollmentRequest }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_AppAuthenticatorEnrollment> @@ -44,14 +50,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/idp/myaccount/app-authenticators` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json, okta-version=1.0.0" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async verifyAppAuthenticatorPushNotificationChallenge( @@ -60,21 +65,20 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_PushNotificationVerification }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res<204, void> | Res<400, void>> > { const url = this.basePath + `/idp/myaccount/app-authenticators/challenge/${p["challengeId"]}/verify` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json;okta-version=1.0.0" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async updateAppAuthenticatorEnrollment( @@ -83,10 +87,10 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_UpdateAppAuthenticatorEnrollmentRequest }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< - | Res<200, t_UpdateAppAuthenticatorEnrollmentRequest> + | Res<200, t_AppAuthenticatorEnrollment> | Res<401, t_Error> | Res<403, t_Error> | Res<404, t_Error> @@ -94,12 +98,15 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/idp/myaccount/app-authenticators/${p["enrollmentId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/merge-patch+json;okta-version=1.0.0" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "PATCH", headers, body, ...(opts ?? {}) }, + { method: "PATCH", body, ...opts, headers }, timeout, ) } @@ -109,7 +116,7 @@ export class ApiClient extends AbstractFetchClient { enrollmentId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<401, t_Error> | Res<403, t_Error> | Res<404, t_Error> @@ -117,8 +124,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/idp/myaccount/app-authenticators/${p["enrollmentId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async listAppAuthenticatorPendingPushNotificationChallenges( @@ -126,22 +134,122 @@ export class ApiClient extends AbstractFetchClient { enrollmentId: string }, timeout?: number, - opts?: RequestInit, - ): Promise>> { + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + Res<200, t_PushNotificationChallenge[]> | Res<401, t_Error> + > + > { const url = this.basePath + `/idp/myaccount/app-authenticators/${p["enrollmentId"]}/push/notifications` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) + } + + async listAuthenticators( + p: { + expand?: string + } = {}, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + Res<200, t_Authenticator[]> | Res<403, t_Error> | Res<429, t_Error> + > + > { + const url = this.basePath + `/idp/myaccount/authenticators` + const headers = this._headers({}, opts.headers) + const query = this._query({ expand: p["expand"] }) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async getAuthenticator( + p: { + authenticatorId: string + expand?: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_Authenticator> + | Res<403, t_Error> + | Res<404, t_Error> + | Res<429, t_Error> + > + > { + const url = + this.basePath + `/idp/myaccount/authenticators/${p["authenticatorId"]}` + const headers = this._headers({}, opts.headers) + const query = this._query({ expand: p["expand"] }) + + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async listEnrollments( + p: { + authenticatorId: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_AuthenticatorEnrollment[]> + | Res<403, t_Error> + | Res<404, t_Error> + | Res<429, t_Error> + > + > { + const url = + this.basePath + + `/idp/myaccount/authenticators/${p["authenticatorId"]}/enrollments` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) + } + + async getEnrollment( + p: { + authenticatorId: string + enrollmentId: string + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_AuthenticatorEnrollment> + | Res<403, t_Error> + | Res<404, t_Error> + | Res<429, t_Error> + > + > { + const url = + this.basePath + + `/idp/myaccount/authenticators/${p["authenticatorId"]}/enrollments/${p["enrollmentId"]}` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async listEmails( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<401, t_Error>>> { const url = this.basePath + `/idp/myaccount/emails` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async createEmail( @@ -156,7 +264,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_Email> @@ -167,14 +275,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/idp/myaccount/emails` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getEmail( @@ -182,11 +289,12 @@ export class ApiClient extends AbstractFetchClient { id: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<401, t_Error>>> { const url = this.basePath + `/idp/myaccount/emails/${p["id"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async deleteEmail( @@ -194,19 +302,16 @@ export class ApiClient extends AbstractFetchClient { id: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< - | Res<204, void> - | Res<400, t_Error> - | Res<401, t_Error> - | Res<403, t_Error> - | Res<404, t_Error> + Res<204, void> | Res<400, t_Error> | Res<401, t_Error> | Res<404, t_Error> > > { const url = this.basePath + `/idp/myaccount/emails/${p["id"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async sendEmailChallenge( @@ -217,7 +322,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -226,13 +331,13 @@ export class ApiClient extends AbstractFetchClient { _links: { poll: { hints: { - allow: string[] + allow: "GET"[] } href: string } verify: { hints: { - allow: string[] + allow: "POST"[] } href: string } @@ -242,7 +347,7 @@ export class ApiClient extends AbstractFetchClient { profile: { email: string } - status: string + status: "VERIFIED" | "UNVERIFIED" } > | Res<401, t_Error> @@ -251,14 +356,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/idp/myaccount/emails/${p["id"]}/challenge` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async pollChallengeForEmailMagicLink( @@ -267,7 +371,7 @@ export class ApiClient extends AbstractFetchClient { challengeId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -276,13 +380,13 @@ export class ApiClient extends AbstractFetchClient { _links: { poll: { hints: { - allow: string[] + allow: ("DELETE" | "GET" | "POST" | "PUT")[] } href: string } verify: { hints: { - allow: string[] + allow: ("DELETE" | "GET" | "POST" | "PUT")[] } href: string } @@ -292,7 +396,7 @@ export class ApiClient extends AbstractFetchClient { profile: { email: string } - status: string + status: "VERIFIED" | "UNVERIFIED" } > | Res<401, t_Error> @@ -302,8 +406,9 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/idp/myaccount/emails/${p["id"]}/challenge/${p["challengeId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async verifyEmailOtp( @@ -315,7 +420,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, void> | Res<401, t_Error> | Res<403, t_Error> | Res<404, t_Error> @@ -324,37 +429,139 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/idp/myaccount/emails/${p["id"]}/challenge/${p["challengeId"]}/verify` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async listOktaApplications( + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res<400, t_Error>> + > { + const url = this.basePath + `/idp/myaccount/okta-applications` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) + } + + async getOrganization( + timeout?: number, + opts: RequestInit = {}, + ): Promise | Res<401, t_Error>>> { + const url = this.basePath + `/idp/myaccount/organization` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) + } + + async getPassword( + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res<401, t_Error>> + > { + const url = this.basePath + `/idp/myaccount/password` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) + } + + async createPassword( + p: { + requestBody: { + profile: { + password: string + } + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<201, t_PasswordResponse> + | Res<400, t_Error> + | Res<401, t_Error> + | Res<403, t_Error> + > + > { + const url = this.basePath + `/idp/myaccount/password` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async replacePassword( + p: { + requestBody: { + profile: { + password: string + } + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<201, t_PasswordResponse> + | Res<400, t_Error> + | Res<401, t_Error> + | Res<403, t_Error> + > + > { + const url = this.basePath + `/idp/myaccount/password` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) + } + + async deletePassword( + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res<401, t_Error> | Res<404, t_Error>> + > { + const url = this.basePath + `/idp/myaccount/password` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async listPhones( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<401, t_Error>>> { const url = this.basePath + `/idp/myaccount/phones` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async createPhone( p: { requestBody: { method?: "SMS" | "CALL" - profile?: { + profile: { phoneNumber?: string } sendCode?: boolean } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_Phone> @@ -366,14 +573,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/idp/myaccount/phones` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPhone( @@ -381,15 +587,16 @@ export class ApiClient extends AbstractFetchClient { id: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_Phone> | Res<401, t_Error> | Res<404, t_Error> > > { const url = this.basePath + `/idp/myaccount/phones/${p["id"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async deletePhone( @@ -397,15 +604,16 @@ export class ApiClient extends AbstractFetchClient { id: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<401, t_Error> | Res<403, t_Error> | Res<404, t_Error> > > { const url = this.basePath + `/idp/myaccount/phones/${p["id"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async sendPhoneChallenge( @@ -417,7 +625,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -426,7 +634,7 @@ export class ApiClient extends AbstractFetchClient { _links?: { verify?: { hints: { - allow: string[] + allow: "GET"[] } href: string } @@ -441,14 +649,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/idp/myaccount/phones/${p["id"]}/challenge` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async verifyPhoneChallenge( @@ -459,7 +666,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<204, void> @@ -471,60 +678,67 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/idp/myaccount/phones/${p["id"]}/verify` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getProfile( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<401, t_Error>>> { const url = this.basePath + `/idp/myaccount/profile` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async replaceProfile( p: { requestBody: { - profile?: { - [key: string]: unknown | undefined - } + profile?: EmptyObject } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< - | Res<200, t_Profile> - | Res<400, t_Error> - | Res<401, t_Error> - | Res<403, t_Error> + Res<200, t_Profile> | Res<400, t_Error> | Res<401, t_Error> > > { const url = this.basePath + `/idp/myaccount/profile` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async getProfileSchema( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<401, t_Error>>> { const url = this.basePath + `/idp/myaccount/profile/schema` + const headers = this._headers({}, opts.headers) + + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) + } + + async deleteSessions( + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res<401, t_Error> | Res<404, t_Error>> + > { + const url = this.basePath + `/idp/myaccount/sessions` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/app-authenticators/[enrollmentId]/push/notifications/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/app-authenticators/[enrollmentId]/push/notifications/route.ts index 3e94a3a8..6bd2155d 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/app-authenticators/[enrollmentId]/push/notifications/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/app-authenticators/[enrollmentId]/push/notifications/route.ts @@ -3,6 +3,7 @@ /* eslint-disable */ import { + t_Error, t_ListAppAuthenticatorPendingPushNotificationChallengesParamSchema, t_PushNotificationChallenge, } from "../../../../../../models" @@ -21,6 +22,7 @@ import { z } from "zod" export type ListAppAuthenticatorPendingPushNotificationChallengesResponder = { with200(): KoaRuntimeResponse + with401(): KoaRuntimeResponse } & KoaRuntimeResponder export type ListAppAuthenticatorPendingPushNotificationChallenges = ( @@ -57,6 +59,9 @@ export const _GET = with200() { return new KoaRuntimeResponse(200) }, + with401() { + return new KoaRuntimeResponse(401) + }, withStatus(status: StatusCode) { return new KoaRuntimeResponse(status) }, diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/app-authenticators/[enrollmentId]/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/app-authenticators/[enrollmentId]/route.ts index ab69cad4..8cc1f462 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/app-authenticators/[enrollmentId]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/app-authenticators/[enrollmentId]/route.ts @@ -3,11 +3,11 @@ /* eslint-disable */ import { + t_AppAuthenticatorEnrollment, t_DeleteAppAuthenticatorEnrollmentParamSchema, t_Error, t_UpdateAppAuthenticatorEnrollmentBodySchema, t_UpdateAppAuthenticatorEnrollmentParamSchema, - t_UpdateAppAuthenticatorEnrollmentRequest, } from "../../../../models" import { s_UpdateAppAuthenticatorEnrollmentRequest } from "../../../../schemas" import { @@ -24,7 +24,7 @@ import { NextRequest } from "next/server" import { z } from "zod" export type UpdateAppAuthenticatorEnrollmentResponder = { - with200(): KoaRuntimeResponse + with200(): KoaRuntimeResponse with401(): KoaRuntimeResponse with403(): KoaRuntimeResponse with404(): KoaRuntimeResponse @@ -83,9 +83,7 @@ export const _PATCH = const responder = { with200() { - return new KoaRuntimeResponse( - 200, - ) + return new KoaRuntimeResponse(200) }, with401() { return new KoaRuntimeResponse(401) diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/enrollments/[enrollmentId]/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/enrollments/[enrollmentId]/route.ts new file mode 100644 index 00000000..a14c1704 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/enrollments/[enrollmentId]/route.ts @@ -0,0 +1,85 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_AuthenticatorEnrollment, + t_Error, + t_GetEnrollmentParamSchema, +} from "../../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type GetEnrollmentResponder = { + with200(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse + with429(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type GetEnrollment = ( + params: Params, + respond: GetEnrollmentResponder, + ctx: { request: NextRequest }, +) => Promise> + +const getEnrollmentParamSchema = z.object({ + authenticatorId: z.string(), + enrollmentId: z.string(), +}) + +export const _GET = + (implementation: GetEnrollment) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + getEnrollmentParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + with429() { + return new KoaRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/enrollments/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/enrollments/route.ts new file mode 100644 index 00000000..f929b9aa --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/enrollments/route.ts @@ -0,0 +1,82 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_AuthenticatorEnrollment, + t_Error, + t_ListEnrollmentsParamSchema, +} from "../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type ListEnrollmentsResponder = { + with200(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse + with429(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type ListEnrollments = ( + params: Params, + respond: ListEnrollmentsResponder, + ctx: { request: NextRequest }, +) => Promise> + +const listEnrollmentsParamSchema = z.object({ authenticatorId: z.string() }) + +export const _GET = + (implementation: ListEnrollments) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + listEnrollmentsParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + with429() { + return new KoaRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/route.ts new file mode 100644 index 00000000..ad66b96a --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/authenticators/[authenticatorId]/route.ts @@ -0,0 +1,93 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Authenticator, + t_Error, + t_GetAuthenticatorParamSchema, + t_GetAuthenticatorQuerySchema, +} from "../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type GetAuthenticatorResponder = { + with200(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with404(): KoaRuntimeResponse + with429(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type GetAuthenticator = ( + params: Params< + t_GetAuthenticatorParamSchema, + t_GetAuthenticatorQuerySchema, + void + >, + respond: GetAuthenticatorResponder, + ctx: { request: NextRequest }, +) => Promise> + +const getAuthenticatorParamSchema = z.object({ authenticatorId: z.string() }) + +const getAuthenticatorQuerySchema = z.object({ expand: z.string().optional() }) + +export const _GET = + (implementation: GetAuthenticator) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + getAuthenticatorParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + getAuthenticatorQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + with429() { + return new KoaRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/authenticators/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/authenticators/route.ts new file mode 100644 index 00000000..63e1d183 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/authenticators/route.ts @@ -0,0 +1,80 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Authenticator, + t_Error, + t_ListAuthenticatorsQuerySchema, +} from "../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type ListAuthenticatorsResponder = { + with200(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with429(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type ListAuthenticators = ( + params: Params, + respond: ListAuthenticatorsResponder, + ctx: { request: NextRequest }, +) => Promise> + +const listAuthenticatorsQuerySchema = z.object({ + expand: z.string().optional(), +}) + +export const _GET = + (implementation: ListAuthenticators) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: parseRequestInput( + listAuthenticatorsQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with429() { + return new KoaRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/emails/[id]/challenge/[challengeId]/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/emails/[id]/challenge/[challengeId]/route.ts index 3946fa35..7109bb91 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/emails/[id]/challenge/[challengeId]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/emails/[id]/challenge/[challengeId]/route.ts @@ -24,13 +24,13 @@ export type PollChallengeForEmailMagicLinkResponder = { _links: { poll: { hints: { - allow: string[] + allow: ("DELETE" | "GET" | "POST" | "PUT")[] } href: string } verify: { hints: { - allow: string[] + allow: ("DELETE" | "GET" | "POST" | "PUT")[] } href: string } @@ -40,7 +40,7 @@ export type PollChallengeForEmailMagicLinkResponder = { profile: { email: string } - status: string + status: "VERIFIED" | "UNVERIFIED" }> with401(): KoaRuntimeResponse with404(): KoaRuntimeResponse @@ -80,13 +80,13 @@ export const _GET = _links: { poll: { hints: { - allow: string[] + allow: ("DELETE" | "GET" | "POST" | "PUT")[] } href: string } verify: { hints: { - allow: string[] + allow: ("DELETE" | "GET" | "POST" | "PUT")[] } href: string } @@ -96,7 +96,7 @@ export const _GET = profile: { email: string } - status: string + status: "VERIFIED" | "UNVERIFIED" }>(200) }, with401() { diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/emails/[id]/challenge/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/emails/[id]/challenge/route.ts index 5b0259e6..fd7aeadc 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/emails/[id]/challenge/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/emails/[id]/challenge/route.ts @@ -25,13 +25,13 @@ export type SendEmailChallengeResponder = { _links: { poll: { hints: { - allow: string[] + allow: "GET"[] } href: string } verify: { hints: { - allow: string[] + allow: "POST"[] } href: string } @@ -41,7 +41,7 @@ export type SendEmailChallengeResponder = { profile: { email: string } - status: string + status: "VERIFIED" | "UNVERIFIED" }> with401(): KoaRuntimeResponse with403(): KoaRuntimeResponse @@ -89,13 +89,13 @@ export const _POST = _links: { poll: { hints: { - allow: string[] + allow: "GET"[] } href: string } verify: { hints: { - allow: string[] + allow: "POST"[] } href: string } @@ -105,7 +105,7 @@ export const _POST = profile: { email: string } - status: string + status: "VERIFIED" | "UNVERIFIED" }>(201) }, with401() { diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/emails/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/emails/[id]/route.ts index 11ade701..09824389 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/emails/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/emails/[id]/route.ts @@ -36,7 +36,6 @@ export type DeleteEmailResponder = { with204(): KoaRuntimeResponse with400(): KoaRuntimeResponse with401(): KoaRuntimeResponse - with403(): KoaRuntimeResponse with404(): KoaRuntimeResponse } & KoaRuntimeResponder @@ -117,9 +116,6 @@ export const _DELETE = with401() { return new KoaRuntimeResponse(401) }, - with403() { - return new KoaRuntimeResponse(403) - }, with404() { return new KoaRuntimeResponse(404) }, diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/okta-applications/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/okta-applications/route.ts new file mode 100644 index 00000000..5281cd4b --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/okta-applications/route.ts @@ -0,0 +1,60 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { t_Error, t_OktaApplication } from "../../../models" +import { KoaRuntimeError } from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" + +export type ListOktaApplicationsResponder = { + with200(): KoaRuntimeResponse + with400(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type ListOktaApplications = ( + params: Params, + respond: ListOktaApplicationsResponder, + ctx: { request: NextRequest }, +) => Promise> + +export const _GET = + (implementation: ListOktaApplications) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: undefined, + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with400() { + return new KoaRuntimeResponse(400) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/organization/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/organization/route.ts new file mode 100644 index 00000000..aef9d929 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/organization/route.ts @@ -0,0 +1,60 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { t_Error, t_Organization } from "../../../models" +import { KoaRuntimeError } from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" + +export type GetOrganizationResponder = { + with200(): KoaRuntimeResponse + with401(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type GetOrganization = ( + params: Params, + respond: GetOrganizationResponder, + ctx: { request: NextRequest }, +) => Promise> + +export const _GET = + (implementation: GetOrganization) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: undefined, + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with401() { + return new KoaRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/password/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/password/route.ts new file mode 100644 index 00000000..ebf1c4f2 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/password/route.ts @@ -0,0 +1,246 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CreatePasswordBodySchema, + t_Error, + t_PasswordResponse, + t_ReplacePasswordBodySchema, +} from "../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type GetPasswordResponder = { + with200(): KoaRuntimeResponse + with401(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type GetPassword = ( + params: Params, + respond: GetPasswordResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type CreatePasswordResponder = { + with201(): KoaRuntimeResponse + with400(): KoaRuntimeResponse + with401(): KoaRuntimeResponse + with403(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type CreatePassword = ( + params: Params, + respond: CreatePasswordResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type ReplacePasswordResponder = { + with201(): KoaRuntimeResponse + with400(): KoaRuntimeResponse + with401(): KoaRuntimeResponse + with403(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type ReplacePassword = ( + params: Params, + respond: ReplacePasswordResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type DeletePasswordResponder = { + with204(): KoaRuntimeResponse + with401(): KoaRuntimeResponse + with404(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type DeletePassword = ( + params: Params, + respond: DeletePasswordResponder, + ctx: { request: NextRequest }, +) => Promise> + +export const _GET = + (implementation: GetPassword) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: undefined, + body: undefined, + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with401() { + return new KoaRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +const createPasswordBodySchema = z.object({ + profile: z.object({ password: z.string() }), +}) + +export const _POST = + (implementation: CreatePassword) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + createPasswordBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with201() { + return new KoaRuntimeResponse(201) + }, + with400() { + return new KoaRuntimeResponse(400) + }, + with401() { + return new KoaRuntimeResponse(401) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +const replacePasswordBodySchema = z.object({ + profile: z.object({ password: z.string() }), +}) + +export const _PUT = + (implementation: ReplacePassword) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + replacePasswordBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with201() { + return new KoaRuntimeResponse(201) + }, + with400() { + return new KoaRuntimeResponse(400) + }, + with401() { + return new KoaRuntimeResponse(401) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +export const _DELETE = + (implementation: DeletePassword) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: undefined, + body: undefined, + } + + const responder = { + with204() { + return new KoaRuntimeResponse(204) + }, + with401() { + return new KoaRuntimeResponse(401) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/phones/[id]/challenge/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/phones/[id]/challenge/route.ts index 99767253..21f476f1 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/phones/[id]/challenge/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/phones/[id]/challenge/route.ts @@ -26,7 +26,7 @@ export type SendPhoneChallengeResponder = { _links?: { verify?: { hints: { - allow: string[] + allow: "GET"[] } href: string } @@ -83,7 +83,7 @@ export const _POST = _links?: { verify?: { hints: { - allow: string[] + allow: "GET"[] } href: string } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/phones/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/phones/route.ts index 5ed78f25..c5d402f2 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/phones/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/phones/route.ts @@ -80,7 +80,7 @@ export const _GET = } const createPhoneBodySchema = z.object({ - profile: z.object({ phoneNumber: z.string().optional() }).optional(), + profile: z.object({ phoneNumber: z.string().optional() }), sendCode: PermissiveBoolean.optional(), method: z.enum(["SMS", "CALL"]).optional(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/profile/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/profile/route.ts index cfd022de..7ede9e25 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/profile/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/profile/route.ts @@ -31,7 +31,6 @@ export type ReplaceProfileResponder = { with200(): KoaRuntimeResponse with400(): KoaRuntimeResponse with401(): KoaRuntimeResponse - with403(): KoaRuntimeResponse } & KoaRuntimeResponder export type ReplaceProfile = ( @@ -76,9 +75,7 @@ export const _GET = : new Response(undefined, { status }) } -const replaceProfileBodySchema = z.object({ - profile: z.record(z.any()).optional(), -}) +const replaceProfileBodySchema = z.object({ profile: z.object({}).optional() }) export const _PUT = (implementation: ReplaceProfile) => @@ -107,9 +104,6 @@ export const _PUT = with401() { return new KoaRuntimeResponse(401) }, - with403() { - return new KoaRuntimeResponse(403) - }, withStatus(status: StatusCode) { return new KoaRuntimeResponse(status) }, diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/sessions/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/sessions/route.ts new file mode 100644 index 00000000..a0956a49 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/idp/myaccount/sessions/route.ts @@ -0,0 +1,64 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { t_Error } from "../../../models" +import { KoaRuntimeError } from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" + +export type DeleteSessionsResponder = { + with204(): KoaRuntimeResponse + with401(): KoaRuntimeResponse + with404(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type DeleteSessions = ( + params: Params, + respond: DeleteSessionsResponder, + ctx: { request: NextRequest }, +) => Promise> + +export const _DELETE = + (implementation: DeleteSessions) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: undefined, + body: undefined, + } + + const responder = { + with204() { + return new KoaRuntimeResponse(204) + }, + with401() { + return new KoaRuntimeResponse(401) + }, + with404() { + return new KoaRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/models.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/models.ts index 490b712a..bab2aeeb 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/models.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/models.ts @@ -26,7 +26,17 @@ export type t_AppAuthenticatorEnrollment = { } methods?: { push?: { - [key: string]: unknown | undefined + createdDate?: string + id?: string + lastUpdated?: string + links?: { + pending?: { + hints?: { + allow?: "GET"[] + } + href?: string + } + } } } readonly user?: { @@ -70,29 +80,74 @@ export type t_AppAuthenticatorMethodCapabilities = { transactionTypes?: ("LOGIN" | "CIBA")[] } +export type t_Authenticator = { + readonly _embedded?: { + enrollments?: t_AuthenticatorEnrollment[] + } + readonly _links?: { + enrollments?: t_HrefObject + self?: t_HrefObject + } + readonly enrollable?: boolean + readonly id?: string + key?: t_AuthenticatorKey + readonly name?: string +} + +export type t_AuthenticatorEnrollment = { + readonly _links?: { + authenticator?: t_HrefObject + self?: t_HrefObject + } + readonly canReset?: boolean + readonly canUnenroll?: boolean + readonly created?: string + readonly id?: string + readonly lastChallenged?: string + name?: string + readonly profile?: EmptyObject +} + +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?: string[] + allow?: ("DELETE" | "GET" | "POST" | "PUT")[] } href?: string } poll?: { hints?: { - allow?: string[] + allow?: ("DELETE" | "GET" | "POST" | "PUT")[] } href?: string } self?: { hints?: { - allow?: string[] + allow?: ("GET" | "DELETE" | "PUT")[] } href?: string } verify?: { hints?: { - allow?: string[] + allow?: ("DELETE" | "GET" | "POST" | "PUT")[] } href?: string } @@ -101,8 +156,8 @@ export type t_Email = { profile: { email: string } - roles: string[] - readonly status: string + roles: ("PRIMARY" | "SECONDARY")[] + readonly status: "VERIFIED" | "UNVERIFIED" } export type t_Error = { @@ -115,6 +170,17 @@ export type t_Error = { readonly errorSummary?: string } +export type t_HrefObject = { + hints?: { + allow?: t_HttpMethod[] + } + href: string + name?: string + type?: string +} + +export type t_HttpMethod = "DELETE" | "GET" | "POST" | "PUT" + export type t_KeyEC = { crv: "P-256" kid: string @@ -134,23 +200,59 @@ export type t_KeyRSA = { "okta:kpr": "HARDWARE" | "SOFTWARE" } +export type t_OktaApplication = { + readonly displayName?: string + readonly id?: string + readonly name?: string +} + +export type t_Organization = { + _links?: { + self?: { + hints?: { + allow?: "GET"[] + } + href?: string + } + } + readonly helpLink?: string + readonly name?: string + readonly supportEmail?: string + readonly url?: string +} + +export type t_PasswordResponse = { + _links?: { + self?: { + hints?: { + allow?: ("DELETE" | "GET" | "PUT")[] + } + href?: string + } + } + created?: string + readonly id?: string + lastUpdated?: string + status?: string +} + export type t_Phone = { _links?: { challenge?: { hints?: { - allow?: string[] + allow?: ("DELETE" | "GET" | "POST" | "PUT")[] } href?: string } self?: { hints?: { - allow?: string[] + allow?: ("GET" | "DELETE" | "PUT")[] } href?: string } verify?: { hints?: { - allow?: string[] + allow?: ("DELETE" | "GET" | "POST" | "PUT")[] } href?: string } @@ -159,7 +261,7 @@ export type t_Phone = { profile: { phoneNumber: string } - readonly status: string + readonly status: "VERIFIED" | "UNVERIFIED" } export type t_Profile = { @@ -173,9 +275,7 @@ export type t_Profile = { } readonly createdAt?: string readonly modifiedAt?: string - profile?: { - [key: string]: unknown | undefined - } + profile?: EmptyObject } export type t_PushNotificationChallenge = { @@ -252,9 +352,15 @@ export type t_CreateEmailBodySchema = { state?: string } +export type t_CreatePasswordBodySchema = { + profile: { + password: string + } +} + export type t_CreatePhoneBodySchema = { method?: "SMS" | "CALL" - profile?: { + profile: { phoneNumber?: string } sendCode?: boolean @@ -272,10 +378,23 @@ export type t_DeletePhoneParamSchema = { id: string } +export type t_GetAuthenticatorParamSchema = { + authenticatorId: string +} + +export type t_GetAuthenticatorQuerySchema = { + expand?: string +} + export type t_GetEmailParamSchema = { id: string } +export type t_GetEnrollmentParamSchema = { + authenticatorId: string + enrollmentId: string +} + export type t_GetPhoneParamSchema = { id: string } @@ -285,17 +404,29 @@ export type t_ListAppAuthenticatorPendingPushNotificationChallengesParamSchema = enrollmentId: string } +export type t_ListAuthenticatorsQuerySchema = { + expand?: string +} + +export type t_ListEnrollmentsParamSchema = { + authenticatorId: string +} + export type t_PollChallengeForEmailMagicLinkParamSchema = { challengeId: string id: string } -export type t_ReplaceProfileBodySchema = { - profile?: { - [key: string]: unknown | undefined +export type t_ReplacePasswordBodySchema = { + profile: { + password: string } } +export type t_ReplaceProfileBodySchema = { + profile?: EmptyObject +} + export type t_SendEmailChallengeBodySchema = { state: string } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/schemas.ts b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/schemas.ts index 9ffa9a4e..dd3a4e4d 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/schemas.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.idp.yaml/schemas.ts @@ -39,7 +39,29 @@ export const s_AppAuthenticatorEnrollment = z.object({ .optional(), }) .optional(), - methods: z.object({ push: z.record(z.any()).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(), @@ -49,35 +71,75 @@ 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.string()), - status: 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.string()).optional() }).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.string()).optional() }).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.string()).optional() }).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.string()).optional() }).optional(), + hints: z + .object({ + allow: z + .array(z.enum(["DELETE", "GET", "POST", "PUT"])) + .optional(), + }) + .optional(), }) .optional(), }) @@ -94,6 +156,8 @@ export const s_Error = z.object({ 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(), @@ -111,28 +175,90 @@ export const s_KeyRSA = z.object({ "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.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.string()).optional() }).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.string()).optional() }).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.string()).optional() }).optional(), + hints: z + .object({ + allow: z + .array(z.enum(["DELETE", "GET", "POST", "PUT"])) + .optional(), + }) + .optional(), }) .optional(), }) @@ -142,7 +268,7 @@ export const s_Phone = z.object({ export const s_Profile = z.object({ createdAt: z.string().datetime({ offset: true }).optional(), modifiedAt: z.string().datetime({ offset: true }).optional(), - profile: z.record(z.any()).optional(), + profile: z.object({}).optional(), _links: z .object({ self: z.object({ href: z.string().optional() }).optional(), @@ -171,6 +297,13 @@ export const s_Schema = z.object({ .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({ @@ -182,7 +315,7 @@ export const s_AppAuthenticatorEnrollmentRequest = z.object({ clientInstanceBundleId: z.string(), platform: z.enum(["ANDROID", "IOS"]), manufacturer: z.string().optional(), - deviceAttestation: z.record(z.any()).optional(), + deviceAttestation: z.record(z.unknown()).optional(), clientInstanceVersion: z.string(), clientInstanceDeviceSdkVersion: z.string(), model: z.string().optional(), @@ -202,6 +335,22 @@ export const s_AppAuthenticatorEnrollmentRequest = z.object({ }), }) +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(), + profile: z.object({}).optional(), + _links: z + .object({ + self: s_HrefObject.optional(), + authenticator: s_HrefObject.optional(), + }) + .optional(), +}) + export const s_UpdateAppAuthenticatorEnrollmentRequest = z.object({ methods: z .object({ @@ -217,3 +366,19 @@ export const s_UpdateAppAuthenticatorEnrollmentRequest = z.object({ }) .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(), + enrollments: s_HrefObject.optional(), + }) + .optional(), +}) diff --git a/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/clients/client.ts b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/clients/client.ts index c20736dc..52bdf7c0 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/clients/client.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/clients/client.ts @@ -7,17 +7,23 @@ import { t_AmrValue, t_BackchannelAuthorizeRequest, t_BackchannelAuthorizeResponse, + t_ChallengeRequest, + t_ChallengeResponse, t_Client, t_CodeChallengeMethod, t_DeviceAuthorizeRequest, t_DeviceAuthorizeResponse, t_Error, + t_GlobalTokenRevocationRequest, t_IntrospectionRequest, t_IntrospectionResponse, + t_LogoutWithPost, t_OAuthError, t_OAuthKeys, t_OAuthMetadata, t_OidcMetadata, + t_OobAuthenticateRequest, + t_OobAuthenticateResponse, t_ParRequest, t_ParResponse, t_Prompt, @@ -47,12 +53,17 @@ export class ApiClient extends AbstractFetchClient { clientId?: string } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<400, t_Error>>> { const url = this.basePath + `/.well-known/openid-configuration` + const headers = this._headers({}, opts.headers) const query = this._query({ client_id: p["clientId"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async authorize( @@ -79,9 +90,10 @@ export class ApiClient extends AbstractFetchClient { state?: string } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/oauth2/v1/authorize` + const headers = this._headers({}, opts.headers) const query = this._query({ acr_values: p["acrValues"], client_id: p["clientId"], @@ -105,7 +117,11 @@ export class ApiClient extends AbstractFetchClient { state: p["state"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async bcAuthorize( @@ -113,7 +129,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_BackchannelAuthorizeRequest }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_BackchannelAuthorizeResponse> @@ -123,16 +139,38 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/oauth2/v1/bc/authorize` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async challenge( + p: { + requestBody: t_ChallengeRequest + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_ChallengeResponse> + | Res<400, t_OAuthError> + | Res<401, t_OAuthError> + | Res<403, t_OAuthError> + | Res<429, t_OAuthError> + > + > { + const url = this.basePath + `/oauth2/v1/challenge` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async listClients( @@ -142,20 +180,25 @@ export class ApiClient extends AbstractFetchClient { q?: string } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_Client[]> | Res<403, t_Error> | Res<429, t_Error> > > { const url = this.basePath + `/oauth2/v1/clients` + const headers = this._headers({}, opts.headers) const query = this._query({ after: p["after"], limit: p["limit"], q: p["q"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async createClient( @@ -163,7 +206,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_Client }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<201, t_Client> @@ -173,14 +216,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/oauth2/v1/clients` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getClient( @@ -188,7 +230,7 @@ export class ApiClient extends AbstractFetchClient { clientId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_Client> @@ -198,8 +240,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/oauth2/v1/clients/${p["clientId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async replaceClient( @@ -208,7 +251,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_Client }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_Client> @@ -219,14 +262,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/oauth2/v1/clients/${p["clientId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async deleteClient( @@ -234,15 +276,16 @@ export class ApiClient extends AbstractFetchClient { clientId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res<403, t_Error> | Res<404, t_Error> | Res<429, t_Error> > > { const url = this.basePath + `/oauth2/v1/clients/${p["clientId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async generateNewClientSecret( @@ -250,7 +293,7 @@ export class ApiClient extends AbstractFetchClient { clientId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_Client> @@ -261,8 +304,9 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/oauth2/v1/clients/${p["clientId"]}/lifecycle/newSecret` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "POST", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "POST", ...opts, headers }, timeout) } async deviceAuthorize( @@ -270,7 +314,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_DeviceAuthorizeRequest }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_DeviceAuthorizeResponse> @@ -280,16 +324,34 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/oauth2/v1/device/authorize` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async globalTokenRevocation( + p: { + requestBody: t_GlobalTokenRevocationRequest + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + Res<204, void> | Res<400, void> | Res<403, t_Error> | Res<429, t_Error> + > + > { + const url = this.basePath + `/oauth2/v1/global-token-revocation` + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async introspect( @@ -297,7 +359,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_IntrospectionRequest }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_IntrospectionResponse> @@ -307,14 +369,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/oauth2/v1/introspect` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async oauthKeys( @@ -322,12 +383,17 @@ export class ApiClient extends AbstractFetchClient { clientId?: string } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<429, t_Error>>> { const url = this.basePath + `/oauth2/v1/keys` + const headers = this._headers({}, opts.headers) const query = this._query({ client_id: p["clientId"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async logout( @@ -337,16 +403,63 @@ export class ApiClient extends AbstractFetchClient { state?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/oauth2/v1/logout` + const headers = this._headers({}, opts.headers) const query = this._query({ id_token_hint: p["idTokenHint"], post_logout_redirect_uri: p["postLogoutRedirectUri"], state: p["state"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async logoutWithPost( + p: { + requestBody: t_LogoutWithPost + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise>> { + const url = this.basePath + `/oauth2/v1/logout` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async oobAuthenticate( + p: { + requestBody: t_OobAuthenticateRequest + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_OobAuthenticateResponse> + | Res<400, t_OAuthError> + | Res<401, t_OAuthError> + | Res<403, t_OAuthError> + | Res<429, t_OAuthError> + > + > { + const url = this.basePath + `/oauth2/v1/oob-authenticate` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async parOptions( @@ -354,16 +467,12 @@ export class ApiClient extends AbstractFetchClient { origin?: string } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<429, t_Error>>> { const url = this.basePath + `/oauth2/v1/par` - const headers = this._headers({ Origin: p["origin"] }) + const headers = this._headers({ Origin: p["origin"] }, opts.headers) - return this._fetch( - url, - { method: "OPTIONS", headers, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "OPTIONS", ...opts, headers }, timeout) } async par( @@ -371,7 +480,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_ParRequest }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_ParResponse> @@ -382,14 +491,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/oauth2/v1/par` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async revoke( @@ -397,7 +505,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_RevokeRequest }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, void> @@ -407,14 +515,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/oauth2/v1/revoke` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async tokenOptions( @@ -422,16 +529,12 @@ export class ApiClient extends AbstractFetchClient { origin?: string } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<429, t_Error>>> { const url = this.basePath + `/oauth2/v1/token` - const headers = this._headers({ Origin: p["origin"] }) + const headers = this._headers({ Origin: p["origin"] }, opts.headers) - return this._fetch( - url, - { method: "OPTIONS", headers, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "OPTIONS", ...opts, headers }, timeout) } async token( @@ -439,7 +542,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_TokenRequest }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_TokenResponse> @@ -449,29 +552,27 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/oauth2/v1/token` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async userinfo( timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_UserInfo> | Res<401, void> | Res<403, void> | Res<429, t_Error> > > { const url = this.basePath + `/oauth2/v1/userinfo` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async getWellKnownOAuthConfigurationCustomAs( @@ -480,7 +581,7 @@ export class ApiClient extends AbstractFetchClient { clientId?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_OAuthMetadata> | Res<400, t_Error> | Res<404, t_Error> @@ -489,9 +590,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/.well-known/oauth-authorization-server` + const headers = this._headers({}, opts.headers) const query = this._query({ client_id: p["clientId"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async getWellKnownOpenIdConfigurationCustomAs( @@ -500,7 +606,7 @@ export class ApiClient extends AbstractFetchClient { clientId?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_OidcMetadata> | Res<400, t_Error> | Res<404, t_Error> @@ -509,9 +615,14 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/.well-known/openid-configuration` + const headers = this._headers({}, opts.headers) const query = this._query({ client_id: p["clientId"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async authorizeCustomAs( @@ -539,10 +650,11 @@ export class ApiClient extends AbstractFetchClient { state?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/authorize` + const headers = this._headers({}, opts.headers) const query = this._query({ acr_values: p["acrValues"], client_id: p["clientId"], @@ -566,7 +678,11 @@ export class ApiClient extends AbstractFetchClient { state: p["state"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async bcAuthorizeCustomAs( @@ -575,7 +691,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_BackchannelAuthorizeRequest }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_BackchannelAuthorizeResponse> @@ -586,16 +702,40 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/bc/authorize` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async challengeCustomAs( + p: { + authorizationServerId: string + requestBody: t_ChallengeRequest + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_ChallengeResponse> + | Res<400, t_OAuthError> + | Res<401, t_OAuthError> + | Res<403, t_OAuthError> + | Res<429, t_OAuthError> + > + > { + const url = + this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/challenge` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deviceAuthorizeCustomAs( @@ -604,7 +744,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_DeviceAuthorizeRequest }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_DeviceAuthorizeResponse> @@ -616,16 +756,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/device/authorize` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async introspectCustomAs( @@ -634,7 +771,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_IntrospectionRequest }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_IntrospectionResponse> @@ -645,14 +782,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/introspect` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async oauthKeysCustomAs( @@ -660,11 +796,12 @@ export class ApiClient extends AbstractFetchClient { authorizationServerId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<429, t_Error>>> { const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/keys` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async logoutCustomAs( @@ -675,17 +812,69 @@ export class ApiClient extends AbstractFetchClient { state?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/logout` + const headers = this._headers({}, opts.headers) const query = this._query({ id_token_hint: p["idTokenHint"], post_logout_redirect_uri: p["postLogoutRedirectUri"], state: p["state"], }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) + } + + async logoutCustomAsWithPost( + p: { + authorizationServerId: string + requestBody: t_LogoutWithPost + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise>> { + const url = + this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/logout` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async oobAuthenticateCustomAs( + p: { + authorizationServerId: string + requestBody: t_OobAuthenticateRequest + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res<200, t_OobAuthenticateResponse> + | Res<400, t_OAuthError> + | Res<401, t_OAuthError> + | Res<403, t_OAuthError> + | Res<429, t_OAuthError> + > + > { + const url = + this.basePath + + `/oauth2/${p["authorizationServerId"]}/v1/oob-authenticate` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async parOptionsCustomAs( @@ -694,16 +883,12 @@ export class ApiClient extends AbstractFetchClient { origin?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<429, t_Error>>> { const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/par` - const headers = this._headers({ Origin: p["origin"] }) + const headers = this._headers({ Origin: p["origin"] }, opts.headers) - return this._fetch( - url, - { method: "OPTIONS", headers, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "OPTIONS", ...opts, headers }, timeout) } async parCustomAs( @@ -712,7 +897,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_ParRequest }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_ParResponse> @@ -723,14 +908,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/par` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async revokeCustomAs( @@ -739,7 +923,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_RevokeRequest }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, void> @@ -750,14 +934,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/revoke` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async tokenOptionsCustomAs( @@ -766,16 +949,12 @@ export class ApiClient extends AbstractFetchClient { origin?: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res<429, t_Error>>> { const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/token` - const headers = this._headers({ Origin: p["origin"] }) + const headers = this._headers({ Origin: p["origin"] }, opts.headers) - return this._fetch( - url, - { method: "OPTIONS", headers, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "OPTIONS", ...opts, headers }, timeout) } async tokenCustomAs( @@ -784,7 +963,7 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_TokenRequest }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_TokenResponse> @@ -794,16 +973,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/token` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async userinfoCustomAs( @@ -811,7 +987,7 @@ export class ApiClient extends AbstractFetchClient { authorizationServerId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_UserInfo> | Res<401, void> | Res<403, void> | Res<429, t_Error> @@ -819,7 +995,8 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/userinfo` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/models.ts b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/models.ts index 1531c540..e93340a7 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/models.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/models.ts @@ -45,6 +45,30 @@ export type t_BackchannelAuthorizeResponse = { interval?: number } +export type t_BindingMethod = "none" | "prompt" | "transfer" + +export type t_ChallengeRequest = { + challenge_types_supported?: t_ChallengeType[] + channel_hint?: t_Channel + mfa_token: string +} + +export type t_ChallengeResponse = { + binding_code?: string + binding_method?: t_BindingMethod + challenge_type?: string + channel?: t_Channel + expires_in?: number + interval?: number + oob_code?: string +} + +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 = { @@ -54,6 +78,8 @@ export type t_Client = { client_name?: string readonly client_secret?: string | null readonly client_secret_expires_at?: number | null + frontchannel_logout_session_required?: boolean + frontchannel_logout_uri?: string | null grant_types?: t_GrantType[] initiate_login_uri?: string jwks?: t_JsonWebKey[] @@ -101,6 +127,10 @@ export type t_Error = { errorSummary?: string } +export type t_GlobalTokenRevocationRequest = { + subject?: t_sub_id +} + export type t_GrantType = | "authorization_code" | "client_credentials" @@ -113,6 +143,10 @@ export type t_GrantType = | "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_IntrospectionRequest = { token?: string @@ -145,12 +179,18 @@ export type t_JsonWebKey = { use?: t_JsonWebKeyUse } -export type t_JsonWebKeyStatus = "ACTIVE" | "EXPIRED" | "NEXT" +export type t_JsonWebKeyStatus = "ACTIVE" | "INACTIVE" export type t_JsonWebKeyType = "EC" | "RSA" export type t_JsonWebKeyUse = "enc" | "sig" +export type t_LogoutWithPost = { + id_token_hint?: string + post_logout_redirect_uri?: string + state?: string +} + export type t_OAuthError = { error?: string error_description?: string @@ -167,6 +207,14 @@ export type t_OAuthMetadata = { claims_supported?: t_Claim[] code_challenge_methods_supported?: t_CodeChallengeMethod[] device_authorization_endpoint?: string + dpop_signing_alg_values_supported?: ( + | "ES256" + | "ES384" + | "ES512" + | "RS256" + | "RS384" + | "RS512" + )[] end_session_endpoint?: string grant_types_supported?: t_GrantType[] introspection_endpoint?: string @@ -192,6 +240,20 @@ export type t_OidcMetadata = t_OAuthMetadata & { userinfo_endpoint?: string } +export type t_OobAuthenticateRequest = { + channel_hint: t_Channel + login_hint: string +} + +export type t_OobAuthenticateResponse = { + binding_code?: string + binding_method?: t_BindingMethod + channel?: t_Channel + expires_in?: number + interval?: number + oob_code?: string +} + export type t_ParRequest = { client_id?: string code_challenge?: string @@ -306,6 +368,11 @@ export type t_UserInfo = { [key: string]: unknown | undefined } +export type t_sub_id = { + format?: "opaque" + id?: string +} + export type t_AuthorizeQuerySchema = { acr_values?: t_AcrValue client_id?: string @@ -380,6 +447,22 @@ export type t_BcAuthorizeCustomAsParamSchema = { authorizationServerId: string } +export type t_ChallengeBodySchema = { + challenge_types_supported?: t_ChallengeType[] + channel_hint?: t_Channel + mfa_token: string +} + +export type t_ChallengeCustomAsBodySchema = { + challenge_types_supported?: t_ChallengeType[] + channel_hint?: t_Channel + mfa_token: string +} + +export type t_ChallengeCustomAsParamSchema = { + authorizationServerId: string +} + export type t_CreateClientBodySchema = { application_type?: t_ApplicationType readonly client_id?: string @@ -387,6 +470,8 @@ export type t_CreateClientBodySchema = { client_name?: string readonly client_secret?: string | null readonly client_secret_expires_at?: number | null + frontchannel_logout_session_required?: boolean + frontchannel_logout_uri?: string | null grant_types?: t_GrantType[] initiate_login_uri?: string jwks?: t_JsonWebKey[] @@ -447,6 +532,10 @@ export type t_GetWellKnownOpenIdConfigurationCustomAsQuerySchema = { client_id?: string } +export type t_GlobalTokenRevocationBodySchema = { + subject?: t_sub_id +} + export type t_IntrospectBodySchema = { token?: string token_type_hint?: t_TokenTypeHintIntrospect @@ -483,6 +572,22 @@ export type t_LogoutCustomAsQuerySchema = { state?: string } +export type t_LogoutCustomAsWithPostBodySchema = { + id_token_hint?: string + post_logout_redirect_uri?: string + state?: string +} + +export type t_LogoutCustomAsWithPostParamSchema = { + authorizationServerId: string +} + +export type t_LogoutWithPostBodySchema = { + id_token_hint?: string + post_logout_redirect_uri?: string + state?: string +} + export type t_OauthKeysQuerySchema = { client_id?: string } @@ -491,6 +596,20 @@ export type t_OauthKeysCustomAsParamSchema = { authorizationServerId: string } +export type t_OobAuthenticateBodySchema = { + channel_hint: t_Channel + login_hint: string +} + +export type t_OobAuthenticateCustomAsBodySchema = { + channel_hint: t_Channel + login_hint: string +} + +export type t_OobAuthenticateCustomAsParamSchema = { + authorizationServerId: string +} + export type t_ParBodySchema = { client_id?: string code_challenge?: string @@ -546,6 +665,8 @@ export type t_ReplaceClientBodySchema = { client_name?: string readonly client_secret?: string | null readonly client_secret_expires_at?: number | null + frontchannel_logout_session_required?: boolean + frontchannel_logout_uri?: string | null grant_types?: t_GrantType[] initiate_login_uri?: string jwks?: t_JsonWebKey[] diff --git a/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/challenge/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/challenge/route.ts new file mode 100644 index 00000000..7b9eb015 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/challenge/route.ts @@ -0,0 +1,100 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_ChallengeCustomAsBodySchema, + t_ChallengeCustomAsParamSchema, + t_ChallengeResponse, + t_OAuthError, +} from "../../../../models" +import { s_ChallengeRequest } from "../../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type ChallengeCustomAsResponder = { + with200(): KoaRuntimeResponse + with400(): KoaRuntimeResponse + with401(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with429(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type ChallengeCustomAs = ( + params: Params< + t_ChallengeCustomAsParamSchema, + void, + t_ChallengeCustomAsBodySchema + >, + respond: ChallengeCustomAsResponder, + ctx: { request: NextRequest }, +) => Promise> + +const challengeCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), +}) + +const challengeCustomAsBodySchema = s_ChallengeRequest + +export const _POST = + (implementation: ChallengeCustomAs) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + challengeCustomAsParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + challengeCustomAsBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with400() { + return new KoaRuntimeResponse(400) + }, + with401() { + return new KoaRuntimeResponse(401) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with429() { + return new KoaRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/logout/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/logout/route.ts index 89bb0b62..4b52d869 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/logout/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/logout/route.ts @@ -6,7 +6,10 @@ import { t_Error, t_LogoutCustomAsParamSchema, t_LogoutCustomAsQuerySchema, + t_LogoutCustomAsWithPostBodySchema, + t_LogoutCustomAsWithPostParamSchema, } from "../../../../models" +import { s_LogoutWithPost } from "../../../../schemas" import { KoaRuntimeError, RequestInputType, @@ -34,6 +37,20 @@ export type LogoutCustomAs = ( ctx: { request: NextRequest }, ) => Promise> +export type LogoutCustomAsWithPostResponder = { + with429(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type LogoutCustomAsWithPost = ( + params: Params< + t_LogoutCustomAsWithPostParamSchema, + void, + t_LogoutCustomAsWithPostBodySchema + >, + respond: LogoutCustomAsWithPostResponder, + ctx: { request: NextRequest }, +) => Promise> + const logoutCustomAsParamSchema = z.object({ authorizationServerId: z.string(), }) @@ -84,3 +101,50 @@ export const _GET = ? Response.json(body, { status }) : new Response(undefined, { status }) } + +const logoutCustomAsWithPostParamSchema = z.object({ + authorizationServerId: z.string(), +}) + +const logoutCustomAsWithPostBodySchema = s_LogoutWithPost + +export const _POST = + (implementation: LogoutCustomAsWithPost) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + logoutCustomAsWithPostParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + logoutCustomAsWithPostBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with429() { + return new KoaRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/oob-authenticate/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/oob-authenticate/route.ts new file mode 100644 index 00000000..a3e638cb --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/[authorizationServerId]/v1/oob-authenticate/route.ts @@ -0,0 +1,100 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_OAuthError, + t_OobAuthenticateCustomAsBodySchema, + t_OobAuthenticateCustomAsParamSchema, + t_OobAuthenticateResponse, +} from "../../../../models" +import { s_OobAuthenticateRequest } from "../../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type OobAuthenticateCustomAsResponder = { + with200(): KoaRuntimeResponse + with400(): KoaRuntimeResponse + with401(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with429(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type OobAuthenticateCustomAs = ( + params: Params< + t_OobAuthenticateCustomAsParamSchema, + void, + t_OobAuthenticateCustomAsBodySchema + >, + respond: OobAuthenticateCustomAsResponder, + ctx: { request: NextRequest }, +) => Promise> + +const oobAuthenticateCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), +}) + +const oobAuthenticateCustomAsBodySchema = s_OobAuthenticateRequest + +export const _POST = + (implementation: OobAuthenticateCustomAs) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + oobAuthenticateCustomAsParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + oobAuthenticateCustomAsBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with400() { + return new KoaRuntimeResponse(400) + }, + with401() { + return new KoaRuntimeResponse(401) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with429() { + return new KoaRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/v1/challenge/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/v1/challenge/route.ts new file mode 100644 index 00000000..b8ea6d2b --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/v1/challenge/route.ts @@ -0,0 +1,86 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_ChallengeBodySchema, + t_ChallengeResponse, + t_OAuthError, +} from "../../../models" +import { s_ChallengeRequest } from "../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" + +export type ChallengeResponder = { + with200(): KoaRuntimeResponse + with400(): KoaRuntimeResponse + with401(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with429(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type Challenge = ( + params: Params, + respond: ChallengeResponder, + ctx: { request: NextRequest }, +) => Promise> + +const challengeBodySchema = s_ChallengeRequest + +export const _POST = + (implementation: Challenge) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + challengeBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with400() { + return new KoaRuntimeResponse(400) + }, + with401() { + return new KoaRuntimeResponse(401) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with429() { + return new KoaRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/v1/global-token-revocation/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/v1/global-token-revocation/route.ts new file mode 100644 index 00000000..0329c291 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/v1/global-token-revocation/route.ts @@ -0,0 +1,78 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { t_Error, t_GlobalTokenRevocationBodySchema } from "../../../models" +import { s_GlobalTokenRevocationRequest } from "../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" + +export type GlobalTokenRevocationResponder = { + with204(): KoaRuntimeResponse + with400(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with429(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type GlobalTokenRevocation = ( + params: Params, + respond: GlobalTokenRevocationResponder, + ctx: { request: NextRequest }, +) => Promise> + +const globalTokenRevocationBodySchema = s_GlobalTokenRevocationRequest + +export const _POST = + (implementation: GlobalTokenRevocation) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + globalTokenRevocationBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with204() { + return new KoaRuntimeResponse(204) + }, + with400() { + return new KoaRuntimeResponse(400) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with429() { + return new KoaRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/v1/logout/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/v1/logout/route.ts index 241fa654..78a092d2 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/v1/logout/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/v1/logout/route.ts @@ -2,7 +2,12 @@ /* tslint:disable */ /* eslint-disable */ -import { t_Error, t_LogoutQuerySchema } from "../../../models" +import { + t_Error, + t_LogoutQuerySchema, + t_LogoutWithPostBodySchema, +} from "../../../models" +import { s_LogoutWithPost } from "../../../schemas" import { KoaRuntimeError, RequestInputType, @@ -26,6 +31,16 @@ export type Logout = ( ctx: { request: NextRequest }, ) => Promise> +export type LogoutWithPostResponder = { + with429(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type LogoutWithPost = ( + params: Params, + respond: LogoutWithPostResponder, + ctx: { request: NextRequest }, +) => Promise> + const logoutQuerySchema = z.object({ id_token_hint: z.string(), post_logout_redirect_uri: z.string().optional(), @@ -68,3 +83,42 @@ export const _GET = ? Response.json(body, { status }) : new Response(undefined, { status }) } + +const logoutWithPostBodySchema = s_LogoutWithPost + +export const _POST = + (implementation: LogoutWithPost) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + logoutWithPostBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with429() { + return new KoaRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/v1/oob-authenticate/route.ts b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/v1/oob-authenticate/route.ts new file mode 100644 index 00000000..18c0db36 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/oauth2/v1/oob-authenticate/route.ts @@ -0,0 +1,86 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_OAuthError, + t_OobAuthenticateBodySchema, + t_OobAuthenticateResponse, +} from "../../../models" +import { s_OobAuthenticateRequest } from "../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" + +export type OobAuthenticateResponder = { + with200(): KoaRuntimeResponse + with400(): KoaRuntimeResponse + with401(): KoaRuntimeResponse + with403(): KoaRuntimeResponse + with429(): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type OobAuthenticate = ( + params: Params, + respond: OobAuthenticateResponder, + ctx: { request: NextRequest }, +) => Promise> + +const oobAuthenticateBodySchema = s_OobAuthenticateRequest + +export const _POST = + (implementation: OobAuthenticate) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + oobAuthenticateBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + with400() { + return new KoaRuntimeResponse(400) + }, + with401() { + return new KoaRuntimeResponse(401) + }, + with403() { + return new KoaRuntimeResponse(403) + }, + with429() { + return new KoaRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/schemas.ts b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/schemas.ts index 76d34d3c..a7cdb426 100644 --- a/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/schemas.ts +++ b/integration-tests/typescript-nextjs/src/generated/okta.oauth.yaml/schemas.ts @@ -51,7 +51,7 @@ export const s_BackchannelAuthorizeRequest = z.intersection( request_expiry: z.coerce.number().min(1).max(300).optional(), scope: z.string(), }), - z.record(z.any()), + z.record(z.unknown()), ) export const s_BackchannelAuthorizeResponse = z.object({ @@ -60,6 +60,15 @@ export const s_BackchannelAuthorizeResponse = z.object({ 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"]) @@ -108,6 +117,10 @@ export const s_GrantType = z.enum([ "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( @@ -127,15 +140,21 @@ export const s_IntrospectionResponse = z.intersection( uid: z.string().optional(), username: z.string().optional(), }), - z.record(z.any()), + z.record(z.unknown()), ) -export const s_JsonWebKeyStatus = z.enum(["ACTIVE", "EXPIRED", "NEXT"]) +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().optional(), + 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(), @@ -239,9 +258,34 @@ export const s_TokenTypeHintRevoke = z.enum([ export const s_UserInfo = z.intersection( z.object({ sub: z.string().optional() }), - z.record(z.any()), + z.record(z.unknown()), ) +export const s_sub_id = z.object({ + format: z.enum(["opaque"]).optional(), + id: z.string().optional(), +}) + +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({ + subject: s_sub_id.optional(), +}) + export const s_IntrospectionRequest = z.object({ token: z.string().optional(), token_type_hint: s_TokenTypeHintIntrospect.optional(), @@ -266,6 +310,9 @@ export const s_OAuthMetadata = z.object({ 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(), @@ -294,6 +341,20 @@ export const s_OAuthMetadata = z.object({ .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().optional(), token_type_hint: s_TokenTypeHintRevoke.optional(), @@ -319,6 +380,8 @@ export const s_Client = z.object({ client_name: z.string().optional(), 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.array(s_JsonWebKey).optional(), diff --git a/integration-tests/typescript-nextjs/src/generated/petstore-expanded.yaml/clients/client.ts b/integration-tests/typescript-nextjs/src/generated/petstore-expanded.yaml/clients/client.ts index ed5523a9..302c004b 100644 --- a/integration-tests/typescript-nextjs/src/generated/petstore-expanded.yaml/clients/client.ts +++ b/integration-tests/typescript-nextjs/src/generated/petstore-expanded.yaml/clients/client.ts @@ -24,12 +24,17 @@ export class ApiClient extends AbstractFetchClient { limit?: number } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/pets` + const headers = this._headers({}, opts.headers) const query = this._query({ tags: p["tags"], limit: p["limit"] }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async addPet( @@ -37,17 +42,16 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_NewPet }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/pets` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async findPetById( @@ -55,11 +59,12 @@ export class ApiClient extends AbstractFetchClient { id: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/pets/${p["id"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async deletePet( @@ -67,10 +72,11 @@ export class ApiClient extends AbstractFetchClient { id: number }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/pets/${p["id"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } } diff --git a/integration-tests/typescript-nextjs/src/generated/petstore-expanded.yaml/pets/route.ts b/integration-tests/typescript-nextjs/src/generated/petstore-expanded.yaml/pets/route.ts index e5b7b01e..12860cea 100644 --- a/integration-tests/typescript-nextjs/src/generated/petstore-expanded.yaml/pets/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/petstore-expanded.yaml/pets/route.ts @@ -45,7 +45,12 @@ export type AddPet = ( ) => Promise> const findPetsQuerySchema = z.object({ - tags: z.array(z.string()).optional(), + tags: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()), + ) + .optional(), limit: z.coerce.number().optional(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/clients/client.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/clients/client.ts index b1e1ffe7..4c6d89a1 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/clients/client.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/clients/client.ts @@ -13,6 +13,7 @@ import { t_balance, t_balance_transaction, t_bank_account, + t_billing_alert, t_billing_meter, t_billing_meter_event, t_billing_meter_event_adjustment, @@ -178,20 +179,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/account` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -212,21 +214,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/account_links` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postAccountSessions( @@ -250,6 +249,7 @@ export class ApiClient extends AbstractFetchClient { enabled: boolean features?: { edit_payout_schedule?: boolean + external_account_collection?: boolean instant_payouts?: boolean standard_payouts?: boolean } @@ -286,6 +286,7 @@ export class ApiClient extends AbstractFetchClient { enabled: boolean features?: { edit_payout_schedule?: boolean + external_account_collection?: boolean instant_payouts?: boolean standard_payouts?: boolean } @@ -294,26 +295,31 @@ export class ApiClient extends AbstractFetchClient { enabled: boolean features?: EmptyObject } + tax_registrations?: { + enabled: boolean + features?: EmptyObject + } + tax_settings?: { + enabled: boolean + features?: EmptyObject + } } expand?: string[] } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/account_sessions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getAccounts( @@ -333,7 +339,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -349,9 +355,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/accounts` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], ending_before: p["endingBefore"], @@ -363,7 +370,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -470,6 +477,9 @@ export class ApiClient extends AbstractFetchClient { fpx_payments?: { requested?: boolean } + gb_bank_transfer_payments?: { + requested?: boolean + } giropay_payments?: { requested?: boolean } @@ -485,6 +495,9 @@ export class ApiClient extends AbstractFetchClient { jcb_payments?: { requested?: boolean } + jp_bank_transfer_payments?: { + requested?: boolean + } klarna_payments?: { requested?: boolean } @@ -500,6 +513,12 @@ export class ApiClient extends AbstractFetchClient { mobilepay_payments?: { requested?: boolean } + multibanco_payments?: { + requested?: boolean + } + mx_bank_transfer_payments?: { + requested?: boolean + } oxxo_payments?: { requested?: boolean } @@ -515,6 +534,9 @@ export class ApiClient extends AbstractFetchClient { revolut_pay_payments?: { requested?: boolean } + sepa_bank_transfer_payments?: { + requested?: boolean + } sepa_debit_payments?: { requested?: boolean } @@ -536,9 +558,15 @@ export class ApiClient extends AbstractFetchClient { treasury?: { requested?: boolean } + twint_payments?: { + requested?: boolean + } us_bank_account_ach_payments?: { requested?: boolean } + us_bank_transfer_payments?: { + requested?: boolean + } zip_payments?: { requested?: boolean } @@ -811,21 +839,18 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteAccountsAccount( @@ -834,19 +859,20 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts/${p["account"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -858,20 +884,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts/${p["account"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -962,6 +989,9 @@ export class ApiClient extends AbstractFetchClient { fpx_payments?: { requested?: boolean } + gb_bank_transfer_payments?: { + requested?: boolean + } giropay_payments?: { requested?: boolean } @@ -977,6 +1007,9 @@ export class ApiClient extends AbstractFetchClient { jcb_payments?: { requested?: boolean } + jp_bank_transfer_payments?: { + requested?: boolean + } klarna_payments?: { requested?: boolean } @@ -992,6 +1025,12 @@ export class ApiClient extends AbstractFetchClient { mobilepay_payments?: { requested?: boolean } + multibanco_payments?: { + requested?: boolean + } + mx_bank_transfer_payments?: { + requested?: boolean + } oxxo_payments?: { requested?: boolean } @@ -1007,6 +1046,9 @@ export class ApiClient extends AbstractFetchClient { revolut_pay_payments?: { requested?: boolean } + sepa_bank_transfer_payments?: { + requested?: boolean + } sepa_debit_payments?: { requested?: boolean } @@ -1028,9 +1070,15 @@ export class ApiClient extends AbstractFetchClient { treasury?: { requested?: boolean } + twint_payments?: { + requested?: boolean + } us_bank_account_ach_payments?: { requested?: boolean } + us_bank_transfer_payments?: { + requested?: boolean + } zip_payments?: { requested?: boolean } @@ -1292,24 +1340,307 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts/${p["account"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async postAccountsAccountBankAccounts( + p: { + account: string + requestBody?: { + bank_account?: + | { + account_holder_name?: string + account_holder_type?: "company" | "individual" + account_number: string + account_type?: "checking" | "futsu" | "savings" | "toza" + country: string + currency?: string + documents?: { + bank_account_ownership_verification?: { + files?: string[] + } + } + object?: "bank_account" + routing_number?: string + } + | string + default_for_currency?: boolean + expand?: string[] + external_account?: string + metadata?: { + [key: string]: string | undefined + } + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res> + > { + const url = this.basePath + `/v1/accounts/${p["account"]}/bank_accounts` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async deleteAccountsAccountBankAccountsId( + p: { + account: string + id: string + requestBody?: EmptyObject + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + Res<200, t_deleted_external_account> | Res + > + > { + const url = + this.basePath + `/v1/accounts/${p["account"]}/bank_accounts/${p["id"]}` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "POST", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } - async postAccountsAccountBankAccounts( + async getAccountsAccountBankAccountsId( + p: { + account: string + expand?: string[] + id: string + requestBody?: EmptyObject + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res> + > { + const url = + this.basePath + `/v1/accounts/${p["account"]}/bank_accounts/${p["id"]}` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const query = this._query({ expand: p["expand"] }) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url + query, + { method: "GET", body, ...opts, headers }, + timeout, + ) + } + + async postAccountsAccountBankAccountsId( + p: { + account: string + id: string + requestBody?: { + account_holder_name?: string + account_holder_type?: "" | "company" | "individual" + account_type?: "checking" | "futsu" | "savings" | "toza" + address_city?: string + address_country?: string + address_line1?: string + address_line2?: string + address_state?: string + address_zip?: string + default_for_currency?: boolean + documents?: { + bank_account_ownership_verification?: { + files?: string[] + } + } + exp_month?: string + exp_year?: string + expand?: string[] + metadata?: + | { + [key: string]: string | undefined + } + | "" + name?: string + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res> + > { + const url = + this.basePath + `/v1/accounts/${p["account"]}/bank_accounts/${p["id"]}` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async getAccountsAccountCapabilities( + p: { + account: string + expand?: string[] + requestBody?: EmptyObject + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 200, + { + data: t_capability[] + has_more: boolean + object: "list" + url: string + } + > + | Res + > + > { + const url = this.basePath + `/v1/accounts/${p["account"]}/capabilities` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const query = this._query({ expand: p["expand"] }) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url + query, + { method: "GET", body, ...opts, headers }, + timeout, + ) + } + + async getAccountsAccountCapabilitiesCapability( + p: { + account: string + capability: string + expand?: string[] + requestBody?: EmptyObject + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res> + > { + const url = + this.basePath + + `/v1/accounts/${p["account"]}/capabilities/${p["capability"]}` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const query = this._query({ expand: p["expand"] }) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url + query, + { method: "GET", body, ...opts, headers }, + timeout, + ) + } + + async postAccountsAccountCapabilitiesCapability( + p: { + account: string + capability: string + requestBody?: { + expand?: string[] + requested?: boolean + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res> + > { + const url = + this.basePath + + `/v1/accounts/${p["account"]}/capabilities/${p["capability"]}` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async getAccountsAccountExternalAccounts( + p: { + account: string + endingBefore?: string + expand?: string[] + limit?: number + object?: "bank_account" | "card" + startingAfter?: string + requestBody?: EmptyObject + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 200, + { + data: (t_bank_account | t_card)[] + has_more: boolean + object: "list" + url: string + } + > + | Res + > + > { + const url = this.basePath + `/v1/accounts/${p["account"]}/external_accounts` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const query = this._query({ + ending_before: p["endingBefore"], + expand: p["expand"], + limit: p["limit"], + object: p["object"], + starting_after: p["startingAfter"], + }) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url + query, + { method: "GET", body, ...opts, headers }, + timeout, + ) + } + + async postAccountsAccountExternalAccounts( p: { account: string requestBody?: { @@ -1339,311 +1670,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> - > { - const url = this.basePath + `/v1/accounts/${p["account"]}/bank_accounts` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) - const body = JSON.stringify(p.requestBody) - - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) - } - - async deleteAccountsAccountBankAccountsId( - p: { - account: string - id: string - requestBody?: EmptyObject - }, - timeout?: number, - opts?: RequestInit, - ): Promise< - TypedFetchResponse< - Res<200, t_deleted_external_account> | Res - > - > { - const url = - this.basePath + `/v1/accounts/${p["account"]}/bank_accounts/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) - const body = JSON.stringify(p.requestBody) - - return this._fetch( - url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, - timeout, - ) - } - - async getAccountsAccountBankAccountsId( - p: { - account: string - expand?: string[] - id: string - requestBody?: EmptyObject - }, - timeout?: number, - opts?: RequestInit, - ): Promise< - TypedFetchResponse | Res> - > { - const url = - this.basePath + `/v1/accounts/${p["account"]}/bank_accounts/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) - const query = this._query({ expand: p["expand"] }) - const body = JSON.stringify(p.requestBody) - - return this._fetch( - url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, - timeout, - ) - } - - async postAccountsAccountBankAccountsId( - p: { - account: string - id: string - requestBody?: { - account_holder_name?: string - account_holder_type?: "" | "company" | "individual" - account_type?: "checking" | "futsu" | "savings" | "toza" - address_city?: string - address_country?: string - address_line1?: string - address_line2?: string - address_state?: string - address_zip?: string - default_for_currency?: boolean - documents?: { - bank_account_ownership_verification?: { - files?: string[] - } - } - exp_month?: string - exp_year?: string - expand?: string[] - metadata?: - | { - [key: string]: string | undefined - } - | "" - name?: string - } - }, - timeout?: number, - opts?: RequestInit, - ): Promise< - TypedFetchResponse | Res> - > { - const url = - this.basePath + `/v1/accounts/${p["account"]}/bank_accounts/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) - const body = JSON.stringify(p.requestBody) - - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) - } - - async getAccountsAccountCapabilities( - p: { - account: string - expand?: string[] - requestBody?: EmptyObject - }, - timeout?: number, - opts?: RequestInit, - ): Promise< - TypedFetchResponse< - | Res< - 200, - { - data: t_capability[] - has_more: boolean - object: "list" - url: string - } - > - | Res - > - > { - const url = this.basePath + `/v1/accounts/${p["account"]}/capabilities` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) - const query = this._query({ expand: p["expand"] }) - const body = JSON.stringify(p.requestBody) - - return this._fetch( - url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, - timeout, - ) - } - - async getAccountsAccountCapabilitiesCapability( - p: { - account: string - capability: string - expand?: string[] - requestBody?: EmptyObject - }, - timeout?: number, - opts?: RequestInit, - ): Promise< - TypedFetchResponse | Res> - > { - const url = - this.basePath + - `/v1/accounts/${p["account"]}/capabilities/${p["capability"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) - const query = this._query({ expand: p["expand"] }) - const body = JSON.stringify(p.requestBody) - - return this._fetch( - url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, - timeout, - ) - } - - async postAccountsAccountCapabilitiesCapability( - p: { - account: string - capability: string - requestBody?: { - expand?: string[] - requested?: boolean - } - }, - timeout?: number, - opts?: RequestInit, - ): Promise< - TypedFetchResponse | Res> - > { - const url = - this.basePath + - `/v1/accounts/${p["account"]}/capabilities/${p["capability"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) - const body = JSON.stringify(p.requestBody) - - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) - } - - async getAccountsAccountExternalAccounts( - p: { - account: string - endingBefore?: string - expand?: string[] - limit?: number - object?: "bank_account" | "card" - startingAfter?: string - requestBody?: EmptyObject - }, - timeout?: number, - opts?: RequestInit, - ): Promise< - TypedFetchResponse< - | Res< - 200, - { - data: (t_bank_account | t_card)[] - has_more: boolean - object: "list" - url: string - } - > - | Res - > > { const url = this.basePath + `/v1/accounts/${p["account"]}/external_accounts` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) - const query = this._query({ - ending_before: p["endingBefore"], - expand: p["expand"], - limit: p["limit"], - object: p["object"], - starting_after: p["startingAfter"], - }) - const body = JSON.stringify(p.requestBody) - - return this._fetch( - url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, - timeout, + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, ) - } - - async postAccountsAccountExternalAccounts( - p: { - account: string - requestBody?: { - bank_account?: - | { - account_holder_name?: string - account_holder_type?: "company" | "individual" - account_number: string - account_type?: "checking" | "futsu" | "savings" | "toza" - country: string - currency?: string - documents?: { - bank_account_ownership_verification?: { - files?: string[] - } - } - object?: "bank_account" - routing_number?: string - } - | string - default_for_currency?: boolean - expand?: string[] - external_account?: string - metadata?: { - [key: string]: string | undefined - } - } - }, - timeout?: number, - opts?: RequestInit, - ): Promise< - TypedFetchResponse | Res> - > { - const url = this.basePath + `/v1/accounts/${p["account"]}/external_accounts` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteAccountsAccountExternalAccountsId( @@ -1653,7 +1691,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_deleted_external_account> | Res @@ -1662,14 +1700,15 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/accounts/${p["account"]}/external_accounts/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -1682,22 +1721,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts/${p["account"]}/external_accounts/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -1734,23 +1774,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts/${p["account"]}/external_accounts/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postAccountsAccountLoginLinks( @@ -1761,21 +1798,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts/${p["account"]}/login_links` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getAccountsAccountPeople( @@ -1795,7 +1829,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -1811,9 +1845,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/accounts/${p["account"]}/people` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -1825,7 +1860,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -1938,21 +1973,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts/${p["account"]}/people` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteAccountsAccountPeoplePerson( @@ -1962,20 +1994,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts/${p["account"]}/people/${p["person"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -1988,21 +2021,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts/${p["account"]}/people/${p["person"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -2116,22 +2150,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts/${p["account"]}/people/${p["person"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getAccountsAccountPersons( @@ -2151,7 +2182,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -2167,9 +2198,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/accounts/${p["account"]}/persons` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -2181,7 +2213,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -2294,21 +2326,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts/${p["account"]}/persons` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteAccountsAccountPersonsPerson( @@ -2318,20 +2347,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts/${p["account"]}/persons/${p["person"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -2344,21 +2374,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts/${p["account"]}/persons/${p["person"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -2472,22 +2503,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts/${p["account"]}/persons/${p["person"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postAccountsAccountReject( @@ -2499,21 +2527,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/accounts/${p["account"]}/reject` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getApplePayDomains( @@ -2526,7 +2551,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -2542,9 +2567,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/apple_pay/domains` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ domain_name: p["domainName"], ending_before: p["endingBefore"], @@ -2556,7 +2582,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -2569,21 +2595,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/apple_pay/domains` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteApplePayDomainsDomain( @@ -2592,21 +2615,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_deleted_apple_pay_domain> | Res > > { const url = this.basePath + `/v1/apple_pay/domains/${p["domain"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -2618,20 +2642,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/apple_pay/domains/${p["domain"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -2654,7 +2679,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -2670,9 +2695,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/application_fees` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ charge: p["charge"], created: p["created"], @@ -2685,7 +2711,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -2698,21 +2724,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/application_fees/${p["fee"]}/refunds/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -2731,22 +2758,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/application_fees/${p["fee"]}/refunds/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getApplicationFeesId( @@ -2756,20 +2780,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/application_fees/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -2784,21 +2809,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/application_fees/${p["id"]}/refund` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getApplicationFeesIdRefunds( @@ -2811,7 +2833,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -2827,9 +2849,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/application_fees/${p["id"]}/refunds` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -2840,7 +2863,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -2857,21 +2880,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/application_fees/${p["id"]}/refunds` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getAppsSecrets( @@ -2887,7 +2907,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -2903,9 +2923,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/apps/secrets` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -2917,7 +2938,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -2936,21 +2957,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/apps/secrets` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postAppsSecretsDelete( @@ -2965,21 +2983,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/apps/secrets/delete` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getAppsSecretsFind( @@ -2993,14 +3008,15 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/apps/secrets/find` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"], name: p["name"], @@ -3010,7 +3026,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -3021,20 +3037,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/balance` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -3060,7 +3077,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -3076,9 +3093,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/balance/history` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], currency: p["currency"], @@ -3094,7 +3112,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -3106,22 +3124,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_balance_transaction> | Res > > { const url = this.basePath + `/v1/balance/history/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -3147,7 +3166,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -3163,9 +3182,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/balance_transactions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], currency: p["currency"], @@ -3181,7 +3201,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -3193,26 +3213,198 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_balance_transaction> | Res > > { const url = this.basePath + `/v1/balance_transactions/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const query = this._query({ expand: p["expand"] }) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url + query, + { method: "GET", body, ...opts, headers }, + timeout, + ) + } + + async getBillingAlerts( + p: { + alertType?: "usage_threshold" + endingBefore?: string + expand?: string[] + limit?: number + meter?: string + startingAfter?: string + requestBody?: EmptyObject + } = {}, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + | Res< + 200, + { + data: t_billing_alert[] + has_more: boolean + object: "list" + url: string + } + > + | Res + > + > { + const url = this.basePath + `/v1/billing/alerts` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const query = this._query({ + alert_type: p["alertType"], + ending_before: p["endingBefore"], + expand: p["expand"], + limit: p["limit"], + meter: p["meter"], + starting_after: p["startingAfter"], }) + const body = JSON.stringify(p.requestBody) + + return this._fetch( + url + query, + { method: "GET", body, ...opts, headers }, + timeout, + ) + } + + async postBillingAlerts( + p: { + requestBody: { + alert_type: "usage_threshold" + expand?: string[] + filter?: { + customer?: string + } + title: string + usage_threshold_config?: { + gte: number + meter?: string + recurrence: "one_time" + } + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res> + > { + const url = this.basePath + `/v1/billing/alerts` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async getBillingAlertsId( + p: { + expand?: string[] + id: string + requestBody?: EmptyObject + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res> + > { + const url = this.basePath + `/v1/billing/alerts/${p["id"]}` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } + async postBillingAlertsIdActivate( + p: { + id: string + requestBody?: { + expand?: string[] + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res> + > { + const url = this.basePath + `/v1/billing/alerts/${p["id"]}/activate` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async postBillingAlertsIdArchive( + p: { + id: string + requestBody?: { + expand?: string[] + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res> + > { + const url = this.basePath + `/v1/billing/alerts/${p["id"]}/archive` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async postBillingAlertsIdDeactivate( + p: { + id: string + requestBody?: { + expand?: string[] + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res> + > { + const url = this.basePath + `/v1/billing/alerts/${p["id"]}/deactivate` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + async postBillingMeterEventAdjustments( p: { requestBody: { @@ -3225,23 +3417,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_billing_meter_event_adjustment> | Res > > { const url = this.basePath + `/v1/billing/meter_event_adjustments` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postBillingMeterEvents( @@ -3257,23 +3446,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_billing_meter_event> | Res > > { const url = this.basePath + `/v1/billing/meter_events` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getBillingMeters( @@ -3286,7 +3472,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -3302,9 +3488,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/billing/meters` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -3316,7 +3503,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -3341,21 +3528,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/billing/meters` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getBillingMetersId( @@ -3365,20 +3549,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/billing/meters/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -3392,21 +3577,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/billing/meters/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postBillingMetersIdDeactivate( @@ -3417,21 +3599,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/billing/meters/${p["id"]}/deactivate` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getBillingMetersIdEventSummaries( @@ -3444,11 +3623,11 @@ export class ApiClient extends AbstractFetchClient { limit?: number startTime: number startingAfter?: string - valueGroupingWindow?: "hour" + valueGroupingWindow?: "day" | "hour" requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -3464,9 +3643,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/billing/meters/${p["id"]}/event_summaries` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ customer: p["customer"], end_time: p["endTime"], @@ -3481,7 +3661,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -3494,21 +3674,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/billing/meters/${p["id"]}/reactivate` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getBillingPortalConfigurations( @@ -3522,7 +3699,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -3538,9 +3715,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/billing_portal/configurations` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ active: p["active"], ending_before: p["endingBefore"], @@ -3553,7 +3731,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -3631,23 +3809,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_billing_portal_configuration> | Res > > { const url = this.basePath + `/v1/billing_portal/configurations` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getBillingPortalConfigurationsConfiguration( @@ -3657,7 +3832,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_billing_portal_configuration> | Res @@ -3665,15 +3840,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/billing_portal/configurations/${p["configuration"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -3755,7 +3931,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_billing_portal_configuration> | Res @@ -3763,16 +3939,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/billing_portal/configurations/${p["configuration"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postBillingPortalSessions( @@ -3874,23 +4047,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_billing_portal_session> | Res > > { const url = this.basePath + `/v1/billing_portal/sessions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCharges( @@ -3913,7 +4083,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -3929,9 +4099,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/charges` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], customer: p["customer"], @@ -3946,7 +4117,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -4022,21 +4193,18 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/charges` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getChargesSearch( @@ -4048,7 +4216,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -4066,9 +4234,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/charges/search` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"], limit: p["limit"], @@ -4079,7 +4248,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -4091,20 +4260,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/charges/${p["charge"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -4143,21 +4313,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/charges/${p["charge"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postChargesChargeCapture( @@ -4178,21 +4345,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/charges/${p["charge"]}/capture` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getChargesChargeDispute( @@ -4202,20 +4366,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/charges/${p["charge"]}/dispute` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -4263,21 +4428,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/charges/${p["charge"]}/dispute` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postChargesChargeDisputeClose( @@ -4288,21 +4450,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/charges/${p["charge"]}/dispute/close` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postChargesChargeRefund( @@ -4324,21 +4483,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/charges/${p["charge"]}/refund` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getChargesChargeRefunds( @@ -4351,7 +4507,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -4367,9 +4523,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/charges/${p["charge"]}/refunds` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -4380,7 +4537,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -4407,21 +4564,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/charges/${p["charge"]}/refunds` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getChargesChargeRefundsRefund( @@ -4432,21 +4586,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/charges/${p["charge"]}/refunds/${p["refund"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -4465,22 +4620,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/charges/${p["charge"]}/refunds/${p["refund"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCheckoutSessions( @@ -4508,7 +4660,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -4524,9 +4676,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/checkout/sessions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], customer: p["customer"], @@ -4544,7 +4697,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -4579,6 +4732,7 @@ export class ApiClient extends AbstractFetchClient { currency?: string custom_fields?: { dropdown?: { + default_value?: string options: { label: string value: string @@ -4590,11 +4744,13 @@ export class ApiClient extends AbstractFetchClient { type: "custom" } numeric?: { + default_value?: string maximum_length?: number minimum_length?: number } optional?: boolean text?: { + default_value?: string maximum_length?: number minimum_length?: number } @@ -4881,6 +5037,9 @@ export class ApiClient extends AbstractFetchClient { mobilepay?: { setup_future_usage?: "none" } + multibanco?: { + setup_future_usage?: "none" + } oxxo?: { expires_after_days?: number setup_future_usage?: "none" @@ -4977,6 +5136,7 @@ export class ApiClient extends AbstractFetchClient { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -4987,6 +5147,7 @@ export class ApiClient extends AbstractFetchClient { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -5319,21 +5480,18 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/checkout/sessions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCheckoutSessionsSession( @@ -5343,24 +5501,52 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/checkout/sessions/${p["session"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } + async postCheckoutSessionsSession( + p: { + session: string + requestBody?: { + expand?: string[] + metadata?: + | { + [key: string]: string | undefined + } + | "" + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res> + > { + const url = this.basePath + `/v1/checkout/sessions/${p["session"]}` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + async postCheckoutSessionsSessionExpire( p: { session: string @@ -5369,21 +5555,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/checkout/sessions/${p["session"]}/expire` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCheckoutSessionsSessionLineItems( @@ -5396,7 +5579,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -5413,9 +5596,10 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/checkout/sessions/${p["session"]}/line_items` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -5426,7 +5610,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -5440,7 +5624,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -5456,9 +5640,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/climate/orders` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -5469,7 +5654,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -5491,21 +5676,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/climate/orders` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getClimateOrdersOrder( @@ -5515,20 +5697,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/climate/orders/${p["order"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -5549,21 +5732,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/climate/orders/${p["order"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postClimateOrdersOrderCancel( @@ -5574,21 +5754,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/climate/orders/${p["order"]}/cancel` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getClimateProducts( @@ -5600,7 +5777,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -5616,9 +5793,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/climate/products` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -5629,7 +5807,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -5641,20 +5819,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/climate/products/${p["product"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -5668,7 +5847,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -5684,9 +5863,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/climate/suppliers` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -5697,7 +5877,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -5709,20 +5889,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/climate/suppliers/${p["supplier"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -5734,7 +5915,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_confirmation_token> | Res @@ -5742,15 +5923,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/confirmation_tokens/${p["confirmationToken"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -5764,7 +5946,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -5780,9 +5962,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/country_specs` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -5793,7 +5976,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -5805,20 +5988,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/country_specs/${p["country"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -5840,7 +6024,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -5856,9 +6040,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/coupons` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], ending_before: p["endingBefore"], @@ -5870,7 +6055,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -5906,21 +6091,18 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/coupons` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteCouponsCoupon( @@ -5929,19 +6111,20 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/coupons/${p["coupon"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -5953,20 +6136,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/coupons/${p["coupon"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -5992,21 +6176,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/coupons/${p["coupon"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCreditNotes( @@ -6028,7 +6209,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -6044,9 +6225,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/credit_notes` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], customer: p["customer"], @@ -6060,7 +6242,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -6071,6 +6253,7 @@ export class ApiClient extends AbstractFetchClient { amount?: number credit_amount?: number effective_at?: number + email_type?: "credit_note" | "none" expand?: string[] invoice: string lines?: { @@ -6108,21 +6291,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/credit_notes` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCreditNotesPreview( @@ -6130,6 +6310,7 @@ export class ApiClient extends AbstractFetchClient { amount?: number creditAmount?: number effectiveAt?: number + emailType?: "credit_note" | "none" expand?: string[] invoice: string lines?: { @@ -6167,18 +6348,20 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/credit_notes/preview` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ amount: p["amount"], credit_amount: p["creditAmount"], effective_at: p["effectiveAt"], + email_type: p["emailType"], expand: p["expand"], invoice: p["invoice"], lines: p["lines"], @@ -6194,7 +6377,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -6204,6 +6387,7 @@ export class ApiClient extends AbstractFetchClient { amount?: number creditAmount?: number effectiveAt?: number + emailType?: "credit_note" | "none" endingBefore?: string expand?: string[] invoice: string @@ -6244,7 +6428,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -6260,13 +6444,15 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/credit_notes/preview/lines` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ amount: p["amount"], credit_amount: p["creditAmount"], effective_at: p["effectiveAt"], + email_type: p["emailType"], ending_before: p["endingBefore"], expand: p["expand"], invoice: p["invoice"], @@ -6285,7 +6471,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -6300,7 +6486,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -6316,9 +6502,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/credit_notes/${p["creditNote"]}/lines` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -6329,7 +6516,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -6341,20 +6528,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/credit_notes/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -6371,21 +6559,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/credit_notes/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postCreditNotesIdVoid( @@ -6396,21 +6581,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/credit_notes/${p["id"]}/void` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postCustomerSessions( @@ -6420,6 +6602,21 @@ export class ApiClient extends AbstractFetchClient { buy_button?: { enabled: boolean } + payment_element?: { + enabled: boolean + features?: { + payment_method_allow_redisplay_filters?: ( + | "always" + | "limited" + | "unspecified" + )[] + payment_method_redisplay?: "disabled" | "enabled" + payment_method_redisplay_limit?: number + payment_method_remove?: "disabled" | "enabled" + payment_method_save?: "disabled" | "enabled" + payment_method_save_usage?: "off_session" | "on_session" + } + } pricing_table?: { enabled: boolean } @@ -6429,21 +6626,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customer_sessions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCustomers( @@ -6465,7 +6659,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -6481,9 +6675,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/customers` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], email: p["email"], @@ -6497,7 +6692,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -6593,11 +6788,13 @@ export class ApiClient extends AbstractFetchClient { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -6654,21 +6851,18 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCustomersSearch( @@ -6680,7 +6874,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -6698,9 +6892,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/customers/search` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"], limit: p["limit"], @@ -6711,7 +6906,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -6722,19 +6917,20 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -6746,22 +6942,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_customer | t_deleted_customer> | Res > > { const url = this.basePath + `/v1/customers/${p["customer"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -6876,21 +7073,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCustomersCustomerBalanceTransactions( @@ -6903,7 +7097,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -6920,9 +7114,10 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/customers/${p["customer"]}/balance_transactions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -6933,7 +7128,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -6954,7 +7149,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_customer_balance_transaction> | Res @@ -6962,16 +7157,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/customers/${p["customer"]}/balance_transactions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCustomersCustomerBalanceTransactionsTransaction( @@ -6982,7 +7174,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_customer_balance_transaction> | Res @@ -6991,15 +7183,16 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/customers/${p["customer"]}/balance_transactions/${p["transaction"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -7019,7 +7212,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_customer_balance_transaction> | Res @@ -7028,16 +7221,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/customers/${p["customer"]}/balance_transactions/${p["transaction"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCustomersCustomerBankAccounts( @@ -7050,7 +7240,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -7066,9 +7256,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/customers/${p["customer"]}/bank_accounts` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -7079,7 +7270,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -7127,21 +7318,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/bank_accounts` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteCustomersCustomerBankAccountsId( @@ -7153,7 +7341,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_payment_source | t_deleted_payment_source> @@ -7162,14 +7350,15 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/customers/${p["customer"]}/bank_accounts/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -7182,21 +7371,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/bank_accounts/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -7239,7 +7429,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_card | t_bank_account | t_source> | Res @@ -7247,16 +7437,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/customers/${p["customer"]}/bank_accounts/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postCustomersCustomerBankAccountsIdVerify( @@ -7269,23 +7456,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/bank_accounts/${p["id"]}/verify` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCustomersCustomerCards( @@ -7298,7 +7482,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -7314,9 +7498,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/customers/${p["customer"]}/cards` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -7327,7 +7512,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -7375,21 +7560,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/cards` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteCustomersCustomerCardsId( @@ -7401,7 +7583,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_payment_source | t_deleted_payment_source> @@ -7410,14 +7592,15 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/customers/${p["customer"]}/cards/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -7430,19 +7613,20 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/customers/${p["customer"]}/cards/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -7485,7 +7669,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_card | t_bank_account | t_source> | Res @@ -7493,16 +7677,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/customers/${p["customer"]}/cards/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCustomersCustomerCashBalance( @@ -7512,20 +7693,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/cash_balance` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -7541,21 +7723,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/cash_balance` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCustomersCustomerCashBalanceTransactions( @@ -7568,7 +7747,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -7585,9 +7764,10 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/customers/${p["customer"]}/cash_balance_transactions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -7598,7 +7778,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -7611,7 +7791,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_customer_cash_balance_transaction> | Res @@ -7620,15 +7800,16 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/customers/${p["customer"]}/cash_balance_transactions/${p["transaction"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -7639,19 +7820,20 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/discount` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -7663,20 +7845,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/discount` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -7703,7 +7886,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_funding_instructions> | Res @@ -7711,16 +7894,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/customers/${p["customer"]}/funding_instructions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCustomersCustomerPaymentMethods( @@ -7754,6 +7934,7 @@ export class ApiClient extends AbstractFetchClient { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -7764,13 +7945,14 @@ export class ApiClient extends AbstractFetchClient { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -7786,9 +7968,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/customers/${p["customer"]}/payment_methods` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ allow_redisplay: p["allowRedisplay"], ending_before: p["endingBefore"], @@ -7801,7 +7984,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -7814,22 +7997,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/payment_methods/${p["paymentMethod"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -7845,7 +8029,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -7861,9 +8045,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/customers/${p["customer"]}/sources` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -7875,7 +8060,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -7923,21 +8108,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/sources` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteCustomersCustomerSourcesId( @@ -7949,7 +8131,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_payment_source | t_deleted_payment_source> @@ -7958,14 +8140,15 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/customers/${p["customer"]}/sources/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -7978,21 +8161,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/sources/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -8035,7 +8219,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_card | t_bank_account | t_source> | Res @@ -8043,16 +8227,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/customers/${p["customer"]}/sources/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postCustomersCustomerSourcesIdVerify( @@ -8065,22 +8246,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/sources/${p["id"]}/verify` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getCustomersCustomerSubscriptions( @@ -8093,7 +8271,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -8109,9 +8287,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/customers/${p["customer"]}/subscriptions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -8122,7 +8301,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -8261,6 +8440,7 @@ export class ApiClient extends AbstractFetchClient { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -8286,6 +8466,9 @@ export class ApiClient extends AbstractFetchClient { us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -8306,6 +8489,7 @@ export class ApiClient extends AbstractFetchClient { | "ach_credit_transfer" | "ach_debit" | "acss_debit" + | "amazon_pay" | "au_becs_debit" | "bacs_debit" | "bancontact" @@ -8320,12 +8504,15 @@ export class ApiClient extends AbstractFetchClient { | "ideal" | "konbini" | "link" + | "multibanco" | "p24" | "paynow" | "paypal" | "promptpay" + | "revolut_pay" | "sepa_debit" | "sofort" + | "swish" | "us_bank_account" | "wechat_pay" )[] @@ -8355,21 +8542,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/subscriptions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteCustomersCustomerSubscriptionsSubscriptionExposedId( @@ -8383,21 +8567,22 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/subscriptions/${p["subscriptionExposedId"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -8410,22 +8595,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/subscriptions/${p["subscriptionExposedId"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -8587,6 +8773,7 @@ export class ApiClient extends AbstractFetchClient { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -8612,6 +8799,9 @@ export class ApiClient extends AbstractFetchClient { us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -8632,6 +8822,7 @@ export class ApiClient extends AbstractFetchClient { | "ach_credit_transfer" | "ach_debit" | "acss_debit" + | "amazon_pay" | "au_becs_debit" | "bacs_debit" | "bancontact" @@ -8646,12 +8837,15 @@ export class ApiClient extends AbstractFetchClient { | "ideal" | "konbini" | "link" + | "multibanco" | "p24" | "paynow" | "paypal" | "promptpay" + | "revolut_pay" | "sepa_debit" | "sofort" + | "swish" | "us_bank_account" | "wechat_pay" )[] @@ -8683,23 +8877,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/subscriptions/${p["subscriptionExposedId"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscount( @@ -8709,21 +8900,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/subscriptions/${p["subscriptionExposedId"]}/discount` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -8736,22 +8928,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/subscriptions/${p["subscriptionExposedId"]}/discount` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -8766,7 +8959,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -8782,9 +8975,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/customers/${p["customer"]}/tax_ids` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -8795,7 +8989,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -8822,11 +9016,13 @@ export class ApiClient extends AbstractFetchClient { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -8881,21 +9077,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/tax_ids` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteCustomersCustomerTaxIdsId( @@ -8905,20 +9098,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/tax_ids/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -8931,21 +9125,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/customers/${p["customer"]}/tax_ids/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -8969,7 +9164,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -8985,9 +9180,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/disputes` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ charge: p["charge"], created: p["created"], @@ -9001,7 +9197,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9013,20 +9209,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/disputes/${p["dispute"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9074,21 +9271,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/disputes/${p["dispute"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postDisputesDisputeClose( @@ -9099,21 +9293,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/disputes/${p["dispute"]}/close` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getEntitlementsActiveEntitlements( @@ -9126,7 +9317,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -9142,9 +9333,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/entitlements/active_entitlements` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ customer: p["customer"], ending_before: p["endingBefore"], @@ -9156,7 +9348,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9168,7 +9360,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_entitlements_active_entitlement> | Res @@ -9176,29 +9368,32 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/entitlements/active_entitlements/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } async getEntitlementsFeatures( p: { + archived?: boolean endingBefore?: string expand?: string[] limit?: number + lookupKey?: string startingAfter?: string requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -9214,20 +9409,23 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/entitlements/features` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ + archived: p["archived"], ending_before: p["endingBefore"], expand: p["expand"], limit: p["limit"], + lookup_key: p["lookupKey"], starting_after: p["startingAfter"], }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9244,23 +9442,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_entitlements_feature> | Res > > { const url = this.basePath + `/v1/entitlements/features` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getEntitlementsFeaturesId( @@ -9270,22 +9465,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_entitlements_feature> | Res > > { const url = this.basePath + `/v1/entitlements/features/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9296,30 +9492,29 @@ export class ApiClient extends AbstractFetchClient { requestBody?: { active?: boolean expand?: string[] - metadata?: { - [key: string]: string | undefined - } + metadata?: + | { + [key: string]: string | undefined + } + | "" name?: string } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_entitlements_feature> | Res > > { const url = this.basePath + `/v1/entitlements/features/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postEphemeralKeys( @@ -9333,21 +9528,18 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/ephemeral_keys` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteEphemeralKeysKey( @@ -9358,19 +9550,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/ephemeral_keys/${p["key"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -9395,7 +9588,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -9411,9 +9604,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/events` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], delivery_success: p["deliverySuccess"], @@ -9428,7 +9622,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9440,18 +9634,19 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/events/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9465,7 +9660,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -9481,9 +9676,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/exchange_rates` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -9494,7 +9690,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9506,20 +9702,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/exchange_rates/${p["rateId"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9543,7 +9740,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -9559,9 +9756,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/file_links` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], ending_before: p["endingBefore"], @@ -9575,7 +9773,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9594,21 +9792,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/file_links` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getFileLinksLink( @@ -9618,20 +9813,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/file_links/${p["link"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9650,21 +9846,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/file_links/${p["link"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getFiles( @@ -9700,7 +9893,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -9716,9 +9909,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/files` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], ending_before: p["endingBefore"], @@ -9731,7 +9925,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9764,17 +9958,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/files` - const headers = this._headers({ "Content-Type": "multipart/form-data" }) + const headers = this._headers( + { "Content-Type": "multipart/form-data" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getFilesFile( @@ -9784,18 +9977,19 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/files/${p["file"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9814,7 +10008,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -9830,9 +10024,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/financial_connections/accounts` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ account_holder: p["accountHolder"], ending_before: p["endingBefore"], @@ -9845,7 +10040,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9857,7 +10052,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_financial_connections_account> | Res @@ -9865,15 +10060,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/financial_connections/accounts/${p["account"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9886,7 +10082,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_financial_connections_account> | Res @@ -9895,16 +10091,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/financial_connections/accounts/${p["account"]}/disconnect` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getFinancialConnectionsAccountsAccountOwners( @@ -9918,7 +10111,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -9936,9 +10129,10 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/financial_connections/accounts/${p["account"]}/owners` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -9950,7 +10144,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -9964,7 +10158,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_financial_connections_account> | Res @@ -9973,16 +10167,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/financial_connections/accounts/${p["account"]}/refresh` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postFinancialConnectionsAccountsAccountSubscribe( @@ -9994,7 +10185,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_financial_connections_account> | Res @@ -10003,16 +10194,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/financial_connections/accounts/${p["account"]}/subscribe` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postFinancialConnectionsAccountsAccountUnsubscribe( @@ -10024,7 +10212,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_financial_connections_account> | Res @@ -10033,16 +10221,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/financial_connections/accounts/${p["account"]}/unsubscribe` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postFinancialConnectionsSessions( @@ -10055,7 +10240,14 @@ export class ApiClient extends AbstractFetchClient { } expand?: string[] filters?: { - countries: string[] + account_subcategories?: ( + | "checking" + | "credit_card" + | "line_of_credit" + | "mortgage" + | "savings" + )[] + countries?: string[] } permissions: ( | "balances" @@ -10068,23 +10260,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_financial_connections_session> | Res > > { const url = this.basePath + `/v1/financial_connections/sessions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getFinancialConnectionsSessionsSession( @@ -10094,7 +10283,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_financial_connections_session> | Res @@ -10102,15 +10291,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/financial_connections/sessions/${p["session"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -10136,7 +10326,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -10152,9 +10342,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/financial_connections/transactions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ account: p["account"], ending_before: p["endingBefore"], @@ -10168,7 +10359,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -10180,7 +10371,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_financial_connections_transaction> | Res @@ -10189,15 +10380,16 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/financial_connections/transactions/${p["transaction"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -10217,7 +10409,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -10233,9 +10425,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/forwarding/requests` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], ending_before: p["endingBefore"], @@ -10247,7 +10440,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -10274,23 +10467,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_forwarding_request> | Res > > { const url = this.basePath + `/v1/forwarding/requests` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getForwardingRequestsId( @@ -10300,22 +10490,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_forwarding_request> | Res > > { const url = this.basePath + `/v1/forwarding/requests/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -10340,7 +10531,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -10356,9 +10547,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/identity/verification_reports` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ client_reference_id: p["clientReferenceId"], created: p["created"], @@ -10373,7 +10565,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -10385,7 +10577,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_identity_verification_report> | Res @@ -10393,15 +10585,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/identity/verification_reports/${p["report"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -10420,12 +10613,13 @@ export class ApiClient extends AbstractFetchClient { endingBefore?: string expand?: string[] limit?: number + relatedCustomer?: string startingAfter?: string status?: "canceled" | "processing" | "requires_input" | "verified" requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -10441,15 +10635,17 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/identity/verification_sessions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ client_reference_id: p["clientReferenceId"], created: p["created"], ending_before: p["endingBefore"], expand: p["expand"], limit: p["limit"], + related_customer: p["relatedCustomer"], starting_after: p["startingAfter"], status: p["status"], }) @@ -10457,7 +10653,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -10479,44 +10675,32 @@ export class ApiClient extends AbstractFetchClient { require_matching_selfie?: boolean } | "" - email?: - | { - require_verification?: boolean - } - | "" - phone?: - | { - require_verification?: boolean - } - | "" } provided_details?: { email?: string phone?: string } + related_customer?: string return_url?: string type?: "document" | "id_number" verification_flow?: string } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_identity_verification_session> | Res > > { const url = this.basePath + `/v1/identity/verification_sessions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getIdentityVerificationSessionsSession( @@ -10526,7 +10710,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_identity_verification_session> | Res @@ -10534,15 +10718,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/identity/verification_sessions/${p["session"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -10564,16 +10749,6 @@ export class ApiClient extends AbstractFetchClient { require_matching_selfie?: boolean } | "" - email?: - | { - require_verification?: boolean - } - | "" - phone?: - | { - require_verification?: boolean - } - | "" } provided_details?: { email?: string @@ -10583,7 +10758,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_identity_verification_session> | Res @@ -10591,16 +10766,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/identity/verification_sessions/${p["session"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postIdentityVerificationSessionsSessionCancel( @@ -10611,7 +10783,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_identity_verification_session> | Res @@ -10620,16 +10792,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/identity/verification_sessions/${p["session"]}/cancel` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postIdentityVerificationSessionsSessionRedact( @@ -10640,7 +10809,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_identity_verification_session> | Res @@ -10649,16 +10818,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/identity/verification_sessions/${p["session"]}/redact` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getInvoiceitems( @@ -10681,7 +10847,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -10697,9 +10863,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/invoiceitems` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], customer: p["customer"], @@ -10714,7 +10881,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -10763,21 +10930,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/invoiceitems` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteInvoiceitemsInvoiceitem( @@ -10786,21 +10950,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_deleted_invoiceitem> | Res > > { const url = this.basePath + `/v1/invoiceitems/${p["invoiceitem"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -10812,20 +10977,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/invoiceitems/${p["invoiceitem"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -10871,21 +11037,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/invoiceitems/${p["invoiceitem"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getInvoices( @@ -10917,7 +11080,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -10933,9 +11096,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/invoices` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ collection_method: p["collectionMethod"], created: p["created"], @@ -10952,7 +11116,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -11035,8 +11199,8 @@ export class ApiClient extends AbstractFetchClient { enabled?: boolean plan?: | { - count: number - interval: "month" + count?: number + interval?: "month" type: "fixed_count" } | "" @@ -11060,6 +11224,9 @@ export class ApiClient extends AbstractFetchClient { us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -11080,6 +11247,7 @@ export class ApiClient extends AbstractFetchClient { | "ach_credit_transfer" | "ach_debit" | "acss_debit" + | "amazon_pay" | "au_becs_debit" | "bacs_debit" | "bancontact" @@ -11094,12 +11262,15 @@ export class ApiClient extends AbstractFetchClient { | "ideal" | "konbini" | "link" + | "multibanco" | "p24" | "paynow" | "paypal" | "promptpay" + | "revolut_pay" | "sepa_debit" | "sofort" + | "swish" | "us_bank_account" | "wechat_pay" )[] @@ -11167,21 +11338,18 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/invoices` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postInvoicesCreatePreview( @@ -11244,11 +11412,13 @@ export class ApiClient extends AbstractFetchClient { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -11352,6 +11522,7 @@ export class ApiClient extends AbstractFetchClient { type: "account" | "self" } on_behalf_of?: string | "" + preview_mode?: "next" | "recurring" schedule?: string schedule_details?: { end_behavior?: "cancel" | "release" @@ -11508,21 +11679,18 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/invoices/create_preview` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getInvoicesSearch( @@ -11534,7 +11702,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -11552,9 +11720,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/invoices/search` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"], limit: p["limit"], @@ -11565,7 +11734,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -11629,11 +11798,13 @@ export class ApiClient extends AbstractFetchClient { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -11737,6 +11908,7 @@ export class ApiClient extends AbstractFetchClient { type: "account" | "self" } onBehalfOf?: string | "" + previewMode?: "next" | "recurring" schedule?: string scheduleDetails?: { end_behavior?: "cancel" | "release" @@ -11942,14 +12114,15 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/invoices/upcoming` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ automatic_tax: p["automaticTax"], coupon: p["coupon"], @@ -11961,6 +12134,7 @@ export class ApiClient extends AbstractFetchClient { invoice_items: p["invoiceItems"], issuer: p["issuer"], on_behalf_of: p["onBehalfOf"], + preview_mode: p["previewMode"], schedule: p["schedule"], schedule_details: p["scheduleDetails"], subscription: p["subscription"], @@ -11981,7 +12155,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -12045,11 +12219,13 @@ export class ApiClient extends AbstractFetchClient { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -12155,6 +12331,7 @@ export class ApiClient extends AbstractFetchClient { } limit?: number onBehalfOf?: string | "" + previewMode?: "next" | "recurring" schedule?: string scheduleDetails?: { end_behavior?: "cancel" | "release" @@ -12361,7 +12538,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -12377,9 +12554,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/invoices/upcoming/lines` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ automatic_tax: p["automaticTax"], coupon: p["coupon"], @@ -12393,6 +12571,7 @@ export class ApiClient extends AbstractFetchClient { issuer: p["issuer"], limit: p["limit"], on_behalf_of: p["onBehalfOf"], + preview_mode: p["previewMode"], schedule: p["schedule"], schedule_details: p["scheduleDetails"], starting_after: p["startingAfter"], @@ -12414,7 +12593,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -12425,19 +12604,20 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/invoices/${p["invoice"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -12449,20 +12629,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/invoices/${p["invoice"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -12540,8 +12721,8 @@ export class ApiClient extends AbstractFetchClient { enabled?: boolean plan?: | { - count: number - interval: "month" + count?: number + interval?: "month" type: "fixed_count" } | "" @@ -12565,6 +12746,9 @@ export class ApiClient extends AbstractFetchClient { us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -12585,6 +12769,7 @@ export class ApiClient extends AbstractFetchClient { | "ach_credit_transfer" | "ach_debit" | "acss_debit" + | "amazon_pay" | "au_becs_debit" | "bacs_debit" | "bancontact" @@ -12599,12 +12784,15 @@ export class ApiClient extends AbstractFetchClient { | "ideal" | "konbini" | "link" + | "multibanco" | "p24" | "paynow" | "paypal" | "promptpay" + | "revolut_pay" | "sepa_debit" | "sofort" + | "swish" | "us_bank_account" | "wechat_pay" )[] @@ -12679,21 +12867,114 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/invoices/${p["invoice"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async postInvoicesInvoiceAddLines( + p: { + invoice: string + requestBody: { + expand?: string[] + invoice_metadata?: + | { + [key: string]: string | undefined + } + | "" + lines: { + amount?: number + description?: string + discountable?: boolean + discounts?: + | { + coupon?: string + discount?: string + promotion_code?: string + }[] + | "" + invoice_item?: string + metadata?: + | { + [key: string]: string | undefined + } + | "" + period?: { + end: number + start: number + } + price?: string + price_data?: { + currency: string + product?: string + product_data?: { + description?: string + images?: string[] + metadata?: { + [key: string]: string | undefined + } + name: string + tax_code?: string + } + tax_behavior?: "exclusive" | "inclusive" | "unspecified" + unit_amount?: number + unit_amount_decimal?: string + } + quantity?: number + tax_amounts?: + | { + amount: number + tax_rate_data: { + country?: string + description?: string + display_name: string + inclusive: boolean + jurisdiction?: string + percentage: number + state?: string + tax_type?: + | "amusement_tax" + | "communications_tax" + | "gst" + | "hst" + | "igst" + | "jct" + | "lease_tax" + | "pst" + | "qst" + | "rst" + | "sales_tax" + | "vat" + } + taxable_amount: number + }[] + | "" + tax_rates?: string[] | "" + }[] + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res> + > { + const url = this.basePath + `/v1/invoices/${p["invoice"]}/add_lines` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postInvoicesInvoiceFinalize( @@ -12705,21 +12986,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/invoices/${p["invoice"]}/finalize` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getInvoicesInvoiceLines( @@ -12732,7 +13010,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -12748,9 +13026,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/invoices/${p["invoice"]}/lines` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -12761,7 +13040,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -12841,22 +13120,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/invoices/${p["invoice"]}/lines/${p["lineItemId"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postInvoicesInvoiceMarkUncollectible( @@ -12867,22 +13143,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/invoices/${p["invoice"]}/mark_uncollectible` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postInvoicesInvoicePay( @@ -12899,21 +13172,49 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/invoices/${p["invoice"]}/pay` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async postInvoicesInvoiceRemoveLines( + p: { + invoice: string + requestBody: { + expand?: string[] + invoice_metadata?: + | { + [key: string]: string | undefined + } + | "" + lines: { + behavior: "delete" | "unassign" + id: string + }[] + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res> + > { + const url = this.basePath + `/v1/invoices/${p["invoice"]}/remove_lines` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postInvoicesInvoiceSend( @@ -12924,21 +13225,114 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/invoices/${p["invoice"]}/send` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async postInvoicesInvoiceUpdateLines( + p: { + invoice: string + requestBody: { + expand?: string[] + invoice_metadata?: + | { + [key: string]: string | undefined + } + | "" + lines: { + amount?: number + description?: string + discountable?: boolean + discounts?: + | { + coupon?: string + discount?: string + promotion_code?: string + }[] + | "" + id: string + metadata?: + | { + [key: string]: string | undefined + } + | "" + period?: { + end: number + start: number + } + price?: string + price_data?: { + currency: string + product?: string + product_data?: { + description?: string + images?: string[] + metadata?: { + [key: string]: string | undefined + } + name: string + tax_code?: string + } + tax_behavior?: "exclusive" | "inclusive" | "unspecified" + unit_amount?: number + unit_amount_decimal?: string + } + quantity?: number + tax_amounts?: + | { + amount: number + tax_rate_data: { + country?: string + description?: string + display_name: string + inclusive: boolean + jurisdiction?: string + percentage: number + state?: string + tax_type?: + | "amusement_tax" + | "communications_tax" + | "gst" + | "hst" + | "igst" + | "jct" + | "lease_tax" + | "pst" + | "qst" + | "rst" + | "sales_tax" + | "vat" + } + taxable_amount: number + }[] + | "" + tax_rates?: string[] | "" + }[] + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res> + > { + const url = this.basePath + `/v1/invoices/${p["invoice"]}/update_lines` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postInvoicesInvoiceVoid( @@ -12949,21 +13343,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/invoices/${p["invoice"]}/void` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getIssuingAuthorizations( @@ -12986,7 +13377,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -13002,9 +13393,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/issuing/authorizations` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ card: p["card"], cardholder: p["cardholder"], @@ -13019,7 +13411,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -13031,7 +13423,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_authorization> | Res @@ -13039,15 +13431,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/issuing/authorizations/${p["authorization"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -13065,7 +13458,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_authorization> | Res @@ -13073,16 +13466,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/issuing/authorizations/${p["authorization"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postIssuingAuthorizationsAuthorizationApprove( @@ -13099,7 +13489,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_authorization> | Res @@ -13107,16 +13497,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/issuing/authorizations/${p["authorization"]}/approve` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postIssuingAuthorizationsAuthorizationDecline( @@ -13132,7 +13519,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_authorization> | Res @@ -13140,16 +13527,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/issuing/authorizations/${p["authorization"]}/decline` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getIssuingCardholders( @@ -13173,7 +13557,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -13189,9 +13573,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/issuing/cardholders` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], email: p["email"], @@ -13207,7 +13592,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -14169,23 +14554,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_cardholder> | Res > > { const url = this.basePath + `/v1/issuing/cardholders` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getIssuingCardholdersCardholder( @@ -14195,22 +14577,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_cardholder> | Res > > { const url = this.basePath + `/v1/issuing/cardholders/${p["cardholder"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -15171,23 +15554,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_cardholder> | Res > > { const url = this.basePath + `/v1/issuing/cardholders/${p["cardholder"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getIssuingCards( @@ -15214,7 +15594,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -15230,9 +15610,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/issuing/cards` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ cardholder: p["cardholder"], created: p["created"], @@ -15251,7 +15632,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -15282,6 +15663,12 @@ export class ApiClient extends AbstractFetchClient { postal_code: string state?: string } + address_validation?: { + mode: + | "disabled" + | "normalization_only" + | "validation_and_normalization" + } customs?: { eori_number?: string } @@ -16201,21 +16588,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/issuing/cards` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getIssuingCardsCard( @@ -16225,20 +16609,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/issuing/cards/${p["card"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -16258,6 +16643,30 @@ export class ApiClient extends AbstractFetchClient { pin?: { encrypted_number?: string } + shipping?: { + address: { + city: string + country: string + line1: string + line2?: string + postal_code: string + state?: string + } + address_validation?: { + mode: + | "disabled" + | "normalization_only" + | "validation_and_normalization" + } + customs?: { + eori_number?: string + } + name: string + phone_number?: string + require_signature?: boolean + service?: "express" | "priority" | "standard" + type?: "bulk" | "individual" + } spending_controls?: { allowed_categories?: ( | "ac_refrigeration_repair" @@ -17167,21 +17576,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/issuing/cards/${p["card"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getIssuingDisputes( @@ -17203,7 +17609,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -17219,9 +17625,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/issuing/disputes` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], ending_before: p["endingBefore"], @@ -17235,7 +17642,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -17285,6 +17692,12 @@ export class ApiClient extends AbstractFetchClient { returned_at?: number | "" } | "" + no_valid_authorization?: + | { + additional_documentation?: string | "" + explanation?: string | "" + } + | "" not_received?: | { additional_documentation?: string | "" @@ -17307,6 +17720,7 @@ export class ApiClient extends AbstractFetchClient { | "duplicate" | "fraudulent" | "merchandise_not_as_described" + | "no_valid_authorization" | "not_received" | "other" | "service_not_as_described" @@ -17331,21 +17745,18 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/issuing/disputes` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getIssuingDisputesDispute( @@ -17355,20 +17766,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/issuing/disputes/${p["dispute"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -17419,6 +17831,12 @@ export class ApiClient extends AbstractFetchClient { returned_at?: number | "" } | "" + no_valid_authorization?: + | { + additional_documentation?: string | "" + explanation?: string | "" + } + | "" not_received?: | { additional_documentation?: string | "" @@ -17441,6 +17859,7 @@ export class ApiClient extends AbstractFetchClient { | "duplicate" | "fraudulent" | "merchandise_not_as_described" + | "no_valid_authorization" | "not_received" | "other" | "service_not_as_described" @@ -17463,21 +17882,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/issuing/disputes/${p["dispute"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postIssuingDisputesDisputeSubmit( @@ -17493,21 +17909,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/issuing/disputes/${p["dispute"]}/submit` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getIssuingPersonalizationDesigns( @@ -17525,7 +17938,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -17541,9 +17954,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/issuing/personalization_designs` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -17557,7 +17971,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -17586,23 +18000,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_personalization_design> | Res > > { const url = this.basePath + `/v1/issuing/personalization_designs` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getIssuingPersonalizationDesignsPersonalizationDesign( @@ -17612,7 +18023,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_personalization_design> | Res @@ -17621,15 +18032,16 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/issuing/personalization_designs/${p["personalizationDesign"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -17661,7 +18073,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_personalization_design> | Res @@ -17670,16 +18082,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/issuing/personalization_designs/${p["personalizationDesign"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getIssuingPhysicalBundles( @@ -17693,7 +18102,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -17709,9 +18118,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/issuing/physical_bundles` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -17724,7 +18134,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -17736,7 +18146,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_physical_bundle> | Res @@ -17744,67 +18154,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/issuing/physical_bundles/${p["physicalBundle"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) - const query = this._query({ expand: p["expand"] }) - const body = JSON.stringify(p.requestBody) - - return this._fetch( - url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, - timeout, + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, ) - } - - async getIssuingSettlements( - p: { - created?: - | { - gt?: number - gte?: number - lt?: number - lte?: number - } - | number - endingBefore?: string - expand?: string[] - limit?: number - startingAfter?: string - requestBody?: EmptyObject - } = {}, - timeout?: number, - opts?: RequestInit, - ): Promise< - TypedFetchResponse< - | Res< - 200, - { - data: t_issuing_settlement[] - has_more: boolean - object: "list" - url: string - } - > - | Res - > - > { - const url = this.basePath + `/v1/issuing/settlements` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) - const query = this._query({ - created: p["created"], - ending_before: p["endingBefore"], - expand: p["expand"], - limit: p["limit"], - starting_after: p["startingAfter"], - }) + const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -17816,22 +18175,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_settlement> | Res > > { const url = this.basePath + `/v1/issuing/settlements/${p["settlement"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -17847,23 +18207,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_settlement> | Res > > { const url = this.basePath + `/v1/issuing/settlements/${p["settlement"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getIssuingTokens( @@ -17885,7 +18242,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -17901,9 +18258,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/issuing/tokens` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ card: p["card"], created: p["created"], @@ -17917,7 +18275,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -17929,20 +18287,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/issuing/tokens/${p["token"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -17956,21 +18315,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/issuing/tokens/${p["token"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getIssuingTransactions( @@ -17993,7 +18349,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -18009,9 +18365,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/issuing/transactions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ card: p["card"], cardholder: p["cardholder"], @@ -18026,7 +18383,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -18038,22 +18395,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_transaction> | Res > > { const url = this.basePath + `/v1/issuing/transactions/${p["transaction"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -18071,23 +18429,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_transaction> | Res > > { const url = this.basePath + `/v1/issuing/transactions/${p["transaction"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postLinkAccountSessions( @@ -18100,7 +18455,14 @@ export class ApiClient extends AbstractFetchClient { } expand?: string[] filters?: { - countries: string[] + account_subcategories?: ( + | "checking" + | "credit_card" + | "line_of_credit" + | "mortgage" + | "savings" + )[] + countries?: string[] } permissions: ( | "balances" @@ -18113,23 +18475,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_financial_connections_session> | Res > > { const url = this.basePath + `/v1/link_account_sessions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getLinkAccountSessionsSession( @@ -18139,22 +18498,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_financial_connections_session> | Res > > { const url = this.basePath + `/v1/link_account_sessions/${p["session"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -18173,7 +18533,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -18189,9 +18549,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/linked_accounts` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ account_holder: p["accountHolder"], ending_before: p["endingBefore"], @@ -18204,7 +18565,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -18216,22 +18577,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_financial_connections_account> | Res > > { const url = this.basePath + `/v1/linked_accounts/${p["account"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -18244,23 +18606,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_financial_connections_account> | Res > > { const url = this.basePath + `/v1/linked_accounts/${p["account"]}/disconnect` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getLinkedAccountsAccountOwners( @@ -18274,7 +18633,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -18290,9 +18649,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/linked_accounts/${p["account"]}/owners` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -18304,7 +18664,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -18318,23 +18678,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_financial_connections_account> | Res > > { const url = this.basePath + `/v1/linked_accounts/${p["account"]}/refresh` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getMandatesMandate( @@ -18344,20 +18701,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/mandates/${p["mandate"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -18380,7 +18738,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -18396,9 +18754,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/payment_intents` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], customer: p["customer"], @@ -18411,7 +18770,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -18587,6 +18946,7 @@ export class ApiClient extends AbstractFetchClient { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -18632,6 +18992,7 @@ export class ApiClient extends AbstractFetchClient { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type: | "acss_debit" | "affirm" @@ -18654,6 +19015,7 @@ export class ApiClient extends AbstractFetchClient { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -18664,6 +19026,7 @@ export class ApiClient extends AbstractFetchClient { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -18722,6 +19085,7 @@ export class ApiClient extends AbstractFetchClient { | "" bacs_debit?: | { + mandate_options?: EmptyObject setup_future_usage?: "" | "none" | "off_session" | "on_session" } | "" @@ -18751,8 +19115,8 @@ export class ApiClient extends AbstractFetchClient { enabled?: boolean plan?: | { - count: number - interval: "month" + count?: number + interval?: "month" type: "fixed_count" } | "" @@ -18774,6 +19138,7 @@ export class ApiClient extends AbstractFetchClient { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -18816,6 +19181,9 @@ export class ApiClient extends AbstractFetchClient { | { request_extended_authorization?: boolean request_incremental_authorization_support?: boolean + routing?: { + requested_priority?: "domestic" | "international" + } } | "" cashapp?: @@ -18906,6 +19274,7 @@ export class ApiClient extends AbstractFetchClient { | "en-NZ" | "en-PL" | "en-PT" + | "en-RO" | "en-SE" | "en-US" | "es-ES" @@ -18922,6 +19291,7 @@ export class ApiClient extends AbstractFetchClient { | "nl-NL" | "pl-PL" | "pt-PT" + | "ro-RO" | "sv-FI" | "sv-SE" setup_future_usage?: "none" @@ -18948,6 +19318,11 @@ export class ApiClient extends AbstractFetchClient { setup_future_usage?: "none" } | "" + multibanco?: + | { + setup_future_usage?: "none" + } + | "" oxxo?: | { expires_after_days?: number @@ -19039,9 +19414,17 @@ export class ApiClient extends AbstractFetchClient { setup_future_usage?: "none" } | "" + twint?: + | { + setup_future_usage?: "none" + } + | "" us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -19107,21 +19490,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_intents` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPaymentIntentsSearch( @@ -19133,7 +19513,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -19151,9 +19531,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/payment_intents/search` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"], limit: p["limit"], @@ -19164,7 +19545,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -19177,14 +19558,15 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_intents/${p["intent"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ client_secret: p["clientSecret"], expand: p["expand"], @@ -19193,7 +19575,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -19348,6 +19730,7 @@ export class ApiClient extends AbstractFetchClient { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -19393,6 +19776,7 @@ export class ApiClient extends AbstractFetchClient { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type: | "acss_debit" | "affirm" @@ -19415,6 +19799,7 @@ export class ApiClient extends AbstractFetchClient { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -19425,6 +19810,7 @@ export class ApiClient extends AbstractFetchClient { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -19483,6 +19869,7 @@ export class ApiClient extends AbstractFetchClient { | "" bacs_debit?: | { + mandate_options?: EmptyObject setup_future_usage?: "" | "none" | "off_session" | "on_session" } | "" @@ -19512,8 +19899,8 @@ export class ApiClient extends AbstractFetchClient { enabled?: boolean plan?: | { - count: number - interval: "month" + count?: number + interval?: "month" type: "fixed_count" } | "" @@ -19535,6 +19922,7 @@ export class ApiClient extends AbstractFetchClient { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -19577,6 +19965,9 @@ export class ApiClient extends AbstractFetchClient { | { request_extended_authorization?: boolean request_incremental_authorization_support?: boolean + routing?: { + requested_priority?: "domestic" | "international" + } } | "" cashapp?: @@ -19667,6 +20058,7 @@ export class ApiClient extends AbstractFetchClient { | "en-NZ" | "en-PL" | "en-PT" + | "en-RO" | "en-SE" | "en-US" | "es-ES" @@ -19683,6 +20075,7 @@ export class ApiClient extends AbstractFetchClient { | "nl-NL" | "pl-PL" | "pt-PT" + | "ro-RO" | "sv-FI" | "sv-SE" setup_future_usage?: "none" @@ -19709,6 +20102,11 @@ export class ApiClient extends AbstractFetchClient { setup_future_usage?: "none" } | "" + multibanco?: + | { + setup_future_usage?: "none" + } + | "" oxxo?: | { expires_after_days?: number @@ -19800,9 +20198,17 @@ export class ApiClient extends AbstractFetchClient { setup_future_usage?: "none" } | "" + twint?: + | { + setup_future_usage?: "none" + } + | "" us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -19864,21 +20270,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_intents/${p["intent"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postPaymentIntentsIntentApplyCustomerBalance( @@ -19891,23 +20294,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_intents/${p["intent"]}/apply_customer_balance` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postPaymentIntentsIntentCancel( @@ -19923,21 +20323,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_intents/${p["intent"]}/cancel` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postPaymentIntentsIntentCapture( @@ -19961,21 +20358,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_intents/${p["intent"]}/capture` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postPaymentIntentsIntentConfirm( @@ -20144,6 +20538,7 @@ export class ApiClient extends AbstractFetchClient { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -20189,6 +20584,7 @@ export class ApiClient extends AbstractFetchClient { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type: | "acss_debit" | "affirm" @@ -20211,6 +20607,7 @@ export class ApiClient extends AbstractFetchClient { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -20221,6 +20618,7 @@ export class ApiClient extends AbstractFetchClient { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -20279,6 +20677,7 @@ export class ApiClient extends AbstractFetchClient { | "" bacs_debit?: | { + mandate_options?: EmptyObject setup_future_usage?: "" | "none" | "off_session" | "on_session" } | "" @@ -20308,8 +20707,8 @@ export class ApiClient extends AbstractFetchClient { enabled?: boolean plan?: | { - count: number - interval: "month" + count?: number + interval?: "month" type: "fixed_count" } | "" @@ -20331,6 +20730,7 @@ export class ApiClient extends AbstractFetchClient { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -20373,6 +20773,9 @@ export class ApiClient extends AbstractFetchClient { | { request_extended_authorization?: boolean request_incremental_authorization_support?: boolean + routing?: { + requested_priority?: "domestic" | "international" + } } | "" cashapp?: @@ -20463,6 +20866,7 @@ export class ApiClient extends AbstractFetchClient { | "en-NZ" | "en-PL" | "en-PT" + | "en-RO" | "en-SE" | "en-US" | "es-ES" @@ -20479,6 +20883,7 @@ export class ApiClient extends AbstractFetchClient { | "nl-NL" | "pl-PL" | "pt-PT" + | "ro-RO" | "sv-FI" | "sv-SE" setup_future_usage?: "none" @@ -20505,6 +20910,11 @@ export class ApiClient extends AbstractFetchClient { setup_future_usage?: "none" } | "" + multibanco?: + | { + setup_future_usage?: "none" + } + | "" oxxo?: | { expires_after_days?: number @@ -20596,9 +21006,17 @@ export class ApiClient extends AbstractFetchClient { setup_future_usage?: "none" } | "" + twint?: + | { + setup_future_usage?: "none" + } + | "" us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -20659,21 +21077,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_intents/${p["intent"]}/confirm` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postPaymentIntentsIntentIncrementAuthorization( @@ -20694,23 +21109,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_intents/${p["intent"]}/increment_authorization` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postPaymentIntentsIntentVerifyMicrodeposits( @@ -20724,22 +21136,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_intents/${p["intent"]}/verify_microdeposits` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPaymentLinks( @@ -20752,7 +21161,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -20768,9 +21177,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/payment_links` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ active: p["active"], ending_before: p["endingBefore"], @@ -20782,7 +21192,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -20941,6 +21351,8 @@ export class ApiClient extends AbstractFetchClient { | "klarna" | "konbini" | "link" + | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -20950,8 +21362,10 @@ export class ApiClient extends AbstractFetchClient { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" + | "zip" )[] phone_number_collection?: { enabled: boolean @@ -21234,21 +21648,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_links` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPaymentLinksPaymentLink( @@ -21258,20 +21669,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_links/${p["paymentLink"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -21424,6 +21836,8 @@ export class ApiClient extends AbstractFetchClient { | "klarna" | "konbini" | "link" + | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -21433,8 +21847,10 @@ export class ApiClient extends AbstractFetchClient { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" + | "zip" )[] | "" restrictions?: @@ -21707,24 +22123,24 @@ export class ApiClient extends AbstractFetchClient { } | "" } + tax_id_collection?: { + enabled: boolean + } } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_links/${p["paymentLink"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPaymentLinksPaymentLinkLineItems( @@ -21737,7 +22153,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -21754,9 +22170,10 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/payment_links/${p["paymentLink"]}/line_items` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -21767,7 +22184,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -21782,7 +22199,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -21798,9 +22215,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/payment_method_configurations` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ application: p["application"], ending_before: p["endingBefore"], @@ -21812,7 +22230,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -21951,6 +22369,16 @@ export class ApiClient extends AbstractFetchClient { preference?: "none" | "off" | "on" } } + mobilepay?: { + display_preference?: { + preference?: "none" | "off" | "on" + } + } + multibanco?: { + display_preference?: { + preference?: "none" | "off" | "on" + } + } name?: string oxxo?: { display_preference?: { @@ -21998,6 +22426,11 @@ export class ApiClient extends AbstractFetchClient { preference?: "none" | "off" | "on" } } + twint?: { + display_preference?: { + preference?: "none" | "off" | "on" + } + } us_bank_account?: { display_preference?: { preference?: "none" | "off" | "on" @@ -22016,23 +22449,20 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_payment_method_configuration> | Res > > { const url = this.basePath + `/v1/payment_method_configurations` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPaymentMethodConfigurationsConfiguration( @@ -22042,7 +22472,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_payment_method_configuration> | Res @@ -22050,15 +22480,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/payment_method_configurations/${p["configuration"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -22199,6 +22630,16 @@ export class ApiClient extends AbstractFetchClient { preference?: "none" | "off" | "on" } } + mobilepay?: { + display_preference?: { + preference?: "none" | "off" | "on" + } + } + multibanco?: { + display_preference?: { + preference?: "none" | "off" | "on" + } + } name?: string oxxo?: { display_preference?: { @@ -22245,6 +22686,11 @@ export class ApiClient extends AbstractFetchClient { preference?: "none" | "off" | "on" } } + twint?: { + display_preference?: { + preference?: "none" | "off" | "on" + } + } us_bank_account?: { display_preference?: { preference?: "none" | "off" | "on" @@ -22263,7 +22709,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_payment_method_configuration> | Res @@ -22271,16 +22717,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/payment_method_configurations/${p["configuration"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPaymentMethodDomains( @@ -22294,7 +22737,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -22310,9 +22753,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/payment_method_domains` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ domain_name: p["domainName"], enabled: p["enabled"], @@ -22325,7 +22769,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -22339,23 +22783,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_payment_method_domain> | Res > > { const url = this.basePath + `/v1/payment_method_domains` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPaymentMethodDomainsPaymentMethodDomain( @@ -22365,7 +22806,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_payment_method_domain> | Res @@ -22373,15 +22814,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/payment_method_domains/${p["paymentMethodDomain"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -22395,7 +22837,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_payment_method_domain> | Res @@ -22403,16 +22845,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/payment_method_domains/${p["paymentMethodDomain"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postPaymentMethodDomainsPaymentMethodDomainValidate( @@ -22423,7 +22862,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_payment_method_domain> | Res @@ -22432,16 +22871,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/payment_method_domains/${p["paymentMethodDomain"]}/validate` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPaymentMethods( @@ -22474,6 +22910,7 @@ export class ApiClient extends AbstractFetchClient { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -22484,13 +22921,14 @@ export class ApiClient extends AbstractFetchClient { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -22506,9 +22944,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/payment_methods` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ customer: p["customer"], ending_before: p["endingBefore"], @@ -22521,7 +22960,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -22675,6 +23114,7 @@ export class ApiClient extends AbstractFetchClient { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -22721,6 +23161,7 @@ export class ApiClient extends AbstractFetchClient { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type?: | "acss_debit" | "affirm" @@ -22744,6 +23185,7 @@ export class ApiClient extends AbstractFetchClient { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -22754,6 +23196,7 @@ export class ApiClient extends AbstractFetchClient { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -22769,21 +23212,18 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_methods` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPaymentMethodsPaymentMethod( @@ -22793,20 +23233,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_methods/${p["paymentMethod"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -22852,21 +23293,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_methods/${p["paymentMethod"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postPaymentMethodsPaymentMethodAttach( @@ -22878,22 +23316,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_methods/${p["paymentMethod"]}/attach` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postPaymentMethodsPaymentMethodDetach( @@ -22904,22 +23339,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payment_methods/${p["paymentMethod"]}/detach` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPayouts( @@ -22949,7 +23381,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -22965,9 +23397,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/payouts` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ arrival_date: p["arrivalDate"], created: p["created"], @@ -22982,7 +23415,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -23004,21 +23437,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payouts` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPayoutsPayout( @@ -23028,20 +23458,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payouts/${p["payout"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -23059,21 +23490,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payouts/${p["payout"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postPayoutsPayoutCancel( @@ -23084,21 +23512,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payouts/${p["payout"]}/cancel` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postPayoutsPayoutReverse( @@ -23112,21 +23537,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/payouts/${p["payout"]}/reverse` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPlans( @@ -23148,7 +23570,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -23164,9 +23586,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/plans` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ active: p["active"], created: p["created"], @@ -23180,7 +23603,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -23235,19 +23658,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/plans` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deletePlansPlan( @@ -23256,19 +23676,20 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/plans/${p["plan"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -23280,18 +23701,19 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/plans/${p["plan"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -23313,19 +23735,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/plans/${p["plan"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPrices( @@ -23355,7 +23774,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -23371,9 +23790,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/prices` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ active: p["active"], created: p["created"], @@ -23391,7 +23811,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -23474,19 +23894,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/prices` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPricesSearch( @@ -23498,7 +23915,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -23516,9 +23933,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/prices/search` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"], limit: p["limit"], @@ -23529,7 +23947,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -23541,18 +23959,19 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/prices/${p["price"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -23599,19 +24018,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/prices/${p["price"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getProducts( @@ -23635,7 +24051,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -23651,9 +24067,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/products` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ active: p["active"], created: p["created"], @@ -23669,7 +24086,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -23735,21 +24152,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/products` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getProductsSearch( @@ -23761,7 +24175,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -23779,9 +24193,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/products/search` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"], limit: p["limit"], @@ -23792,7 +24207,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -23803,19 +24218,20 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/products/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -23827,20 +24243,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/products/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -23881,21 +24298,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/products/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getProductsProductFeatures( @@ -23908,7 +24322,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -23924,9 +24338,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/products/${p["product"]}/features` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -23937,7 +24352,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -23951,21 +24366,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/products/${p["product"]}/features` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteProductsProductFeaturesId( @@ -23975,7 +24387,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_deleted_product_feature> | Res @@ -23983,14 +24395,15 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/products/${p["product"]}/features/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -24003,21 +24416,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/products/${p["product"]}/features/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -24043,7 +24457,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -24059,9 +24473,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/promotion_codes` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ active: p["active"], code: p["code"], @@ -24077,7 +24492,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -24110,21 +24525,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/promotion_codes` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getPromotionCodesPromotionCode( @@ -24134,20 +24546,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/promotion_codes/${p["promotionCode"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -24175,21 +24588,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/promotion_codes/${p["promotionCode"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getQuotes( @@ -24204,7 +24614,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -24220,9 +24630,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/quotes` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ customer: p["customer"], ending_before: p["endingBefore"], @@ -24236,7 +24647,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -24267,129 +24678,10 @@ export class ApiClient extends AbstractFetchClient { expand?: string[] expires_at?: number footer?: string | "" - from_quote?: { - is_revision?: boolean - quote: string - } - header?: string | "" - invoice_settings?: { - days_until_due?: number - issuer?: { - account?: string - type: "account" | "self" - } - } - line_items?: { - discounts?: - | { - coupon?: string - discount?: string - promotion_code?: string - }[] - | "" - price?: string - price_data?: { - currency: string - product: string - recurring?: { - interval: "day" | "month" | "week" | "year" - interval_count?: number - } - tax_behavior?: "exclusive" | "inclusive" | "unspecified" - unit_amount?: number - unit_amount_decimal?: string - } - quantity?: number - tax_rates?: string[] | "" - }[] - metadata?: { - [key: string]: string | undefined - } - on_behalf_of?: string | "" - subscription_data?: { - description?: string - effective_date?: "current_period_end" | number | "" - metadata?: { - [key: string]: string | undefined - } - trial_period_days?: number | "" - } - test_clock?: string - transfer_data?: - | { - amount?: number - amount_percent?: number - destination: string - } - | "" - } - } = {}, - timeout?: number, - opts?: RequestInit, - ): Promise | Res>> { - const url = this.basePath + `/v1/quotes` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) - const body = JSON.stringify(p.requestBody) - - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) - } - - async getQuotesQuote( - p: { - expand?: string[] - quote: string - requestBody?: EmptyObject - }, - timeout?: number, - opts?: RequestInit, - ): Promise | Res>> { - const url = this.basePath + `/v1/quotes/${p["quote"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) - const query = this._query({ expand: p["expand"] }) - const body = JSON.stringify(p.requestBody) - - return this._fetch( - url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, - timeout, - ) - } - - async postQuotesQuote( - p: { - quote: string - requestBody?: { - application_fee_amount?: number | "" - application_fee_percent?: number | "" - automatic_tax?: { - enabled: boolean - liability?: { - account?: string - type: "account" | "self" - } - } - collection_method?: "charge_automatically" | "send_invoice" - customer?: string - default_tax_rates?: string[] | "" - description?: string | "" - discounts?: - | { - coupon?: string - discount?: string - promotion_code?: string - }[] - | "" - expand?: string[] - expires_at?: number - footer?: string | "" + from_quote?: { + is_revision?: boolean + quote: string + } header?: string | "" invoice_settings?: { days_until_due?: number @@ -24406,7 +24698,6 @@ export class ApiClient extends AbstractFetchClient { promotion_code?: string }[] | "" - id?: string price?: string price_data?: { currency: string @@ -24427,13 +24718,14 @@ export class ApiClient extends AbstractFetchClient { } on_behalf_of?: string | "" subscription_data?: { - description?: string | "" + description?: string effective_date?: "current_period_end" | number | "" metadata?: { [key: string]: string | undefined } trial_period_days?: number | "" } + test_clock?: string transfer_data?: | { amount?: number @@ -24442,23 +24734,137 @@ export class ApiClient extends AbstractFetchClient { } | "" } + } = {}, + timeout?: number, + opts: RequestInit = {}, + ): Promise | Res>> { + const url = this.basePath + `/v1/quotes` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async getQuotesQuote( + p: { + expand?: string[] + quote: string + requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/quotes/${p["quote"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, + url + query, + { method: "GET", body, ...opts, headers }, timeout, ) } + async postQuotesQuote( + p: { + quote: string + requestBody?: { + application_fee_amount?: number | "" + application_fee_percent?: number | "" + automatic_tax?: { + enabled: boolean + liability?: { + account?: string + type: "account" | "self" + } + } + collection_method?: "charge_automatically" | "send_invoice" + customer?: string + default_tax_rates?: string[] | "" + description?: string | "" + discounts?: + | { + coupon?: string + discount?: string + promotion_code?: string + }[] + | "" + expand?: string[] + expires_at?: number + footer?: string | "" + header?: string | "" + invoice_settings?: { + days_until_due?: number + issuer?: { + account?: string + type: "account" | "self" + } + } + line_items?: { + discounts?: + | { + coupon?: string + discount?: string + promotion_code?: string + }[] + | "" + id?: string + price?: string + price_data?: { + currency: string + product: string + recurring?: { + interval: "day" | "month" | "week" | "year" + interval_count?: number + } + tax_behavior?: "exclusive" | "inclusive" | "unspecified" + unit_amount?: number + unit_amount_decimal?: string + } + quantity?: number + tax_rates?: string[] | "" + }[] + metadata?: { + [key: string]: string | undefined + } + on_behalf_of?: string | "" + subscription_data?: { + description?: string | "" + effective_date?: "current_period_end" | number | "" + metadata?: { + [key: string]: string | undefined + } + trial_period_days?: number | "" + } + transfer_data?: + | { + amount?: number + amount_percent?: number + destination: string + } + | "" + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise | Res>> { + const url = this.basePath + `/v1/quotes/${p["quote"]}` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + async postQuotesQuoteAccept( p: { quote: string @@ -24467,19 +24873,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/quotes/${p["quote"]}/accept` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postQuotesQuoteCancel( @@ -24490,19 +24893,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/quotes/${p["quote"]}/cancel` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getQuotesQuoteComputedUpfrontLineItems( @@ -24515,7 +24915,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -24532,9 +24932,10 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/quotes/${p["quote"]}/computed_upfront_line_items` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -24545,7 +24946,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -24559,19 +24960,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/quotes/${p["quote"]}/finalize` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getQuotesQuoteLineItems( @@ -24584,7 +24982,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -24600,9 +24998,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/quotes/${p["quote"]}/line_items` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -24613,7 +25012,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -24625,18 +25024,19 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/quotes/${p["quote"]}/pdf` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -24660,7 +25060,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -24676,9 +25076,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/radar/early_fraud_warnings` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ charge: p["charge"], created: p["created"], @@ -24692,7 +25093,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -24704,7 +25105,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_radar_early_fraud_warning> | Res @@ -24712,15 +25113,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/radar/early_fraud_warnings/${p["earlyFraudWarning"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -24744,7 +25146,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -24760,9 +25162,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/radar/value_list_items` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], ending_before: p["endingBefore"], @@ -24776,7 +25179,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -24790,23 +25193,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_radar_value_list_item> | Res > > { const url = this.basePath + `/v1/radar/value_list_items` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteRadarValueListItemsItem( @@ -24815,21 +25215,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_deleted_radar_value_list_item> | Res > > { const url = this.basePath + `/v1/radar/value_list_items/${p["item"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -24841,22 +25242,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_radar_value_list_item> | Res > > { const url = this.basePath + `/v1/radar/value_list_items/${p["item"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -24880,7 +25282,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -24896,9 +25298,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/radar/value_lists` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ alias: p["alias"], contains: p["contains"], @@ -24912,7 +25315,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -24940,21 +25343,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/radar/value_lists` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteRadarValueListsValueList( @@ -24963,21 +25363,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_deleted_radar_value_list> | Res > > { const url = this.basePath + `/v1/radar/value_lists/${p["valueList"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -24989,20 +25390,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/radar/value_lists/${p["valueList"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -25020,21 +25422,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/radar/value_lists/${p["valueList"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getRefunds( @@ -25056,7 +25455,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -25072,9 +25471,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/refunds` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ charge: p["charge"], created: p["created"], @@ -25088,7 +25488,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -25115,21 +25515,18 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/refunds` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getRefundsRefund( @@ -25139,20 +25536,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/refunds/${p["refund"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -25170,21 +25568,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/refunds/${p["refund"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postRefundsRefundCancel( @@ -25195,21 +25590,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/refunds/${p["refund"]}/cancel` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getReportingReportRuns( @@ -25229,7 +25621,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -25245,9 +25637,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/reporting/report_runs` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], ending_before: p["endingBefore"], @@ -25259,7 +25652,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -25917,23 +26310,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_reporting_report_run> | Res > > { const url = this.basePath + `/v1/reporting/report_runs` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getReportingReportRunsReportRun( @@ -25943,22 +26333,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_reporting_report_run> | Res > > { const url = this.basePath + `/v1/reporting/report_runs/${p["reportRun"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -25969,7 +26360,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -25985,15 +26376,16 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/reporting/report_types` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -26005,22 +26397,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_reporting_report_type> | Res > > { const url = this.basePath + `/v1/reporting/report_types/${p["reportType"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -26042,7 +26435,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -26058,9 +26451,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/reviews` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], ending_before: p["endingBefore"], @@ -26072,7 +26466,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -26084,20 +26478,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/reviews/${p["review"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -26110,21 +26505,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/reviews/${p["review"]}/approve` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getSetupAttempts( @@ -26145,7 +26537,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -26161,9 +26553,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/setup_attempts` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], ending_before: p["endingBefore"], @@ -26176,7 +26569,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -26201,7 +26594,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -26217,9 +26610,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/setup_intents` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ attach_to_self: p["attachToSelf"], created: p["created"], @@ -26234,7 +26628,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -26404,6 +26798,7 @@ export class ApiClient extends AbstractFetchClient { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -26449,6 +26844,7 @@ export class ApiClient extends AbstractFetchClient { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type: | "acss_debit" | "affirm" @@ -26471,6 +26867,7 @@ export class ApiClient extends AbstractFetchClient { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -26481,6 +26878,7 @@ export class ApiClient extends AbstractFetchClient { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -26507,6 +26905,9 @@ export class ApiClient extends AbstractFetchClient { verification_method?: "automatic" | "instant" | "microdeposits" } amazon_pay?: EmptyObject + bacs_debit?: { + mandate_options?: EmptyObject + } card?: { mandate_options?: { amount: number @@ -26526,6 +26927,7 @@ export class ApiClient extends AbstractFetchClient { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -26559,6 +26961,9 @@ export class ApiClient extends AbstractFetchClient { } us_bank_account?: { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -26588,21 +26993,18 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/setup_intents` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getSetupIntentsIntent( @@ -26613,14 +27015,15 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/setup_intents/${p["intent"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ client_secret: p["clientSecret"], expand: p["expand"], @@ -26629,7 +27032,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -26782,6 +27185,7 @@ export class ApiClient extends AbstractFetchClient { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -26827,6 +27231,7 @@ export class ApiClient extends AbstractFetchClient { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type: | "acss_debit" | "affirm" @@ -26849,6 +27254,7 @@ export class ApiClient extends AbstractFetchClient { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -26859,6 +27265,7 @@ export class ApiClient extends AbstractFetchClient { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -26885,6 +27292,9 @@ export class ApiClient extends AbstractFetchClient { verification_method?: "automatic" | "instant" | "microdeposits" } amazon_pay?: EmptyObject + bacs_debit?: { + mandate_options?: EmptyObject + } card?: { mandate_options?: { amount: number @@ -26904,6 +27314,7 @@ export class ApiClient extends AbstractFetchClient { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -26937,6 +27348,9 @@ export class ApiClient extends AbstractFetchClient { } us_bank_account?: { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -26959,21 +27373,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/setup_intents/${p["intent"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postSetupIntentsIntentCancel( @@ -26988,21 +27399,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/setup_intents/${p["intent"]}/cancel` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postSetupIntentsIntentConfirm( @@ -27167,6 +27575,7 @@ export class ApiClient extends AbstractFetchClient { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -27212,6 +27621,7 @@ export class ApiClient extends AbstractFetchClient { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type: | "acss_debit" | "affirm" @@ -27234,6 +27644,7 @@ export class ApiClient extends AbstractFetchClient { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -27244,6 +27655,7 @@ export class ApiClient extends AbstractFetchClient { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -27270,6 +27682,9 @@ export class ApiClient extends AbstractFetchClient { verification_method?: "automatic" | "instant" | "microdeposits" } amazon_pay?: EmptyObject + bacs_debit?: { + mandate_options?: EmptyObject + } card?: { mandate_options?: { amount: number @@ -27289,6 +27704,7 @@ export class ApiClient extends AbstractFetchClient { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -27322,6 +27738,9 @@ export class ApiClient extends AbstractFetchClient { } us_bank_account?: { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -27345,21 +27764,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/setup_intents/${p["intent"]}/confirm` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postSetupIntentsIntentVerifyMicrodeposits( @@ -27373,22 +27789,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/setup_intents/${p["intent"]}/verify_microdeposits` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getShippingRates( @@ -27410,7 +27823,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -27426,9 +27839,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/shipping_rates` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ active: p["active"], created: p["created"], @@ -27442,7 +27856,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -27483,21 +27897,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/shipping_rates` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getShippingRatesShippingRateToken( @@ -27507,20 +27918,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/shipping_rates/${p["shippingRateToken"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -27550,21 +27962,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/shipping_rates/${p["shippingRateToken"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getSigmaScheduledQueryRuns( @@ -27576,7 +27985,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -27592,9 +28001,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/sigma/scheduled_query_runs` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -27605,7 +28015,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -27617,7 +28027,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_scheduled_query_run> | Res @@ -27625,15 +28035,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/sigma/scheduled_query_runs/${p["scheduledQueryRun"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -27726,21 +28137,18 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/sources` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getSourcesSource( @@ -27751,14 +28159,15 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/sources/${p["source"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ client_secret: p["clientSecret"], expand: p["expand"], @@ -27767,7 +28176,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -27849,21 +28258,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/sources/${p["source"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getSourcesSourceMandateNotificationsMandateNotification( @@ -27874,7 +28280,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_source_mandate_notification> | Res @@ -27883,15 +28289,16 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/sources/${p["source"]}/mandate_notifications/${p["mandateNotification"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -27906,7 +28313,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -27922,9 +28329,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/sources/${p["source"]}/source_transactions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -27935,7 +28343,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -27948,7 +28356,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_source_transaction> | Res @@ -27957,15 +28365,16 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/sources/${p["source"]}/source_transactions/${p["sourceTransaction"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -27979,21 +28388,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/sources/${p["source"]}/verify` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getSubscriptionItems( @@ -28006,7 +28412,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -28022,9 +28428,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/subscription_items` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -28036,7 +28443,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -28085,21 +28492,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/subscription_items` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteSubscriptionItemsItem( @@ -28112,21 +28516,22 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_deleted_subscription_item> | Res > > { const url = this.basePath + `/v1/subscription_items/${p["item"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -28138,20 +28543,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/subscription_items/${p["item"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -28203,21 +28609,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/subscription_items/${p["item"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getSubscriptionItemsSubscriptionItemUsageRecordSummaries( @@ -28230,7 +28633,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -28248,9 +28651,10 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/subscription_items/${p["subscriptionItem"]}/usage_record_summaries` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -28261,7 +28665,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -28277,23 +28681,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/subscription_items/${p["subscriptionItem"]}/usage_records` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getSubscriptionSchedules( @@ -28339,7 +28740,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -28355,9 +28756,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/subscription_schedules` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ canceled_at: p["canceledAt"], completed_at: p["completedAt"], @@ -28374,7 +28776,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -28529,23 +28931,20 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_subscription_schedule> | Res > > { const url = this.basePath + `/v1/subscription_schedules` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getSubscriptionSchedulesSchedule( @@ -28555,22 +28954,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_subscription_schedule> | Res > > { const url = this.basePath + `/v1/subscription_schedules/${p["schedule"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -28724,23 +29124,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_subscription_schedule> | Res > > { const url = this.basePath + `/v1/subscription_schedules/${p["schedule"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postSubscriptionSchedulesScheduleCancel( @@ -28753,7 +29150,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_subscription_schedule> | Res @@ -28761,16 +29158,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/subscription_schedules/${p["schedule"]}/cancel` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postSubscriptionSchedulesScheduleRelease( @@ -28782,7 +29176,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_subscription_schedule> | Res @@ -28790,16 +29184,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/subscription_schedules/${p["schedule"]}/release` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getSubscriptions( @@ -28853,7 +29244,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -28869,9 +29260,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/subscriptions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ automatic_tax: p["automaticTax"], collection_method: p["collectionMethod"], @@ -28891,7 +29283,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -29039,6 +29431,7 @@ export class ApiClient extends AbstractFetchClient { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -29064,6 +29457,9 @@ export class ApiClient extends AbstractFetchClient { us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -29084,6 +29480,7 @@ export class ApiClient extends AbstractFetchClient { | "ach_credit_transfer" | "ach_debit" | "acss_debit" + | "amazon_pay" | "au_becs_debit" | "bacs_debit" | "bancontact" @@ -29098,12 +29495,15 @@ export class ApiClient extends AbstractFetchClient { | "ideal" | "konbini" | "link" + | "multibanco" | "p24" | "paynow" | "paypal" | "promptpay" + | "revolut_pay" | "sepa_debit" | "sofort" + | "swish" | "us_bank_account" | "wechat_pay" )[] @@ -29133,21 +29533,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/subscriptions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getSubscriptionsSearch( @@ -29159,7 +29556,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -29177,9 +29574,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/subscriptions/search` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"], limit: p["limit"], @@ -29190,7 +29588,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -29218,20 +29616,21 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/subscriptions/${p["subscriptionExposedId"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -29243,21 +29642,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/subscriptions/${p["subscriptionExposedId"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -29420,6 +29820,7 @@ export class ApiClient extends AbstractFetchClient { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -29445,6 +29846,9 @@ export class ApiClient extends AbstractFetchClient { us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -29465,6 +29869,7 @@ export class ApiClient extends AbstractFetchClient { | "ach_credit_transfer" | "ach_debit" | "acss_debit" + | "amazon_pay" | "au_becs_debit" | "bacs_debit" | "bancontact" @@ -29479,12 +29884,15 @@ export class ApiClient extends AbstractFetchClient { | "ideal" | "konbini" | "link" + | "multibanco" | "p24" | "paynow" | "paypal" | "promptpay" + | "revolut_pay" | "sepa_debit" | "sofort" + | "swish" | "us_bank_account" | "wechat_pay" )[] @@ -29516,22 +29924,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/subscriptions/${p["subscriptionExposedId"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteSubscriptionsSubscriptionExposedIdDiscount( @@ -29540,20 +29945,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/subscriptions/${p["subscriptionExposedId"]}/discount` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -29569,21 +29975,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/subscriptions/${p["subscription"]}/resume` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTaxCalculations( @@ -29620,11 +30023,13 @@ export class ApiClient extends AbstractFetchClient { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -29688,6 +30093,16 @@ export class ApiClient extends AbstractFetchClient { tax_behavior?: "exclusive" | "inclusive" tax_code?: string }[] + ship_from_details?: { + address: { + city?: string | "" + country: string + line1?: string | "" + line2?: string | "" + postal_code?: string | "" + state?: string | "" + } + } shipping_cost?: { amount?: number shipping_rate?: string @@ -29698,19 +30113,42 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax/calculations` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async getTaxCalculationsCalculation( + p: { + calculation: string + expand?: string[] + requestBody?: EmptyObject + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse | Res> + > { + const url = this.basePath + `/v1/tax/calculations/${p["calculation"]}` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) + const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, + url + query, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -29725,7 +30163,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -29742,9 +30180,10 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/tax/calculations/${p["calculation"]}/line_items` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -29755,7 +30194,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -29770,7 +30209,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -29786,9 +30225,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/tax/registrations` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -29800,7 +30240,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -29835,6 +30275,9 @@ export class ApiClient extends AbstractFetchClient { } type: "ioss" | "oss_non_union" | "oss_union" | "standard" } + bh?: { + type: "standard" + } ca?: { province_standard?: { province: string @@ -29880,6 +30323,9 @@ export class ApiClient extends AbstractFetchClient { } type: "ioss" | "oss_non_union" | "oss_union" | "standard" } + eg?: { + type: "simplified" + } es?: { standard?: { place_of_supply_scheme: "small_seller" | "standard" @@ -29901,6 +30347,9 @@ export class ApiClient extends AbstractFetchClient { gb?: { type: "standard" } + ge?: { + type: "simplified" + } gr?: { standard?: { place_of_supply_scheme: "small_seller" | "standard" @@ -29940,9 +30389,15 @@ export class ApiClient extends AbstractFetchClient { jp?: { type: "standard" } + ke?: { + type: "simplified" + } kr?: { type: "simplified" } + kz?: { + type: "simplified" + } lt?: { standard?: { place_of_supply_scheme: "small_seller" | "standard" @@ -29973,6 +30428,9 @@ export class ApiClient extends AbstractFetchClient { my?: { type: "simplified" } + ng?: { + type: "simplified" + } nl?: { standard?: { place_of_supply_scheme: "small_seller" | "standard" @@ -29985,6 +30443,9 @@ export class ApiClient extends AbstractFetchClient { nz?: { type: "standard" } + om?: { + type: "standard" + } pl?: { standard?: { place_of_supply_scheme: "small_seller" | "standard" @@ -30059,21 +30520,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax/registrations` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTaxRegistrationsId( @@ -30083,20 +30541,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax/registrations/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -30111,21 +30570,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax/registrations/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTaxSettings( @@ -30134,20 +30590,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax/settings` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -30173,21 +30630,18 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax/settings` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTaxTransactionsCreateFromCalculation( @@ -30198,25 +30652,23 @@ export class ApiClient extends AbstractFetchClient { metadata?: { [key: string]: string | undefined } + posted_at?: number reference: string } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax/transactions/create_from_calculation` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTaxTransactionsCreateReversal( @@ -30247,21 +30699,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax/transactions/create_reversal` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTaxTransactionsTransaction( @@ -30271,20 +30720,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax/transactions/${p["transaction"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -30299,7 +30749,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -30316,9 +30766,10 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/tax/transactions/${p["transaction"]}/line_items` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -30329,7 +30780,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -30343,7 +30794,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -30359,9 +30810,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/tax_codes` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -30372,7 +30824,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -30384,20 +30836,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax_codes/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -30416,7 +30869,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -30432,9 +30885,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/tax_ids` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -30446,7 +30900,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -30477,11 +30931,13 @@ export class ApiClient extends AbstractFetchClient { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -30536,21 +30992,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax_ids` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteTaxIdsId( @@ -30559,19 +31012,20 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax_ids/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -30583,20 +31037,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax_ids/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -30620,7 +31075,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -30636,9 +31091,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/tax_rates` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ active: p["active"], created: p["created"], @@ -30652,7 +31108,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -30688,21 +31144,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax_rates` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTaxRatesTaxRate( @@ -30712,20 +31165,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax_rates/${p["taxRate"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -30762,21 +31216,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/tax_rates/${p["taxRate"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTerminalConfigurations( @@ -30789,7 +31240,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -30805,9 +31256,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/terminal/configurations` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -30819,7 +31271,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -30837,6 +31289,13 @@ export class ApiClient extends AbstractFetchClient { enabled: boolean } | "" + reboot_window?: { + end_hour: number + start_hour: number + } + stripe_s700?: { + splashscreen?: string | "" + } tipping?: | { aud?: { @@ -30917,23 +31376,20 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_terminal_configuration> | Res > > { const url = this.basePath + `/v1/terminal/configurations` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteTerminalConfigurationsConfiguration( @@ -30942,7 +31398,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_deleted_terminal_configuration> | Res @@ -30950,14 +31406,15 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/terminal/configurations/${p["configuration"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -30969,7 +31426,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_terminal_configuration | t_deleted_terminal_configuration> @@ -30978,15 +31435,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/terminal/configurations/${p["configuration"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -31007,6 +31465,17 @@ export class ApiClient extends AbstractFetchClient { enabled: boolean } | "" + reboot_window?: + | { + end_hour: number + start_hour: number + } + | "" + stripe_s700?: + | { + splashscreen?: string | "" + } + | "" tipping?: | { aud?: { @@ -31089,7 +31558,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_terminal_configuration | t_deleted_terminal_configuration> @@ -31098,16 +31567,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/terminal/configurations/${p["configuration"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTerminalConnectionTokens( @@ -31118,23 +31584,20 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_terminal_connection_token> | Res > > { const url = this.basePath + `/v1/terminal/connection_tokens` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTerminalLocations( @@ -31146,7 +31609,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -31162,9 +31625,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/terminal/locations` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -31175,7 +31639,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -31202,21 +31666,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/terminal/locations` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteTerminalLocationsLocation( @@ -31225,21 +31686,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_deleted_terminal_location> | Res > > { const url = this.basePath + `/v1/terminal/locations/${p["location"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -31251,7 +31713,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_terminal_location | t_deleted_terminal_location> @@ -31259,15 +31721,16 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/terminal/locations/${p["location"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -31295,7 +31758,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_terminal_location | t_deleted_terminal_location> @@ -31303,16 +31766,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/terminal/locations/${p["location"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTerminalReaders( @@ -31324,6 +31784,7 @@ export class ApiClient extends AbstractFetchClient { | "mobile_phone_reader" | "simulated_wisepos_e" | "stripe_m2" + | "stripe_s700" | "verifone_P400" endingBefore?: string expand?: string[] @@ -31335,7 +31796,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -31351,9 +31812,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/terminal/readers` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ device_type: p["deviceType"], ending_before: p["endingBefore"], @@ -31368,7 +31830,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -31388,21 +31850,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/terminal/readers` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteTerminalReadersReader( @@ -31411,21 +31870,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_deleted_terminal_reader> | Res > > { const url = this.basePath + `/v1/terminal/readers/${p["reader"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -31437,7 +31897,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_terminal_reader | t_deleted_terminal_reader> @@ -31445,15 +31905,16 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/terminal/readers/${p["reader"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -31472,7 +31933,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res<200, t_terminal_reader | t_deleted_terminal_reader> @@ -31480,16 +31941,13 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/terminal/readers/${p["reader"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTerminalReadersReaderCancelAction( @@ -31500,22 +31958,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/terminal/readers/${p["reader"]}/cancel_action` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTerminalReadersReaderProcessPaymentIntent( @@ -31534,23 +31989,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/terminal/readers/${p["reader"]}/process_payment_intent` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTerminalReadersReaderProcessSetupIntent( @@ -31566,22 +32018,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/terminal/readers/${p["reader"]}/process_setup_intent` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTerminalReadersReaderRefundPayment( @@ -31603,22 +32052,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/terminal/readers/${p["reader"]}/refund_payment` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTerminalReadersReaderSetReaderDisplay( @@ -31640,22 +32086,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/terminal/readers/${p["reader"]}/set_reader_display` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersConfirmationTokens( @@ -31795,6 +32238,7 @@ export class ApiClient extends AbstractFetchClient { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -31840,6 +32284,7 @@ export class ApiClient extends AbstractFetchClient { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type: | "acss_debit" | "affirm" @@ -31862,6 +32307,7 @@ export class ApiClient extends AbstractFetchClient { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -31872,6 +32318,7 @@ export class ApiClient extends AbstractFetchClient { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -31902,23 +32349,20 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_confirmation_token> | Res > > { const url = this.basePath + `/v1/test_helpers/confirmation_tokens` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersCustomersCustomerFundCashBalance( @@ -31932,7 +32376,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_customer_cash_balance_transaction> | Res @@ -31941,16 +32385,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/customers/${p["customer"]}/fund_cash_balance` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersIssuingAuthorizations( @@ -31970,6 +32411,55 @@ export class ApiClient extends AbstractFetchClient { card: string currency?: string expand?: string[] + fleet?: { + cardholder_prompt_data?: { + driver_id?: string + odometer?: number + unspecified_id?: string + user_id?: string + vehicle_number?: string + } + purchase_type?: + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + reported_breakdown?: { + fuel?: { + gross_amount_decimal?: string + } + non_fuel?: { + gross_amount_decimal?: string + } + tax?: { + local_amount_decimal?: string + national_amount_decimal?: string + } + } + service_type?: + | "full_service" + | "non_fuel_transaction" + | "self_service" + } + fuel?: { + industry_product_code?: string + quantity_decimal?: string + type?: + | "diesel" + | "other" + | "unleaded_plus" + | "unleaded_regular" + | "unleaded_super" + unit?: + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" + unit_cost_decimal?: string + } is_amount_controllable?: boolean merchant_data?: { category?: @@ -32303,23 +32793,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_authorization> | Res > > { const url = this.basePath + `/v1/test_helpers/issuing/authorizations` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersIssuingAuthorizationsAuthorizationCapture( @@ -32330,6 +32817,35 @@ export class ApiClient extends AbstractFetchClient { close_authorization?: boolean expand?: string[] purchase_details?: { + fleet?: { + cardholder_prompt_data?: { + driver_id?: string + odometer?: number + unspecified_id?: string + user_id?: string + vehicle_number?: string + } + purchase_type?: + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + reported_breakdown?: { + fuel?: { + gross_amount_decimal?: string + } + non_fuel?: { + gross_amount_decimal?: string + } + tax?: { + local_amount_decimal?: string + national_amount_decimal?: string + } + } + service_type?: + | "full_service" + | "non_fuel_transaction" + | "self_service" + } flight?: { departure_at?: number passenger_name?: string @@ -32345,15 +32861,24 @@ export class ApiClient extends AbstractFetchClient { travel_agency?: string } fuel?: { + industry_product_code?: string + quantity_decimal?: string type?: | "diesel" | "other" | "unleaded_plus" | "unleaded_regular" | "unleaded_super" - unit?: "liter" | "other" | "us_gallon" + unit?: + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" unit_cost_decimal?: string - volume_decimal?: string } lodging?: { check_in_at?: number @@ -32370,7 +32895,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_authorization> | Res @@ -32379,16 +32904,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/issuing/authorizations/${p["authorization"]}/capture` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersIssuingAuthorizationsAuthorizationExpire( @@ -32399,7 +32921,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_authorization> | Res @@ -32408,16 +32930,89 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/issuing/authorizations/${p["authorization"]}/expire` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async postTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmount( + p: { + authorization: string + requestBody: { + expand?: string[] + final_amount: number + fleet?: { + cardholder_prompt_data?: { + driver_id?: string + odometer?: number + unspecified_id?: string + user_id?: string + vehicle_number?: string + } + purchase_type?: + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + reported_breakdown?: { + fuel?: { + gross_amount_decimal?: string + } + non_fuel?: { + gross_amount_decimal?: string + } + tax?: { + local_amount_decimal?: string + national_amount_decimal?: string + } + } + service_type?: + | "full_service" + | "non_fuel_transaction" + | "self_service" + } + fuel?: { + industry_product_code?: string + quantity_decimal?: string + type?: + | "diesel" + | "other" + | "unleaded_plus" + | "unleaded_regular" + | "unleaded_super" + unit?: + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" + unit_cost_decimal?: string + } + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + Res<200, t_issuing_authorization> | Res + > + > { + const url = + this.basePath + + `/v1/test_helpers/issuing/authorizations/${p["authorization"]}/finalize_amount` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersIssuingAuthorizationsAuthorizationIncrement( @@ -32430,7 +33025,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_authorization> | Res @@ -32439,16 +33034,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/issuing/authorizations/${p["authorization"]}/increment` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersIssuingAuthorizationsAuthorizationReverse( @@ -32460,7 +33052,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_authorization> | Res @@ -32469,16 +33061,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/issuing/authorizations/${p["authorization"]}/reverse` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersIssuingCardsCardShippingDeliver( @@ -32489,23 +33078,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/test_helpers/issuing/cards/${p["card"]}/shipping/deliver` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersIssuingCardsCardShippingFail( @@ -32516,23 +33102,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/test_helpers/issuing/cards/${p["card"]}/shipping/fail` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersIssuingCardsCardShippingReturn( @@ -32543,23 +33126,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/test_helpers/issuing/cards/${p["card"]}/shipping/return` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersIssuingCardsCardShippingShip( @@ -32570,23 +33150,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/test_helpers/issuing/cards/${p["card"]}/shipping/ship` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivate( @@ -32597,7 +33174,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_personalization_design> | Res @@ -32606,16 +33183,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/issuing/personalization_designs/${p["personalizationDesign"]}/activate` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivate( @@ -32626,7 +33200,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_personalization_design> | Res @@ -32635,16 +33209,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/issuing/personalization_designs/${p["personalizationDesign"]}/deactivate` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignReject( @@ -32676,7 +33247,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_personalization_design> | Res @@ -32685,16 +33256,44 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/issuing/personalization_designs/${p["personalizationDesign"]}/reject` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async postTestHelpersIssuingSettlements( + p: { + requestBody: { + bin: string + clearing_date: number + currency: string + expand?: string[] + interchange_fees?: number + net_total: number + network_settlement_identifier?: string + transaction_count?: number + transaction_volume?: number + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + Res<200, t_issuing_settlement> | Res + > + > { + const url = this.basePath + `/v1/test_helpers/issuing/settlements` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersIssuingTransactionsCreateForceCapture( @@ -33010,6 +33609,35 @@ export class ApiClient extends AbstractFetchClient { url?: string } purchase_details?: { + fleet?: { + cardholder_prompt_data?: { + driver_id?: string + odometer?: number + unspecified_id?: string + user_id?: string + vehicle_number?: string + } + purchase_type?: + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + reported_breakdown?: { + fuel?: { + gross_amount_decimal?: string + } + non_fuel?: { + gross_amount_decimal?: string + } + tax?: { + local_amount_decimal?: string + national_amount_decimal?: string + } + } + service_type?: + | "full_service" + | "non_fuel_transaction" + | "self_service" + } flight?: { departure_at?: number passenger_name?: string @@ -33025,15 +33653,24 @@ export class ApiClient extends AbstractFetchClient { travel_agency?: string } fuel?: { + industry_product_code?: string + quantity_decimal?: string type?: | "diesel" | "other" | "unleaded_plus" | "unleaded_regular" | "unleaded_super" - unit?: "liter" | "other" | "us_gallon" + unit?: + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" unit_cost_decimal?: string - volume_decimal?: string } lodging?: { check_in_at?: number @@ -33050,7 +33687,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_transaction> | Res @@ -33059,16 +33696,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/issuing/transactions/create_force_capture` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersIssuingTransactionsCreateUnlinkedRefund( @@ -33384,6 +34018,35 @@ export class ApiClient extends AbstractFetchClient { url?: string } purchase_details?: { + fleet?: { + cardholder_prompt_data?: { + driver_id?: string + odometer?: number + unspecified_id?: string + user_id?: string + vehicle_number?: string + } + purchase_type?: + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + reported_breakdown?: { + fuel?: { + gross_amount_decimal?: string + } + non_fuel?: { + gross_amount_decimal?: string + } + tax?: { + local_amount_decimal?: string + national_amount_decimal?: string + } + } + service_type?: + | "full_service" + | "non_fuel_transaction" + | "self_service" + } flight?: { departure_at?: number passenger_name?: string @@ -33399,15 +34062,24 @@ export class ApiClient extends AbstractFetchClient { travel_agency?: string } fuel?: { + industry_product_code?: string + quantity_decimal?: string type?: | "diesel" | "other" | "unleaded_plus" | "unleaded_regular" | "unleaded_super" - unit?: "liter" | "other" | "us_gallon" + unit?: + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" unit_cost_decimal?: string - volume_decimal?: string } lodging?: { check_in_at?: number @@ -33424,7 +34096,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_transaction> | Res @@ -33433,16 +34105,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/issuing/transactions/create_unlinked_refund` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersIssuingTransactionsTransactionRefund( @@ -33454,7 +34123,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_issuing_transaction> | Res @@ -33463,16 +34132,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/issuing/transactions/${p["transaction"]}/refund` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersRefundsRefundExpire( @@ -33483,21 +34149,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/test_helpers/refunds/${p["refund"]}/expire` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersTerminalReadersReaderPresentPaymentMethod( @@ -33516,23 +34179,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/test_helpers/terminal/readers/${p["reader"]}/present_payment_method` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTestHelpersTestClocks( @@ -33544,7 +34204,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -33560,9 +34220,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/test_helpers/test_clocks` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -33573,7 +34234,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -33587,23 +34248,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_test_helpers_test_clock> | Res > > { const url = this.basePath + `/v1/test_helpers/test_clocks` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteTestHelpersTestClocksTestClock( @@ -33612,21 +34270,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_deleted_test_helpers_test_clock> | Res > > { const url = this.basePath + `/v1/test_helpers/test_clocks/${p["testClock"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -33638,22 +34297,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_test_helpers_test_clock> | Res > > { const url = this.basePath + `/v1/test_helpers/test_clocks/${p["testClock"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -33667,7 +34327,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_test_helpers_test_clock> | Res @@ -33675,16 +34335,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/test_helpers/test_clocks/${p["testClock"]}/advance` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersTreasuryInboundTransfersIdFail( @@ -33711,7 +34368,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_inbound_transfer> | Res @@ -33720,16 +34377,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/treasury/inbound_transfers/${p["id"]}/fail` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersTreasuryInboundTransfersIdReturn( @@ -33740,7 +34394,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_inbound_transfer> | Res @@ -33749,16 +34403,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/treasury/inbound_transfers/${p["id"]}/return` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersTreasuryInboundTransfersIdSucceed( @@ -33769,7 +34420,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_inbound_transfer> | Res @@ -33778,16 +34429,49 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/treasury/inbound_transfers/${p["id"]}/succeed` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async postTestHelpersTreasuryOutboundPaymentsId( + p: { + id: string + requestBody: { + expand?: string[] + tracking_details: { + ach?: { + trace_id: string + } + type: "ach" | "us_domestic_wire" + us_domestic_wire?: { + chips?: string + imad?: string + omad?: string + } + } + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + Res<200, t_treasury_outbound_payment> | Res + > + > { + const url = + this.basePath + `/v1/test_helpers/treasury/outbound_payments/${p["id"]}` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersTreasuryOutboundPaymentsIdFail( @@ -33798,7 +34482,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_outbound_payment> | Res @@ -33807,16 +34491,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/treasury/outbound_payments/${p["id"]}/fail` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersTreasuryOutboundPaymentsIdPost( @@ -33827,7 +34508,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_outbound_payment> | Res @@ -33836,16 +34517,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/treasury/outbound_payments/${p["id"]}/post` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersTreasuryOutboundPaymentsIdReturn( @@ -33869,7 +34547,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_outbound_payment> | Res @@ -33878,16 +34556,50 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/treasury/outbound_payments/${p["id"]}/return` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) + } + + async postTestHelpersTreasuryOutboundTransfersOutboundTransfer( + p: { + outboundTransfer: string + requestBody: { + expand?: string[] + tracking_details: { + ach?: { + trace_id: string + } + type: "ach" | "us_domestic_wire" + us_domestic_wire?: { + chips?: string + imad?: string + omad?: string + } + } + } + }, + timeout?: number, + opts: RequestInit = {}, + ): Promise< + TypedFetchResponse< + Res<200, t_treasury_outbound_transfer> | Res + > + > { + const url = + this.basePath + + `/v1/test_helpers/treasury/outbound_transfers/${p["outboundTransfer"]}` + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, ) + const body = JSON.stringify(p.requestBody) + + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersTreasuryOutboundTransfersOutboundTransferFail( @@ -33898,7 +34610,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_outbound_transfer> | Res @@ -33907,16 +34619,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/treasury/outbound_transfers/${p["outboundTransfer"]}/fail` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersTreasuryOutboundTransfersOutboundTransferPost( @@ -33927,7 +34636,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_outbound_transfer> | Res @@ -33936,16 +34645,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/treasury/outbound_transfers/${p["outboundTransfer"]}/post` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersTreasuryOutboundTransfersOutboundTransferReturn( @@ -33969,7 +34675,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_outbound_transfer> | Res @@ -33978,16 +34684,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/test_helpers/treasury/outbound_transfers/${p["outboundTransfer"]}/return` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersTreasuryReceivedCredits( @@ -34010,23 +34713,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_received_credit> | Res > > { const url = this.basePath + `/v1/test_helpers/treasury/received_credits` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTestHelpersTreasuryReceivedDebits( @@ -34049,23 +34749,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_received_debit> | Res > > { const url = this.basePath + `/v1/test_helpers/treasury/received_debits` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTokens( @@ -34378,19 +35075,16 @@ export class ApiClient extends AbstractFetchClient { } } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/tokens` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTokensToken( @@ -34400,18 +35094,19 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/tokens/${p["token"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -34442,7 +35137,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -34458,9 +35153,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/topups` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ amount: p["amount"], created: p["created"], @@ -34474,7 +35170,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -34497,19 +35193,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/topups` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTopupsTopup( @@ -34519,18 +35212,19 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/topups/${p["topup"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -34549,19 +35243,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/topups/${p["topup"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async postTopupsTopupCancel( @@ -34572,19 +35263,16 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise | Res>> { const url = this.basePath + `/v1/topups/${p["topup"]}/cancel` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTransfers( @@ -34606,7 +35294,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -34622,9 +35310,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/transfers` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], destination: p["destination"], @@ -34638,7 +35327,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -34660,21 +35349,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/transfers` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTransfersIdReversals( @@ -34687,7 +35373,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -34703,9 +35389,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/transfers/${p["id"]}/reversals` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -34716,7 +35403,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -34737,21 +35424,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/transfers/${p["id"]}/reversals` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTransfersTransfer( @@ -34761,20 +35445,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/transfers/${p["transfer"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -34793,21 +35478,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/transfers/${p["transfer"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTransfersTransferReversalsId( @@ -34818,21 +35500,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/transfers/${p["transfer"]}/reversals/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -34851,22 +35534,19 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/transfers/${p["transfer"]}/reversals/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTreasuryCreditReversals( @@ -34881,7 +35561,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -34897,9 +35577,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/treasury/credit_reversals` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -34913,7 +35594,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -34929,23 +35610,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_credit_reversal> | Res > > { const url = this.basePath + `/v1/treasury/credit_reversals` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTreasuryCreditReversalsCreditReversal( @@ -34955,7 +35633,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_credit_reversal> | Res @@ -34963,15 +35641,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/treasury/credit_reversals/${p["creditReversal"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -34989,7 +35668,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -35005,9 +35684,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/treasury/debit_reversals` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -35022,7 +35702,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -35038,23 +35718,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_debit_reversal> | Res > > { const url = this.basePath + `/v1/treasury/debit_reversals` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTreasuryDebitReversalsDebitReversal( @@ -35064,7 +35741,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_debit_reversal> | Res @@ -35072,15 +35749,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/treasury/debit_reversals/${p["debitReversal"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -35102,7 +35780,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -35118,9 +35796,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/treasury/financial_accounts` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], ending_before: p["endingBefore"], @@ -35132,7 +35811,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -35189,23 +35868,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_financial_account> | Res > > { const url = this.basePath + `/v1/treasury/financial_accounts` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTreasuryFinancialAccountsFinancialAccount( @@ -35215,7 +35891,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_financial_account> | Res @@ -35223,15 +35899,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/treasury/financial_accounts/${p["financialAccount"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -35288,7 +35965,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_financial_account> | Res @@ -35296,16 +35973,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/treasury/financial_accounts/${p["financialAccount"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTreasuryFinancialAccountsFinancialAccountFeatures( @@ -35315,7 +35989,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_financial_account_features> | Res @@ -35324,15 +35998,16 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/treasury/financial_accounts/${p["financialAccount"]}/features` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -35380,7 +36055,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_financial_account_features> | Res @@ -35389,16 +36064,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/treasury/financial_accounts/${p["financialAccount"]}/features` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTreasuryInboundTransfers( @@ -35412,7 +36084,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -35428,9 +36100,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/treasury/inbound_transfers` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -35443,7 +36116,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -35464,23 +36137,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_inbound_transfer> | Res > > { const url = this.basePath + `/v1/treasury/inbound_transfers` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTreasuryInboundTransfersId( @@ -35490,22 +36160,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_inbound_transfer> | Res > > { const url = this.basePath + `/v1/treasury/inbound_transfers/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -35518,7 +36189,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_inbound_transfer> | Res @@ -35527,16 +36198,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/treasury/inbound_transfers/${p["inboundTransfer"]}/cancel` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTreasuryOutboundPayments( @@ -35559,7 +36227,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -35575,9 +36243,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/treasury/outbound_payments` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], customer: p["customer"], @@ -35592,7 +36261,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -35654,23 +36323,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_outbound_payment> | Res > > { const url = this.basePath + `/v1/treasury/outbound_payments` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTreasuryOutboundPaymentsId( @@ -35680,22 +36346,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_outbound_payment> | Res > > { const url = this.basePath + `/v1/treasury/outbound_payments/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -35708,7 +36375,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_outbound_payment> | Res @@ -35716,16 +36383,13 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/treasury/outbound_payments/${p["id"]}/cancel` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTreasuryOutboundTransfers( @@ -35739,7 +36403,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -35755,9 +36419,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/treasury/outbound_transfers` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -35770,7 +36435,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -35798,23 +36463,20 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_outbound_transfer> | Res > > { const url = this.basePath + `/v1/treasury/outbound_transfers` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTreasuryOutboundTransfersOutboundTransfer( @@ -35824,7 +36486,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_outbound_transfer> | Res @@ -35832,15 +36494,16 @@ export class ApiClient extends AbstractFetchClient { > { const url = this.basePath + `/v1/treasury/outbound_transfers/${p["outboundTransfer"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -35853,7 +36516,7 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_outbound_transfer> | Res @@ -35862,16 +36525,13 @@ export class ApiClient extends AbstractFetchClient { const url = this.basePath + `/v1/treasury/outbound_transfers/${p["outboundTransfer"]}/cancel` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async getTreasuryReceivedCredits( @@ -35892,7 +36552,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -35908,9 +36568,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/treasury/received_credits` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -35924,7 +36585,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -35936,22 +36597,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_received_credit> | Res > > { const url = this.basePath + `/v1/treasury/received_credits/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -35967,7 +36629,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -35983,9 +36645,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/treasury/received_debits` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -35998,7 +36661,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -36010,22 +36673,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_received_debit> | Res > > { const url = this.basePath + `/v1/treasury/received_debits/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -36058,7 +36722,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -36074,9 +36738,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/treasury/transaction_entries` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], effective_at: p["effectiveAt"], @@ -36092,7 +36757,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -36104,22 +36769,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_transaction_entry> | Res > > { const url = this.basePath + `/v1/treasury/transaction_entries/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -36154,7 +36820,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -36170,9 +36836,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/treasury/transactions` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ created: p["created"], ending_before: p["endingBefore"], @@ -36188,7 +36855,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -36200,22 +36867,23 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_treasury_transaction> | Res > > { const url = this.basePath + `/v1/treasury/transactions/${p["id"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -36229,7 +36897,7 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -36245,9 +36913,10 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/v1/webhook_endpoints` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ ending_before: p["endingBefore"], expand: p["expand"], @@ -36258,7 +36927,7 @@ export class ApiClient extends AbstractFetchClient { return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -36368,6 +37037,7 @@ export class ApiClient extends AbstractFetchClient { | "2023-08-16" | "2023-10-16" | "2024-04-10" + | "2024-06-20" connect?: boolean description?: string | "" enabled_events: ( @@ -36382,6 +37052,7 @@ export class ApiClient extends AbstractFetchClient { | "application_fee.refund.updated" | "application_fee.refunded" | "balance.available" + | "billing.alert.triggered" | "billing_portal.configuration.created" | "billing_portal.configuration.updated" | "billing_portal.session.created" @@ -36459,6 +37130,7 @@ export class ApiClient extends AbstractFetchClient { | "invoice.finalization_failed" | "invoice.finalized" | "invoice.marked_uncollectible" + | "invoice.overdue" | "invoice.paid" | "invoice.payment_action_required" | "invoice.payment_failed" @@ -36467,6 +37139,7 @@ export class ApiClient extends AbstractFetchClient { | "invoice.upcoming" | "invoice.updated" | "invoice.voided" + | "invoice.will_be_due" | "invoiceitem.created" | "invoiceitem.deleted" | "issuing_authorization.created" @@ -36479,8 +37152,13 @@ export class ApiClient extends AbstractFetchClient { | "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" @@ -36589,12 +37267,14 @@ export class ApiClient extends AbstractFetchClient { | "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" @@ -36610,21 +37290,18 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/webhook_endpoints` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } async deleteWebhookEndpointsWebhookEndpoint( @@ -36633,21 +37310,22 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_deleted_webhook_endpoint> | Res > > { const url = this.basePath + `/v1/webhook_endpoints/${p["webhookEndpoint"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) return this._fetch( url, - { method: "DELETE", headers, body, ...(opts ?? {}) }, + { method: "DELETE", body, ...opts, headers }, timeout, ) } @@ -36659,20 +37337,21 @@ export class ApiClient extends AbstractFetchClient { requestBody?: EmptyObject }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/webhook_endpoints/${p["webhookEndpoint"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const query = this._query({ expand: p["expand"] }) const body = JSON.stringify(p.requestBody) return this._fetch( url + query, - { method: "GET", headers, body, ...(opts ?? {}) }, + { method: "GET", body, ...opts, headers }, timeout, ) } @@ -36695,6 +37374,7 @@ export class ApiClient extends AbstractFetchClient { | "application_fee.refund.updated" | "application_fee.refunded" | "balance.available" + | "billing.alert.triggered" | "billing_portal.configuration.created" | "billing_portal.configuration.updated" | "billing_portal.session.created" @@ -36772,6 +37452,7 @@ export class ApiClient extends AbstractFetchClient { | "invoice.finalization_failed" | "invoice.finalized" | "invoice.marked_uncollectible" + | "invoice.overdue" | "invoice.paid" | "invoice.payment_action_required" | "invoice.payment_failed" @@ -36780,6 +37461,7 @@ export class ApiClient extends AbstractFetchClient { | "invoice.upcoming" | "invoice.updated" | "invoice.voided" + | "invoice.will_be_due" | "invoiceitem.created" | "invoiceitem.deleted" | "issuing_authorization.created" @@ -36792,8 +37474,13 @@ export class ApiClient extends AbstractFetchClient { | "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" @@ -36902,12 +37589,14 @@ export class ApiClient extends AbstractFetchClient { | "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" @@ -36923,20 +37612,17 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse | Res> > { const url = this.basePath + `/v1/webhook_endpoints/${p["webhookEndpoint"]}` - const headers = this._headers({ - "Content-Type": "application/x-www-form-urlencoded", - }) + const headers = this._headers( + { "Content-Type": "application/x-www-form-urlencoded" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } } diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/models.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/models.ts index 1cfde43d..9aae684b 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/models.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/models.ts @@ -90,21 +90,26 @@ export type t_account_capabilities = { cashapp_payments?: "active" | "inactive" | "pending" eps_payments?: "active" | "inactive" | "pending" fpx_payments?: "active" | "inactive" | "pending" + gb_bank_transfer_payments?: "active" | "inactive" | "pending" giropay_payments?: "active" | "inactive" | "pending" grabpay_payments?: "active" | "inactive" | "pending" ideal_payments?: "active" | "inactive" | "pending" india_international_payments?: "active" | "inactive" | "pending" jcb_payments?: "active" | "inactive" | "pending" + jp_bank_transfer_payments?: "active" | "inactive" | "pending" klarna_payments?: "active" | "inactive" | "pending" konbini_payments?: "active" | "inactive" | "pending" legacy_payments?: "active" | "inactive" | "pending" link_payments?: "active" | "inactive" | "pending" mobilepay_payments?: "active" | "inactive" | "pending" + multibanco_payments?: "active" | "inactive" | "pending" + mx_bank_transfer_payments?: "active" | "inactive" | "pending" oxxo_payments?: "active" | "inactive" | "pending" p24_payments?: "active" | "inactive" | "pending" paynow_payments?: "active" | "inactive" | "pending" promptpay_payments?: "active" | "inactive" | "pending" revolut_pay_payments?: "active" | "inactive" | "pending" + sepa_bank_transfer_payments?: "active" | "inactive" | "pending" sepa_debit_payments?: "active" | "inactive" | "pending" sofort_payments?: "active" | "inactive" | "pending" swish_payments?: "active" | "inactive" | "pending" @@ -112,7 +117,9 @@ export type t_account_capabilities = { tax_reporting_us_1099_misc?: "active" | "inactive" | "pending" transfers?: "active" | "inactive" | "pending" treasury?: "active" | "inactive" | "pending" + twint_payments?: "active" | "inactive" | "pending" us_bank_account_ach_payments?: "active" | "inactive" | "pending" + us_bank_transfer_payments?: "active" | "inactive" | "pending" zip_payments?: "active" | "inactive" | "pending" } @@ -120,7 +127,18 @@ export type t_account_capability_future_requirements = { alternatives?: t_account_requirements_alternative[] | null current_deadline?: number | null currently_due: string[] - disabled_reason?: string | null + disabled_reason?: + | "other" + | "paused.inactivity" + | "pending.onboarding" + | "pending.review" + | "platform_disabled" + | "platform_paused" + | "rejected.inactivity" + | "rejected.other" + | "rejected.unsupported_business" + | "requirements.fields_needed" + | null errors: t_account_requirements_error[] eventually_due: string[] past_due: string[] @@ -131,7 +149,18 @@ export type t_account_capability_requirements = { alternatives?: t_account_requirements_alternative[] | null current_deadline?: number | null currently_due: string[] - disabled_reason?: string | null + disabled_reason?: + | "other" + | "paused.inactivity" + | "pending.onboarding" + | "pending.review" + | "platform_disabled" + | "platform_paused" + | "rejected.inactivity" + | "rejected.other" + | "rejected.unsupported_business" + | "requirements.fields_needed" + | null errors: t_account_requirements_error[] eventually_due: string[] past_due: string[] @@ -305,6 +334,7 @@ export type t_account_requirements_error = { | "verification_missing_executives" | "verification_missing_owners" | "verification_requires_additional_memorandum_of_associations" + | "verification_requires_additional_proof_of_registration" reason: string requirement: string } @@ -429,6 +459,7 @@ export type t_application_fee = { charge: string | t_charge created: number currency: string + fee_source?: t_platform_earning_fee_source | null id: string livemode: boolean object: "application_fee" @@ -485,6 +516,7 @@ export type t_balance_amount_by_source_type = { export type t_balance_amount_net = { amount: number currency: string + net_available?: t_balance_net_available[] source_types?: t_balance_amount_by_source_type } @@ -492,6 +524,12 @@ 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 +} + export type t_balance_transaction = { amount: number available_on: number @@ -517,7 +555,6 @@ export type t_balance_transaction = { | t_issuing_dispute | t_issuing_transaction | t_payout - | t_platform_tax_fee | t_refund | t_reserve_transaction | t_tax_deducted_at_source @@ -628,6 +665,9 @@ export type t_bank_connections_resource_balance_refresh = { } export type t_bank_connections_resource_link_account_session_filters = { + account_subcategories?: + | ("checking" | "credit_card" | "line_of_credit" | "mortgage" | "savings")[] + | null countries?: string[] | null } @@ -650,6 +690,17 @@ export type t_bank_connections_resource_transaction_resource_status_transitions void_at?: number | null } +export type t_billing_alert = { + alert_type: "usage_threshold" + filter?: t_thresholds_resource_alert_filter | null + id: string + livemode: boolean + object: "billing.alert" + status?: "active" | "archived" | "inactive" | null + title: string + usage_threshold_config?: t_thresholds_resource_usage_threshold_config | null +} + export type t_billing_meter = { created: number customer_mapping: t_billing_meter_resource_customer_mapping_settings @@ -1101,7 +1152,9 @@ export type t_checkout_alipay_payment_method_options = { setup_future_usage?: "none" } -export type t_checkout_amazon_pay_payment_method_options = EmptyObject +export type t_checkout_amazon_pay_payment_method_options = { + setup_future_usage?: "none" | "off_session" +} export type t_checkout_au_becs_debit_payment_method_options = { setup_future_usage?: "none" @@ -1199,6 +1252,10 @@ export type t_checkout_mobilepay_payment_method_options = { setup_future_usage?: "none" } +export type t_checkout_multibanco_payment_method_options = { + setup_future_usage?: "none" +} + export type t_checkout_oxxo_payment_method_options = { expires_after_days: number setup_future_usage?: "none" @@ -1223,7 +1280,9 @@ export type t_checkout_pix_payment_method_options = { expires_after_seconds?: number | null } -export type t_checkout_revolut_pay_payment_method_options = EmptyObject +export type t_checkout_revolut_pay_payment_method_options = { + setup_future_usage?: "none" | "off_session" +} export type t_checkout_sepa_debit_payment_method_options = { setup_future_usage?: "none" | "off_session" | "on_session" @@ -1251,6 +1310,7 @@ export type t_checkout_session_payment_method_options = { konbini?: t_checkout_konbini_payment_method_options link?: t_checkout_link_payment_method_options mobilepay?: t_checkout_mobilepay_payment_method_options + multibanco?: t_checkout_multibanco_payment_method_options oxxo?: t_checkout_oxxo_payment_method_options p24?: t_checkout_p24_payment_method_options paynow?: t_checkout_paynow_payment_method_options @@ -1365,6 +1425,7 @@ export type t_confirmation_token = { mandate_data?: t_confirmation_tokens_resource_mandate_data | null object: "confirmation_token" payment_intent?: string | null + payment_method_options?: t_confirmation_tokens_resource_payment_method_options | null payment_method_preview?: t_confirmation_tokens_resource_payment_method_preview | null return_url?: string | null setup_future_usage?: "off_session" | "on_session" | null @@ -1389,11 +1450,21 @@ export type t_confirmation_tokens_resource_mandate_data_resource_customer_accept user_agent?: string | null } +export type t_confirmation_tokens_resource_payment_method_options = { + card?: t_confirmation_tokens_resource_payment_method_options_resource_card | null +} + +export type t_confirmation_tokens_resource_payment_method_options_resource_card = + { + cvc_token?: string | null + } + export type t_confirmation_tokens_resource_payment_method_preview = { acss_debit?: t_payment_method_acss_debit affirm?: t_payment_method_affirm afterpay_clearpay?: t_payment_method_afterpay_clearpay alipay?: t_payment_flows_private_payment_methods_alipay + allow_redisplay?: "always" | "limited" | "unspecified" amazon_pay?: t_payment_method_amazon_pay au_becs_debit?: t_payment_method_au_becs_debit bacs_debit?: t_payment_method_bacs_debit @@ -1404,6 +1475,7 @@ export type t_confirmation_tokens_resource_payment_method_preview = { card?: t_payment_method_card card_present?: t_payment_method_card_present cashapp?: t_payment_method_cashapp + customer?: string | t_customer | null customer_balance?: t_payment_method_customer_balance eps?: t_payment_method_eps fpx?: t_payment_method_fpx @@ -1415,6 +1487,7 @@ export type t_confirmation_tokens_resource_payment_method_preview = { konbini?: t_payment_method_konbini link?: t_payment_method_link mobilepay?: t_payment_method_mobilepay + multibanco?: t_payment_method_multibanco oxxo?: t_payment_method_oxxo p24?: t_payment_method_p24 paynow?: t_payment_method_paynow @@ -1425,6 +1498,7 @@ export type t_confirmation_tokens_resource_payment_method_preview = { sepa_debit?: t_payment_method_sepa_debit sofort?: t_payment_method_sofort swish?: t_payment_method_swish + twint?: t_payment_method_twint type: | "acss_debit" | "affirm" @@ -1450,6 +1524,7 @@ export type t_confirmation_tokens_resource_payment_method_preview = { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -1460,6 +1535,7 @@ export type t_confirmation_tokens_resource_payment_method_preview = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -1507,6 +1583,8 @@ export type t_connect_embedded_account_session_create_components = { payments: t_connect_embedded_payments_config_claim payouts: t_connect_embedded_payouts_config_claim 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 = { @@ -1535,6 +1613,7 @@ export type t_connect_embedded_payouts_config_claim = { export type t_connect_embedded_payouts_features = { edit_payout_schedule: boolean + external_account_collection: boolean instant_payouts: boolean standard_payouts: boolean } @@ -1898,6 +1977,7 @@ export type t_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 } @@ -1905,6 +1985,25 @@ 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 +} + +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 + payment_method_remove: "disabled" | "enabled" + payment_method_save: "disabled" | "enabled" + payment_method_save_usage?: "off_session" | "on_session" | null + } + export type t_customer_session_resource_components_resource_pricing_table = { enabled: boolean } @@ -2184,21 +2283,33 @@ export type t_dispute_evidence_details = { export type t_dispute_payment_method_details = { card?: t_dispute_payment_method_details_card - type: "card" + klarna?: t_dispute_payment_method_details_klarna + paypal?: t_dispute_payment_method_details_paypal + type: "card" | "klarna" | "paypal" } export type t_dispute_payment_method_details_card = { brand: string + case_type: "chargeback" | "inquiry" network_reason_code?: string | null } +export type t_dispute_payment_method_details_klarna = { + reason_code?: string | null +} + +export type t_dispute_payment_method_details_paypal = { + case_id?: string | null + reason_code?: string | null +} + export type t_email_sent = { email_sent_at: number email_sent_to: string } export type t_entitlements_active_entitlement = { - feature: string + feature: string | t_entitlements_feature id: string livemode: boolean lookup_key: string @@ -2764,6 +2875,7 @@ export type t_identity_verification_session = { options?: t_gelato_verification_session_options | null provided_details?: t_gelato_provided_details | null redaction?: t_verification_session_redaction | null + related_customer?: string | null status: "canceled" | "processing" | "requires_input" | "verified" type: "document" | "id_number" | "verification_flow" url?: string | null @@ -2962,6 +3074,7 @@ export type t_invoice_payment_method_options_us_bank_account = { 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 permissions?: ( | "balances" | "ownership" @@ -2971,6 +3084,11 @@ export type t_invoice_payment_method_options_us_bank_account_linked_account_opti prefetch?: ("balances" | "ownership" | "transactions")[] | null } +export type t_invoice_payment_method_options_us_bank_account_linked_account_options_filters = + { + account_subcategories?: ("checking" | "savings")[] + } + export type t_invoice_rendering_pdf = { page_size?: "a4" | "auto" | "letter" | null } @@ -3091,6 +3209,7 @@ export type t_invoices_payment_settings = { | "ach_credit_transfer" | "ach_debit" | "acss_debit" + | "amazon_pay" | "au_becs_debit" | "bacs_debit" | "bancontact" @@ -3105,12 +3224,15 @@ export type t_invoices_payment_settings = { | "ideal" | "konbini" | "link" + | "multibanco" | "p24" | "paynow" | "paypal" | "promptpay" + | "revolut_pay" | "sepa_debit" | "sofort" + | "swish" | "us_bank_account" | "wechat_pay" )[] @@ -3145,11 +3267,13 @@ export type t_invoices_resource_invoice_tax_id = { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -3238,6 +3362,8 @@ export type t_issuing_authorization = { cardholder?: string | t_issuing_cardholder | null created: number currency: string + fleet?: t_issuing_authorization_fleet_data | null + fuel?: t_issuing_authorization_fuel_data | null id: string livemode: boolean merchant_amount: number @@ -3316,6 +3442,27 @@ export type t_issuing_dispute = { 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" metadata: { [key: string]: string | undefined } @@ -3344,7 +3491,7 @@ export type t_issuing_personalization_design = { } export type t_issuing_physical_bundle = { - features?: t_issuing_physical_bundle_features + features: t_issuing_physical_bundle_features id: string livemode: boolean name: string @@ -3365,7 +3512,7 @@ export type t_issuing_settlement = { [key: string]: string | undefined } net_total: number - network: "visa" + network: "maestro" | "visa" network_fees: number network_settlement_identifier: string object: "issuing.settlement" @@ -3426,6 +3573,68 @@ export type t_issuing_authorization_authentication_exemption = { type: "low_value_transaction" | "transaction_risk_analysis" | "unknown" } +export type t_issuing_authorization_fleet_cardholder_prompt_data = { + alphanumeric_id?: string | null + driver_id?: string | null + odometer?: number | null + unspecified_id?: string | null + user_id?: string | null + vehicle_number?: string | null +} + +export type t_issuing_authorization_fleet_data = { + cardholder_prompt_data?: t_issuing_authorization_fleet_cardholder_prompt_data | null + purchase_type?: + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + | null + reported_breakdown?: t_issuing_authorization_fleet_reported_breakdown | null + service_type?: "full_service" | "non_fuel_transaction" | "self_service" | null +} + +export type t_issuing_authorization_fleet_fuel_price_data = { + gross_amount_decimal?: string | null +} + +export type t_issuing_authorization_fleet_non_fuel_price_data = { + gross_amount_decimal?: string | null +} + +export type t_issuing_authorization_fleet_reported_breakdown = { + fuel?: t_issuing_authorization_fleet_fuel_price_data | null + non_fuel?: t_issuing_authorization_fleet_non_fuel_price_data | null + tax?: t_issuing_authorization_fleet_tax_data | null +} + +export type t_issuing_authorization_fleet_tax_data = { + local_amount_decimal?: string | null + national_amount_decimal?: string | null +} + +export type t_issuing_authorization_fuel_data = { + industry_product_code?: string | null + quantity_decimal?: string | null + type?: + | "diesel" + | "other" + | "unleaded_plus" + | "unleaded_regular" + | "unleaded_super" + | null + unit?: + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" + | null + unit_cost_decimal?: string | null +} + export type t_issuing_authorization_merchant_data = { category: string category_code: string @@ -3468,11 +3677,16 @@ export type t_issuing_authorization_request = { reason: | "account_disabled" | "card_active" + | "card_canceled" + | "card_expired" | "card_inactive" + | "cardholder_blocked" | "cardholder_inactive" | "cardholder_verification_required" + | "insecure_authorization_method" | "insufficient_funds" | "not_allowed" + | "pin_blocked" | "spending_controls" | "suspected_fraud" | "verification_failed" @@ -4129,6 +4343,7 @@ export type t_issuing_card_google_pay = { export type t_issuing_card_shipping = { address: t_address + address_validation?: t_issuing_card_shipping_address_validation | null carrier?: "dhl" | "fedex" | "royal_mail" | "usps" | null customs?: t_issuing_card_shipping_customs | null eta?: number | null @@ -4149,6 +4364,16 @@ export type t_issuing_card_shipping = { type: "bulk" | "individual" } +export type t_issuing_card_shipping_address_validation = { + mode: "disabled" | "normalization_only" | "validation_and_normalization" + normalized_address?: t_address | null + result?: + | "indeterminate" + | "likely_deliverable" + | "likely_undeliverable" + | null +} + export type t_issuing_card_shipping_customs = { eori_number?: string | null } @@ -5474,6 +5699,7 @@ export type t_issuing_dispute_evidence = { duplicate?: t_issuing_dispute_duplicate_evidence fraudulent?: t_issuing_dispute_fraudulent_evidence merchandise_not_as_described?: t_issuing_dispute_merchandise_not_as_described_evidence + no_valid_authorization?: t_issuing_dispute_no_valid_authorization_evidence not_received?: t_issuing_dispute_not_received_evidence other?: t_issuing_dispute_other_evidence reason: @@ -5481,6 +5707,7 @@ export type t_issuing_dispute_evidence = { | "duplicate" | "fraudulent" | "merchandise_not_as_described" + | "no_valid_authorization" | "not_received" | "other" | "service_not_as_described" @@ -5501,6 +5728,11 @@ export type t_issuing_dispute_merchandise_not_as_described_evidence = { returned_at?: number | null } +export type t_issuing_dispute_no_valid_authorization_evidence = { + additional_documentation?: string | t_file | null + explanation?: string | null +} + export type t_issuing_dispute_not_received_evidence = { additional_documentation?: string | t_file | null expected_at?: number | null @@ -5656,6 +5888,40 @@ export type t_issuing_transaction_amount_details = { cashback_amount?: number | null } +export type t_issuing_transaction_fleet_cardholder_prompt_data = { + driver_id?: string | null + odometer?: number | null + unspecified_id?: string | null + user_id?: string | null + vehicle_number?: string | null +} + +export type t_issuing_transaction_fleet_data = { + cardholder_prompt_data?: t_issuing_transaction_fleet_cardholder_prompt_data | null + purchase_type?: string | null + reported_breakdown?: t_issuing_transaction_fleet_reported_breakdown | null + service_type?: string | null +} + +export type t_issuing_transaction_fleet_fuel_price_data = { + gross_amount_decimal?: string | null +} + +export type t_issuing_transaction_fleet_non_fuel_price_data = { + gross_amount_decimal?: string | null +} + +export type t_issuing_transaction_fleet_reported_breakdown = { + fuel?: t_issuing_transaction_fleet_fuel_price_data | null + non_fuel?: t_issuing_transaction_fleet_non_fuel_price_data | null + tax?: t_issuing_transaction_fleet_tax_data | null +} + +export type t_issuing_transaction_fleet_tax_data = { + local_amount_decimal?: string | null + national_amount_decimal?: string | null +} + export type t_issuing_transaction_flight_data = { departure_at?: number | null passenger_name?: string | null @@ -5674,10 +5940,11 @@ export type t_issuing_transaction_flight_data_leg = { } export type t_issuing_transaction_fuel_data = { + industry_product_code?: string | null + quantity_decimal?: string | null type: string unit: string unit_cost_decimal: string - volume_decimal?: string | null } export type t_issuing_transaction_lodging_data = { @@ -5692,6 +5959,7 @@ export type t_issuing_transaction_network_data = { } export type t_issuing_transaction_purchase_details = { + fleet?: t_issuing_transaction_fleet_data | null flight?: t_issuing_transaction_flight_data | null fuel?: t_issuing_transaction_fuel_data | null lodging?: t_issuing_transaction_lodging_data | null @@ -5876,6 +6144,7 @@ export type t_line_items_tax_amount = { } export type t_linked_account_options_us_bank_account = { + filters?: t_payment_flows_private_payment_methods_us_bank_account_linked_account_options_filters permissions?: ("balances" | "ownership" | "payment_method" | "transactions")[] prefetch?: ("balances" | "ownership" | "transactions")[] | null return_url?: string @@ -5908,6 +6177,8 @@ export type t_mandate_acss_debit = { transaction_type: "business" | "personal" } +export type t_mandate_amazon_pay = EmptyObject + export type t_mandate_au_becs_debit = { url: string } @@ -5933,12 +6204,14 @@ export type t_mandate_multi_use = EmptyObject export type t_mandate_payment_method_details = { acss_debit?: t_mandate_acss_debit + amazon_pay?: t_mandate_amazon_pay au_becs_debit?: t_mandate_au_becs_debit bacs_debit?: t_mandate_bacs_debit card?: t_card_mandate_payment_method_details cashapp?: t_mandate_cashapp link?: t_mandate_link paypal?: t_mandate_paypal + revolut_pay?: t_mandate_revolut_pay sepa_debit?: t_mandate_sepa_debit type: string us_bank_account?: t_mandate_us_bank_account @@ -5949,6 +6222,8 @@ export type t_mandate_paypal = { payer_id?: string | null } +export type t_mandate_revolut_pay = EmptyObject + export type t_mandate_sepa_debit = { reference: string url: string @@ -6084,12 +6359,22 @@ export type t_payment_flows_private_payment_methods_card_details_api_resource_mu 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_klarna_dob = { day?: number | null month?: number | null year?: number | null } +export type t_payment_flows_private_payment_methods_us_bank_account_linked_account_options_filters = + { + account_subcategories?: ("checking" | "savings")[] + } + export type t_payment_intent = { amount: number amount_capturable?: number @@ -6160,6 +6445,7 @@ export type t_payment_intent_next_action = { cashapp_handle_redirect_or_display_qr_code?: t_payment_intent_next_action_cashapp_handle_redirect_or_display_qr_code display_bank_transfer_instructions?: t_payment_intent_next_action_display_bank_transfer_instructions konbini_display_details?: t_payment_intent_next_action_konbini + multibanco_display_details?: t_payment_intent_next_action_display_multibanco_details oxxo_display_details?: t_payment_intent_next_action_display_oxxo_details paynow_display_qr_code?: t_payment_intent_next_action_paynow_display_qr_code pix_display_qr_code?: t_payment_intent_next_action_pix_display_qr_code @@ -6220,6 +6506,13 @@ export type t_payment_intent_next_action_display_bank_transfer_instructions = { | "us_bank_transfer" } +export type t_payment_intent_next_action_display_multibanco_details = { + entity?: string | null + expires_at?: number | null + hosted_voucher_url?: string | null + reference?: string | null +} + export type t_payment_intent_next_action_display_oxxo_details = { expires_after?: number | null hosted_voucher_url?: string | null @@ -6346,7 +6639,7 @@ export type t_payment_intent_payment_method_options = { | t_payment_intent_payment_method_options_au_becs_debit | t_payment_intent_type_specific_payment_method_options_client bacs_debit?: - | t_payment_method_options_bacs_debit + | t_payment_intent_payment_method_options_bacs_debit | t_payment_intent_type_specific_payment_method_options_client bancontact?: | t_payment_method_options_bancontact @@ -6399,6 +6692,9 @@ export type t_payment_intent_payment_method_options = { mobilepay?: | t_payment_intent_payment_method_options_mobilepay | t_payment_intent_type_specific_payment_method_options_client + multibanco?: + | t_payment_method_options_multibanco + | t_payment_intent_type_specific_payment_method_options_client oxxo?: | t_payment_method_options_oxxo | t_payment_intent_type_specific_payment_method_options_client @@ -6429,6 +6725,9 @@ export type t_payment_intent_payment_method_options = { swish?: | t_payment_intent_payment_method_options_swish | t_payment_intent_type_specific_payment_method_options_client + twint?: + | t_payment_method_options_twint + | t_payment_intent_type_specific_payment_method_options_client us_bank_account?: | t_payment_intent_payment_method_options_us_bank_account | t_payment_intent_type_specific_payment_method_options_client @@ -6450,6 +6749,11 @@ export type t_payment_intent_payment_method_options_au_becs_debit = { setup_future_usage?: "none" | "off_session" | "on_session" } +export type t_payment_intent_payment_method_options_bacs_debit = { + mandate_options?: t_payment_intent_payment_method_options_mandate_options_bacs_debit + setup_future_usage?: "none" | "off_session" | "on_session" +} + export type t_payment_intent_payment_method_options_blik = { setup_future_usage?: "none" } @@ -6464,6 +6768,7 @@ export type t_payment_intent_payment_method_options_card = { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -6499,6 +6804,9 @@ export type t_payment_intent_payment_method_options_mandate_options_acss_debit = transaction_type?: "business" | "personal" | null } +export type t_payment_intent_payment_method_options_mandate_options_bacs_debit = + EmptyObject + export type t_payment_intent_payment_method_options_mandate_options_sepa_debit = EmptyObject @@ -6538,7 +6846,9 @@ export type t_payment_intent_processing_customer_notification = { export type t_payment_intent_type_specific_payment_method_options_client = { capture_method?: "manual" | "manual_preferred" installments?: t_payment_flows_installment_options + request_incremental_authorization_support?: boolean require_cvc_recollection?: boolean + routing?: t_payment_method_options_card_present_routing setup_future_usage?: "none" | "off_session" | "on_session" verification_method?: "automatic" | "instant" | "microdeposits" } @@ -6594,6 +6904,8 @@ export type t_payment_link = { | "klarna" | "konbini" | "link" + | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -6603,8 +6915,10 @@ export type t_payment_link = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" + | "zip" )[] | null phone_number_collection: t_payment_links_resource_phone_number_collection @@ -7009,6 +7323,7 @@ export type t_payment_method = { affirm?: t_payment_method_affirm afterpay_clearpay?: t_payment_method_afterpay_clearpay alipay?: t_payment_flows_private_payment_methods_alipay + allow_redisplay?: "always" | "limited" | "unspecified" amazon_pay?: t_payment_method_amazon_pay au_becs_debit?: t_payment_method_au_becs_debit bacs_debit?: t_payment_method_bacs_debit @@ -7037,6 +7352,7 @@ export type t_payment_method = { [key: string]: string | undefined } | null mobilepay?: t_payment_method_mobilepay + multibanco?: t_payment_method_multibanco object: "payment_method" oxxo?: t_payment_method_oxxo p24?: t_payment_method_p24 @@ -7049,6 +7365,7 @@ export type t_payment_method = { sepa_debit?: t_payment_method_sepa_debit sofort?: t_payment_method_sofort swish?: t_payment_method_swish + twint?: t_payment_method_twint type: | "acss_debit" | "affirm" @@ -7074,6 +7391,7 @@ export type t_payment_method = { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -7084,6 +7402,7 @@ export type t_payment_method = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -7156,14 +7475,19 @@ export type t_payment_method_card_generated_card = { export type t_payment_method_card_present = { brand?: string | null + brand_product?: string | null cardholder_name?: string | null country?: string | null + description?: string | null exp_month: number exp_year: number fingerprint?: string | null funding?: string | null + issuer?: string | null last4?: string | null networks?: t_payment_method_card_present_networks | null + offline?: t_payment_method_details_card_present_offline | null + preferred_locales?: string[] | null read_method?: | "contact_emv" | "contactless_emv" @@ -7171,6 +7495,7 @@ export type t_payment_method_card_present = { | "magnetic_stripe_fallback" | "magnetic_stripe_track2" | null + wallet?: t_payment_flows_private_payment_methods_card_present_common_wallet } export type t_payment_method_card_present_networks = { @@ -7273,6 +7598,8 @@ export type t_payment_method_configuration = { konbini?: t_payment_method_config_resource_payment_method_properties link?: t_payment_method_config_resource_payment_method_properties livemode: boolean + mobilepay?: t_payment_method_config_resource_payment_method_properties + multibanco?: t_payment_method_config_resource_payment_method_properties name: string object: "payment_method_configuration" oxxo?: t_payment_method_config_resource_payment_method_properties @@ -7285,6 +7612,7 @@ export type t_payment_method_configuration = { sepa_debit?: t_payment_method_config_resource_payment_method_properties sofort?: t_payment_method_config_resource_payment_method_properties swish?: t_payment_method_config_resource_payment_method_properties + twint?: t_payment_method_config_resource_payment_method_properties us_bank_account?: t_payment_method_config_resource_payment_method_properties wechat_pay?: t_payment_method_config_resource_payment_method_properties zip?: t_payment_method_config_resource_payment_method_properties @@ -7331,6 +7659,7 @@ export type t_payment_method_details = { sofort?: t_payment_method_details_sofort stripe_account?: t_payment_method_details_stripe_account swish?: t_payment_method_details_swish + twint?: t_payment_method_details_twint type: string us_bank_account?: t_payment_method_details_us_bank_account wechat?: t_payment_method_details_wechat @@ -7363,7 +7692,9 @@ export type t_payment_method_details_acss_debit = { transit_number?: string | null } -export type t_payment_method_details_affirm = EmptyObject +export type t_payment_method_details_affirm = { + transaction_id?: string | null +} export type t_payment_method_details_afterpay_clearpay = { order_id?: string | null @@ -7397,7 +7728,9 @@ export type t_payment_method_details_bancontact = { verified_name?: string | null } -export type t_payment_method_details_blik = EmptyObject +export type t_payment_method_details_blik = { + buyer_id?: string | null +} export type t_payment_method_details_boleto = { tax_id: string @@ -7405,6 +7738,7 @@ export type t_payment_method_details_boleto = { export type t_payment_method_details_card = { amount_authorized?: number | null + authorization_code?: string | null brand?: string | null capture_before?: number checks?: t_payment_method_details_card_checks | null @@ -7449,9 +7783,11 @@ export type t_payment_method_details_card_network_token = { export type t_payment_method_details_card_present = { amount_authorized?: number | null brand?: string | null + brand_product?: string | null capture_before?: number cardholder_name?: string | null country?: string | null + description?: string | null emv_auth_data?: string | null exp_month: number exp_year: number @@ -7459,10 +7795,13 @@ export type t_payment_method_details_card_present = { funding?: string | null generated_card?: string | null incremental_authorization_supported: boolean + issuer?: string | null last4?: string | null network?: string | null + network_transaction_id?: string | null offline?: t_payment_method_details_card_present_offline | null overcapture_supported: boolean + preferred_locales?: string[] | null read_method?: | "contact_emv" | "contactless_emv" @@ -7471,10 +7810,12 @@ export type t_payment_method_details_card_present = { | "magnetic_stripe_track2" | null receipt?: t_payment_method_details_card_present_receipt | null + wallet?: t_payment_flows_private_payment_methods_card_present_common_wallet } export type t_payment_method_details_card_present_offline = { stored_at?: number | null + type?: "deferred" | null } export type t_payment_method_details_card_present_receipt = { @@ -7660,14 +8001,17 @@ export type t_payment_method_details_interac_present = { brand?: string | null cardholder_name?: string | null country?: string | null + description?: string | null emv_auth_data?: string | null exp_month: number exp_year: number fingerprint?: string | null funding?: string | null generated_card?: string | null + issuer?: string | null last4?: string | null network?: string | null + network_transaction_id?: string | null preferred_locales?: string[] | null read_method?: | "contact_emv" @@ -7805,6 +8149,8 @@ export type t_payment_method_details_swish = { verified_phone_last4?: string | null } +export type t_payment_method_details_twint = EmptyObject + export type t_payment_method_details_us_bank_account = { account_holder_type?: "company" | "individual" | null account_type?: "checking" | "savings" | null @@ -7954,10 +8300,12 @@ export type t_payment_method_interac_present = { brand?: string | null cardholder_name?: string | null country?: string | null + description?: string | null exp_month: number exp_year: number fingerprint?: string | null funding?: string | null + issuer?: string | null last4?: string | null networks?: t_payment_method_card_present_networks | null preferred_locales?: string[] | null @@ -7982,6 +8330,8 @@ export type t_payment_method_link = { export type t_payment_method_mobilepay = EmptyObject +export type t_payment_method_multibanco = EmptyObject + export type t_payment_method_options_affirm = { capture_method?: "manual" preferred_locale?: string @@ -8000,10 +8350,7 @@ export type t_payment_method_options_alipay = { export type t_payment_method_options_amazon_pay = { capture_method?: "manual" -} - -export type t_payment_method_options_bacs_debit = { - setup_future_usage?: "none" | "off_session" | "on_session" + setup_future_usage?: "none" | "off_session" } export type t_payment_method_options_bancontact = { @@ -8037,6 +8384,11 @@ export type t_payment_method_options_card_mandate_options = { export type t_payment_method_options_card_present = { request_extended_authorization?: boolean | null request_incremental_authorization_support?: boolean | null + routing?: t_payment_method_options_card_present_routing +} + +export type t_payment_method_options_card_present_routing = { + requested_priority?: "domestic" | "international" | null } export type t_payment_method_options_cashapp = { @@ -8106,6 +8458,10 @@ export type t_payment_method_options_konbini = { setup_future_usage?: "none" } +export type t_payment_method_options_multibanco = { + setup_future_usage?: "none" +} + export type t_payment_method_options_oxxo = { expires_after_days: number setup_future_usage?: "none" @@ -8138,6 +8494,7 @@ export type t_payment_method_options_promptpay = { export type t_payment_method_options_revolut_pay = { capture_method?: "manual" + setup_future_usage?: "none" | "off_session" } export type t_payment_method_options_sofort = { @@ -8145,6 +8502,10 @@ export type t_payment_method_options_sofort = { setup_future_usage?: "none" | "off_session" } +export type t_payment_method_options_twint = { + setup_future_usage?: "none" +} + export type t_payment_method_options_us_bank_account_mandate_options = { collection_method?: "paper" } @@ -8220,6 +8581,8 @@ export type t_payment_method_sofort = { 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 account_type?: "checking" | "savings" | null @@ -8311,6 +8674,7 @@ export type t_payment_pages_checkout_session_custom_fields = { } export type t_payment_pages_checkout_session_custom_fields_dropdown = { + default_value?: string | null options: t_payment_pages_checkout_session_custom_fields_option[] value?: string | null } @@ -8321,6 +8685,7 @@ export type t_payment_pages_checkout_session_custom_fields_label = { } export type t_payment_pages_checkout_session_custom_fields_numeric = { + default_value?: string | null maximum_length?: number | null minimum_length?: number | null value?: string | null @@ -8332,6 +8697,7 @@ export type t_payment_pages_checkout_session_custom_fields_option = { } export type t_payment_pages_checkout_session_custom_fields_text = { + default_value?: string | null maximum_length?: number | null minimum_length?: number | null value?: string | null @@ -8384,6 +8750,7 @@ export type t_payment_pages_checkout_session_phone_number_collection = { export type t_payment_pages_checkout_session_saved_payment_method_options = { allow_redisplay_filters?: ("always" | "limited" | "unspecified")[] | null + payment_method_remove?: "disabled" | "enabled" | null payment_method_save?: "disabled" | "enabled" | null } @@ -8660,11 +9027,13 @@ export type t_payment_pages_checkout_session_tax_id = { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -8740,6 +9109,8 @@ 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 + application_fee_amount?: number | null arrival_date: number automatic: boolean balance_transaction?: string | t_balance_transaction | null @@ -8825,7 +9196,7 @@ export type t_person_additional_tos_acceptance = { } export type t_person_additional_tos_acceptances = { - account: t_person_additional_tos_acceptance + account?: t_person_additional_tos_acceptance | null } export type t_person_future_requirements = { @@ -8890,12 +9261,10 @@ export type t_plan_tier = { up_to?: number | null } -export type t_platform_tax_fee = { - account: string - id: string - object: "platform_tax_fee" - source_transaction: string - type: string +export type t_platform_earning_fee_source = { + charge?: string + payout?: string + type: "charge" | "payout" } export type t_portal_business_profile = { @@ -9377,6 +9746,7 @@ export type t_refund_destination_details = { grabpay?: t_destination_details_unimplemented jp_bank_transfer?: t_refund_destination_details_generic klarna?: t_destination_details_unimplemented + multibanco?: t_refund_destination_details_generic mx_bank_transfer?: t_refund_destination_details_generic p24?: t_refund_destination_details_generic paynow?: t_destination_details_unimplemented @@ -9525,6 +9895,7 @@ export type t_setup_attempt = { export type t_setup_attempt_payment_method_details = { acss_debit?: t_setup_attempt_payment_method_details_acss_debit + amazon_pay?: t_setup_attempt_payment_method_details_amazon_pay au_becs_debit?: t_setup_attempt_payment_method_details_au_becs_debit bacs_debit?: t_setup_attempt_payment_method_details_bacs_debit bancontact?: t_setup_attempt_payment_method_details_bancontact @@ -9536,6 +9907,7 @@ export type t_setup_attempt_payment_method_details = { klarna?: t_setup_attempt_payment_method_details_klarna link?: t_setup_attempt_payment_method_details_link paypal?: t_setup_attempt_payment_method_details_paypal + revolut_pay?: t_setup_attempt_payment_method_details_revolut_pay sepa_debit?: t_setup_attempt_payment_method_details_sepa_debit sofort?: t_setup_attempt_payment_method_details_sofort type: string @@ -9544,6 +9916,8 @@ export type t_setup_attempt_payment_method_details = { 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 @@ -9644,6 +10018,8 @@ export type t_setup_attempt_payment_method_details_link = 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 = { @@ -9725,7 +10101,12 @@ export type t_setup_intent_payment_method_options = { amazon_pay?: | t_setup_intent_payment_method_options_amazon_pay | t_setup_intent_type_specific_payment_method_options_client - card?: t_setup_intent_payment_method_options_card + bacs_debit?: + | t_setup_intent_payment_method_options_bacs_debit + | t_setup_intent_type_specific_payment_method_options_client + card?: + | t_setup_intent_payment_method_options_card + | t_setup_intent_type_specific_payment_method_options_client card_present?: | t_setup_intent_payment_method_options_card_present | t_setup_intent_type_specific_payment_method_options_client @@ -9751,6 +10132,10 @@ export type t_setup_intent_payment_method_options_acss_debit = { 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 +} + export type t_setup_intent_payment_method_options_card = { mandate_options?: t_setup_intent_payment_method_options_card_mandate_options | null network?: @@ -9759,6 +10144,7 @@ export type t_setup_intent_payment_method_options_card = { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -9794,6 +10180,9 @@ export type t_setup_intent_payment_method_options_mandate_options_acss_debit = { transaction_type?: "business" | "personal" | null } +export type t_setup_intent_payment_method_options_mandate_options_bacs_debit = + EmptyObject + export type t_setup_intent_payment_method_options_mandate_options_sepa_debit = EmptyObject @@ -10308,6 +10697,7 @@ export type t_subscription = { discounts: (string | t_discount)[] ended_at?: number | null id: string + invoice_settings: t_subscriptions_resource_subscription_invoice_settings items: { data: t_subscription_item[] has_more: boolean @@ -10388,6 +10778,7 @@ export type t_subscription_payment_method_options_card = { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -10528,6 +10919,7 @@ export type t_subscriptions_resource_payment_settings = { | "ach_credit_transfer" | "ach_debit" | "acss_debit" + | "amazon_pay" | "au_becs_debit" | "bacs_debit" | "bancontact" @@ -10542,12 +10934,15 @@ export type t_subscriptions_resource_payment_settings = { | "ideal" | "konbini" | "link" + | "multibanco" | "p24" | "paynow" | "paypal" | "promptpay" + | "revolut_pay" | "sepa_debit" | "sofort" + | "swish" | "us_bank_account" | "wechat_pay" )[] @@ -10563,6 +10958,11 @@ export type t_subscriptions_resource_pending_update = { trial_from_plan?: boolean | null } +export type t_subscriptions_resource_subscription_invoice_settings = { + account_tax_ids?: (string | t_tax_id | t_deleted_tax_id)[] | null + issuer: t_connect_account_reference +} + export type t_subscriptions_trials_resource_end_behavior = { missing_payment_method: "cancel" | "create_invoice" | "pause" } @@ -10586,6 +10986,7 @@ export type t_tax_calculation = { } | null livemode: boolean object: "tax.calculation" + ship_from_details?: t_tax_product_resource_ship_from_details | null shipping_cost?: t_tax_product_resource_tax_calculation_shipping_cost | null tax_amount_exclusive: number tax_amount_inclusive: number @@ -10645,8 +11046,10 @@ export type t_tax_transaction = { [key: string]: string | undefined } | null object: "tax.transaction" + posted_at: number reference: string reversal?: t_tax_product_resource_tax_transaction_resource_reversal | null + ship_from_details?: t_tax_product_resource_ship_from_details | null shipping_cost?: t_tax_product_resource_tax_transaction_shipping_cost | null tax_date: number type: "reversal" | "transaction" @@ -10717,11 +11120,13 @@ export type t_tax_id = { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -10789,6 +11194,7 @@ export type t_tax_product_registrations_resource_country_options = { au?: t_tax_product_registrations_resource_country_options_default be?: t_tax_product_registrations_resource_country_options_europe bg?: t_tax_product_registrations_resource_country_options_europe + bh?: t_tax_product_registrations_resource_country_options_default ca?: t_tax_product_registrations_resource_country_options_canada ch?: t_tax_product_registrations_resource_country_options_default cl?: t_tax_product_registrations_resource_country_options_simplified @@ -10798,10 +11204,12 @@ export type t_tax_product_registrations_resource_country_options = { de?: t_tax_product_registrations_resource_country_options_europe dk?: t_tax_product_registrations_resource_country_options_europe ee?: t_tax_product_registrations_resource_country_options_europe + eg?: t_tax_product_registrations_resource_country_options_simplified es?: t_tax_product_registrations_resource_country_options_europe fi?: t_tax_product_registrations_resource_country_options_europe fr?: t_tax_product_registrations_resource_country_options_europe gb?: t_tax_product_registrations_resource_country_options_default + ge?: t_tax_product_registrations_resource_country_options_simplified gr?: t_tax_product_registrations_resource_country_options_europe hr?: t_tax_product_registrations_resource_country_options_europe hu?: t_tax_product_registrations_resource_country_options_europe @@ -10810,16 +11218,20 @@ export type t_tax_product_registrations_resource_country_options = { is?: t_tax_product_registrations_resource_country_options_default it?: t_tax_product_registrations_resource_country_options_europe jp?: t_tax_product_registrations_resource_country_options_default + ke?: t_tax_product_registrations_resource_country_options_simplified kr?: t_tax_product_registrations_resource_country_options_simplified + kz?: t_tax_product_registrations_resource_country_options_simplified lt?: t_tax_product_registrations_resource_country_options_europe lu?: t_tax_product_registrations_resource_country_options_europe lv?: t_tax_product_registrations_resource_country_options_europe mt?: t_tax_product_registrations_resource_country_options_europe mx?: t_tax_product_registrations_resource_country_options_simplified my?: t_tax_product_registrations_resource_country_options_simplified + ng?: t_tax_product_registrations_resource_country_options_simplified nl?: t_tax_product_registrations_resource_country_options_europe no?: t_tax_product_registrations_resource_country_options_default nz?: t_tax_product_registrations_resource_country_options_default + om?: t_tax_product_registrations_resource_country_options_default pl?: t_tax_product_registrations_resource_country_options_europe pt?: t_tax_product_registrations_resource_country_options_europe ro?: t_tax_product_registrations_resource_country_options_europe @@ -10910,11 +11322,13 @@ export type t_tax_product_resource_customer_details_resource_tax_id = { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -11027,6 +11441,10 @@ export type t_tax_product_resource_postal_address = { state?: string | null } +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 @@ -11167,6 +11585,8 @@ export type t_terminal_configuration = { name?: string | null object: "terminal.configuration" offline?: t_terminal_configuration_configuration_resource_offline_config + reboot_window?: t_terminal_configuration_configuration_resource_reboot_window + stripe_s700?: t_terminal_configuration_configuration_resource_device_type_specific_config tipping?: t_terminal_configuration_configuration_resource_tipping verifone_p400?: t_terminal_configuration_configuration_resource_device_type_specific_config } @@ -11199,6 +11619,7 @@ export type t_terminal_reader = { | "mobile_phone_reader" | "simulated_wisepos_e" | "stripe_m2" + | "stripe_s700" | "verifone_P400" id: string ip_address?: string | null @@ -11229,6 +11650,11 @@ export type t_terminal_configuration_configuration_resource_offline_config = { enabled?: boolean | null } +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 cad?: t_terminal_configuration_configuration_resource_currency_specific_config @@ -11387,6 +11813,16 @@ export type t_three_d_secure_usage = { supported: boolean } +export type t_thresholds_resource_alert_filter = { + customer?: string | t_customer | null +} + +export type t_thresholds_resource_usage_threshold_config = { + gte: number + meter: string | t_billing_meter + recurrence: "one_time" +} + export type t_token = { bank_account?: t_bank_account card?: t_card @@ -11532,6 +11968,7 @@ export type t_treasury_financial_account = { | "card_issuing" | "deposit_insurance" | "financial_addresses.aba" + | "financial_addresses.aba.forwarding" | "inbound_transfers.ach" | "intra_stripe_flows" | "outbound_payments.ach" @@ -11555,6 +11992,7 @@ export type t_treasury_financial_account = { | "card_issuing" | "deposit_insurance" | "financial_addresses.aba" + | "financial_addresses.aba.forwarding" | "inbound_transfers.ach" | "intra_stripe_flows" | "outbound_payments.ach" @@ -11568,6 +12006,7 @@ export type t_treasury_financial_account = { | "card_issuing" | "deposit_insurance" | "financial_addresses.aba" + | "financial_addresses.aba.forwarding" | "inbound_transfers.ach" | "intra_stripe_flows" | "outbound_payments.ach" @@ -11640,6 +12079,7 @@ export type t_treasury_outbound_payment = { 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 transaction: string | t_treasury_transaction } @@ -11664,6 +12104,7 @@ export type t_treasury_outbound_transfer = { 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 transaction: string | t_treasury_transaction } @@ -11912,6 +12353,10 @@ export type t_treasury_inbound_transfers_resource_inbound_transfer_resource_stat succeeded_at?: number | null } +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 @@ -11926,6 +12371,13 @@ export type t_treasury_outbound_payments_resource_outbound_payment_resource_stat returned_at?: number | null } +export type t_treasury_outbound_payments_resource_outbound_payment_resource_tracking_details = + { + ach?: t_treasury_outbound_payments_resource_ach_tracking_details + type: "ach" | "us_domestic_wire" + us_domestic_wire?: t_treasury_outbound_payments_resource_us_domestic_wire_tracking_details + } + export type t_treasury_outbound_payments_resource_returned_status = { code: | "account_closed" @@ -11941,6 +12393,24 @@ export type t_treasury_outbound_payments_resource_returned_status = { transaction: string | t_treasury_transaction } +export type t_treasury_outbound_payments_resource_us_domestic_wire_tracking_details = + { + chips?: string | null + imad?: string | null + omad?: string | null + } + +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 + type: "ach" | "us_domestic_wire" + us_domestic_wire?: t_treasury_outbound_transfers_resource_us_domestic_wire_tracking_details + } + export type t_treasury_outbound_transfers_resource_returned_details = { code: | "account_closed" @@ -11963,6 +12433,13 @@ export type t_treasury_outbound_transfers_resource_status_transitions = { returned_at?: number | null } +export type t_treasury_outbound_transfers_resource_us_domestic_wire_tracking_details = + { + chips?: string | null + imad?: string | null + omad?: string | null + } + export type t_treasury_received_credits_resource_linked_flows = { credit_reversal?: string | null issuing_authorization?: string | null @@ -12684,6 +13161,27 @@ export type t_GetBalanceTransactionsIdQuerySchema = { expand?: string[] } +export type t_GetBillingAlertsBodySchema = EmptyObject + +export type t_GetBillingAlertsQuerySchema = { + alert_type?: "usage_threshold" + ending_before?: string + expand?: string[] + limit?: number + meter?: string + starting_after?: string +} + +export type t_GetBillingAlertsIdBodySchema = EmptyObject + +export type t_GetBillingAlertsIdParamSchema = { + id: string +} + +export type t_GetBillingAlertsIdQuerySchema = { + expand?: string[] +} + export type t_GetBillingMetersBodySchema = EmptyObject export type t_GetBillingMetersQuerySchema = { @@ -12718,7 +13216,7 @@ export type t_GetBillingMetersIdEventSummariesQuerySchema = { limit?: number start_time: number starting_after?: string - value_grouping_window?: "hour" + value_grouping_window?: "day" | "hour" } export type t_GetBillingPortalConfigurationsBodySchema = EmptyObject @@ -13025,6 +13523,7 @@ export type t_GetCreditNotesPreviewQuerySchema = { amount?: number credit_amount?: number effective_at?: number + email_type?: "credit_note" | "none" expand?: string[] invoice: string lines?: { @@ -13067,6 +13566,7 @@ export type t_GetCreditNotesPreviewLinesQuerySchema = { amount?: number credit_amount?: number effective_at?: number + email_type?: "credit_note" | "none" ending_before?: string expand?: string[] invoice: string @@ -13291,6 +13791,7 @@ export type t_GetCustomersCustomerPaymentMethodsQuerySchema = { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -13301,6 +13802,7 @@ export type t_GetCustomersCustomerPaymentMethodsQuerySchema = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -13469,9 +13971,11 @@ export type t_GetEntitlementsActiveEntitlementsIdQuerySchema = { export type t_GetEntitlementsFeaturesBodySchema = EmptyObject export type t_GetEntitlementsFeaturesQuerySchema = { + archived?: boolean ending_before?: string expand?: string[] limit?: number + lookup_key?: string starting_after?: string } @@ -13757,6 +14261,7 @@ export type t_GetIdentityVerificationSessionsQuerySchema = { ending_before?: string expand?: string[] limit?: number + related_customer?: string starting_after?: string status?: "canceled" | "processing" | "requires_input" | "verified" } @@ -13922,11 +14427,13 @@ export type t_GetInvoicesUpcomingQuerySchema = { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -14030,6 +14537,7 @@ export type t_GetInvoicesUpcomingQuerySchema = { type: "account" | "self" } on_behalf_of?: string | "" + preview_mode?: "next" | "recurring" schedule?: string schedule_details?: { end_behavior?: "cancel" | "release" @@ -14294,11 +14802,13 @@ export type t_GetInvoicesUpcomingLinesQuerySchema = { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -14404,6 +14914,7 @@ export type t_GetInvoicesUpcomingLinesQuerySchema = { } limit?: number on_behalf_of?: string | "" + preview_mode?: "next" | "recurring" schedule?: string schedule_details?: { end_behavior?: "cancel" | "release" @@ -14782,23 +15293,6 @@ export type t_GetIssuingPhysicalBundlesPhysicalBundleQuerySchema = { expand?: string[] } -export type t_GetIssuingSettlementsBodySchema = EmptyObject - -export type t_GetIssuingSettlementsQuerySchema = { - created?: - | { - gt?: number - gte?: number - lt?: number - lte?: number - } - | number - ending_before?: string - expand?: string[] - limit?: number - starting_after?: string -} - export type t_GetIssuingSettlementsSettlementBodySchema = EmptyObject export type t_GetIssuingSettlementsSettlementParamSchema = { @@ -15070,6 +15564,7 @@ export type t_GetPaymentMethodsQuerySchema = { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -15080,6 +15575,7 @@ export type t_GetPaymentMethodsQuerySchema = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -15854,6 +16350,16 @@ export type t_GetSubscriptionsSubscriptionExposedIdQuerySchema = { expand?: string[] } +export type t_GetTaxCalculationsCalculationBodySchema = EmptyObject + +export type t_GetTaxCalculationsCalculationParamSchema = { + calculation: string +} + +export type t_GetTaxCalculationsCalculationQuerySchema = { + expand?: string[] +} + export type t_GetTaxCalculationsCalculationLineItemsBodySchema = EmptyObject export type t_GetTaxCalculationsCalculationLineItemsParamSchema = { @@ -16037,6 +16543,7 @@ export type t_GetTerminalReadersQuerySchema = { | "mobile_phone_reader" | "simulated_wisepos_e" | "stripe_m2" + | "stripe_s700" | "verifone_P400" ending_before?: string expand?: string[] @@ -16512,6 +17019,7 @@ export type t_PostAccountSessionsBodySchema = { enabled: boolean features?: { edit_payout_schedule?: boolean + external_account_collection?: boolean instant_payouts?: boolean standard_payouts?: boolean } @@ -16548,6 +17056,7 @@ export type t_PostAccountSessionsBodySchema = { enabled: boolean features?: { edit_payout_schedule?: boolean + external_account_collection?: boolean instant_payouts?: boolean standard_payouts?: boolean } @@ -16556,6 +17065,14 @@ export type t_PostAccountSessionsBodySchema = { enabled: boolean features?: EmptyObject } + tax_registrations?: { + enabled: boolean + features?: EmptyObject + } + tax_settings?: { + enabled: boolean + features?: EmptyObject + } } expand?: string[] } @@ -16656,6 +17173,9 @@ export type t_PostAccountsBodySchema = { fpx_payments?: { requested?: boolean } + gb_bank_transfer_payments?: { + requested?: boolean + } giropay_payments?: { requested?: boolean } @@ -16671,6 +17191,9 @@ export type t_PostAccountsBodySchema = { jcb_payments?: { requested?: boolean } + jp_bank_transfer_payments?: { + requested?: boolean + } klarna_payments?: { requested?: boolean } @@ -16686,6 +17209,12 @@ export type t_PostAccountsBodySchema = { mobilepay_payments?: { requested?: boolean } + multibanco_payments?: { + requested?: boolean + } + mx_bank_transfer_payments?: { + requested?: boolean + } oxxo_payments?: { requested?: boolean } @@ -16701,6 +17230,9 @@ export type t_PostAccountsBodySchema = { revolut_pay_payments?: { requested?: boolean } + sepa_bank_transfer_payments?: { + requested?: boolean + } sepa_debit_payments?: { requested?: boolean } @@ -16722,9 +17254,15 @@ export type t_PostAccountsBodySchema = { treasury?: { requested?: boolean } + twint_payments?: { + requested?: boolean + } us_bank_account_ach_payments?: { requested?: boolean } + us_bank_transfer_payments?: { + requested?: boolean + } zip_payments?: { requested?: boolean } @@ -17075,6 +17613,9 @@ export type t_PostAccountsAccountBodySchema = { fpx_payments?: { requested?: boolean } + gb_bank_transfer_payments?: { + requested?: boolean + } giropay_payments?: { requested?: boolean } @@ -17090,6 +17631,9 @@ export type t_PostAccountsAccountBodySchema = { jcb_payments?: { requested?: boolean } + jp_bank_transfer_payments?: { + requested?: boolean + } klarna_payments?: { requested?: boolean } @@ -17105,6 +17649,12 @@ export type t_PostAccountsAccountBodySchema = { mobilepay_payments?: { requested?: boolean } + multibanco_payments?: { + requested?: boolean + } + mx_bank_transfer_payments?: { + requested?: boolean + } oxxo_payments?: { requested?: boolean } @@ -17120,6 +17670,9 @@ export type t_PostAccountsAccountBodySchema = { revolut_pay_payments?: { requested?: boolean } + sepa_bank_transfer_payments?: { + requested?: boolean + } sepa_debit_payments?: { requested?: boolean } @@ -17141,9 +17694,15 @@ export type t_PostAccountsAccountBodySchema = { treasury?: { requested?: boolean } + twint_payments?: { + requested?: boolean + } us_bank_account_ach_payments?: { requested?: boolean } + us_bank_transfer_payments?: { + requested?: boolean + } zip_payments?: { requested?: boolean } @@ -18054,6 +18613,44 @@ export type t_PostAppsSecretsDeleteBodySchema = { } } +export type t_PostBillingAlertsBodySchema = { + alert_type: "usage_threshold" + expand?: string[] + filter?: { + customer?: string + } + title: string + usage_threshold_config?: { + gte: number + meter?: string + recurrence: "one_time" + } +} + +export type t_PostBillingAlertsIdActivateBodySchema = { + expand?: string[] +} + +export type t_PostBillingAlertsIdActivateParamSchema = { + id: string +} + +export type t_PostBillingAlertsIdArchiveBodySchema = { + expand?: string[] +} + +export type t_PostBillingAlertsIdArchiveParamSchema = { + id: string +} + +export type t_PostBillingAlertsIdDeactivateBodySchema = { + expand?: string[] +} + +export type t_PostBillingAlertsIdDeactivateParamSchema = { + id: string +} + export type t_PostBillingMeterEventAdjustmentsBodySchema = { cancel?: { identifier?: string @@ -18594,6 +19191,7 @@ export type t_PostCheckoutSessionsBodySchema = { currency?: string custom_fields?: { dropdown?: { + default_value?: string options: { label: string value: string @@ -18605,11 +19203,13 @@ export type t_PostCheckoutSessionsBodySchema = { type: "custom" } numeric?: { + default_value?: string maximum_length?: number minimum_length?: number } optional?: boolean text?: { + default_value?: string maximum_length?: number minimum_length?: number } @@ -18893,6 +19493,9 @@ export type t_PostCheckoutSessionsBodySchema = { mobilepay?: { setup_future_usage?: "none" } + multibanco?: { + setup_future_usage?: "none" + } oxxo?: { expires_after_days?: number setup_future_usage?: "none" @@ -18989,6 +19592,7 @@ export type t_PostCheckoutSessionsBodySchema = { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -18999,6 +19603,7 @@ export type t_PostCheckoutSessionsBodySchema = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -19330,6 +19935,19 @@ export type t_PostCheckoutSessionsBodySchema = { ui_mode?: "embedded" | "hosted" } +export type t_PostCheckoutSessionsSessionBodySchema = { + expand?: string[] + metadata?: + | { + [key: string]: string | undefined + } + | "" +} + +export type t_PostCheckoutSessionsSessionParamSchema = { + session: string +} + export type t_PostCheckoutSessionsSessionExpireBodySchema = { expand?: string[] } @@ -19429,6 +20047,7 @@ export type t_PostCreditNotesBodySchema = { amount?: number credit_amount?: number effective_at?: number + email_type?: "credit_note" | "none" expand?: string[] invoice: string lines?: { @@ -19490,6 +20109,21 @@ export type t_PostCustomerSessionsBodySchema = { buy_button?: { enabled: boolean } + payment_element?: { + enabled: boolean + features?: { + payment_method_allow_redisplay_filters?: ( + | "always" + | "limited" + | "unspecified" + )[] + payment_method_redisplay?: "disabled" | "enabled" + payment_method_redisplay_limit?: number + payment_method_remove?: "disabled" | "enabled" + payment_method_save?: "disabled" | "enabled" + payment_method_save_usage?: "off_session" | "on_session" + } + } pricing_table?: { enabled: boolean } @@ -19584,11 +20218,13 @@ export type t_PostCustomersBodySchema = { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -20206,6 +20842,7 @@ export type t_PostCustomersCustomerSubscriptionsBodySchema = { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -20231,6 +20868,9 @@ export type t_PostCustomersCustomerSubscriptionsBodySchema = { us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -20248,6 +20888,7 @@ export type t_PostCustomersCustomerSubscriptionsBodySchema = { | "ach_credit_transfer" | "ach_debit" | "acss_debit" + | "amazon_pay" | "au_becs_debit" | "bacs_debit" | "bancontact" @@ -20262,12 +20903,15 @@ export type t_PostCustomersCustomerSubscriptionsBodySchema = { | "ideal" | "konbini" | "link" + | "multibanco" | "p24" | "paynow" | "paypal" | "promptpay" + | "revolut_pay" | "sepa_debit" | "sofort" + | "swish" | "us_bank_account" | "wechat_pay" )[] @@ -20451,6 +21095,7 @@ export type t_PostCustomersCustomerSubscriptionsSubscriptionExposedIdBodySchema | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -20476,6 +21121,9 @@ export type t_PostCustomersCustomerSubscriptionsSubscriptionExposedIdBodySchema us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -20493,6 +21141,7 @@ export type t_PostCustomersCustomerSubscriptionsSubscriptionExposedIdBodySchema | "ach_credit_transfer" | "ach_debit" | "acss_debit" + | "amazon_pay" | "au_becs_debit" | "bacs_debit" | "bancontact" @@ -20507,12 +21156,15 @@ export type t_PostCustomersCustomerSubscriptionsSubscriptionExposedIdBodySchema | "ideal" | "konbini" | "link" + | "multibanco" | "p24" | "paynow" | "paypal" | "promptpay" + | "revolut_pay" | "sepa_debit" | "sofort" + | "swish" | "us_bank_account" | "wechat_pay" )[] @@ -20568,11 +21220,13 @@ export type t_PostCustomersCustomerTaxIdsBodySchema = { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -20693,9 +21347,11 @@ export type t_PostEntitlementsFeaturesBodySchema = { export type t_PostEntitlementsFeaturesIdBodySchema = { active?: boolean expand?: string[] - metadata?: { - [key: string]: string | undefined - } + metadata?: + | { + [key: string]: string | undefined + } + | "" name?: string } @@ -20804,7 +21460,14 @@ export type t_PostFinancialConnectionsSessionsBodySchema = { } expand?: string[] filters?: { - countries: string[] + account_subcategories?: ( + | "checking" + | "credit_card" + | "line_of_credit" + | "mortgage" + | "savings" + )[] + countries?: string[] } permissions: ("balances" | "ownership" | "payment_method" | "transactions")[] prefetch?: ("balances" | "ownership" | "transactions")[] @@ -20845,21 +21508,12 @@ export type t_PostIdentityVerificationSessionsBodySchema = { require_matching_selfie?: boolean } | "" - email?: - | { - require_verification?: boolean - } - | "" - phone?: - | { - require_verification?: boolean - } - | "" } provided_details?: { email?: string phone?: string } + related_customer?: string return_url?: string type?: "document" | "id_number" verification_flow?: string @@ -20879,16 +21533,6 @@ export type t_PostIdentityVerificationSessionsSessionBodySchema = { require_matching_selfie?: boolean } | "" - email?: - | { - require_verification?: boolean - } - | "" - phone?: - | { - require_verification?: boolean - } - | "" } provided_details?: { email?: string @@ -21072,8 +21716,8 @@ export type t_PostInvoicesBodySchema = { enabled?: boolean plan?: | { - count: number - interval: "month" + count?: number + interval?: "month" type: "fixed_count" } | "" @@ -21097,6 +21741,9 @@ export type t_PostInvoicesBodySchema = { us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -21114,6 +21761,7 @@ export type t_PostInvoicesBodySchema = { | "ach_credit_transfer" | "ach_debit" | "acss_debit" + | "amazon_pay" | "au_becs_debit" | "bacs_debit" | "bancontact" @@ -21128,12 +21776,15 @@ export type t_PostInvoicesBodySchema = { | "ideal" | "konbini" | "link" + | "multibanco" | "p24" | "paynow" | "paypal" | "promptpay" + | "revolut_pay" | "sepa_debit" | "sofort" + | "swish" | "us_bank_account" | "wechat_pay" )[] @@ -21258,11 +21909,13 @@ export type t_PostInvoicesCreatePreviewBodySchema = { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -21366,6 +22019,7 @@ export type t_PostInvoicesCreatePreviewBodySchema = { type: "account" | "self" } on_behalf_of?: string | "" + preview_mode?: "next" | "recurring" schedule?: string schedule_details?: { end_behavior?: "cancel" | "release" @@ -21588,8 +22242,8 @@ export type t_PostInvoicesInvoiceBodySchema = { enabled?: boolean plan?: | { - count: number - interval: "month" + count?: number + interval?: "month" type: "fixed_count" } | "" @@ -21613,6 +22267,9 @@ export type t_PostInvoicesInvoiceBodySchema = { us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -21630,6 +22287,7 @@ export type t_PostInvoicesInvoiceBodySchema = { | "ach_credit_transfer" | "ach_debit" | "acss_debit" + | "amazon_pay" | "au_becs_debit" | "bacs_debit" | "bancontact" @@ -21644,12 +22302,15 @@ export type t_PostInvoicesInvoiceBodySchema = { | "ideal" | "konbini" | "link" + | "multibanco" | "p24" | "paynow" | "paypal" | "promptpay" + | "revolut_pay" | "sepa_debit" | "sofort" + | "swish" | "us_bank_account" | "wechat_pay" )[] @@ -21724,6 +22385,88 @@ export type t_PostInvoicesInvoiceParamSchema = { invoice: string } +export type t_PostInvoicesInvoiceAddLinesBodySchema = { + expand?: string[] + invoice_metadata?: + | { + [key: string]: string | undefined + } + | "" + lines: { + amount?: number + description?: string + discountable?: boolean + discounts?: + | { + coupon?: string + discount?: string + promotion_code?: string + }[] + | "" + invoice_item?: string + metadata?: + | { + [key: string]: string | undefined + } + | "" + period?: { + end: number + start: number + } + price?: string + price_data?: { + currency: string + product?: string + product_data?: { + description?: string + images?: string[] + metadata?: { + [key: string]: string | undefined + } + name: string + tax_code?: string + } + tax_behavior?: "exclusive" | "inclusive" | "unspecified" + unit_amount?: number + unit_amount_decimal?: string + } + quantity?: number + tax_amounts?: + | { + amount: number + tax_rate_data: { + country?: string + description?: string + display_name: string + inclusive: boolean + jurisdiction?: string + percentage: number + state?: string + tax_type?: + | "amusement_tax" + | "communications_tax" + | "gst" + | "hst" + | "igst" + | "jct" + | "lease_tax" + | "pst" + | "qst" + | "rst" + | "sales_tax" + | "vat" + } + taxable_amount: number + }[] + | "" + tax_rates?: string[] | "" + }[] +} + +export type t_PostInvoicesInvoiceAddLinesParamSchema = { + invoice: string +} + export type t_PostInvoicesInvoiceFinalizeBodySchema = { auto_advance?: boolean expand?: string[] @@ -21830,6 +22573,23 @@ export type t_PostInvoicesInvoicePayParamSchema = { invoice: string } +export type t_PostInvoicesInvoiceRemoveLinesBodySchema = { + expand?: string[] + invoice_metadata?: + | { + [key: string]: string | undefined + } + | "" + lines: { + behavior: "delete" | "unassign" + id: string + }[] +} + +export type t_PostInvoicesInvoiceRemoveLinesParamSchema = { + invoice: string +} + export type t_PostInvoicesInvoiceSendBodySchema = { expand?: string[] } @@ -21838,6 +22598,88 @@ export type t_PostInvoicesInvoiceSendParamSchema = { invoice: string } +export type t_PostInvoicesInvoiceUpdateLinesBodySchema = { + expand?: string[] + invoice_metadata?: + | { + [key: string]: string | undefined + } + | "" + lines: { + amount?: number + description?: string + discountable?: boolean + discounts?: + | { + coupon?: string + discount?: string + promotion_code?: string + }[] + | "" + id: string + metadata?: + | { + [key: string]: string | undefined + } + | "" + period?: { + end: number + start: number + } + price?: string + price_data?: { + currency: string + product?: string + product_data?: { + description?: string + images?: string[] + metadata?: { + [key: string]: string | undefined + } + name: string + tax_code?: string + } + tax_behavior?: "exclusive" | "inclusive" | "unspecified" + unit_amount?: number + unit_amount_decimal?: string + } + quantity?: number + tax_amounts?: + | { + amount: number + tax_rate_data: { + country?: string + description?: string + display_name: string + inclusive: boolean + jurisdiction?: string + percentage: number + state?: string + tax_type?: + | "amusement_tax" + | "communications_tax" + | "gst" + | "hst" + | "igst" + | "jct" + | "lease_tax" + | "pst" + | "qst" + | "rst" + | "sales_tax" + | "vat" + } + taxable_amount: number + }[] + | "" + tax_rates?: string[] | "" + }[] +} + +export type t_PostInvoicesInvoiceUpdateLinesParamSchema = { + invoice: string +} + export type t_PostInvoicesInvoiceVoidBodySchema = { expand?: string[] } @@ -23820,6 +24662,9 @@ export type t_PostIssuingCardsBodySchema = { postal_code: string state?: string } + address_validation?: { + mode: "disabled" | "normalization_only" | "validation_and_normalization" + } customs?: { eori_number?: string } @@ -24750,6 +25595,27 @@ export type t_PostIssuingCardsCardBodySchema = { pin?: { encrypted_number?: string } + shipping?: { + address: { + city: string + country: string + line1: string + line2?: string + postal_code: string + state?: string + } + address_validation?: { + mode: "disabled" | "normalization_only" | "validation_and_normalization" + } + customs?: { + eori_number?: string + } + name: string + phone_number?: string + require_signature?: boolean + service?: "express" | "priority" | "standard" + type?: "bulk" | "individual" + } spending_controls?: { allowed_categories?: ( | "ac_refrigeration_repair" @@ -25705,6 +26571,12 @@ export type t_PostIssuingDisputesBodySchema = { returned_at?: number | "" } | "" + no_valid_authorization?: + | { + additional_documentation?: string | "" + explanation?: string | "" + } + | "" not_received?: | { additional_documentation?: string | "" @@ -25727,6 +26599,7 @@ export type t_PostIssuingDisputesBodySchema = { | "duplicate" | "fraudulent" | "merchandise_not_as_described" + | "no_valid_authorization" | "not_received" | "other" | "service_not_as_described" @@ -25793,6 +26666,12 @@ export type t_PostIssuingDisputesDisputeBodySchema = { returned_at?: number | "" } | "" + no_valid_authorization?: + | { + additional_documentation?: string | "" + explanation?: string | "" + } + | "" not_received?: | { additional_documentation?: string | "" @@ -25815,6 +26694,7 @@ export type t_PostIssuingDisputesDisputeBodySchema = { | "duplicate" | "fraudulent" | "merchandise_not_as_described" + | "no_valid_authorization" | "not_received" | "other" | "service_not_as_described" @@ -25944,7 +26824,14 @@ export type t_PostLinkAccountSessionsBodySchema = { } expand?: string[] filters?: { - countries: string[] + account_subcategories?: ( + | "checking" + | "credit_card" + | "line_of_credit" + | "mortgage" + | "savings" + )[] + countries?: string[] } permissions: ("balances" | "ownership" | "payment_method" | "transactions")[] prefetch?: ("balances" | "ownership" | "transactions")[] @@ -26137,6 +27024,7 @@ export type t_PostPaymentIntentsBodySchema = { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -26182,6 +27070,7 @@ export type t_PostPaymentIntentsBodySchema = { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type: | "acss_debit" | "affirm" @@ -26204,6 +27093,7 @@ export type t_PostPaymentIntentsBodySchema = { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -26214,6 +27104,7 @@ export type t_PostPaymentIntentsBodySchema = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -26272,6 +27163,7 @@ export type t_PostPaymentIntentsBodySchema = { | "" bacs_debit?: | { + mandate_options?: EmptyObject setup_future_usage?: "" | "none" | "off_session" | "on_session" } | "" @@ -26301,8 +27193,8 @@ export type t_PostPaymentIntentsBodySchema = { enabled?: boolean plan?: | { - count: number - interval: "month" + count?: number + interval?: "month" type: "fixed_count" } | "" @@ -26324,6 +27216,7 @@ export type t_PostPaymentIntentsBodySchema = { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -26361,6 +27254,9 @@ export type t_PostPaymentIntentsBodySchema = { | { request_extended_authorization?: boolean request_incremental_authorization_support?: boolean + routing?: { + requested_priority?: "domestic" | "international" + } } | "" cashapp?: @@ -26451,6 +27347,7 @@ export type t_PostPaymentIntentsBodySchema = { | "en-NZ" | "en-PL" | "en-PT" + | "en-RO" | "en-SE" | "en-US" | "es-ES" @@ -26467,6 +27364,7 @@ export type t_PostPaymentIntentsBodySchema = { | "nl-NL" | "pl-PL" | "pt-PT" + | "ro-RO" | "sv-FI" | "sv-SE" setup_future_usage?: "none" @@ -26493,6 +27391,11 @@ export type t_PostPaymentIntentsBodySchema = { setup_future_usage?: "none" } | "" + multibanco?: + | { + setup_future_usage?: "none" + } + | "" oxxo?: | { expires_after_days?: number @@ -26584,9 +27487,17 @@ export type t_PostPaymentIntentsBodySchema = { setup_future_usage?: "none" } | "" + twint?: + | { + setup_future_usage?: "none" + } + | "" us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -26798,6 +27709,7 @@ export type t_PostPaymentIntentsIntentBodySchema = { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -26843,6 +27755,7 @@ export type t_PostPaymentIntentsIntentBodySchema = { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type: | "acss_debit" | "affirm" @@ -26865,6 +27778,7 @@ export type t_PostPaymentIntentsIntentBodySchema = { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -26875,6 +27789,7 @@ export type t_PostPaymentIntentsIntentBodySchema = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -26933,6 +27848,7 @@ export type t_PostPaymentIntentsIntentBodySchema = { | "" bacs_debit?: | { + mandate_options?: EmptyObject setup_future_usage?: "" | "none" | "off_session" | "on_session" } | "" @@ -26962,8 +27878,8 @@ export type t_PostPaymentIntentsIntentBodySchema = { enabled?: boolean plan?: | { - count: number - interval: "month" + count?: number + interval?: "month" type: "fixed_count" } | "" @@ -26985,6 +27901,7 @@ export type t_PostPaymentIntentsIntentBodySchema = { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -27022,6 +27939,9 @@ export type t_PostPaymentIntentsIntentBodySchema = { | { request_extended_authorization?: boolean request_incremental_authorization_support?: boolean + routing?: { + requested_priority?: "domestic" | "international" + } } | "" cashapp?: @@ -27112,6 +28032,7 @@ export type t_PostPaymentIntentsIntentBodySchema = { | "en-NZ" | "en-PL" | "en-PT" + | "en-RO" | "en-SE" | "en-US" | "es-ES" @@ -27128,6 +28049,7 @@ export type t_PostPaymentIntentsIntentBodySchema = { | "nl-NL" | "pl-PL" | "pt-PT" + | "ro-RO" | "sv-FI" | "sv-SE" setup_future_usage?: "none" @@ -27154,6 +28076,11 @@ export type t_PostPaymentIntentsIntentBodySchema = { setup_future_usage?: "none" } | "" + multibanco?: + | { + setup_future_usage?: "none" + } + | "" oxxo?: | { expires_after_days?: number @@ -27245,9 +28172,17 @@ export type t_PostPaymentIntentsIntentBodySchema = { setup_future_usage?: "none" } | "" + twint?: + | { + setup_future_usage?: "none" + } + | "" us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -27519,6 +28454,7 @@ export type t_PostPaymentIntentsIntentConfirmBodySchema = { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -27564,6 +28500,7 @@ export type t_PostPaymentIntentsIntentConfirmBodySchema = { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type: | "acss_debit" | "affirm" @@ -27586,6 +28523,7 @@ export type t_PostPaymentIntentsIntentConfirmBodySchema = { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -27596,6 +28534,7 @@ export type t_PostPaymentIntentsIntentConfirmBodySchema = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -27654,6 +28593,7 @@ export type t_PostPaymentIntentsIntentConfirmBodySchema = { | "" bacs_debit?: | { + mandate_options?: EmptyObject setup_future_usage?: "" | "none" | "off_session" | "on_session" } | "" @@ -27683,8 +28623,8 @@ export type t_PostPaymentIntentsIntentConfirmBodySchema = { enabled?: boolean plan?: | { - count: number - interval: "month" + count?: number + interval?: "month" type: "fixed_count" } | "" @@ -27706,6 +28646,7 @@ export type t_PostPaymentIntentsIntentConfirmBodySchema = { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -27743,6 +28684,9 @@ export type t_PostPaymentIntentsIntentConfirmBodySchema = { | { request_extended_authorization?: boolean request_incremental_authorization_support?: boolean + routing?: { + requested_priority?: "domestic" | "international" + } } | "" cashapp?: @@ -27833,6 +28777,7 @@ export type t_PostPaymentIntentsIntentConfirmBodySchema = { | "en-NZ" | "en-PL" | "en-PT" + | "en-RO" | "en-SE" | "en-US" | "es-ES" @@ -27849,6 +28794,7 @@ export type t_PostPaymentIntentsIntentConfirmBodySchema = { | "nl-NL" | "pl-PL" | "pt-PT" + | "ro-RO" | "sv-FI" | "sv-SE" setup_future_usage?: "none" @@ -27875,6 +28821,11 @@ export type t_PostPaymentIntentsIntentConfirmBodySchema = { setup_future_usage?: "none" } | "" + multibanco?: + | { + setup_future_usage?: "none" + } + | "" oxxo?: | { expires_after_days?: number @@ -27966,9 +28917,17 @@ export type t_PostPaymentIntentsIntentConfirmBodySchema = { setup_future_usage?: "none" } | "" + twint?: + | { + setup_future_usage?: "none" + } + | "" us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -28210,6 +29169,8 @@ export type t_PostPaymentLinksBodySchema = { | "klarna" | "konbini" | "link" + | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -28219,8 +29180,10 @@ export type t_PostPaymentLinksBodySchema = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" + | "zip" )[] phone_number_collection?: { enabled: boolean @@ -28644,6 +29607,8 @@ export type t_PostPaymentLinksPaymentLinkBodySchema = { | "klarna" | "konbini" | "link" + | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -28653,8 +29618,10 @@ export type t_PostPaymentLinksPaymentLinkBodySchema = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" + | "zip" )[] | "" restrictions?: @@ -28927,6 +29894,9 @@ export type t_PostPaymentLinksPaymentLinkBodySchema = { } | "" } + tax_id_collection?: { + enabled: boolean + } } export type t_PostPaymentLinksPaymentLinkParamSchema = { @@ -29065,6 +30035,16 @@ export type t_PostPaymentMethodConfigurationsBodySchema = { preference?: "none" | "off" | "on" } } + mobilepay?: { + display_preference?: { + preference?: "none" | "off" | "on" + } + } + multibanco?: { + display_preference?: { + preference?: "none" | "off" | "on" + } + } name?: string oxxo?: { display_preference?: { @@ -29112,6 +30092,11 @@ export type t_PostPaymentMethodConfigurationsBodySchema = { preference?: "none" | "off" | "on" } } + twint?: { + display_preference?: { + preference?: "none" | "off" | "on" + } + } us_bank_account?: { display_preference?: { preference?: "none" | "off" | "on" @@ -29262,6 +30247,16 @@ export type t_PostPaymentMethodConfigurationsConfigurationBodySchema = { preference?: "none" | "off" | "on" } } + mobilepay?: { + display_preference?: { + preference?: "none" | "off" | "on" + } + } + multibanco?: { + display_preference?: { + preference?: "none" | "off" | "on" + } + } name?: string oxxo?: { display_preference?: { @@ -29308,6 +30303,11 @@ export type t_PostPaymentMethodConfigurationsConfigurationBodySchema = { preference?: "none" | "off" | "on" } } + twint?: { + display_preference?: { + preference?: "none" | "off" | "on" + } + } us_bank_account?: { display_preference?: { preference?: "none" | "off" | "on" @@ -29499,6 +30499,7 @@ export type t_PostPaymentMethodsBodySchema = { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -29545,6 +30546,7 @@ export type t_PostPaymentMethodsBodySchema = { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type?: | "acss_debit" | "affirm" @@ -29568,6 +30570,7 @@ export type t_PostPaymentMethodsBodySchema = { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -29578,6 +30581,7 @@ export type t_PostPaymentMethodsBodySchema = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -31115,6 +32119,7 @@ export type t_PostSetupIntentsBodySchema = { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -31160,6 +32165,7 @@ export type t_PostSetupIntentsBodySchema = { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type: | "acss_debit" | "affirm" @@ -31182,6 +32188,7 @@ export type t_PostSetupIntentsBodySchema = { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -31192,6 +32199,7 @@ export type t_PostSetupIntentsBodySchema = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -31218,6 +32226,9 @@ export type t_PostSetupIntentsBodySchema = { verification_method?: "automatic" | "instant" | "microdeposits" } amazon_pay?: EmptyObject + bacs_debit?: { + mandate_options?: EmptyObject + } card?: { mandate_options?: { amount: number @@ -31237,6 +32248,7 @@ export type t_PostSetupIntentsBodySchema = { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -31270,6 +32282,9 @@ export type t_PostSetupIntentsBodySchema = { } us_bank_account?: { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -31443,6 +32458,7 @@ export type t_PostSetupIntentsIntentBodySchema = { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -31488,6 +32504,7 @@ export type t_PostSetupIntentsIntentBodySchema = { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type: | "acss_debit" | "affirm" @@ -31510,6 +32527,7 @@ export type t_PostSetupIntentsIntentBodySchema = { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -31520,6 +32538,7 @@ export type t_PostSetupIntentsIntentBodySchema = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -31546,6 +32565,9 @@ export type t_PostSetupIntentsIntentBodySchema = { verification_method?: "automatic" | "instant" | "microdeposits" } amazon_pay?: EmptyObject + bacs_debit?: { + mandate_options?: EmptyObject + } card?: { mandate_options?: { amount: number @@ -31565,6 +32587,7 @@ export type t_PostSetupIntentsIntentBodySchema = { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -31598,6 +32621,9 @@ export type t_PostSetupIntentsIntentBodySchema = { } us_bank_account?: { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -31791,6 +32817,7 @@ export type t_PostSetupIntentsIntentConfirmBodySchema = { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -31836,6 +32863,7 @@ export type t_PostSetupIntentsIntentConfirmBodySchema = { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type: | "acss_debit" | "affirm" @@ -31858,6 +32886,7 @@ export type t_PostSetupIntentsIntentConfirmBodySchema = { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -31868,6 +32897,7 @@ export type t_PostSetupIntentsIntentConfirmBodySchema = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -31894,6 +32924,9 @@ export type t_PostSetupIntentsIntentConfirmBodySchema = { verification_method?: "automatic" | "instant" | "microdeposits" } amazon_pay?: EmptyObject + bacs_debit?: { + mandate_options?: EmptyObject + } card?: { mandate_options?: { amount: number @@ -31913,6 +32946,7 @@ export type t_PostSetupIntentsIntentConfirmBodySchema = { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -31946,6 +32980,9 @@ export type t_PostSetupIntentsIntentConfirmBodySchema = { } us_bank_account?: { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -32764,6 +33801,7 @@ export type t_PostSubscriptionsBodySchema = { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -32789,6 +33827,9 @@ export type t_PostSubscriptionsBodySchema = { us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -32806,6 +33847,7 @@ export type t_PostSubscriptionsBodySchema = { | "ach_credit_transfer" | "ach_debit" | "acss_debit" + | "amazon_pay" | "au_becs_debit" | "bacs_debit" | "bancontact" @@ -32820,12 +33862,15 @@ export type t_PostSubscriptionsBodySchema = { | "ideal" | "konbini" | "link" + | "multibanco" | "p24" | "paynow" | "paypal" | "promptpay" + | "revolut_pay" | "sepa_debit" | "sofort" + | "swish" | "us_bank_account" | "wechat_pay" )[] @@ -33006,6 +34051,7 @@ export type t_PostSubscriptionsSubscriptionExposedIdBodySchema = { | "diners" | "discover" | "eftpos_au" + | "girocard" | "interac" | "jcb" | "mastercard" @@ -33031,6 +34077,9 @@ export type t_PostSubscriptionsSubscriptionExposedIdBodySchema = { us_bank_account?: | { financial_connections?: { + filters?: { + account_subcategories?: ("checking" | "savings")[] + } permissions?: ( | "balances" | "ownership" @@ -33048,6 +34097,7 @@ export type t_PostSubscriptionsSubscriptionExposedIdBodySchema = { | "ach_credit_transfer" | "ach_debit" | "acss_debit" + | "amazon_pay" | "au_becs_debit" | "bacs_debit" | "bancontact" @@ -33062,12 +34112,15 @@ export type t_PostSubscriptionsSubscriptionExposedIdBodySchema = { | "ideal" | "konbini" | "link" + | "multibanco" | "p24" | "paynow" | "paypal" | "promptpay" + | "revolut_pay" | "sepa_debit" | "sofort" + | "swish" | "us_bank_account" | "wechat_pay" )[] @@ -33145,11 +34198,13 @@ export type t_PostTaxCalculationsBodySchema = { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -33213,6 +34268,16 @@ export type t_PostTaxCalculationsBodySchema = { tax_behavior?: "exclusive" | "inclusive" tax_code?: string }[] + ship_from_details?: { + address: { + city?: string | "" + country: string + line1?: string | "" + line2?: string | "" + postal_code?: string | "" + state?: string | "" + } + } shipping_cost?: { amount?: number shipping_rate?: string @@ -33246,11 +34311,13 @@ export type t_PostTaxIdsBodySchema = { | "ca_pst_mb" | "ca_pst_sk" | "ca_qst" + | "ch_uid" | "ch_vat" | "cl_tin" | "cn_tin" | "co_nit" | "cr_tin" + | "de_stn" | "do_rcn" | "ec_ruc" | "eg_tin" @@ -33392,6 +34459,9 @@ export type t_PostTaxRegistrationsBodySchema = { } type: "ioss" | "oss_non_union" | "oss_union" | "standard" } + bh?: { + type: "standard" + } ca?: { province_standard?: { province: string @@ -33437,6 +34507,9 @@ export type t_PostTaxRegistrationsBodySchema = { } type: "ioss" | "oss_non_union" | "oss_union" | "standard" } + eg?: { + type: "simplified" + } es?: { standard?: { place_of_supply_scheme: "small_seller" | "standard" @@ -33458,6 +34531,9 @@ export type t_PostTaxRegistrationsBodySchema = { gb?: { type: "standard" } + ge?: { + type: "simplified" + } gr?: { standard?: { place_of_supply_scheme: "small_seller" | "standard" @@ -33497,9 +34573,15 @@ export type t_PostTaxRegistrationsBodySchema = { jp?: { type: "standard" } + ke?: { + type: "simplified" + } kr?: { type: "simplified" } + kz?: { + type: "simplified" + } lt?: { standard?: { place_of_supply_scheme: "small_seller" | "standard" @@ -33530,6 +34612,9 @@ export type t_PostTaxRegistrationsBodySchema = { my?: { type: "simplified" } + ng?: { + type: "simplified" + } nl?: { standard?: { place_of_supply_scheme: "small_seller" | "standard" @@ -33542,6 +34627,9 @@ export type t_PostTaxRegistrationsBodySchema = { nz?: { type: "standard" } + om?: { + type: "standard" + } pl?: { standard?: { place_of_supply_scheme: "small_seller" | "standard" @@ -33649,6 +34737,7 @@ export type t_PostTaxTransactionsCreateFromCalculationBodySchema = { metadata?: { [key: string]: string | undefined } + posted_at?: number reference: string } @@ -33688,6 +34777,13 @@ export type t_PostTerminalConfigurationsBodySchema = { enabled: boolean } | "" + reboot_window?: { + end_hour: number + start_hour: number + } + stripe_s700?: { + splashscreen?: string | "" + } tipping?: | { aud?: { @@ -33780,6 +34876,17 @@ export type t_PostTerminalConfigurationsConfigurationBodySchema = { enabled: boolean } | "" + reboot_window?: + | { + end_hour: number + start_hour: number + } + | "" + stripe_s700?: + | { + splashscreen?: string | "" + } + | "" tipping?: | { aud?: { @@ -34148,6 +35255,7 @@ export type t_PostTestHelpersConfirmationTokensBodySchema = { [key: string]: string | undefined } mobilepay?: EmptyObject + multibanco?: EmptyObject oxxo?: EmptyObject p24?: { bank?: @@ -34193,6 +35301,7 @@ export type t_PostTestHelpersConfirmationTokensBodySchema = { country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" } swish?: EmptyObject + twint?: EmptyObject type: | "acss_debit" | "affirm" @@ -34215,6 +35324,7 @@ export type t_PostTestHelpersConfirmationTokensBodySchema = { | "konbini" | "link" | "mobilepay" + | "multibanco" | "oxxo" | "p24" | "paynow" @@ -34225,6 +35335,7 @@ export type t_PostTestHelpersConfirmationTokensBodySchema = { | "sepa_debit" | "sofort" | "swish" + | "twint" | "us_bank_account" | "wechat_pay" | "zip" @@ -34280,6 +35391,52 @@ export type t_PostTestHelpersIssuingAuthorizationsBodySchema = { card: string currency?: string expand?: string[] + fleet?: { + cardholder_prompt_data?: { + driver_id?: string + odometer?: number + unspecified_id?: string + user_id?: string + vehicle_number?: string + } + purchase_type?: + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + reported_breakdown?: { + fuel?: { + gross_amount_decimal?: string + } + non_fuel?: { + gross_amount_decimal?: string + } + tax?: { + local_amount_decimal?: string + national_amount_decimal?: string + } + } + service_type?: "full_service" | "non_fuel_transaction" | "self_service" + } + fuel?: { + industry_product_code?: string + quantity_decimal?: string + type?: + | "diesel" + | "other" + | "unleaded_plus" + | "unleaded_regular" + | "unleaded_super" + unit?: + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" + unit_cost_decimal?: string + } is_amount_controllable?: boolean merchant_data?: { category?: @@ -34611,6 +35768,32 @@ export type t_PostTestHelpersIssuingAuthorizationsAuthorizationCaptureBodySchema close_authorization?: boolean expand?: string[] purchase_details?: { + fleet?: { + cardholder_prompt_data?: { + driver_id?: string + odometer?: number + unspecified_id?: string + user_id?: string + vehicle_number?: string + } + purchase_type?: + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + reported_breakdown?: { + fuel?: { + gross_amount_decimal?: string + } + non_fuel?: { + gross_amount_decimal?: string + } + tax?: { + local_amount_decimal?: string + national_amount_decimal?: string + } + } + service_type?: "full_service" | "non_fuel_transaction" | "self_service" + } flight?: { departure_at?: number passenger_name?: string @@ -34626,15 +35809,24 @@ export type t_PostTestHelpersIssuingAuthorizationsAuthorizationCaptureBodySchema travel_agency?: string } fuel?: { + industry_product_code?: string + quantity_decimal?: string type?: | "diesel" | "other" | "unleaded_plus" | "unleaded_regular" | "unleaded_super" - unit?: "liter" | "other" | "us_gallon" + unit?: + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" unit_cost_decimal?: string - volume_decimal?: string } lodging?: { check_in_at?: number @@ -34665,6 +35857,63 @@ export type t_PostTestHelpersIssuingAuthorizationsAuthorizationExpireParamSchema authorization: string } +export type t_PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountBodySchema = + { + expand?: string[] + final_amount: number + fleet?: { + cardholder_prompt_data?: { + driver_id?: string + odometer?: number + unspecified_id?: string + user_id?: string + vehicle_number?: string + } + purchase_type?: + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + reported_breakdown?: { + fuel?: { + gross_amount_decimal?: string + } + non_fuel?: { + gross_amount_decimal?: string + } + tax?: { + local_amount_decimal?: string + national_amount_decimal?: string + } + } + service_type?: "full_service" | "non_fuel_transaction" | "self_service" + } + fuel?: { + industry_product_code?: string + quantity_decimal?: string + type?: + | "diesel" + | "other" + | "unleaded_plus" + | "unleaded_regular" + | "unleaded_super" + unit?: + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" + unit_cost_decimal?: string + } + } + +export type t_PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountParamSchema = + { + authorization: string + } + export type t_PostTestHelpersIssuingAuthorizationsAuthorizationIncrementBodySchema = { expand?: string[] @@ -34771,6 +36020,18 @@ export type t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignR personalization_design: string } +export type t_PostTestHelpersIssuingSettlementsBodySchema = { + bin: string + clearing_date: number + currency: string + expand?: string[] + interchange_fees?: number + net_total: number + network_settlement_identifier?: string + transaction_count?: number + transaction_volume?: number +} + export type t_PostTestHelpersIssuingTransactionsCreateForceCaptureBodySchema = { amount: number card: string @@ -35082,6 +36343,32 @@ export type t_PostTestHelpersIssuingTransactionsCreateForceCaptureBodySchema = { url?: string } purchase_details?: { + fleet?: { + cardholder_prompt_data?: { + driver_id?: string + odometer?: number + unspecified_id?: string + user_id?: string + vehicle_number?: string + } + purchase_type?: + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + reported_breakdown?: { + fuel?: { + gross_amount_decimal?: string + } + non_fuel?: { + gross_amount_decimal?: string + } + tax?: { + local_amount_decimal?: string + national_amount_decimal?: string + } + } + service_type?: "full_service" | "non_fuel_transaction" | "self_service" + } flight?: { departure_at?: number passenger_name?: string @@ -35097,15 +36384,24 @@ export type t_PostTestHelpersIssuingTransactionsCreateForceCaptureBodySchema = { travel_agency?: string } fuel?: { + industry_product_code?: string + quantity_decimal?: string type?: | "diesel" | "other" | "unleaded_plus" | "unleaded_regular" | "unleaded_super" - unit?: "liter" | "other" | "us_gallon" + unit?: + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" unit_cost_decimal?: string - volume_decimal?: string } lodging?: { check_in_at?: number @@ -35433,6 +36729,32 @@ export type t_PostTestHelpersIssuingTransactionsCreateUnlinkedRefundBodySchema = url?: string } purchase_details?: { + fleet?: { + cardholder_prompt_data?: { + driver_id?: string + odometer?: number + unspecified_id?: string + user_id?: string + vehicle_number?: string + } + purchase_type?: + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + reported_breakdown?: { + fuel?: { + gross_amount_decimal?: string + } + non_fuel?: { + gross_amount_decimal?: string + } + tax?: { + local_amount_decimal?: string + national_amount_decimal?: string + } + } + service_type?: "full_service" | "non_fuel_transaction" | "self_service" + } flight?: { departure_at?: number passenger_name?: string @@ -35448,15 +36770,24 @@ export type t_PostTestHelpersIssuingTransactionsCreateUnlinkedRefundBodySchema = travel_agency?: string } fuel?: { + industry_product_code?: string + quantity_decimal?: string type?: | "diesel" | "other" | "unleaded_plus" | "unleaded_regular" | "unleaded_super" - unit?: "liter" | "other" | "us_gallon" + unit?: + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" unit_cost_decimal?: string - volume_decimal?: string } lodging?: { check_in_at?: number @@ -35562,6 +36893,25 @@ export type t_PostTestHelpersTreasuryInboundTransfersIdSucceedParamSchema = { id: string } +export type t_PostTestHelpersTreasuryOutboundPaymentsIdBodySchema = { + expand?: string[] + tracking_details: { + ach?: { + trace_id: string + } + type: "ach" | "us_domestic_wire" + us_domestic_wire?: { + chips?: string + imad?: string + omad?: string + } + } +} + +export type t_PostTestHelpersTreasuryOutboundPaymentsIdParamSchema = { + id: string +} + export type t_PostTestHelpersTreasuryOutboundPaymentsIdFailBodySchema = { expand?: string[] } @@ -35599,6 +36949,27 @@ export type t_PostTestHelpersTreasuryOutboundPaymentsIdReturnParamSchema = { id: string } +export type t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferBodySchema = + { + expand?: string[] + tracking_details: { + ach?: { + trace_id: string + } + type: "ach" | "us_domestic_wire" + us_domestic_wire?: { + chips?: string + imad?: string + omad?: string + } + } + } + +export type t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferParamSchema = + { + outbound_transfer: string + } + export type t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferFailBodySchema = { expand?: string[] @@ -36454,6 +37825,7 @@ export type t_PostWebhookEndpointsBodySchema = { | "2023-08-16" | "2023-10-16" | "2024-04-10" + | "2024-06-20" connect?: boolean description?: string | "" enabled_events: ( @@ -36468,6 +37840,7 @@ export type t_PostWebhookEndpointsBodySchema = { | "application_fee.refund.updated" | "application_fee.refunded" | "balance.available" + | "billing.alert.triggered" | "billing_portal.configuration.created" | "billing_portal.configuration.updated" | "billing_portal.session.created" @@ -36545,6 +37918,7 @@ export type t_PostWebhookEndpointsBodySchema = { | "invoice.finalization_failed" | "invoice.finalized" | "invoice.marked_uncollectible" + | "invoice.overdue" | "invoice.paid" | "invoice.payment_action_required" | "invoice.payment_failed" @@ -36553,6 +37927,7 @@ export type t_PostWebhookEndpointsBodySchema = { | "invoice.upcoming" | "invoice.updated" | "invoice.voided" + | "invoice.will_be_due" | "invoiceitem.created" | "invoiceitem.deleted" | "issuing_authorization.created" @@ -36565,8 +37940,13 @@ export type t_PostWebhookEndpointsBodySchema = { | "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" @@ -36675,12 +38055,14 @@ export type t_PostWebhookEndpointsBodySchema = { | "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" @@ -36710,6 +38092,7 @@ export type t_PostWebhookEndpointsWebhookEndpointBodySchema = { | "application_fee.refund.updated" | "application_fee.refunded" | "balance.available" + | "billing.alert.triggered" | "billing_portal.configuration.created" | "billing_portal.configuration.updated" | "billing_portal.session.created" @@ -36787,6 +38170,7 @@ export type t_PostWebhookEndpointsWebhookEndpointBodySchema = { | "invoice.finalization_failed" | "invoice.finalized" | "invoice.marked_uncollectible" + | "invoice.overdue" | "invoice.paid" | "invoice.payment_action_required" | "invoice.payment_failed" @@ -36795,6 +38179,7 @@ export type t_PostWebhookEndpointsWebhookEndpointBodySchema = { | "invoice.upcoming" | "invoice.updated" | "invoice.voided" + | "invoice.will_be_due" | "invoiceitem.created" | "invoiceitem.deleted" | "issuing_authorization.created" @@ -36807,8 +38192,13 @@ export type t_PostWebhookEndpointsWebhookEndpointBodySchema = { | "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" @@ -36917,12 +38307,14 @@ export type t_PostWebhookEndpointsWebhookEndpointBodySchema = { | "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" diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/schemas.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/schemas.ts index bb490135..9184639a 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/schemas.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/schemas.ts @@ -13,6 +13,7 @@ import { t_balance_transaction, t_bank_account, t_bank_connections_resource_accountholder, + t_billing_alert, t_capability, t_card, t_charge, @@ -68,6 +69,7 @@ import { 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, @@ -150,6 +152,7 @@ import { 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, @@ -159,6 +162,7 @@ import { 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_alert_filter, t_token, t_topup, t_transfer, @@ -222,6 +226,9 @@ export const s_account_capabilities = z.object({ 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(), @@ -229,16 +236,26 @@ export const s_account_capabilities = z.object({ .enum(["active", "inactive", "pending"]) .optional(), jcb_payments: z.enum(["active", "inactive", "pending"]).optional(), + jp_bank_transfer_payments: z + .enum(["active", "inactive", "pending"]) + .optional(), klarna_payments: z.enum(["active", "inactive", "pending"]).optional(), konbini_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(), oxxo_payments: z.enum(["active", "inactive", "pending"]).optional(), p24_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(), + 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(), @@ -248,9 +265,13 @@ export const s_account_capabilities = z.object({ .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(), }) @@ -378,6 +399,7 @@ export const s_account_requirements_error = z.object({ "verification_missing_executives", "verification_missing_owners", "verification_requires_additional_memorandum_of_associations", + "verification_requires_additional_proof_of_registration", ]), reason: z.string().max(5000), requirement: z.string().max(5000), @@ -458,7 +480,21 @@ export const s_bank_connections_resource_balance_refresh = z.object({ }) export const s_bank_connections_resource_link_account_session_filters = - z.object({ countries: z.array(z.string().max(5000)).nullable().optional() }) + 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(), @@ -575,7 +611,9 @@ 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({}) +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(), @@ -639,6 +677,10 @@ 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_oxxo_payment_method_options = z.object({ expires_after_days: z.coerce.number(), setup_future_usage: z.enum(["none"]).optional(), @@ -663,7 +705,9 @@ 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({}) +export const s_checkout_revolut_pay_payment_method_options = z.object({ + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) export const s_checkout_sepa_debit_payment_method_options = z.object({ setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), @@ -701,6 +745,9 @@ export const s_confirmation_tokens_resource_mandate_data_resource_customer_accep 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({ external_account_collection: PermissiveBoolean, }) @@ -716,6 +763,7 @@ export const s_connect_embedded_payments_features = z.object({ export const s_connect_embedded_payouts_features = z.object({ edit_payout_schedule: PermissiveBoolean, + external_account_collection: PermissiveBoolean, instant_payouts: PermissiveBoolean, standard_payouts: PermissiveBoolean, }) @@ -774,6 +822,21 @@ export const s_customer_balance_resource_cash_balance_transaction_resource_funde 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 }) @@ -940,22 +1003,24 @@ export const s_dispute_evidence_details = z.object({ 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_email_sent = z.object({ email_sent_at: z.coerce.number(), email_sent_to: z.string().max(5000), }) -export const s_entitlements_active_entitlement = z.object({ - feature: z.string().max(5000), - id: z.string().max(5000), - livemode: PermissiveBoolean, - lookup_key: z.string().max(5000), - object: z.enum(["entitlements.active_entitlement"]), -}) - export const s_entitlements_feature = z.object({ active: PermissiveBoolean, id: z.string().max(5000), @@ -1254,17 +1319,9 @@ 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 = +export const s_invoice_payment_method_options_us_bank_account_linked_account_options_filters = z.object({ - permissions: z - .array( - z.enum(["balances", "ownership", "payment_method", "transactions"]), - ) - .optional(), - prefetch: z - .array(z.enum(["balances", "ownership", "transactions"])) - .nullable() - .optional(), + account_subcategories: z.array(z.enum(["checking", "savings"])).optional(), }) export const s_invoice_rendering_pdf = z.object({ @@ -1302,11 +1359,13 @@ export const s_invoices_resource_invoice_tax_id = z.object({ "ca_pst_mb", "ca_pst_sk", "ca_qst", + "ch_uid", "ch_vat", "cl_tin", "cn_tin", "co_nit", "cr_tin", + "de_stn", "do_rcn", "ec_ruc", "eg_tin", @@ -1388,6 +1447,57 @@ export const s_issuing_authorization_authentication_exemption = z.object({ ]), }) +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_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), @@ -2215,7 +2325,7 @@ export const s_issuing_settlement = z.object({ livemode: PermissiveBoolean, metadata: z.record(z.string().max(500)), net_total: z.coerce.number(), - network: z.enum(["visa"]), + network: z.enum(["maestro", "visa"]), network_fees: z.coerce.number(), network_settlement_identifier: z.string().max(5000), object: z.enum(["issuing.settlement"]), @@ -2229,6 +2339,27 @@ export const s_issuing_transaction_amount_details = z.object({ 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(), @@ -2239,10 +2370,11 @@ export const s_issuing_transaction_flight_data_leg = z.object({ }) 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(), - volume_decimal: z.string().nullable().optional(), }) export const s_issuing_transaction_lodging_data = z.object({ @@ -2290,17 +2422,6 @@ export const s_legal_entity_ubo_declaration = z.object({ user_agent: z.string().max(5000).nullable().optional(), }) -export const s_linked_account_options_us_bank_account = z.object({ - 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_login_link = z.object({ created: z.coerce.number(), object: z.enum(["login_link"]), @@ -2314,6 +2435,8 @@ export const s_mandate_acss_debit = z.object({ 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({ @@ -2343,6 +2466,8 @@ export const s_mandate_paypal = z.object({ 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), @@ -2427,12 +2552,22 @@ export const s_payment_flows_private_payment_methods_card_details_api_resource_e 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_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_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(), @@ -2458,6 +2593,15 @@ export const s_payment_intent_next_action_cashapp_qr_code = z.object({ 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(), @@ -2578,6 +2722,9 @@ export const s_payment_intent_payment_method_options_mandate_options_acss_debit transaction_type: z.enum(["business", "personal"]).nullable().optional(), }) +export const s_payment_intent_payment_method_options_mandate_options_bacs_debit = + z.object({}) + export const s_payment_intent_payment_method_options_mandate_options_sepa_debit = z.object({}) @@ -3003,7 +3150,9 @@ export const s_payment_method_details_acss_debit = z.object({ transit_number: z.string().max(5000).nullable().optional(), }) -export const s_payment_method_details_affirm = z.object({}) +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(), @@ -3026,7 +3175,9 @@ export const s_payment_method_details_bacs_debit = z.object({ sort_code: z.string().max(5000).nullable().optional(), }) -export const s_payment_method_details_blik = 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), @@ -3050,6 +3201,7 @@ export const s_payment_method_details_card_network_token = z.object({ 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({ @@ -3262,6 +3414,8 @@ export const s_payment_method_details_swish = z.object({ 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({ @@ -3395,6 +3549,8 @@ export const s_payment_method_link = z.object({ export const s_payment_method_mobilepay = z.object({}) +export const s_payment_method_multibanco = z.object({}) + export const s_payment_method_options_affirm = z.object({ capture_method: z.enum(["manual"]).optional(), preferred_locale: z.string().max(30).optional(), @@ -3413,10 +3569,7 @@ export const s_payment_method_options_alipay = z.object({ export const s_payment_method_options_amazon_pay = z.object({ capture_method: z.enum(["manual"]).optional(), -}) - -export const s_payment_method_options_bacs_debit = z.object({ - setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), + setup_future_usage: z.enum(["none", "off_session"]).optional(), }) export const s_payment_method_options_bancontact = z.object({ @@ -3444,10 +3597,11 @@ export const s_payment_method_options_card_mandate_options = z.object({ .optional(), }) -export const s_payment_method_options_card_present = z.object({ - request_extended_authorization: PermissiveBoolean.nullable().optional(), - request_incremental_authorization_support: - PermissiveBoolean.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({ @@ -3490,6 +3644,10 @@ export const s_payment_method_options_konbini = z.object({ setup_future_usage: z.enum(["none"]).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(), @@ -3522,6 +3680,7 @@ export const s_payment_method_options_promptpay = z.object({ 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({ @@ -3532,6 +3691,10 @@ export const s_payment_method_options_sofort = z.object({ 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() }) @@ -3600,6 +3763,8 @@ export const s_payment_method_sofort = z.object({ 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([ @@ -3661,6 +3826,7 @@ export const s_payment_pages_checkout_session_custom_fields_label = z.object({ }) 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(), @@ -3672,6 +3838,7 @@ export const s_payment_pages_checkout_session_custom_fields_option = z.object({ }) 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(), @@ -3693,6 +3860,10 @@ export const s_payment_pages_checkout_session_saved_payment_method_options = .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(), }) @@ -3959,11 +4130,13 @@ export const s_payment_pages_checkout_session_tax_id = z.object({ "ca_pst_mb", "ca_pst_sk", "ca_qst", + "ch_uid", "ch_vat", "cl_tin", "cn_tin", "co_nit", "cr_tin", + "de_stn", "do_rcn", "ec_ruc", "eg_tin", @@ -4060,12 +4233,10 @@ export const s_plan_tier = z.object({ up_to: z.coerce.number().nullable().optional(), }) -export const s_platform_tax_fee = z.object({ - account: z.string().max(5000), - id: z.string().max(5000), - object: z.enum(["platform_tax_fee"]), - source_transaction: z.string().max(5000), - type: z.string().max(5000), +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({ @@ -4259,6 +4430,8 @@ export const s_secret_service_resource_scope = z.object({ 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({}) @@ -4279,6 +4452,8 @@ export const s_setup_attempt_payment_method_details_link = 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( @@ -4334,6 +4509,9 @@ export const s_setup_intent_payment_method_options_mandate_options_acss_debit = transaction_type: z.enum(["business", "personal"]).nullable().optional(), }) +export const s_setup_intent_payment_method_options_mandate_options_bacs_debit = + z.object({}) + export const s_setup_intent_payment_method_options_mandate_options_sepa_debit = z.object({}) @@ -4748,11 +4926,13 @@ export const s_tax_product_resource_customer_details_resource_tax_id = z.object( "ca_pst_mb", "ca_pst_sk", "ca_qst", + "ch_uid", "ch_vat", "cl_tin", "cn_tin", "co_nit", "cr_tin", + "de_stn", "do_rcn", "ec_ruc", "eg_tin", @@ -4945,6 +5125,9 @@ export const s_terminal_configuration_configuration_resource_currency_specific_c export const s_terminal_configuration_configuration_resource_offline_config = z.object({ enabled: PermissiveBoolean.nullable().optional() }) +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"]), @@ -5155,6 +5338,9 @@ export const s_treasury_inbound_transfers_resource_inbound_transfer_resource_sta 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(), @@ -5169,6 +5355,16 @@ export const s_treasury_outbound_payments_resource_outbound_payment_resource_sta 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(), @@ -5177,6 +5373,13 @@ export const s_treasury_outbound_transfers_resource_status_transitions = 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 @@ -5297,7 +5500,21 @@ export const s_account_capability_future_requirements = z.object({ .optional(), current_deadline: z.coerce.number().nullable().optional(), currently_due: z.array(z.string().max(5000)), - disabled_reason: z.string().max(5000).nullable().optional(), + 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)), @@ -5311,7 +5528,21 @@ export const s_account_capability_requirements = z.object({ .optional(), current_deadline: z.coerce.number().nullable().optional(), currently_due: z.array(z.string().max(5000)), - disabled_reason: z.string().max(5000).nullable().optional(), + 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)), @@ -5395,9 +5626,9 @@ export const s_balance_amount = z.object({ source_types: s_balance_amount_by_source_type.optional(), }) -export const s_balance_amount_net = z.object({ +export const s_balance_net_available = z.object({ amount: z.coerce.number(), - currency: z.string(), + destination: z.string().max(5000), source_types: s_balance_amount_by_source_type.optional(), }) @@ -5500,12 +5731,6 @@ export const s_checkout_customer_balance_bank_transfer_payment_method_options = .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(), - verification_method: z.enum(["automatic", "instant"]).optional(), -}) - export const s_climate_supplier = z.object({ id: z.string().max(5000), info_url: z.string().max(5000), @@ -5529,6 +5754,12 @@ export const s_confirmation_tokens_resource_mandate_data_resource_customer_accep 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), @@ -5645,10 +5876,14 @@ export const s_customer_balance_resource_cash_balance_transaction_resource_funde 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 = z.object({ - buy_button: s_customer_session_resource_components_resource_buy_button, - pricing_table: s_customer_session_resource_components_resource_pricing_table, -}) +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([ @@ -5673,7 +5908,17 @@ export const s_deleted_payment_source = z.union([ export const s_dispute_payment_method_details = z.object({ card: s_dispute_payment_method_details_card.optional(), - type: z.enum(["card"]), + klarna: s_dispute_payment_method_details_klarna.optional(), + paypal: s_dispute_payment_method_details_paypal.optional(), + type: z.enum(["card", "klarna", "paypal"]), +}) + +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({ @@ -5855,13 +6100,20 @@ export const s_invoice_payment_method_options_customer_balance_bank_transfer = type: z.string().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_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_tax_amount = z.object({ amount: z.coerce.number(), @@ -5906,6 +6158,14 @@ export const s_invoices_resource_line_items_proration_details = z.object({ .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(), @@ -5929,11 +6189,16 @@ export const s_issuing_authorization_request = z.object({ 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", "not_allowed", + "pin_blocked", "spending_controls", "suspected_fraud", "verification_failed", @@ -6575,29 +6840,17 @@ export const s_issuing_card_authorization_controls = z.object({ spending_limits_currency: z.string().nullable().optional(), }) -export const s_issuing_card_shipping = z.object({ - address: s_address, - 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", - ]) +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(), - 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_card_wallets = z.object({ @@ -7281,7 +7534,7 @@ export const s_issuing_network_token_wallet_provider = z.object({ }) export const s_issuing_physical_bundle = z.object({ - features: s_issuing_physical_bundle_features.optional(), + features: s_issuing_physical_bundle_features, id: z.string().max(5000), livemode: PermissiveBoolean, name: z.string().max(5000), @@ -7290,6 +7543,14 @@ export const s_issuing_physical_bundle = z.object({ 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(), @@ -7327,14 +7588,29 @@ export const s_line_items_tax_amount = z.object({ taxable_amount: z.coerce.number().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(), link: s_mandate_link.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(), @@ -7387,27 +7663,18 @@ export const s_payment_intent_payment_method_options_acss_debit = z.object({ .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(), +}) + 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(), }) -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(), - verification_method: z - .enum(["automatic", "instant", "microdeposits"]) - .optional(), - }, -) - export const s_payment_links_resource_after_completion = z.object({ hosted_confirmation: s_payment_links_resource_completion_behavior_confirmation_page.optional(), @@ -7447,14 +7714,19 @@ export const s_payment_links_resource_restrictions = z.object({ 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", @@ -7465,6 +7737,8 @@ export const s_payment_method_card_present = z.object({ ]) .nullable() .optional(), + wallet: + s_payment_flows_private_payment_methods_card_present_common_wallet.optional(), }) export const s_payment_method_card_wallet_masterpass = z.object({ @@ -7494,9 +7768,11 @@ export const s_payment_method_details_card_installments = z.object({ 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(), @@ -7504,10 +7780,13 @@ export const s_payment_method_details_card_present = z.object({ 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", @@ -7519,6 +7798,8 @@ export const s_payment_method_details_card_present = z.object({ .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({ @@ -7539,14 +7820,17 @@ 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([ @@ -7589,10 +7873,12 @@ 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(), @@ -7621,6 +7907,13 @@ export const s_payment_method_options_card_installments = z.object({ 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: @@ -7664,6 +7957,7 @@ export const s_payment_pages_checkout_session_consent_collection = z.object({ 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(), }, @@ -7696,7 +7990,7 @@ export const s_payment_pages_checkout_session_customer_details = z.object({ }) export const s_person_additional_tos_acceptances = z.object({ - account: s_person_additional_tos_acceptance, + account: s_person_additional_tos_acceptance.nullable().optional(), }) export const s_person_future_requirements = z.object({ @@ -7822,6 +8116,7 @@ export const s_refund_destination_details = z.object({ grabpay: s_destination_details_unimplemented.optional(), jp_bank_transfer: s_refund_destination_details_generic.optional(), klarna: s_destination_details_unimplemented.optional(), + multibanco: s_refund_destination_details_generic.optional(), mx_bank_transfer: s_refund_destination_details_generic.optional(), p24: s_refund_destination_details_generic.optional(), paynow: s_destination_details_unimplemented.optional(), @@ -7857,6 +8152,11 @@ export const s_setup_intent_payment_method_options_acss_debit = z.object({ .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() @@ -7868,6 +8168,7 @@ export const s_setup_intent_payment_method_options_card = z.object({ "diners", "discover", "eftpos_au", + "girocard", "interac", "jcb", "mastercard", @@ -7888,15 +8189,6 @@ export const s_setup_intent_payment_method_options_sepa_debit = z.object({ s_setup_intent_payment_method_options_mandate_options_sepa_debit.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 = z.object({ address: s_address.optional(), carrier: z.string().max(5000).nullable().optional(), @@ -7971,6 +8263,7 @@ export const s_subscription_payment_method_options_card = z.object({ "diners", "discover", "eftpos_au", + "girocard", "interac", "jcb", "mastercard", @@ -8054,6 +8347,10 @@ export const s_tax_product_resource_line_item_tax_breakdown = z.object({ 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_breakdown = z.object({ amount: z.coerce.number(), inclusive: PermissiveBoolean, @@ -8188,6 +8485,22 @@ export const s_treasury_financial_accounts_resource_toggle_settings = z.object({ ), }) +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(), @@ -8204,6 +8517,13 @@ export const s_usage_record_summary = z.object({ total_usage: z.coerce.number(), }) +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), }) @@ -8220,6 +8540,12 @@ export const s_checkout_customer_balance_payment_method_options = z.object({ 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(), + 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), @@ -8255,6 +8581,8 @@ export const s_connect_embedded_account_session_create_components = z.object({ payments: s_connect_embedded_payments_config_claim, payouts: s_connect_embedded_payouts_config_claim, 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({ @@ -8274,6 +8602,13 @@ export const s_customer_balance_resource_cash_balance_transaction_resource_funde 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_forwarding_request = z.object({ created: z.coerce.number(), id: z.string().max(5000), @@ -8320,6 +8655,59 @@ export const s_invoice_payment_method_options_customer_balance = z.object({ 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", + ]) + .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(), @@ -8328,12 +8716,15 @@ export const s_issuing_network_token_network_data = z.object({ wallet_provider: s_issuing_network_token_wallet_provider.optional(), }) -export const s_issuing_transaction_purchase_details = z.object({ - 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_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_payment_intent_next_action_display_bank_transfer_instructions = @@ -8375,6 +8766,7 @@ export const s_payment_intent_payment_method_options_card = z.object({ "diners", "discover", "eftpos_au", + "girocard", "interac", "jcb", "mastercard", @@ -8400,6 +8792,21 @@ export const s_payment_intent_payment_method_options_card = z.object({ 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(), + 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"]), @@ -8409,7 +8816,9 @@ 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(), @@ -8494,6 +8903,10 @@ export const s_payment_method_configuration = z.object({ 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), object: z.enum(["payment_method_configuration"]), oxxo: s_payment_method_config_resource_payment_method_properties.optional(), @@ -8509,6 +8922,7 @@ export const s_payment_method_configuration = z.object({ 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: @@ -8627,49 +9041,12 @@ export const s_setup_intent_next_action = z.object({ s_setup_intent_next_action_verify_with_microdeposits.optional(), }) -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(), - card: s_setup_intent_payment_method_options_card.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, - ]) +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(), }) @@ -8725,6 +9102,7 @@ export const s_tax_product_registrations_resource_country_options = z.object({ au: 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(), ca: s_tax_product_registrations_resource_country_options_canada.optional(), ch: s_tax_product_registrations_resource_country_options_default.optional(), cl: s_tax_product_registrations_resource_country_options_simplified.optional(), @@ -8734,10 +9112,12 @@ export const s_tax_product_registrations_resource_country_options = z.object({ de: s_tax_product_registrations_resource_country_options_europe.optional(), dk: s_tax_product_registrations_resource_country_options_europe.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.optional(), + ge: s_tax_product_registrations_resource_country_options_simplified.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(), @@ -8746,16 +9126,20 @@ export const s_tax_product_registrations_resource_country_options = z.object({ 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.optional(), + ke: 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(), 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.optional(), nz: s_tax_product_registrations_resource_country_options_default.optional(), + om: s_tax_product_registrations_resource_country_options_default.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(), @@ -8814,10 +9198,14 @@ export const s_tax_transaction = z.object({ 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(), @@ -8831,6 +9219,12 @@ export const s_terminal_reader_reader_resource_set_reader_display_action = type: z.enum(["cart"]), }) +export const s_thresholds_resource_usage_threshold_config = z.object({ + gte: z.coerce.number(), + meter: z.union([z.string().max(5000), s_billing_meter]), + recurrence: z.enum(["one_time"]), +}) + export const s_treasury_financial_accounts_resource_financial_addresses_features = z.object({ aba: s_treasury_financial_accounts_resource_aba_toggle_settings.optional(), @@ -8935,6 +9329,7 @@ export const s_checkout_session_payment_method_options = z.object({ konbini: s_checkout_konbini_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(), oxxo: s_checkout_oxxo_payment_method_options.optional(), p24: s_checkout_p24_payment_method_options.optional(), paynow: s_checkout_paynow_payment_method_options.optional(), @@ -9005,6 +9400,7 @@ export const s_identity_verification_session = z.object({ 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(), @@ -9037,6 +9433,15 @@ export const s_invoices_resource_shipping_cost = z.object({ 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 = z.object({ alipay_handle_redirect: s_payment_intent_next_action_alipay_handle_redirect.optional(), @@ -9048,6 +9453,8 @@ export const s_payment_intent_next_action = z.object({ 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: @@ -9110,7 +9517,7 @@ export const s_payment_intent_payment_method_options = z.object({ .optional(), bacs_debit: z .union([ - s_payment_method_options_bacs_debit, + s_payment_intent_payment_method_options_bacs_debit, s_payment_intent_type_specific_payment_method_options_client, ]) .optional(), @@ -9216,6 +9623,12 @@ export const s_payment_intent_payment_method_options = z.object({ 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(), oxxo: z .union([ s_payment_method_options_oxxo, @@ -9276,6 +9689,12 @@ export const s_payment_intent_payment_method_options = z.object({ 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, @@ -9303,6 +9722,7 @@ export const s_payment_links_resource_shipping_option = z.object({ 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(), @@ -9367,6 +9787,63 @@ export const s_portal_flows_flow = z.object({ ]), }) +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(), @@ -9461,6 +9938,9 @@ export const s_tax_calculation = z.object({ .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(), @@ -9579,6 +10059,7 @@ export const s_invoices_payment_settings = z.object({ "ach_credit_transfer", "ach_debit", "acss_debit", + "amazon_pay", "au_becs_debit", "bacs_debit", "bancontact", @@ -9593,12 +10074,15 @@ export const s_invoices_payment_settings = z.object({ "ideal", "konbini", "link", + "multibanco", "p24", "paynow", "paypal", "promptpay", + "revolut_pay", "sepa_debit", "sofort", + "swish", "us_bank_account", "wechat_pay", ]), @@ -9632,6 +10116,7 @@ export const s_subscriptions_resource_payment_settings = z.object({ "ach_credit_transfer", "ach_debit", "acss_debit", + "amazon_pay", "au_becs_debit", "bacs_debit", "bancontact", @@ -9646,12 +10131,15 @@ export const s_subscriptions_resource_payment_settings = z.object({ "ideal", "konbini", "link", + "multibanco", "p24", "paynow", "paypal", "promptpay", + "revolut_pay", "sepa_debit", "sofort", + "swish", "us_bank_account", "wechat_pay", ]), @@ -9671,6 +10159,7 @@ export const s_treasury_financial_account = z.object({ "card_issuing", "deposit_insurance", "financial_addresses.aba", + "financial_addresses.aba.forwarding", "inbound_transfers.ach", "intra_stripe_flows", "outbound_payments.ach", @@ -9698,6 +10187,7 @@ export const s_treasury_financial_account = z.object({ "card_issuing", "deposit_insurance", "financial_addresses.aba", + "financial_addresses.aba.forwarding", "inbound_transfers.ach", "intra_stripe_flows", "outbound_payments.ach", @@ -9718,6 +10208,7 @@ export const s_treasury_financial_account = z.object({ "card_issuing", "deposit_insurance", "financial_addresses.aba", + "financial_addresses.aba.forwarding", "inbound_transfers.ach", "intra_stripe_flows", "outbound_payments.ach", @@ -9925,6 +10416,7 @@ export const s_application_fee: z.ZodType< 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"]), @@ -9986,7 +10478,6 @@ export const s_balance_transaction: z.ZodType< z.lazy(() => s_issuing_dispute), z.lazy(() => s_issuing_transaction), z.lazy(() => s_payout), - s_platform_tax_fee, z.lazy(() => s_refund), s_reserve_transaction, s_tax_deducted_at_source, @@ -10041,6 +10532,25 @@ export const s_balance_transaction: z.ZodType< ]), }) +export const s_billing_alert: z.ZodType< + t_billing_alert, + z.ZodTypeDef, + unknown +> = z.object({ + alert_type: z.enum(["usage_threshold"]), + filter: z.lazy(() => + s_thresholds_resource_alert_filter.nullable().optional(), + ), + 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_config: s_thresholds_resource_usage_threshold_config + .nullable() + .optional(), +}) + export const s_charge: z.ZodType = z.object({ amount: z.coerce.number(), amount_captured: z.coerce.number(), @@ -10403,6 +10913,9 @@ export const s_confirmation_token: z.ZodType< .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(), ), @@ -10738,6 +11251,7 @@ export const s_payment_method: z.ZodType< 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(), 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(), @@ -10767,6 +11281,7 @@ export const s_payment_method: z.ZodType< livemode: PermissiveBoolean, metadata: z.record(z.string().max(500)).nullable().optional(), mobilepay: s_payment_method_mobilepay.optional(), + multibanco: s_payment_method_multibanco.optional(), object: z.enum(["payment_method"]), oxxo: s_payment_method_oxxo.optional(), p24: s_payment_method_p24.optional(), @@ -10779,6 +11294,7 @@ export const s_payment_method: z.ZodType< 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", @@ -10804,6 +11320,7 @@ export const s_payment_method: z.ZodType< "konbini", "link", "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -10814,6 +11331,7 @@ export const s_payment_method: z.ZodType< "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", "zip", @@ -10873,6 +11391,9 @@ export const s_subscription: z.ZodType = ), 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, @@ -10964,11 +11485,13 @@ export const s_tax_id: z.ZodType = z.object({ "ca_pst_mb", "ca_pst_sk", "ca_qst", + "ch_uid", "ch_vat", "cl_tin", "cn_tin", "co_nit", "cr_tin", + "de_stn", "do_rcn", "ec_ruc", "eg_tin", @@ -11431,6 +11954,8 @@ export const s_issuing_authorization: z.ZodType< .optional(), created: z.coerce.number(), currency: z.string(), + fleet: s_issuing_authorization_fleet_data.nullable().optional(), + fuel: s_issuing_authorization_fuel_data.nullable().optional(), id: z.string().max(5000), livemode: PermissiveBoolean, merchant_amount: z.coerce.number(), @@ -11545,6 +12070,30 @@ export const s_issuing_dispute: z.ZodType< 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"]), @@ -11829,6 +12378,8 @@ export const s_payment_link: z.ZodType = "klarna", "konbini", "link", + "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -11838,8 +12389,10 @@ export const s_payment_link: z.ZodType = "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", + "zip", ]), ) .nullable() @@ -11864,6 +12417,11 @@ export const s_payment_link: z.ZodType = 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 @@ -12359,6 +12917,11 @@ export const s_terminal_configuration: z.ZodType< 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(), @@ -12381,6 +12944,7 @@ export const s_terminal_reader: z.ZodType< "mobile_phone_reader", "simulated_wisepos_e", "stripe_m2", + "stripe_s700", "verifone_P400", ]), id: z.string().max(5000), @@ -12466,6 +13030,10 @@ export const s_treasury_outbound_payment: z.ZodType< 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), @@ -12501,6 +13069,10 @@ export const s_treasury_outbound_transfer: z.ZodType< 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), @@ -12944,6 +13516,17 @@ export const s_connect_collection_transfer: z.ZodType< object: z.enum(["connect_collection_transfer"]), }) +export const s_thresholds_resource_alert_filter: z.ZodType< + t_thresholds_resource_alert_filter, + z.ZodTypeDef, + unknown +> = z.object({ + customer: z + .union([z.string().max(5000), z.lazy(() => s_customer)]) + .nullable() + .optional(), +}) + export const s_payment_method_details: z.ZodType< t_payment_method_details, z.ZodTypeDef, @@ -12987,6 +13570,7 @@ export const s_payment_method_details: z.ZodType< 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(), @@ -13116,6 +13700,7 @@ export const s_confirmation_tokens_resource_payment_method_preview: z.ZodType< 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(), 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(), @@ -13126,6 +13711,10 @@ export const s_confirmation_tokens_resource_payment_method_preview: z.ZodType< 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(), @@ -13137,6 +13726,7 @@ export const s_confirmation_tokens_resource_payment_method_preview: z.ZodType< konbini: s_payment_method_konbini.optional(), link: s_payment_method_link.optional(), mobilepay: s_payment_method_mobilepay.optional(), + multibanco: s_payment_method_multibanco.optional(), oxxo: s_payment_method_oxxo.optional(), p24: s_payment_method_p24.optional(), paynow: s_payment_method_paynow.optional(), @@ -13147,6 +13737,7 @@ export const s_confirmation_tokens_resource_payment_method_preview: z.ZodType< 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", @@ -13172,6 +13763,7 @@ export const s_confirmation_tokens_resource_payment_method_preview: z.ZodType< "konbini", "link", "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -13182,6 +13774,7 @@ export const s_confirmation_tokens_resource_payment_method_preview: z.ZodType< "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", "zip", @@ -13322,6 +13915,20 @@ export const s_subscription_automatic_tax: z.ZodType< 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, @@ -13436,6 +14043,9 @@ export const s_issuing_dispute_evidence: z.ZodType< 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(), ), @@ -13445,6 +14055,7 @@ export const s_issuing_dispute_evidence: z.ZodType< "duplicate", "fraudulent", "merchandise_not_as_described", + "no_valid_authorization", "not_received", "other", "service_not_as_described", @@ -13577,6 +14188,7 @@ export const s_setup_attempt_payment_method_details: z.ZodType< 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(), @@ -13593,6 +14205,7 @@ export const s_setup_attempt_payment_method_details: z.ZodType< klarna: s_setup_attempt_payment_method_details_klarna.optional(), link: s_setup_attempt_payment_method_details_link.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(), @@ -14168,6 +14781,18 @@ export const s_issuing_dispute_merchandise_not_as_described_evidence: z.ZodType< 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, diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/account/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/account/route.ts index c2b58cb3..7de73cbc 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/account/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/account/route.ts @@ -37,7 +37,12 @@ export type GetAccount = ( ) => Promise> const getAccountQuerySchema = z.object({ - expand: z.array(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 getAccountBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/account_sessions/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/account_sessions/route.ts index 803a6f9b..b6e8ba04 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/account_sessions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/account_sessions/route.ts @@ -57,6 +57,7 @@ const postAccountSessionsBodySchema = z.object({ features: z .object({ edit_payout_schedule: PermissiveBoolean.optional(), + external_account_collection: PermissiveBoolean.optional(), instant_payouts: PermissiveBoolean.optional(), standard_payouts: PermissiveBoolean.optional(), }) @@ -108,6 +109,7 @@ const postAccountSessionsBodySchema = z.object({ features: z .object({ edit_payout_schedule: PermissiveBoolean.optional(), + external_account_collection: PermissiveBoolean.optional(), instant_payouts: PermissiveBoolean.optional(), standard_payouts: PermissiveBoolean.optional(), }) @@ -117,6 +119,12 @@ const postAccountSessionsBodySchema = z.object({ 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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/bank_accounts/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/bank_accounts/[id]/route.ts index 67b2bc43..6b3c7250 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/bank_accounts/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/bank_accounts/[id]/route.ts @@ -130,7 +130,12 @@ const getAccountsAccountBankAccountsIdParamSchema = z.object({ }) const getAccountsAccountBankAccountsIdQuerySchema = z.object({ - expand: z.array(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 getAccountsAccountBankAccountsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/capabilities/[capability]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/capabilities/[capability]/route.ts index 48c010af..0d0531a9 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/capabilities/[capability]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/capabilities/[capability]/route.ts @@ -61,7 +61,12 @@ const getAccountsAccountCapabilitiesCapabilityParamSchema = z.object({ }) const getAccountsAccountCapabilitiesCapabilityQuerySchema = z.object({ - expand: z.array(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 getAccountsAccountCapabilitiesCapabilityBodySchema = z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/capabilities/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/capabilities/route.ts index b4d897cd..56d7b3c8 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/capabilities/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/capabilities/route.ts @@ -47,7 +47,12 @@ const getAccountsAccountCapabilitiesParamSchema = z.object({ }) const getAccountsAccountCapabilitiesQuerySchema = z.object({ - expand: z.array(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 getAccountsAccountCapabilitiesBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/external_accounts/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/external_accounts/[id]/route.ts index 1e003a01..809dce15 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/external_accounts/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/external_accounts/[id]/route.ts @@ -132,7 +132,12 @@ const getAccountsAccountExternalAccountsIdParamSchema = z.object({ }) const getAccountsAccountExternalAccountsIdQuerySchema = z.object({ - expand: z.array(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 getAccountsAccountExternalAccountsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/external_accounts/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/external_accounts/route.ts index 4284260b..87582ec1 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/external_accounts/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/external_accounts/route.ts @@ -68,7 +68,12 @@ const getAccountsAccountExternalAccountsParamSchema = z.object({ const getAccountsAccountExternalAccountsQuerySchema = z.object({ ending_before: z.string().optional(), - expand: z.array(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(), object: z.enum(["bank_account", "card"]).optional(), starting_after: z.string().optional(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/people/[person]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/people/[person]/route.ts index 38ae320e..f2ded4bb 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/people/[person]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/people/[person]/route.ts @@ -130,7 +130,12 @@ const getAccountsAccountPeoplePersonParamSchema = z.object({ }) const getAccountsAccountPeoplePersonQuerySchema = z.object({ - expand: z.array(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 getAccountsAccountPeoplePersonBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/people/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/people/route.ts index e51bb83e..e556f604 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/people/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/people/route.ts @@ -66,7 +66,12 @@ const getAccountsAccountPeopleParamSchema = z.object({ const getAccountsAccountPeopleQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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({ diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/persons/[person]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/persons/[person]/route.ts index 71ab2f4b..36923e61 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/persons/[person]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/persons/[person]/route.ts @@ -130,7 +130,12 @@ const getAccountsAccountPersonsPersonParamSchema = z.object({ }) const getAccountsAccountPersonsPersonQuerySchema = z.object({ - expand: z.array(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 getAccountsAccountPersonsPersonBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/persons/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/persons/route.ts index d9924926..cf74faa7 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/persons/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/persons/route.ts @@ -66,7 +66,12 @@ const getAccountsAccountPersonsParamSchema = z.object({ const getAccountsAccountPersonsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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({ diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/route.ts index ea0596c0..6f0cbd88 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/[account]/route.ts @@ -128,7 +128,12 @@ const getAccountsAccountParamSchema = z.object({ }) const getAccountsAccountQuerySchema = z.object({ - expand: z.array(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 getAccountsAccountBodySchema = z.object({}).optional() @@ -273,6 +278,9 @@ const postAccountsAccountBodySchema = z 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(), @@ -288,6 +296,9 @@ const postAccountsAccountBodySchema = z jcb_payments: z .object({ requested: PermissiveBoolean.optional() }) .optional(), + jp_bank_transfer_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), klarna_payments: z .object({ requested: PermissiveBoolean.optional() }) .optional(), @@ -303,6 +314,12 @@ const postAccountsAccountBodySchema = z 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(), oxxo_payments: z .object({ requested: PermissiveBoolean.optional() }) .optional(), @@ -318,6 +335,9 @@ const postAccountsAccountBodySchema = z revolut_pay_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(), @@ -339,9 +359,15 @@ const postAccountsAccountBodySchema = z 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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/route.ts index 57624694..d9581de8 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/accounts/route.ts @@ -67,7 +67,12 @@ const getAccountsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().optional(), - expand: z.array(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().optional(), }) @@ -235,6 +240,9 @@ const postAccountsBodySchema = z 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(), @@ -250,6 +258,9 @@ const postAccountsBodySchema = z jcb_payments: z .object({ requested: PermissiveBoolean.optional() }) .optional(), + jp_bank_transfer_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), klarna_payments: z .object({ requested: PermissiveBoolean.optional() }) .optional(), @@ -265,6 +276,12 @@ const postAccountsBodySchema = z 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(), oxxo_payments: z .object({ requested: PermissiveBoolean.optional() }) .optional(), @@ -280,6 +297,9 @@ const postAccountsBodySchema = z revolut_pay_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(), @@ -301,9 +321,15 @@ const postAccountsBodySchema = z 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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apple_pay/domains/[domain]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apple_pay/domains/[domain]/route.ts index 1915f7bc..1c3c3035 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apple_pay/domains/[domain]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apple_pay/domains/[domain]/route.ts @@ -110,7 +110,12 @@ const getApplePayDomainsDomainParamSchema = z.object({ }) const getApplePayDomainsDomainQuerySchema = z.object({ - expand: z.array(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 getApplePayDomainsDomainBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apple_pay/domains/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apple_pay/domains/route.ts index 0fd84ac2..5407c9a6 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apple_pay/domains/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apple_pay/domains/route.ts @@ -56,7 +56,12 @@ export type PostApplePayDomains = ( const getApplePayDomainsQuerySchema = z.object({ domain_name: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/[fee]/refunds/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/[fee]/refunds/[id]/route.ts index 757d9684..314bac63 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/[fee]/refunds/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/[fee]/refunds/[id]/route.ts @@ -60,7 +60,12 @@ const getApplicationFeesFeeRefundsIdParamSchema = z.object({ }) const getApplicationFeesFeeRefundsIdQuerySchema = z.object({ - expand: z.array(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 getApplicationFeesFeeRefundsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/[id]/refunds/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/[id]/refunds/route.ts index 43b2c6cd..44086dc1 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/[id]/refunds/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/[id]/refunds/route.ts @@ -65,7 +65,12 @@ const getApplicationFeesIdRefundsParamSchema = z.object({ const getApplicationFeesIdRefundsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/[id]/route.ts index 84f2feec..92e8c63c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/[id]/route.ts @@ -40,7 +40,12 @@ export type GetApplicationFeesId = ( const getApplicationFeesIdParamSchema = z.object({ id: z.string().max(5000) }) const getApplicationFeesIdQuerySchema = z.object({ - expand: z.array(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 getApplicationFeesIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/route.ts index def283a9..7f1118a9 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/application_fees/route.ts @@ -55,7 +55,12 @@ const getApplicationFeesQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apps/secrets/find/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apps/secrets/find/route.ts index d1ef96e3..0be00509 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apps/secrets/find/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apps/secrets/find/route.ts @@ -37,7 +37,12 @@ export type GetAppsSecretsFind = ( ) => Promise> const getAppsSecretsFindQuerySchema = z.object({ - expand: z.array(z.string().max(5000)).optional(), + 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"]), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apps/secrets/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apps/secrets/route.ts index 7fe2b16f..aba34159 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apps/secrets/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/apps/secrets/route.ts @@ -55,7 +55,12 @@ export type PostAppsSecrets = ( const getAppsSecretsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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"]), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance/history/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance/history/[id]/route.ts index ecf8bb47..0578518c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance/history/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance/history/[id]/route.ts @@ -40,7 +40,12 @@ export type GetBalanceHistoryId = ( const getBalanceHistoryIdParamSchema = z.object({ id: z.string().max(5000) }) const getBalanceHistoryIdQuerySchema = z.object({ - expand: z.array(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 getBalanceHistoryIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance/history/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance/history/route.ts index c15f9453..dc04a8f3 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance/history/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance/history/route.ts @@ -55,7 +55,12 @@ const getBalanceHistoryQuerySchema = z.object({ .optional(), currency: z.string().optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance/route.ts index 9ff150db..e1d9edb9 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance/route.ts @@ -37,7 +37,12 @@ export type GetBalance = ( ) => Promise> const getBalanceQuerySchema = z.object({ - expand: z.array(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 getBalanceBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance_transactions/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance_transactions/[id]/route.ts index c2c455c7..60a262d9 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance_transactions/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance_transactions/[id]/route.ts @@ -42,7 +42,12 @@ const getBalanceTransactionsIdParamSchema = z.object({ }) const getBalanceTransactionsIdQuerySchema = z.object({ - expand: z.array(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 getBalanceTransactionsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance_transactions/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance_transactions/route.ts index 56fe559f..fbdcd1a1 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance_transactions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/balance_transactions/route.ts @@ -55,7 +55,12 @@ const getBalanceTransactionsQuerySchema = z.object({ .optional(), currency: z.string().optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/alerts/[id]/activate/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/alerts/[id]/activate/route.ts new file mode 100644 index 00000000..2904ac93 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/alerts/[id]/activate/route.ts @@ -0,0 +1,89 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_PostBillingAlertsIdActivateBodySchema, + t_PostBillingAlertsIdActivateParamSchema, + t_billing_alert, + t_error, +} from "../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type PostBillingAlertsIdActivateResponder = { + with200(): KoaRuntimeResponse + withDefault(status: StatusCode): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type PostBillingAlertsIdActivate = ( + params: Params< + t_PostBillingAlertsIdActivateParamSchema, + void, + t_PostBillingAlertsIdActivateBodySchema | undefined + >, + respond: PostBillingAlertsIdActivateResponder, + ctx: { request: NextRequest }, +) => Promise> + +const postBillingAlertsIdActivateParamSchema = z.object({ + id: z.string().max(5000), +}) + +const postBillingAlertsIdActivateBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + +export const _POST = + (implementation: PostBillingAlertsIdActivate) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + postBillingAlertsIdActivateParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + postBillingAlertsIdActivateBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/alerts/[id]/archive/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/alerts/[id]/archive/route.ts new file mode 100644 index 00000000..5f422306 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/alerts/[id]/archive/route.ts @@ -0,0 +1,89 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_PostBillingAlertsIdArchiveBodySchema, + t_PostBillingAlertsIdArchiveParamSchema, + t_billing_alert, + t_error, +} from "../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type PostBillingAlertsIdArchiveResponder = { + with200(): KoaRuntimeResponse + withDefault(status: StatusCode): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type PostBillingAlertsIdArchive = ( + params: Params< + t_PostBillingAlertsIdArchiveParamSchema, + void, + t_PostBillingAlertsIdArchiveBodySchema | undefined + >, + respond: PostBillingAlertsIdArchiveResponder, + ctx: { request: NextRequest }, +) => Promise> + +const postBillingAlertsIdArchiveParamSchema = z.object({ + id: z.string().max(5000), +}) + +const postBillingAlertsIdArchiveBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + +export const _POST = + (implementation: PostBillingAlertsIdArchive) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + postBillingAlertsIdArchiveParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + postBillingAlertsIdArchiveBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/alerts/[id]/deactivate/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/alerts/[id]/deactivate/route.ts new file mode 100644 index 00000000..5381417f --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/alerts/[id]/deactivate/route.ts @@ -0,0 +1,89 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_PostBillingAlertsIdDeactivateBodySchema, + t_PostBillingAlertsIdDeactivateParamSchema, + t_billing_alert, + t_error, +} from "../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type PostBillingAlertsIdDeactivateResponder = { + with200(): KoaRuntimeResponse + withDefault(status: StatusCode): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type PostBillingAlertsIdDeactivate = ( + params: Params< + t_PostBillingAlertsIdDeactivateParamSchema, + void, + t_PostBillingAlertsIdDeactivateBodySchema | undefined + >, + respond: PostBillingAlertsIdDeactivateResponder, + ctx: { request: NextRequest }, +) => Promise> + +const postBillingAlertsIdDeactivateParamSchema = z.object({ + id: z.string().max(5000), +}) + +const postBillingAlertsIdDeactivateBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + +export const _POST = + (implementation: PostBillingAlertsIdDeactivate) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + postBillingAlertsIdDeactivateParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + postBillingAlertsIdDeactivateBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/settlements/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/alerts/[id]/route.ts similarity index 55% rename from integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/settlements/route.ts rename to integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/alerts/[id]/route.ts index 51f3b3f8..6b4871dd 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/settlements/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/alerts/[id]/route.ts @@ -3,11 +3,12 @@ /* eslint-disable */ import { - t_GetIssuingSettlementsBodySchema, - t_GetIssuingSettlementsQuerySchema, + t_GetBillingAlertsIdBodySchema, + t_GetBillingAlertsIdParamSchema, + t_GetBillingAlertsIdQuerySchema, + t_billing_alert, t_error, - t_issuing_settlement, -} from "../../../models" +} from "../../../../models" import { KoaRuntimeError, RequestInputType, @@ -21,62 +22,54 @@ import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" import { NextRequest } from "next/server" import { z } from "zod" -export type GetIssuingSettlementsResponder = { - with200(): KoaRuntimeResponse<{ - data: t_issuing_settlement[] - has_more: boolean - object: "list" - url: string - }> +export type GetBillingAlertsIdResponder = { + with200(): KoaRuntimeResponse withDefault(status: StatusCode): KoaRuntimeResponse } & KoaRuntimeResponder -export type GetIssuingSettlements = ( +export type GetBillingAlertsId = ( params: Params< - void, - t_GetIssuingSettlementsQuerySchema, - t_GetIssuingSettlementsBodySchema | undefined + t_GetBillingAlertsIdParamSchema, + t_GetBillingAlertsIdQuerySchema, + t_GetBillingAlertsIdBodySchema | undefined >, - respond: GetIssuingSettlementsResponder, + respond: GetBillingAlertsIdResponder, ctx: { request: NextRequest }, ) => Promise> -const getIssuingSettlementsQuerySchema = 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(), - ]) +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(), - ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), - limit: z.coerce.number().optional(), - starting_after: z.string().max(5000).optional(), }) -const getIssuingSettlementsBodySchema = z.object({}).optional() +const getBillingAlertsIdBodySchema = z.object({}).optional() export const _GET = - (implementation: GetIssuingSettlements) => + (implementation: GetBillingAlertsId) => async ( request: NextRequest, { params }: { params: unknown }, ): Promise => { const input = { - params: undefined, + params: parseRequestInput( + getBillingAlertsIdParamSchema, + params, + RequestInputType.RouteParam, + ), // TODO: this swallows repeated parameters query: parseRequestInput( - getIssuingSettlementsQuerySchema, + getBillingAlertsIdQuerySchema, Object.fromEntries(request.nextUrl.searchParams.entries()), RequestInputType.QueryString, ), body: parseRequestInput( - getIssuingSettlementsBodySchema, + getBillingAlertsIdBodySchema, await request.json(), RequestInputType.RequestBody, ), @@ -84,12 +77,7 @@ export const _GET = const responder = { with200() { - return new KoaRuntimeResponse<{ - data: t_issuing_settlement[] - has_more: boolean - object: "list" - url: string - }>(200) + return new KoaRuntimeResponse(200) }, withDefault(status: StatusCode) { return new KoaRuntimeResponse(status) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/alerts/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/alerts/route.ts new file mode 100644 index 00000000..c0bb39f1 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/alerts/route.ts @@ -0,0 +1,173 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_GetBillingAlertsBodySchema, + t_GetBillingAlertsQuerySchema, + t_PostBillingAlertsBodySchema, + t_billing_alert, + t_error, +} from "../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type GetBillingAlertsResponder = { + with200(): KoaRuntimeResponse<{ + data: t_billing_alert[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type GetBillingAlerts = ( + params: Params< + void, + t_GetBillingAlertsQuerySchema, + t_GetBillingAlertsBodySchema | undefined + >, + respond: GetBillingAlertsResponder, + ctx: { request: NextRequest }, +) => Promise> + +export type PostBillingAlertsResponder = { + with200(): KoaRuntimeResponse + withDefault(status: StatusCode): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type PostBillingAlerts = ( + params: Params, + respond: PostBillingAlertsResponder, + ctx: { request: NextRequest }, +) => Promise> + +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 getBillingAlertsBodySchema = z.object({}).optional() + +export const _GET = + (implementation: GetBillingAlerts) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: parseRequestInput( + getBillingAlertsQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBillingAlertsBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse<{ + data: t_billing_alert[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } + +const postBillingAlertsBodySchema = z.object({ + alert_type: z.enum(["usage_threshold"]), + expand: z.array(z.string().max(5000)).optional(), + filter: z.object({ customer: z.string().max(5000).optional() }).optional(), + title: z.string().max(256), + usage_threshold_config: z + .object({ + gte: z.coerce.number(), + meter: z.string().max(5000).optional(), + recurrence: z.enum(["one_time"]), + }) + .optional(), +}) + +export const _POST = + (implementation: PostBillingAlerts) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + postBillingAlertsBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/meters/[id]/event_summaries/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/meters/[id]/event_summaries/route.ts index 13146289..9e0f8a85 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/meters/[id]/event_summaries/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/meters/[id]/event_summaries/route.ts @@ -50,11 +50,16 @@ const getBillingMetersIdEventSummariesQuerySchema = z.object({ customer: z.string().max(5000), end_time: z.coerce.number(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(["hour"]).optional(), + value_grouping_window: z.enum(["day", "hour"]).optional(), }) const getBillingMetersIdEventSummariesBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/meters/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/meters/[id]/route.ts index e962d521..41563454 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/meters/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/meters/[id]/route.ts @@ -57,7 +57,12 @@ export type PostBillingMetersId = ( const getBillingMetersIdParamSchema = z.object({ id: z.string().max(5000) }) const getBillingMetersIdQuerySchema = z.object({ - expand: z.array(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 getBillingMetersIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/meters/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/meters/route.ts index 25623634..31733ae7 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/meters/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing/meters/route.ts @@ -55,7 +55,12 @@ export type PostBillingMeters = ( const getBillingMetersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing_portal/configurations/[configuration]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing_portal/configurations/[configuration]/route.ts index dc9dec66..9a2f524a 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing_portal/configurations/[configuration]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing_portal/configurations/[configuration]/route.ts @@ -60,7 +60,12 @@ const getBillingPortalConfigurationsConfigurationParamSchema = z.object({ }) const getBillingPortalConfigurationsConfigurationQuerySchema = z.object({ - expand: z.array(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 getBillingPortalConfigurationsConfigurationBodySchema = z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing_portal/configurations/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing_portal/configurations/route.ts index c1fb01ce..e6a982ae 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing_portal/configurations/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/billing_portal/configurations/route.ts @@ -57,7 +57,12 @@ export type PostBillingPortalConfigurations = ( const getBillingPortalConfigurationsQuerySchema = z.object({ active: PermissiveBoolean.optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/dispute/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/dispute/route.ts index 159816b1..ce4bcc59 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/dispute/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/dispute/route.ts @@ -60,7 +60,12 @@ const getChargesChargeDisputeParamSchema = z.object({ }) const getChargesChargeDisputeQuerySchema = z.object({ - expand: z.array(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 getChargesChargeDisputeBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/refunds/[refund]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/refunds/[refund]/route.ts index e52b154e..6b001007 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/refunds/[refund]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/refunds/[refund]/route.ts @@ -60,7 +60,12 @@ const getChargesChargeRefundsRefundParamSchema = z.object({ }) const getChargesChargeRefundsRefundQuerySchema = z.object({ - expand: z.array(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 getChargesChargeRefundsRefundBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/refunds/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/refunds/route.ts index 82794032..89dc0871 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/refunds/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/refunds/route.ts @@ -64,7 +64,12 @@ const getChargesChargeRefundsParamSchema = z.object({ charge: z.string() }) const getChargesChargeRefundsQuerySchema = z.object({ ending_before: z.string().optional(), - expand: z.array(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().optional(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/route.ts index 33251b30..d85373a5 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/[charge]/route.ts @@ -57,7 +57,12 @@ export type PostChargesCharge = ( const getChargesChargeParamSchema = z.object({ charge: z.string().max(5000) }) const getChargesChargeQuerySchema = z.object({ - expand: z.array(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 getChargesChargeBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/route.ts index 69182187..a2420e95 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/route.ts @@ -68,7 +68,12 @@ const getChargesQuerySchema = z.object({ .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().optional(), - expand: z.array(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().optional(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/search/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/search/route.ts index cb92f816..a54f2cd1 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/search/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/charges/search/route.ts @@ -44,7 +44,12 @@ export type GetChargesSearch = ( ) => Promise> const getChargesSearchQuerySchema = z.object({ - expand: z.array(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(), page: z.string().max(5000).optional(), query: z.string().max(5000), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/checkout/sessions/[session]/line_items/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/checkout/sessions/[session]/line_items/route.ts index 1f64c093..2d8498d3 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/checkout/sessions/[session]/line_items/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/checkout/sessions/[session]/line_items/route.ts @@ -48,7 +48,12 @@ const getCheckoutSessionsSessionLineItemsParamSchema = z.object({ const getCheckoutSessionsSessionLineItemsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/checkout/sessions/[session]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/checkout/sessions/[session]/route.ts index e80d3ee5..a6f5aa4b 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/checkout/sessions/[session]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/checkout/sessions/[session]/route.ts @@ -6,6 +6,8 @@ import { t_GetCheckoutSessionsSessionBodySchema, t_GetCheckoutSessionsSessionParamSchema, t_GetCheckoutSessionsSessionQuerySchema, + t_PostCheckoutSessionsSessionBodySchema, + t_PostCheckoutSessionsSessionParamSchema, t_checkout_session, t_error, } from "../../../../models" @@ -37,12 +39,32 @@ export type GetCheckoutSessionsSession = ( ctx: { request: NextRequest }, ) => Promise> +export type PostCheckoutSessionsSessionResponder = { + with200(): KoaRuntimeResponse + withDefault(status: StatusCode): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type PostCheckoutSessionsSession = ( + params: Params< + t_PostCheckoutSessionsSessionParamSchema, + void, + t_PostCheckoutSessionsSessionBodySchema | undefined + >, + respond: PostCheckoutSessionsSessionResponder, + ctx: { request: NextRequest }, +) => Promise> + const getCheckoutSessionsSessionParamSchema = z.object({ session: z.string().max(66), }) const getCheckoutSessionsSessionQuerySchema = z.object({ - expand: z.array(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 getCheckoutSessionsSessionBodySchema = z.object({}).optional() @@ -94,3 +116,58 @@ export const _GET = ? Response.json(body, { status }) : new Response(undefined, { status }) } + +const postCheckoutSessionsSessionParamSchema = z.object({ + session: z.string().max(5000), +}) + +const postCheckoutSessionsSessionBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + +export const _POST = + (implementation: PostCheckoutSessionsSession) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + postCheckoutSessionsSessionParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + postCheckoutSessionsSessionBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/checkout/sessions/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/checkout/sessions/route.ts index 1b487f53..c64e9eab 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/checkout/sessions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/checkout/sessions/route.ts @@ -69,7 +69,12 @@ const getCheckoutSessionsQuerySchema = z.object({ customer: z.string().max(5000).optional(), customer_details: z.object({ email: z.string() }).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), @@ -171,6 +176,7 @@ const postCheckoutSessionsBodySchema = z z.object({ dropdown: z .object({ + default_value: z.string().max(100).optional(), options: z.array( z.object({ label: z.string().max(100), @@ -186,6 +192,7 @@ const postCheckoutSessionsBodySchema = z }), numeric: z .object({ + default_value: z.string().max(255).optional(), maximum_length: z.coerce.number().optional(), minimum_length: z.coerce.number().optional(), }) @@ -193,6 +200,7 @@ const postCheckoutSessionsBodySchema = z 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(), }) @@ -566,6 +574,9 @@ const postCheckoutSessionsBodySchema = z mobilepay: z .object({ setup_future_usage: z.enum(["none"]).optional() }) .optional(), + multibanco: z + .object({ setup_future_usage: z.enum(["none"]).optional() }) + .optional(), oxxo: z .object({ expires_after_days: z.coerce.number().optional(), @@ -694,6 +705,7 @@ const postCheckoutSessionsBodySchema = z "konbini", "link", "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -704,6 +716,7 @@ const postCheckoutSessionsBodySchema = z "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", "zip", diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/orders/[order]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/orders/[order]/route.ts index b3f30085..77af4d95 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/orders/[order]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/orders/[order]/route.ts @@ -59,7 +59,12 @@ const getClimateOrdersOrderParamSchema = z.object({ }) const getClimateOrdersOrderQuerySchema = z.object({ - expand: z.array(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 getClimateOrdersOrderBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/orders/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/orders/route.ts index 31b8519e..118c42e2 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/orders/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/orders/route.ts @@ -55,7 +55,12 @@ export type PostClimateOrders = ( const getClimateOrdersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/products/[product]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/products/[product]/route.ts index 5ad2df6b..b9d40b4c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/products/[product]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/products/[product]/route.ts @@ -42,7 +42,12 @@ const getClimateProductsProductParamSchema = z.object({ }) const getClimateProductsProductQuerySchema = z.object({ - expand: z.array(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 getClimateProductsProductBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/products/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/products/route.ts index 89aa2124..185c78aa 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/products/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/products/route.ts @@ -43,7 +43,12 @@ export type GetClimateProducts = ( const getClimateProductsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/suppliers/[supplier]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/suppliers/[supplier]/route.ts index f73464aa..aaad296c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/suppliers/[supplier]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/suppliers/[supplier]/route.ts @@ -42,7 +42,12 @@ const getClimateSuppliersSupplierParamSchema = z.object({ }) const getClimateSuppliersSupplierQuerySchema = z.object({ - expand: z.array(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 getClimateSuppliersSupplierBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/suppliers/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/suppliers/route.ts index a372142b..e58d07b3 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/suppliers/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/climate/suppliers/route.ts @@ -43,7 +43,12 @@ export type GetClimateSuppliers = ( const getClimateSuppliersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/confirmation_tokens/[confirmation_token]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/confirmation_tokens/[confirmation_token]/route.ts index 5e56767a..7291b5ad 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/confirmation_tokens/[confirmation_token]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/confirmation_tokens/[confirmation_token]/route.ts @@ -42,7 +42,12 @@ const getConfirmationTokensConfirmationTokenParamSchema = z.object({ }) const getConfirmationTokensConfirmationTokenQuerySchema = z.object({ - expand: z.array(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 getConfirmationTokensConfirmationTokenBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/country_specs/[country]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/country_specs/[country]/route.ts index c73fa0eb..f1aaf501 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/country_specs/[country]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/country_specs/[country]/route.ts @@ -42,7 +42,12 @@ const getCountrySpecsCountryParamSchema = z.object({ }) const getCountrySpecsCountryQuerySchema = z.object({ - expand: z.array(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 getCountrySpecsCountryBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/country_specs/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/country_specs/route.ts index a19fe75e..03d0feea 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/country_specs/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/country_specs/route.ts @@ -43,7 +43,12 @@ export type GetCountrySpecs = ( const getCountrySpecsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/coupons/[coupon]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/coupons/[coupon]/route.ts index a8d54b1d..f32a57d0 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/coupons/[coupon]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/coupons/[coupon]/route.ts @@ -125,7 +125,12 @@ export const _DELETE = const getCouponsCouponParamSchema = z.object({ coupon: z.string().max(5000) }) const getCouponsCouponQuerySchema = z.object({ - expand: z.array(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 getCouponsCouponBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/coupons/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/coupons/route.ts index 4604a6a3..40ca342c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/coupons/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/coupons/route.ts @@ -66,7 +66,12 @@ const getCouponsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/[credit_note]/lines/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/[credit_note]/lines/route.ts index b4f17465..c28ec138 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/[credit_note]/lines/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/[credit_note]/lines/route.ts @@ -48,7 +48,12 @@ const getCreditNotesCreditNoteLinesParamSchema = z.object({ const getCreditNotesCreditNoteLinesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/[id]/route.ts index c82f2e21..7d64907f 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/[id]/route.ts @@ -57,7 +57,12 @@ export type PostCreditNotesId = ( const getCreditNotesIdParamSchema = z.object({ id: z.string().max(5000) }) const getCreditNotesIdQuerySchema = z.object({ - expand: z.array(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 getCreditNotesIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/preview/lines/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/preview/lines/route.ts index 8b8ccb38..479f82c4 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/preview/lines/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/preview/lines/route.ts @@ -45,36 +45,45 @@ 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.array(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 - .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(), - }), + .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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/preview/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/preview/route.ts index 81efd04f..a6369516 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/preview/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/preview/route.ts @@ -40,34 +40,43 @@ const getCreditNotesPreviewQuerySchema = z.object({ amount: z.coerce.number().optional(), credit_amount: z.coerce.number().optional(), effective_at: z.coerce.number().optional(), - expand: z.array(z.string().max(5000)).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 - .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(), - }), + .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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/route.ts index 780e3cbc..25d7f02e 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/credit_notes/route.ts @@ -67,7 +67,12 @@ const getCreditNotesQuerySchema = z.object({ .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), @@ -128,6 +133,7 @@ const postCreditNotesBodySchema = 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 diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customer_sessions/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customer_sessions/route.ts index af4dca8b..8cf43077 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customer_sessions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customer_sessions/route.ts @@ -35,6 +35,27 @@ export type PostCustomerSessions = ( const postCustomerSessionsBodySchema = 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), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/balance_transactions/[transaction]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/balance_transactions/[transaction]/route.ts index 6fc1c4ca..48d387c4 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/balance_transactions/[transaction]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/balance_transactions/[transaction]/route.ts @@ -60,7 +60,12 @@ const getCustomersCustomerBalanceTransactionsTransactionParamSchema = z.object({ }) const getCustomersCustomerBalanceTransactionsTransactionQuerySchema = z.object({ - expand: z.array(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 getCustomersCustomerBalanceTransactionsTransactionBodySchema = z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/balance_transactions/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/balance_transactions/route.ts index cf82fdf7..5d4e03f5 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/balance_transactions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/balance_transactions/route.ts @@ -65,7 +65,12 @@ const getCustomersCustomerBalanceTransactionsParamSchema = z.object({ const getCustomersCustomerBalanceTransactionsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/bank_accounts/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/bank_accounts/[id]/route.ts index 598570b8..f83cb696 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/bank_accounts/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/bank_accounts/[id]/route.ts @@ -136,7 +136,12 @@ const getCustomersCustomerBankAccountsIdParamSchema = z.object({ }) const getCustomersCustomerBankAccountsIdQuerySchema = z.object({ - expand: z.array(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 getCustomersCustomerBankAccountsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/bank_accounts/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/bank_accounts/route.ts index ce303a36..a5afa3db 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/bank_accounts/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/bank_accounts/route.ts @@ -66,7 +66,12 @@ const getCustomersCustomerBankAccountsParamSchema = z.object({ const getCustomersCustomerBankAccountsQuerySchema = z.object({ ending_before: z.string().optional(), - expand: z.array(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().optional(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cards/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cards/[id]/route.ts index c6d74405..1f3667de 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cards/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cards/[id]/route.ts @@ -136,7 +136,12 @@ const getCustomersCustomerCardsIdParamSchema = z.object({ }) const getCustomersCustomerCardsIdQuerySchema = z.object({ - expand: z.array(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 getCustomersCustomerCardsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cards/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cards/route.ts index d4f13958..8e5f0be8 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cards/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cards/route.ts @@ -66,7 +66,12 @@ const getCustomersCustomerCardsParamSchema = z.object({ const getCustomersCustomerCardsQuerySchema = z.object({ ending_before: z.string().optional(), - expand: z.array(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().optional(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cash_balance/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cash_balance/route.ts index 4336b1d3..beaf01e0 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cash_balance/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cash_balance/route.ts @@ -59,7 +59,12 @@ const getCustomersCustomerCashBalanceParamSchema = z.object({ }) const getCustomersCustomerCashBalanceQuerySchema = z.object({ - expand: z.array(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 getCustomersCustomerCashBalanceBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cash_balance_transactions/[transaction]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cash_balance_transactions/[transaction]/route.ts index fe0d6b8a..67faa999 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cash_balance_transactions/[transaction]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cash_balance_transactions/[transaction]/route.ts @@ -42,7 +42,14 @@ const getCustomersCustomerCashBalanceTransactionsTransactionParamSchema = z.object({ customer: z.string().max(5000), transaction: z.string() }) const getCustomersCustomerCashBalanceTransactionsTransactionQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) const getCustomersCustomerCashBalanceTransactionsTransactionBodySchema = z .object({}) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cash_balance_transactions/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cash_balance_transactions/route.ts index 66538783..0eac99bd 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cash_balance_transactions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/cash_balance_transactions/route.ts @@ -48,7 +48,12 @@ const getCustomersCustomerCashBalanceTransactionsParamSchema = z.object({ const getCustomersCustomerCashBalanceTransactionsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/discount/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/discount/route.ts index d3756d28..fdff8a07 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/discount/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/discount/route.ts @@ -110,7 +110,12 @@ const getCustomersCustomerDiscountParamSchema = z.object({ }) const getCustomersCustomerDiscountQuerySchema = z.object({ - expand: z.array(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 getCustomersCustomerDiscountBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/payment_methods/[payment_method]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/payment_methods/[payment_method]/route.ts index e319d07c..a450f3d9 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/payment_methods/[payment_method]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/payment_methods/[payment_method]/route.ts @@ -43,7 +43,12 @@ const getCustomersCustomerPaymentMethodsPaymentMethodParamSchema = z.object({ }) const getCustomersCustomerPaymentMethodsPaymentMethodQuerySchema = z.object({ - expand: z.array(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 getCustomersCustomerPaymentMethodsPaymentMethodBodySchema = z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/payment_methods/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/payment_methods/route.ts index 5d8982f0..a15c16e1 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/payment_methods/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/payment_methods/route.ts @@ -49,7 +49,12 @@ const getCustomersCustomerPaymentMethodsParamSchema = z.object({ const getCustomersCustomerPaymentMethodsQuerySchema = z.object({ allow_redisplay: z.enum(["always", "limited", "unspecified"]).optional(), ending_before: z.string().optional(), - expand: z.array(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().optional(), type: z @@ -76,6 +81,7 @@ const getCustomersCustomerPaymentMethodsQuerySchema = z.object({ "konbini", "link", "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -86,6 +92,7 @@ const getCustomersCustomerPaymentMethodsQuerySchema = z.object({ "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", "zip", diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/route.ts index 204e2166..f5730a69 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/route.ts @@ -127,7 +127,12 @@ const getCustomersCustomerParamSchema = z.object({ }) const getCustomersCustomerQuerySchema = z.object({ - expand: z.array(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 getCustomersCustomerBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/sources/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/sources/[id]/route.ts index 6a626fd7..862bc485 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/sources/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/sources/[id]/route.ts @@ -136,7 +136,12 @@ const getCustomersCustomerSourcesIdParamSchema = z.object({ }) const getCustomersCustomerSourcesIdQuerySchema = z.object({ - expand: z.array(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 getCustomersCustomerSourcesIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/sources/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/sources/route.ts index a6fb7432..f82290e2 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/sources/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/sources/route.ts @@ -68,7 +68,12 @@ const getCustomersCustomerSourcesParamSchema = z.object({ const getCustomersCustomerSourcesQuerySchema = z.object({ ending_before: z.string().optional(), - expand: z.array(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(), object: z.string().max(5000).optional(), starting_after: z.string().optional(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/subscriptions/[subscription_exposed_id]/discount/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/subscriptions/[subscription_exposed_id]/discount/route.ts index 0e734515..86370712 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/subscriptions/[subscription_exposed_id]/discount/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/subscriptions/[subscription_exposed_id]/discount/route.ts @@ -122,7 +122,14 @@ const getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountParamSchema }) const getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) const getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/subscriptions/[subscription_exposed_id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/subscriptions/[subscription_exposed_id]/route.ts index d243dd27..eeede6d9 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/subscriptions/[subscription_exposed_id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/subscriptions/[subscription_exposed_id]/route.ts @@ -141,7 +141,14 @@ const getCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema = }) const getCustomersCustomerSubscriptionsSubscriptionExposedIdQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) const getCustomersCustomerSubscriptionsSubscriptionExposedIdBodySchema = z .object({}) @@ -426,6 +433,7 @@ const postCustomersCustomerSubscriptionsSubscriptionExposedIdBodySchema = z "diners", "discover", "eftpos_au", + "girocard", "interac", "jcb", "mastercard", @@ -464,6 +472,13 @@ const postCustomersCustomerSubscriptionsSubscriptionExposedIdBodySchema = z z.object({ financial_connections: z .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), permissions: z .array( z.enum([ @@ -497,6 +512,7 @@ const postCustomersCustomerSubscriptionsSubscriptionExposedIdBodySchema = z "ach_credit_transfer", "ach_debit", "acss_debit", + "amazon_pay", "au_becs_debit", "bacs_debit", "bancontact", @@ -511,12 +527,15 @@ const postCustomersCustomerSubscriptionsSubscriptionExposedIdBodySchema = z "ideal", "konbini", "link", + "multibanco", "p24", "paynow", "paypal", "promptpay", + "revolut_pay", "sepa_debit", "sofort", + "swish", "us_bank_account", "wechat_pay", ]), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/subscriptions/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/subscriptions/route.ts index 55f9fa05..61f69278 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/subscriptions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/subscriptions/route.ts @@ -66,7 +66,12 @@ const getCustomersCustomerSubscriptionsParamSchema = z.object({ const getCustomersCustomerSubscriptionsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) @@ -327,6 +332,7 @@ const postCustomersCustomerSubscriptionsBodySchema = z "diners", "discover", "eftpos_au", + "girocard", "interac", "jcb", "mastercard", @@ -365,6 +371,13 @@ const postCustomersCustomerSubscriptionsBodySchema = z z.object({ financial_connections: z .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), permissions: z .array( z.enum([ @@ -398,6 +411,7 @@ const postCustomersCustomerSubscriptionsBodySchema = z "ach_credit_transfer", "ach_debit", "acss_debit", + "amazon_pay", "au_becs_debit", "bacs_debit", "bancontact", @@ -412,12 +426,15 @@ const postCustomersCustomerSubscriptionsBodySchema = z "ideal", "konbini", "link", + "multibanco", "p24", "paynow", "paypal", "promptpay", + "revolut_pay", "sepa_debit", "sofort", + "swish", "us_bank_account", "wechat_pay", ]), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/tax_ids/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/tax_ids/[id]/route.ts index 1734dfdd..888f3a25 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/tax_ids/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/tax_ids/[id]/route.ts @@ -112,7 +112,12 @@ const getCustomersCustomerTaxIdsIdParamSchema = z.object({ }) const getCustomersCustomerTaxIdsIdQuerySchema = z.object({ - expand: z.array(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 getCustomersCustomerTaxIdsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/tax_ids/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/tax_ids/route.ts index 0525e02c..75b0d9aa 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/tax_ids/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/[customer]/tax_ids/route.ts @@ -65,7 +65,12 @@ const getCustomersCustomerTaxIdsParamSchema = z.object({ const getCustomersCustomerTaxIdsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) @@ -148,11 +153,13 @@ const postCustomersCustomerTaxIdsBodySchema = z.object({ "ca_pst_mb", "ca_pst_sk", "ca_qst", + "ch_uid", "ch_vat", "cl_tin", "cn_tin", "co_nit", "cr_tin", + "de_stn", "do_rcn", "ec_ruc", "eg_tin", diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/route.ts index 239b24b9..f55d892b 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/route.ts @@ -67,7 +67,12 @@ const getCustomersQuerySchema = z.object({ .optional(), email: z.string().max(512).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), @@ -235,11 +240,13 @@ const postCustomersBodySchema = z "ca_pst_mb", "ca_pst_sk", "ca_qst", + "ch_uid", "ch_vat", "cl_tin", "cn_tin", "co_nit", "cr_tin", + "de_stn", "do_rcn", "ec_ruc", "eg_tin", diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/search/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/search/route.ts index 0c63d51e..1f88606b 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/search/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/customers/search/route.ts @@ -44,7 +44,12 @@ export type GetCustomersSearch = ( ) => Promise> const getCustomersSearchQuerySchema = z.object({ - expand: z.array(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(), page: z.string().max(5000).optional(), query: z.string().max(5000), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/disputes/[dispute]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/disputes/[dispute]/route.ts index e1f4775e..733484b7 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/disputes/[dispute]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/disputes/[dispute]/route.ts @@ -60,7 +60,12 @@ const getDisputesDisputeParamSchema = z.object({ }) const getDisputesDisputeQuerySchema = z.object({ - expand: z.array(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 getDisputesDisputeBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/disputes/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/disputes/route.ts index c42de283..c1b28f01 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/disputes/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/disputes/route.ts @@ -55,7 +55,12 @@ const getDisputesQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/active_entitlements/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/active_entitlements/[id]/route.ts index a5974e1f..82e4bf5e 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/active_entitlements/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/active_entitlements/[id]/route.ts @@ -42,7 +42,12 @@ const getEntitlementsActiveEntitlementsIdParamSchema = z.object({ }) const getEntitlementsActiveEntitlementsIdQuerySchema = z.object({ - expand: z.array(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 getEntitlementsActiveEntitlementsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/active_entitlements/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/active_entitlements/route.ts index af1cc883..57516043 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/active_entitlements/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/active_entitlements/route.ts @@ -44,7 +44,12 @@ export type GetEntitlementsActiveEntitlements = ( const getEntitlementsActiveEntitlementsQuerySchema = z.object({ customer: z.string().max(5000), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/features/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/features/[id]/route.ts index 1ad334fc..3f478505 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/features/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/features/[id]/route.ts @@ -60,7 +60,12 @@ const getEntitlementsFeaturesIdParamSchema = z.object({ }) const getEntitlementsFeaturesIdQuerySchema = z.object({ - expand: z.array(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 getEntitlementsFeaturesIdBodySchema = z.object({}).optional() @@ -121,7 +126,7 @@ const postEntitlementsFeaturesIdBodySchema = z .object({ active: PermissiveBoolean.optional(), expand: z.array(z.string().max(5000)).optional(), - metadata: z.record(z.string()).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), name: z.string().max(80).optional(), }) .optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/features/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/features/route.ts index 87b6f42f..b519132b 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/features/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/entitlements/features/route.ts @@ -9,6 +9,7 @@ import { t_entitlements_feature, t_error, } from "../../../models" +import { PermissiveBoolean } from "../../../schemas" import { KoaRuntimeError, RequestInputType, @@ -54,9 +55,16 @@ export type PostEntitlementsFeatures = ( ) => Promise> const getEntitlementsFeaturesQuerySchema = z.object({ + archived: PermissiveBoolean.optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/events/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/events/[id]/route.ts index e7b56037..bf2b05e6 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/events/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/events/[id]/route.ts @@ -40,7 +40,12 @@ export type GetEventsId = ( const getEventsIdParamSchema = z.object({ id: z.string().max(5000) }) const getEventsIdQuerySchema = z.object({ - expand: z.array(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 getEventsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/events/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/events/route.ts index 7a6ad4e2..bca77dcc 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/events/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/events/route.ts @@ -56,11 +56,21 @@ const getEventsQuerySchema = z.object({ .optional(), delivery_success: PermissiveBoolean.optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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.array(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 getEventsBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/exchange_rates/[rate_id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/exchange_rates/[rate_id]/route.ts index 7143278e..b437f564 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/exchange_rates/[rate_id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/exchange_rates/[rate_id]/route.ts @@ -42,7 +42,12 @@ const getExchangeRatesRateIdParamSchema = z.object({ }) const getExchangeRatesRateIdQuerySchema = z.object({ - expand: z.array(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 getExchangeRatesRateIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/exchange_rates/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/exchange_rates/route.ts index f67883c1..0f4be2ec 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/exchange_rates/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/exchange_rates/route.ts @@ -43,7 +43,12 @@ export type GetExchangeRates = ( const getExchangeRatesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/file_links/[link]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/file_links/[link]/route.ts index b3ae9c03..f1778450 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/file_links/[link]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/file_links/[link]/route.ts @@ -57,7 +57,12 @@ export type PostFileLinksLink = ( const getFileLinksLinkParamSchema = z.object({ link: z.string() }) const getFileLinksLinkQuerySchema = z.object({ - expand: z.array(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 getFileLinksLinkBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/file_links/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/file_links/route.ts index 27bb8b35..f135f47c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/file_links/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/file_links/route.ts @@ -67,7 +67,12 @@ const getFileLinksQuerySchema = z.object({ ]) .optional(), ending_before: z.string().optional(), - expand: z.array(z.string().max(5000)).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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/files/[file]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/files/[file]/route.ts index 871028d6..3865a3f7 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/files/[file]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/files/[file]/route.ts @@ -40,7 +40,12 @@ export type GetFilesFile = ( const getFilesFileParamSchema = z.object({ file: z.string().max(5000) }) const getFilesFileQuerySchema = z.object({ - expand: z.array(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 getFilesFileBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/files/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/files/route.ts index 2390ef01..d6c2746c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/files/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/files/route.ts @@ -63,7 +63,12 @@ const getFilesQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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([ diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/accounts/[account]/owners/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/accounts/[account]/owners/route.ts index cc4a0a93..883973c0 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/accounts/[account]/owners/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/accounts/[account]/owners/route.ts @@ -48,7 +48,12 @@ const getFinancialConnectionsAccountsAccountOwnersParamSchema = z.object({ const getFinancialConnectionsAccountsAccountOwnersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/accounts/[account]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/accounts/[account]/route.ts index 0c1d7d09..c84c9d90 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/accounts/[account]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/accounts/[account]/route.ts @@ -42,7 +42,12 @@ const getFinancialConnectionsAccountsAccountParamSchema = z.object({ }) const getFinancialConnectionsAccountsAccountQuerySchema = z.object({ - expand: z.array(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 getFinancialConnectionsAccountsAccountBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/accounts/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/accounts/route.ts index ada03ec5..5092f874 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/accounts/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/accounts/route.ts @@ -49,7 +49,12 @@ const getFinancialConnectionsAccountsQuerySchema = z.object({ }) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/sessions/[session]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/sessions/[session]/route.ts index a257f132..de32f6da 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/sessions/[session]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/sessions/[session]/route.ts @@ -42,7 +42,12 @@ const getFinancialConnectionsSessionsSessionParamSchema = z.object({ }) const getFinancialConnectionsSessionsSessionQuerySchema = z.object({ - expand: z.array(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 getFinancialConnectionsSessionsSessionBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/sessions/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/sessions/route.ts index 8df99a10..1962dc6f 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/sessions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/sessions/route.ts @@ -38,7 +38,22 @@ const postFinancialConnectionsSessionsBodySchema = z.object({ type: z.enum(["account", "customer"]), }), expand: z.array(z.string().max(5000)).optional(), - filters: z.object({ countries: 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"]), ), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/transactions/[transaction]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/transactions/[transaction]/route.ts index 988f5099..9a73b52f 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/transactions/[transaction]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/transactions/[transaction]/route.ts @@ -42,7 +42,12 @@ const getFinancialConnectionsTransactionsTransactionParamSchema = z.object({ }) const getFinancialConnectionsTransactionsTransactionQuerySchema = z.object({ - expand: z.array(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 getFinancialConnectionsTransactionsTransactionBodySchema = z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/transactions/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/transactions/route.ts index 5db62a4e..2ff63148 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/transactions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/financial_connections/transactions/route.ts @@ -44,7 +44,12 @@ export type GetFinancialConnectionsTransactions = ( const getFinancialConnectionsTransactionsQuerySchema = z.object({ account: z.string().max(5000), ending_before: z.string().max(5000).optional(), - expand: z.array(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 diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/forwarding/requests/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/forwarding/requests/[id]/route.ts index acd0ba24..a34aca7a 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/forwarding/requests/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/forwarding/requests/[id]/route.ts @@ -42,7 +42,12 @@ const getForwardingRequestsIdParamSchema = z.object({ }) const getForwardingRequestsIdQuerySchema = z.object({ - expand: z.array(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 getForwardingRequestsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/forwarding/requests/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/forwarding/requests/route.ts index c99a787c..2b1dde26 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/forwarding/requests/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/forwarding/requests/route.ts @@ -63,7 +63,12 @@ const getForwardingRequestsQuerySchema = z.object({ }) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_reports/[report]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_reports/[report]/route.ts index b927c90e..d6bb951c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_reports/[report]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_reports/[report]/route.ts @@ -42,7 +42,12 @@ const getIdentityVerificationReportsReportParamSchema = z.object({ }) const getIdentityVerificationReportsReportQuerySchema = z.object({ - expand: z.array(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 getIdentityVerificationReportsReportBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_reports/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_reports/route.ts index 1ab262d9..1058d703 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_reports/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_reports/route.ts @@ -55,7 +55,12 @@ const getIdentityVerificationReportsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_sessions/[session]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_sessions/[session]/route.ts index b4423664..3da55c28 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_sessions/[session]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_sessions/[session]/route.ts @@ -60,7 +60,12 @@ const getIdentityVerificationSessionsSessionParamSchema = z.object({ }) const getIdentityVerificationSessionsSessionQuerySchema = z.object({ - expand: z.array(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 getIdentityVerificationSessionsSessionBodySchema = z.object({}).optional() @@ -136,18 +141,6 @@ const postIdentityVerificationSessionsSessionBodySchema = z z.enum([""]), ]) .optional(), - email: z - .union([ - z.object({ require_verification: PermissiveBoolean.optional() }), - z.enum([""]), - ]) - .optional(), - phone: z - .union([ - z.object({ require_verification: PermissiveBoolean.optional() }), - z.enum([""]), - ]) - .optional(), }) .optional(), provided_details: z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_sessions/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_sessions/route.ts index 335c46a1..ac98e1e9 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_sessions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/identity/verification_sessions/route.ts @@ -72,8 +72,14 @@ const getIdentityVerificationSessionsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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"]) @@ -151,23 +157,12 @@ const postIdentityVerificationSessionsBodySchema = z z.enum([""]), ]) .optional(), - email: z - .union([ - z.object({ require_verification: PermissiveBoolean.optional() }), - z.enum([""]), - ]) - .optional(), - phone: z - .union([ - z.object({ require_verification: 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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoiceitems/[invoiceitem]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoiceitems/[invoiceitem]/route.ts index ae9740d2..c0d9f549 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoiceitems/[invoiceitem]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoiceitems/[invoiceitem]/route.ts @@ -128,7 +128,12 @@ const getInvoiceitemsInvoiceitemParamSchema = z.object({ }) const getInvoiceitemsInvoiceitemQuerySchema = z.object({ - expand: z.array(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 getInvoiceitemsInvoiceitemBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoiceitems/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoiceitems/route.ts index 5d9e8a55..d4250ad4 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoiceitems/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoiceitems/route.ts @@ -68,7 +68,12 @@ const getInvoiceitemsQuerySchema = z.object({ .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/add_lines/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/add_lines/route.ts new file mode 100644 index 00000000..aaa34df7 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/add_lines/route.ts @@ -0,0 +1,176 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_PostInvoicesInvoiceAddLinesBodySchema, + t_PostInvoicesInvoiceAddLinesParamSchema, + t_error, + t_invoice, +} from "../../../../models" +import { PermissiveBoolean } from "../../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type PostInvoicesInvoiceAddLinesResponder = { + with200(): KoaRuntimeResponse + withDefault(status: StatusCode): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type PostInvoicesInvoiceAddLines = ( + params: Params< + t_PostInvoicesInvoiceAddLinesParamSchema, + void, + t_PostInvoicesInvoiceAddLinesBodySchema + >, + respond: PostInvoicesInvoiceAddLinesResponder, + ctx: { request: NextRequest }, +) => Promise> + +const postInvoicesInvoiceAddLinesParamSchema = z.object({ + invoice: z.string().max(5000), +}) + +const postInvoicesInvoiceAddLinesBodySchema = 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: 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(), + 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_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(50), + inclusive: PermissiveBoolean, + jurisdiction: z.string().max(200).optional(), + percentage: z.coerce.number(), + state: z.string().max(2).optional(), + tax_type: z + .enum([ + "amusement_tax", + "communications_tax", + "gst", + "hst", + "igst", + "jct", + "lease_tax", + "pst", + "qst", + "rst", + "sales_tax", + "vat", + ]) + .optional(), + }), + taxable_amount: z.coerce.number(), + }), + ), + z.enum([""]), + ]) + .optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ), +}) + +export const _POST = + (implementation: PostInvoicesInvoiceAddLines) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + postInvoicesInvoiceAddLinesParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + postInvoicesInvoiceAddLinesBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/lines/[line_item_id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/lines/[line_item_id]/route.ts index 2f4bda1f..2dad9d6a 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/lines/[line_item_id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/lines/[line_item_id]/route.ts @@ -96,7 +96,7 @@ const postInvoicesInvoiceLinesLineItemIdBodySchema = z description: z.string().max(5000).optional(), display_name: z.string().max(50), inclusive: PermissiveBoolean, - jurisdiction: z.string().max(50).optional(), + jurisdiction: z.string().max(200).optional(), percentage: z.coerce.number(), state: z.string().max(2).optional(), tax_type: z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/lines/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/lines/route.ts index ac474a19..6c0d4647 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/lines/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/lines/route.ts @@ -48,7 +48,12 @@ const getInvoicesInvoiceLinesParamSchema = z.object({ const getInvoicesInvoiceLinesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/remove_lines/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/remove_lines/route.ts new file mode 100644 index 00000000..4dd0a586 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/remove_lines/route.ts @@ -0,0 +1,96 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_PostInvoicesInvoiceRemoveLinesBodySchema, + t_PostInvoicesInvoiceRemoveLinesParamSchema, + t_error, + t_invoice, +} from "../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type PostInvoicesInvoiceRemoveLinesResponder = { + with200(): KoaRuntimeResponse + withDefault(status: StatusCode): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type PostInvoicesInvoiceRemoveLines = ( + params: Params< + t_PostInvoicesInvoiceRemoveLinesParamSchema, + void, + t_PostInvoicesInvoiceRemoveLinesBodySchema + >, + respond: PostInvoicesInvoiceRemoveLinesResponder, + ctx: { request: NextRequest }, +) => Promise> + +const postInvoicesInvoiceRemoveLinesParamSchema = z.object({ + invoice: z.string().max(5000), +}) + +const postInvoicesInvoiceRemoveLinesBodySchema = 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), + }), + ), +}) + +export const _POST = + (implementation: PostInvoicesInvoiceRemoveLines) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + postInvoicesInvoiceRemoveLinesParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + postInvoicesInvoiceRemoveLinesBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/route.ts index 75a4090e..3eafd2c1 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/route.ts @@ -128,7 +128,12 @@ const getInvoicesInvoiceParamSchema = z.object({ }) const getInvoicesInvoiceQuerySchema = z.object({ - expand: z.array(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 getInvoicesInvoiceBodySchema = z.object({}).optional() @@ -289,8 +294,8 @@ const postInvoicesInvoiceBodySchema = z plan: z .union([ z.object({ - count: z.coerce.number(), - interval: z.enum(["month"]), + count: z.coerce.number().optional(), + interval: z.enum(["month"]).optional(), type: z.enum(["fixed_count"]), }), z.enum([""]), @@ -328,6 +333,13 @@ const postInvoicesInvoiceBodySchema = z z.object({ financial_connections: z .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), permissions: z .array( z.enum([ @@ -361,6 +373,7 @@ const postInvoicesInvoiceBodySchema = z "ach_credit_transfer", "ach_debit", "acss_debit", + "amazon_pay", "au_becs_debit", "bacs_debit", "bancontact", @@ -375,12 +388,15 @@ const postInvoicesInvoiceBodySchema = z "ideal", "konbini", "link", + "multibanco", "p24", "paynow", "paypal", "promptpay", + "revolut_pay", "sepa_debit", "sofort", + "swish", "us_bank_account", "wechat_pay", ]), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/update_lines/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/update_lines/route.ts new file mode 100644 index 00000000..4c479a50 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/[invoice]/update_lines/route.ts @@ -0,0 +1,176 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_PostInvoicesInvoiceUpdateLinesBodySchema, + t_PostInvoicesInvoiceUpdateLinesParamSchema, + t_error, + t_invoice, +} from "../../../../models" +import { PermissiveBoolean } from "../../../../schemas" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type PostInvoicesInvoiceUpdateLinesResponder = { + with200(): KoaRuntimeResponse + withDefault(status: StatusCode): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type PostInvoicesInvoiceUpdateLines = ( + params: Params< + t_PostInvoicesInvoiceUpdateLinesParamSchema, + void, + t_PostInvoicesInvoiceUpdateLinesBodySchema + >, + respond: PostInvoicesInvoiceUpdateLinesResponder, + ctx: { request: NextRequest }, +) => Promise> + +const postInvoicesInvoiceUpdateLinesParamSchema = z.object({ + invoice: z.string().max(5000), +}) + +const postInvoicesInvoiceUpdateLinesBodySchema = 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: 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(), + 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_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(50), + inclusive: PermissiveBoolean, + jurisdiction: z.string().max(200).optional(), + percentage: z.coerce.number(), + state: z.string().max(2).optional(), + tax_type: z + .enum([ + "amusement_tax", + "communications_tax", + "gst", + "hst", + "igst", + "jct", + "lease_tax", + "pst", + "qst", + "rst", + "sales_tax", + "vat", + ]) + .optional(), + }), + taxable_amount: z.coerce.number(), + }), + ), + z.enum([""]), + ]) + .optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ), +}) + +export const _POST = + (implementation: PostInvoicesInvoiceUpdateLines) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + postInvoicesInvoiceUpdateLinesParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + postInvoicesInvoiceUpdateLinesBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/create_preview/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/create_preview/route.ts index 2ec49670..ea127ca6 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/create_preview/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/create_preview/route.ts @@ -106,11 +106,13 @@ const postInvoicesCreatePreviewBodySchema = z "ca_pst_mb", "ca_pst_sk", "ca_qst", + "ch_uid", "ch_vat", "cl_tin", "cn_tin", "co_nit", "cr_tin", + "de_stn", "do_rcn", "ec_ruc", "eg_tin", @@ -237,6 +239,7 @@ const postInvoicesCreatePreviewBodySchema = z }) .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({ diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/route.ts index 7c595bab..fa88254e 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/route.ts @@ -82,7 +82,12 @@ const getInvoicesQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), @@ -247,8 +252,8 @@ const postInvoicesBodySchema = z plan: z .union([ z.object({ - count: z.coerce.number(), - interval: z.enum(["month"]), + count: z.coerce.number().optional(), + interval: z.enum(["month"]).optional(), type: z.enum(["fixed_count"]), }), z.enum([""]), @@ -286,6 +291,13 @@ const postInvoicesBodySchema = z z.object({ financial_connections: z .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), permissions: z .array( z.enum([ @@ -319,6 +331,7 @@ const postInvoicesBodySchema = z "ach_credit_transfer", "ach_debit", "acss_debit", + "amazon_pay", "au_becs_debit", "bacs_debit", "bancontact", @@ -333,12 +346,15 @@ const postInvoicesBodySchema = z "ideal", "konbini", "link", + "multibanco", "p24", "paynow", "paypal", "promptpay", + "revolut_pay", "sepa_debit", "sofort", + "swish", "us_bank_account", "wechat_pay", ]), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/search/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/search/route.ts index 15c92aa8..c9fe50de 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/search/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/search/route.ts @@ -44,7 +44,12 @@ export type GetInvoicesSearch = ( ) => Promise> const getInvoicesSearchQuerySchema = z.object({ - expand: z.array(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(), page: z.string().max(5000).optional(), query: z.string().max(5000), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/upcoming/lines/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/upcoming/lines/route.ts index 85fbaada..bedb0059 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/upcoming/lines/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/upcoming/lines/route.ts @@ -113,11 +113,13 @@ const getInvoicesUpcomingLinesQuerySchema = z.object({ "ca_pst_mb", "ca_pst_sk", "ca_qst", + "ch_uid", "ch_vat", "cl_tin", "cn_tin", "co_nit", "cr_tin", + "de_stn", "do_rcn", "ec_ruc", "eg_tin", @@ -188,54 +190,62 @@ const getInvoicesUpcomingLinesQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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_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(), - }), + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + 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 @@ -246,6 +256,7 @@ const getInvoicesUpcomingLinesQuerySchema = z.object({ .optional(), limit: z.coerce.number().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({ @@ -491,48 +502,51 @@ const getInvoicesUpcomingLinesQuerySchema = z.object({ }) .optional(), subscription_items: z - .array( - z.object({ - billing_thresholds: z - .union([z.object({ usage_gte: z.coerce.number() }), z.enum([""])]) - .optional(), - 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(), + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array( + z.object({ + billing_thresholds: z + .union([z.object({ usage_gte: z.coerce.number() }), z.enum([""])]) + .optional(), + 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(), }), - ), - 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(), - }), + 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(), subscription_proration_behavior: z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/upcoming/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/upcoming/route.ts index 51939493..9e6df7f1 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/upcoming/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/invoices/upcoming/route.ts @@ -108,11 +108,13 @@ const getInvoicesUpcomingQuerySchema = z.object({ "ca_pst_mb", "ca_pst_sk", "ca_qst", + "ch_uid", "ch_vat", "cl_tin", "cn_tin", "co_nit", "cr_tin", + "de_stn", "do_rcn", "ec_ruc", "eg_tin", @@ -182,54 +184,62 @@ const getInvoicesUpcomingQuerySchema = z.object({ z.enum([""]), ]) .optional(), - expand: z.array(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_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(), - }), + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + 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 @@ -239,6 +249,7 @@ const getInvoicesUpcomingQuerySchema = z.object({ }) .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({ @@ -483,48 +494,51 @@ const getInvoicesUpcomingQuerySchema = z.object({ }) .optional(), subscription_items: z - .array( - z.object({ - billing_thresholds: z - .union([z.object({ usage_gte: z.coerce.number() }), z.enum([""])]) - .optional(), - 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(), + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array( + z.object({ + billing_thresholds: z + .union([z.object({ usage_gte: z.coerce.number() }), z.enum([""])]) + .optional(), + 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(), }), - ), - 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(), - }), + 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(), subscription_proration_behavior: z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/authorizations/[authorization]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/authorizations/[authorization]/route.ts index b4039051..7197e5d5 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/authorizations/[authorization]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/authorizations/[authorization]/route.ts @@ -59,7 +59,12 @@ const getIssuingAuthorizationsAuthorizationParamSchema = z.object({ }) const getIssuingAuthorizationsAuthorizationQuerySchema = z.object({ - expand: z.array(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 getIssuingAuthorizationsAuthorizationBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/authorizations/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/authorizations/route.ts index dca0cf95..fe67f44f 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/authorizations/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/authorizations/route.ts @@ -56,7 +56,12 @@ const getIssuingAuthorizationsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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", "pending", "reversed"]).optional(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cardholders/[cardholder]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cardholders/[cardholder]/route.ts index 68896a8b..3d14dfc3 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cardholders/[cardholder]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cardholders/[cardholder]/route.ts @@ -59,7 +59,12 @@ const getIssuingCardholdersCardholderParamSchema = z.object({ }) const getIssuingCardholdersCardholderQuerySchema = z.object({ - expand: z.array(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 getIssuingCardholdersCardholderBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cardholders/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cardholders/route.ts index 8e70d73c..841266f4 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cardholders/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cardholders/route.ts @@ -67,7 +67,12 @@ const getIssuingCardholdersQuerySchema = z.object({ .optional(), email: z.string().optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cards/[card]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cards/[card]/route.ts index 96a433d7..3c267e77 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cards/[card]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cards/[card]/route.ts @@ -11,6 +11,7 @@ import { t_error, t_issuing_card, } from "../../../../models" +import { PermissiveBoolean } from "../../../../schemas" import { KoaRuntimeError, RequestInputType, @@ -57,7 +58,12 @@ export type PostIssuingCardsCard = ( const getIssuingCardsCardParamSchema = z.object({ card: z.string().max(5000) }) const getIssuingCardsCardQuerySchema = z.object({ - expand: z.array(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 getIssuingCardsCardBodySchema = z.object({}).optional() @@ -121,6 +127,35 @@ const postIssuingCardsCardBodySchema = z 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 diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cards/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cards/route.ts index 95809aa5..f760502c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cards/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/cards/route.ts @@ -70,7 +70,12 @@ const getIssuingCardsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), exp_month: z.coerce.number().optional(), exp_year: z.coerce.number().optional(), - expand: z.array(z.string().max(5000)).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(), @@ -155,6 +160,15 @@ const postIssuingCardsBodySchema = z.object({ 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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/disputes/[dispute]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/disputes/[dispute]/route.ts index 69a3e130..d4315adb 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/disputes/[dispute]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/disputes/[dispute]/route.ts @@ -60,7 +60,12 @@ const getIssuingDisputesDisputeParamSchema = z.object({ }) const getIssuingDisputesDisputeQuerySchema = z.object({ - expand: z.array(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 getIssuingDisputesDisputeBodySchema = z.object({}).optional() @@ -135,16 +140,16 @@ const postIssuingDisputesDisputeBodySchema = z .union([PermissiveBoolean, z.enum([""])]) .optional(), cancellation_reason: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), expected_at: z .union([z.coerce.number(), z.enum([""])]) .optional(), explanation: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), product_description: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), product_type: z.enum(["", "merchandise", "service"]).optional(), return_status: z @@ -167,7 +172,7 @@ const postIssuingDisputesDisputeBodySchema = z cash_receipt: z.union([z.string(), z.enum([""])]).optional(), check_image: z.union([z.string(), z.enum([""])]).optional(), explanation: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), original_transaction: z.string().max(5000).optional(), }), @@ -181,7 +186,7 @@ const postIssuingDisputesDisputeBodySchema = z .union([z.string(), z.enum([""])]) .optional(), explanation: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), }), z.enum([""]), @@ -194,13 +199,13 @@ const postIssuingDisputesDisputeBodySchema = z .union([z.string(), z.enum([""])]) .optional(), explanation: z - .union([z.string().max(1500), z.enum([""])]) + .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(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), return_status: z .enum(["", "merchant_rejected", "successful"]) @@ -212,6 +217,19 @@ const postIssuingDisputesDisputeBodySchema = z 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({ @@ -222,10 +240,10 @@ const postIssuingDisputesDisputeBodySchema = z .union([z.coerce.number(), z.enum([""])]) .optional(), explanation: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), product_description: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), product_type: z.enum(["", "merchandise", "service"]).optional(), }), @@ -239,10 +257,10 @@ const postIssuingDisputesDisputeBodySchema = z .union([z.string(), z.enum([""])]) .optional(), explanation: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), product_description: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), product_type: z.enum(["", "merchandise", "service"]).optional(), }), @@ -255,6 +273,7 @@ const postIssuingDisputesDisputeBodySchema = z "duplicate", "fraudulent", "merchandise_not_as_described", + "no_valid_authorization", "not_received", "other", "service_not_as_described", @@ -270,10 +289,10 @@ const postIssuingDisputesDisputeBodySchema = z .union([z.coerce.number(), z.enum([""])]) .optional(), cancellation_reason: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), explanation: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), received_at: z .union([z.coerce.number(), z.enum([""])]) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/disputes/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/disputes/route.ts index 77b04454..138cda99 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/disputes/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/disputes/route.ts @@ -67,7 +67,12 @@ const getIssuingDisputesQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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 @@ -145,16 +150,16 @@ const postIssuingDisputesBodySchema = z .union([PermissiveBoolean, z.enum([""])]) .optional(), cancellation_reason: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), expected_at: z .union([z.coerce.number(), z.enum([""])]) .optional(), explanation: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), product_description: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), product_type: z.enum(["", "merchandise", "service"]).optional(), return_status: z @@ -177,7 +182,7 @@ const postIssuingDisputesBodySchema = z cash_receipt: z.union([z.string(), z.enum([""])]).optional(), check_image: z.union([z.string(), z.enum([""])]).optional(), explanation: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), original_transaction: z.string().max(5000).optional(), }), @@ -191,7 +196,7 @@ const postIssuingDisputesBodySchema = z .union([z.string(), z.enum([""])]) .optional(), explanation: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), }), z.enum([""]), @@ -204,13 +209,13 @@ const postIssuingDisputesBodySchema = z .union([z.string(), z.enum([""])]) .optional(), explanation: z - .union([z.string().max(1500), z.enum([""])]) + .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(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), return_status: z .enum(["", "merchant_rejected", "successful"]) @@ -222,6 +227,19 @@ const postIssuingDisputesBodySchema = z 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({ @@ -232,10 +250,10 @@ const postIssuingDisputesBodySchema = z .union([z.coerce.number(), z.enum([""])]) .optional(), explanation: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), product_description: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), product_type: z.enum(["", "merchandise", "service"]).optional(), }), @@ -249,10 +267,10 @@ const postIssuingDisputesBodySchema = z .union([z.string(), z.enum([""])]) .optional(), explanation: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), product_description: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), product_type: z.enum(["", "merchandise", "service"]).optional(), }), @@ -265,6 +283,7 @@ const postIssuingDisputesBodySchema = z "duplicate", "fraudulent", "merchandise_not_as_described", + "no_valid_authorization", "not_received", "other", "service_not_as_described", @@ -280,10 +299,10 @@ const postIssuingDisputesBodySchema = z .union([z.coerce.number(), z.enum([""])]) .optional(), cancellation_reason: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), explanation: z - .union([z.string().max(1500), z.enum([""])]) + .union([z.string().max(2500), z.enum([""])]) .optional(), received_at: z .union([z.coerce.number(), z.enum([""])]) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/personalization_designs/[personalization_design]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/personalization_designs/[personalization_design]/route.ts index 19873a5a..2812aa65 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/personalization_designs/[personalization_design]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/personalization_designs/[personalization_design]/route.ts @@ -61,7 +61,14 @@ const getIssuingPersonalizationDesignsPersonalizationDesignParamSchema = z.object({ personalization_design: z.string().max(5000) }) const getIssuingPersonalizationDesignsPersonalizationDesignQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) const getIssuingPersonalizationDesignsPersonalizationDesignBodySchema = z .object({}) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/personalization_designs/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/personalization_designs/route.ts index a1bc3806..de00c607 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/personalization_designs/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/personalization_designs/route.ts @@ -56,9 +56,19 @@ export type PostIssuingPersonalizationDesigns = ( const getIssuingPersonalizationDesignsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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.array(z.string().max(200)).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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/physical_bundles/[physical_bundle]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/physical_bundles/[physical_bundle]/route.ts index b9542761..4a0a379b 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/physical_bundles/[physical_bundle]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/physical_bundles/[physical_bundle]/route.ts @@ -42,7 +42,12 @@ const getIssuingPhysicalBundlesPhysicalBundleParamSchema = z.object({ }) const getIssuingPhysicalBundlesPhysicalBundleQuerySchema = z.object({ - expand: z.array(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 getIssuingPhysicalBundlesPhysicalBundleBodySchema = z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/physical_bundles/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/physical_bundles/route.ts index 871bf608..deb1616b 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/physical_bundles/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/physical_bundles/route.ts @@ -43,7 +43,12 @@ export type GetIssuingPhysicalBundles = ( const getIssuingPhysicalBundlesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/settlements/[settlement]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/settlements/[settlement]/route.ts index a88a221d..6e9b2282 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/settlements/[settlement]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/settlements/[settlement]/route.ts @@ -59,7 +59,12 @@ const getIssuingSettlementsSettlementParamSchema = z.object({ }) const getIssuingSettlementsSettlementQuerySchema = z.object({ - expand: z.array(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 getIssuingSettlementsSettlementBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/tokens/[token]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/tokens/[token]/route.ts index 997fb670..14572c9e 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/tokens/[token]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/tokens/[token]/route.ts @@ -59,7 +59,12 @@ const getIssuingTokensTokenParamSchema = z.object({ }) const getIssuingTokensTokenQuerySchema = z.object({ - expand: z.array(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 getIssuingTokensTokenBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/tokens/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/tokens/route.ts index fc7471ce..1a394e28 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/tokens/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/tokens/route.ts @@ -55,7 +55,12 @@ const getIssuingTokensQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/transactions/[transaction]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/transactions/[transaction]/route.ts index 3539afd7..40a0daf6 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/transactions/[transaction]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/transactions/[transaction]/route.ts @@ -59,7 +59,12 @@ const getIssuingTransactionsTransactionParamSchema = z.object({ }) const getIssuingTransactionsTransactionQuerySchema = z.object({ - expand: z.array(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 getIssuingTransactionsTransactionBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/transactions/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/transactions/route.ts index f093e16c..08bcc9c7 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/transactions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/issuing/transactions/route.ts @@ -56,7 +56,12 @@ const getIssuingTransactionsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/link_account_sessions/[session]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/link_account_sessions/[session]/route.ts index 44f05b70..df38982c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/link_account_sessions/[session]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/link_account_sessions/[session]/route.ts @@ -42,7 +42,12 @@ const getLinkAccountSessionsSessionParamSchema = z.object({ }) const getLinkAccountSessionsSessionQuerySchema = z.object({ - expand: z.array(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 getLinkAccountSessionsSessionBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/link_account_sessions/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/link_account_sessions/route.ts index fb52861a..793328ce 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/link_account_sessions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/link_account_sessions/route.ts @@ -38,7 +38,22 @@ const postLinkAccountSessionsBodySchema = z.object({ type: z.enum(["account", "customer"]), }), expand: z.array(z.string().max(5000)).optional(), - filters: z.object({ countries: 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"]), ), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/linked_accounts/[account]/owners/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/linked_accounts/[account]/owners/route.ts index d1d993da..2a8e30b5 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/linked_accounts/[account]/owners/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/linked_accounts/[account]/owners/route.ts @@ -48,7 +48,12 @@ const getLinkedAccountsAccountOwnersParamSchema = z.object({ const getLinkedAccountsAccountOwnersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/linked_accounts/[account]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/linked_accounts/[account]/route.ts index 998c714b..bf977f52 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/linked_accounts/[account]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/linked_accounts/[account]/route.ts @@ -42,7 +42,12 @@ const getLinkedAccountsAccountParamSchema = z.object({ }) const getLinkedAccountsAccountQuerySchema = z.object({ - expand: z.array(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 getLinkedAccountsAccountBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/linked_accounts/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/linked_accounts/route.ts index 05ce7e81..a3247d23 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/linked_accounts/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/linked_accounts/route.ts @@ -49,7 +49,12 @@ const getLinkedAccountsQuerySchema = z.object({ }) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/mandates/[mandate]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/mandates/[mandate]/route.ts index e199b40e..8c267102 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/mandates/[mandate]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/mandates/[mandate]/route.ts @@ -40,7 +40,12 @@ export type GetMandatesMandate = ( const getMandatesMandateParamSchema = z.object({ mandate: z.string() }) const getMandatesMandateQuerySchema = z.object({ - expand: z.array(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 getMandatesMandateBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/[intent]/confirm/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/[intent]/confirm/route.ts index aa20ccb4..87332701 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/[intent]/confirm/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/[intent]/confirm/route.ts @@ -241,6 +241,7 @@ const postPaymentIntentsIntentConfirmBodySchema = z link: z.object({}).optional(), metadata: z.record(z.string()).optional(), mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), oxxo: z.object({}).optional(), p24: z .object({ @@ -289,6 +290,7 @@ const postPaymentIntentsIntentConfirmBodySchema = 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", @@ -311,6 +313,7 @@ const postPaymentIntentsIntentConfirmBodySchema = z "konbini", "link", "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -321,6 +324,7 @@ const postPaymentIntentsIntentConfirmBodySchema = z "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", "zip", @@ -419,6 +423,7 @@ const postPaymentIntentsIntentConfirmBodySchema = z bacs_debit: z .union([ z.object({ + mandate_options: z.object({}).optional(), setup_future_usage: z .enum(["", "none", "off_session", "on_session"]) .optional(), @@ -468,8 +473,8 @@ const postPaymentIntentsIntentConfirmBodySchema = z plan: z .union([ z.object({ - count: z.coerce.number(), - interval: z.enum(["month"]), + count: z.coerce.number().optional(), + interval: z.enum(["month"]).optional(), type: z.enum(["fixed_count"]), }), z.enum([""]), @@ -503,6 +508,7 @@ const postPaymentIntentsIntentConfirmBodySchema = z "diners", "discover", "eftpos_au", + "girocard", "interac", "jcb", "mastercard", @@ -570,6 +576,13 @@ const postPaymentIntentsIntentConfirmBodySchema = z request_extended_authorization: PermissiveBoolean.optional(), request_incremental_authorization_support: PermissiveBoolean.optional(), + routing: z + .object({ + requested_priority: z + .enum(["domestic", "international"]) + .optional(), + }) + .optional(), }), z.enum([""]), ]) @@ -688,6 +701,7 @@ const postPaymentIntentsIntentConfirmBodySchema = z "en-NZ", "en-PL", "en-PT", + "en-RO", "en-SE", "en-US", "es-ES", @@ -704,6 +718,7 @@ const postPaymentIntentsIntentConfirmBodySchema = z "nl-NL", "pl-PL", "pt-PT", + "ro-RO", "sv-FI", "sv-SE", ]) @@ -751,6 +766,12 @@ const postPaymentIntentsIntentConfirmBodySchema = z z.enum([""]), ]) .optional(), + multibanco: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), oxxo: z .union([ z.object({ @@ -875,11 +896,24 @@ const postPaymentIntentsIntentConfirmBodySchema = z 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([ diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/[intent]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/[intent]/route.ts index 1e609b79..b4eead13 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/[intent]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/[intent]/route.ts @@ -61,7 +61,12 @@ const getPaymentIntentsIntentParamSchema = z.object({ const getPaymentIntentsIntentQuerySchema = z.object({ client_secret: z.string().max(5000).optional(), - expand: z.array(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 getPaymentIntentsIntentBodySchema = z.object({}).optional() @@ -293,6 +298,7 @@ const postPaymentIntentsIntentBodySchema = z link: z.object({}).optional(), metadata: z.record(z.string()).optional(), mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), oxxo: z.object({}).optional(), p24: z .object({ @@ -341,6 +347,7 @@ const postPaymentIntentsIntentBodySchema = 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", @@ -363,6 +370,7 @@ const postPaymentIntentsIntentBodySchema = z "konbini", "link", "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -373,6 +381,7 @@ const postPaymentIntentsIntentBodySchema = z "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", "zip", @@ -471,6 +480,7 @@ const postPaymentIntentsIntentBodySchema = z bacs_debit: z .union([ z.object({ + mandate_options: z.object({}).optional(), setup_future_usage: z .enum(["", "none", "off_session", "on_session"]) .optional(), @@ -520,8 +530,8 @@ const postPaymentIntentsIntentBodySchema = z plan: z .union([ z.object({ - count: z.coerce.number(), - interval: z.enum(["month"]), + count: z.coerce.number().optional(), + interval: z.enum(["month"]).optional(), type: z.enum(["fixed_count"]), }), z.enum([""]), @@ -555,6 +565,7 @@ const postPaymentIntentsIntentBodySchema = z "diners", "discover", "eftpos_au", + "girocard", "interac", "jcb", "mastercard", @@ -622,6 +633,13 @@ const postPaymentIntentsIntentBodySchema = z request_extended_authorization: PermissiveBoolean.optional(), request_incremental_authorization_support: PermissiveBoolean.optional(), + routing: z + .object({ + requested_priority: z + .enum(["domestic", "international"]) + .optional(), + }) + .optional(), }), z.enum([""]), ]) @@ -740,6 +758,7 @@ const postPaymentIntentsIntentBodySchema = z "en-NZ", "en-PL", "en-PT", + "en-RO", "en-SE", "en-US", "es-ES", @@ -756,6 +775,7 @@ const postPaymentIntentsIntentBodySchema = z "nl-NL", "pl-PL", "pt-PT", + "ro-RO", "sv-FI", "sv-SE", ]) @@ -803,6 +823,12 @@ const postPaymentIntentsIntentBodySchema = z z.enum([""]), ]) .optional(), + multibanco: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), oxxo: z .union([ z.object({ @@ -927,11 +953,24 @@ const postPaymentIntentsIntentBodySchema = z 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([ diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/route.ts index b32486ea..eeccaeac 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/route.ts @@ -68,7 +68,12 @@ const getPaymentIntentsQuerySchema = z.object({ .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) @@ -325,6 +330,7 @@ const postPaymentIntentsBodySchema = z.object({ link: z.object({}).optional(), metadata: z.record(z.string()).optional(), mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), oxxo: z.object({}).optional(), p24: z .object({ @@ -373,6 +379,7 @@ const postPaymentIntentsBodySchema = z.object({ .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", @@ -395,6 +402,7 @@ const postPaymentIntentsBodySchema = z.object({ "konbini", "link", "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -405,6 +413,7 @@ const postPaymentIntentsBodySchema = z.object({ "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", "zip", @@ -499,6 +508,7 @@ const postPaymentIntentsBodySchema = z.object({ bacs_debit: z .union([ z.object({ + mandate_options: z.object({}).optional(), setup_future_usage: z .enum(["", "none", "off_session", "on_session"]) .optional(), @@ -546,8 +556,8 @@ const postPaymentIntentsBodySchema = z.object({ plan: z .union([ z.object({ - count: z.coerce.number(), - interval: z.enum(["month"]), + count: z.coerce.number().optional(), + interval: z.enum(["month"]).optional(), type: z.enum(["fixed_count"]), }), z.enum([""]), @@ -575,6 +585,7 @@ const postPaymentIntentsBodySchema = z.object({ "diners", "discover", "eftpos_au", + "girocard", "interac", "jcb", "mastercard", @@ -640,6 +651,13 @@ const postPaymentIntentsBodySchema = 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([""]), ]) @@ -756,6 +774,7 @@ const postPaymentIntentsBodySchema = z.object({ "en-NZ", "en-PL", "en-PT", + "en-RO", "en-SE", "en-US", "es-ES", @@ -772,6 +791,7 @@ const postPaymentIntentsBodySchema = z.object({ "nl-NL", "pl-PL", "pt-PT", + "ro-RO", "sv-FI", "sv-SE", ]) @@ -817,6 +837,12 @@ const postPaymentIntentsBodySchema = z.object({ z.enum([""]), ]) .optional(), + multibanco: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), oxxo: z .union([ z.object({ @@ -933,11 +959,24 @@ const postPaymentIntentsBodySchema = z.object({ 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([ diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/search/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/search/route.ts index 77c66727..1a04b13d 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/search/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_intents/search/route.ts @@ -44,7 +44,12 @@ export type GetPaymentIntentsSearch = ( ) => Promise> const getPaymentIntentsSearchQuerySchema = z.object({ - expand: z.array(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(), page: z.string().max(5000).optional(), query: z.string().max(5000), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_links/[payment_link]/line_items/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_links/[payment_link]/line_items/route.ts index db0c0adf..57ac77e1 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_links/[payment_link]/line_items/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_links/[payment_link]/line_items/route.ts @@ -48,7 +48,12 @@ const getPaymentLinksPaymentLinkLineItemsParamSchema = z.object({ const getPaymentLinksPaymentLinkLineItemsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_links/[payment_link]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_links/[payment_link]/route.ts index 3ffc7c30..66ef0f42 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_links/[payment_link]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_links/[payment_link]/route.ts @@ -60,7 +60,12 @@ const getPaymentLinksPaymentLinkParamSchema = z.object({ }) const getPaymentLinksPaymentLinkQuerySchema = z.object({ - expand: z.array(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 getPaymentLinksPaymentLinkBodySchema = z.object({}).optional() @@ -295,6 +300,8 @@ const postPaymentLinksPaymentLinkBodySchema = z "klarna", "konbini", "link", + "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -304,8 +311,10 @@ const postPaymentLinksPaymentLinkBodySchema = z "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", + "zip", ]), ), z.enum([""]), @@ -596,6 +605,7 @@ const postPaymentLinksPaymentLinkBodySchema = z .optional(), }) .optional(), + tax_id_collection: z.object({ enabled: PermissiveBoolean }).optional(), }) .optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_links/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_links/route.ts index 1a55ed3f..5ffbc16c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_links/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_links/route.ts @@ -57,7 +57,12 @@ export type PostPaymentLinks = ( const getPaymentLinksQuerySchema = z.object({ active: PermissiveBoolean.optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) @@ -294,6 +299,8 @@ const postPaymentLinksBodySchema = z.object({ "klarna", "konbini", "link", + "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -303,8 +310,10 @@ const postPaymentLinksBodySchema = z.object({ "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", + "zip", ]), ) .optional(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_configurations/[configuration]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_configurations/[configuration]/route.ts index 0cf130a8..e581383a 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_configurations/[configuration]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_configurations/[configuration]/route.ts @@ -60,7 +60,12 @@ const getPaymentMethodConfigurationsConfigurationParamSchema = z.object({ }) const getPaymentMethodConfigurationsConfigurationQuerySchema = z.object({ - expand: z.array(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 getPaymentMethodConfigurationsConfigurationBodySchema = z @@ -305,6 +310,20 @@ const postPaymentMethodConfigurationsConfigurationBodySchema = z .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(), oxxo: z .object({ @@ -369,6 +388,13 @@ const postPaymentMethodConfigurationsConfigurationBodySchema = z .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 diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_configurations/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_configurations/route.ts index 40512451..693ea535 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_configurations/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_configurations/route.ts @@ -60,7 +60,12 @@ export type PostPaymentMethodConfigurations = ( const getPaymentMethodConfigurationsQuerySchema = z.object({ application: z.union([z.string().max(100), z.enum([""])]).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) @@ -301,6 +306,20 @@ const postPaymentMethodConfigurationsBodySchema = z .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(), oxxo: z .object({ @@ -366,6 +385,13 @@ const postPaymentMethodConfigurationsBodySchema = z .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 diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_domains/[payment_method_domain]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_domains/[payment_method_domain]/route.ts index 4f437007..4b8670ee 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_domains/[payment_method_domain]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_domains/[payment_method_domain]/route.ts @@ -60,7 +60,12 @@ const getPaymentMethodDomainsPaymentMethodDomainParamSchema = z.object({ }) const getPaymentMethodDomainsPaymentMethodDomainQuerySchema = z.object({ - expand: z.array(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 getPaymentMethodDomainsPaymentMethodDomainBodySchema = z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_domains/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_domains/route.ts index f2299072..85126d04 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_domains/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_method_domains/route.ts @@ -58,7 +58,12 @@ const getPaymentMethodDomainsQuerySchema = z.object({ domain_name: z.string().max(5000).optional(), enabled: PermissiveBoolean.optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_methods/[payment_method]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_methods/[payment_method]/route.ts index 7a702457..0db41dd1 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_methods/[payment_method]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_methods/[payment_method]/route.ts @@ -59,7 +59,12 @@ const getPaymentMethodsPaymentMethodParamSchema = z.object({ }) const getPaymentMethodsPaymentMethodQuerySchema = z.object({ - expand: z.array(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 getPaymentMethodsPaymentMethodBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_methods/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_methods/route.ts index bf17b476..62149273 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_methods/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payment_methods/route.ts @@ -56,7 +56,12 @@ export type PostPaymentMethods = ( const getPaymentMethodsQuerySchema = z.object({ customer: z.string().max(5000).optional(), ending_before: z.string().optional(), - expand: z.array(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().optional(), type: z @@ -83,6 +88,7 @@ const getPaymentMethodsQuerySchema = z.object({ "konbini", "link", "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -93,6 +99,7 @@ const getPaymentMethodsQuerySchema = z.object({ "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", "zip", @@ -328,6 +335,7 @@ const postPaymentMethodsBodySchema = z link: z.object({}).optional(), metadata: z.record(z.string()).optional(), mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), oxxo: z.object({}).optional(), p24: z .object({ @@ -377,6 +385,7 @@ const postPaymentMethodsBodySchema = 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", @@ -401,6 +410,7 @@ const postPaymentMethodsBodySchema = z "konbini", "link", "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -411,6 +421,7 @@ const postPaymentMethodsBodySchema = z "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", "zip", diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payouts/[payout]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payouts/[payout]/route.ts index c44b7202..442f5f67 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payouts/[payout]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payouts/[payout]/route.ts @@ -57,7 +57,12 @@ export type PostPayoutsPayout = ( const getPayoutsPayoutParamSchema = z.object({ payout: z.string().max(5000) }) const getPayoutsPayoutQuerySchema = z.object({ - expand: z.array(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 getPayoutsPayoutBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payouts/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payouts/route.ts index ed57ab20..d6d023d6 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payouts/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/payouts/route.ts @@ -78,7 +78,12 @@ const getPayoutsQuerySchema = z.object({ .optional(), destination: z.string().optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/plans/[plan]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/plans/[plan]/route.ts index 59b5bb66..7c712979 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/plans/[plan]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/plans/[plan]/route.ts @@ -124,7 +124,12 @@ export const _DELETE = const getPlansPlanParamSchema = z.object({ plan: z.string().max(5000) }) const getPlansPlanQuerySchema = z.object({ - expand: z.array(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 getPlansPlanBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/plans/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/plans/route.ts index f7403192..edc14628 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/plans/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/plans/route.ts @@ -64,7 +64,12 @@ const getPlansQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/prices/[price]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/prices/[price]/route.ts index 432e2803..2ab12fc2 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/prices/[price]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/prices/[price]/route.ts @@ -58,7 +58,12 @@ export type PostPricesPrice = ( const getPricesPriceParamSchema = z.object({ price: z.string().max(5000) }) const getPricesPriceQuerySchema = z.object({ - expand: z.array(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 getPricesPriceBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/prices/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/prices/route.ts index a51164f0..ff697e8a 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/prices/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/prices/route.ts @@ -69,9 +69,19 @@ const getPricesQuerySchema = z.object({ .optional(), currency: z.string().optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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.array(z.string().max(5000)).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({ diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/prices/search/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/prices/search/route.ts index 5376fbaa..a0b60474 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/prices/search/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/prices/search/route.ts @@ -44,7 +44,12 @@ export type GetPricesSearch = ( ) => Promise> const getPricesSearchQuerySchema = z.object({ - expand: z.array(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(), page: z.string().max(5000).optional(), query: z.string().max(5000), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/[id]/route.ts index 56a01195..5a901687 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/[id]/route.ts @@ -124,7 +124,12 @@ export const _DELETE = const getProductsIdParamSchema = z.object({ id: z.string().max(5000) }) const getProductsIdQuerySchema = z.object({ - expand: z.array(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 getProductsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/[product]/features/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/[product]/features/[id]/route.ts index d1203008..19db091c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/[product]/features/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/[product]/features/[id]/route.ts @@ -112,7 +112,12 @@ const getProductsProductFeaturesIdParamSchema = z.object({ }) const getProductsProductFeaturesIdQuerySchema = z.object({ - expand: z.array(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 getProductsProductFeaturesIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/[product]/features/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/[product]/features/route.ts index 01a5c0b5..ce2b0bc5 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/[product]/features/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/[product]/features/route.ts @@ -65,7 +65,12 @@ const getProductsProductFeaturesParamSchema = z.object({ const getProductsProductFeaturesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/route.ts index dd7657c4..a0f0b7f2 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/route.ts @@ -68,8 +68,18 @@ const getProductsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(z.string().max(5000)).optional(), - ids: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/search/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/search/route.ts index 18604859..d17796a1 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/search/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/products/search/route.ts @@ -44,7 +44,12 @@ export type GetProductsSearch = ( ) => Promise> const getProductsSearchQuerySchema = z.object({ - expand: z.array(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(), page: z.string().max(5000).optional(), query: z.string().max(5000), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/promotion_codes/[promotion_code]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/promotion_codes/[promotion_code]/route.ts index aa498846..7bede450 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/promotion_codes/[promotion_code]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/promotion_codes/[promotion_code]/route.ts @@ -60,7 +60,12 @@ const getPromotionCodesPromotionCodeParamSchema = z.object({ }) const getPromotionCodesPromotionCodeQuerySchema = z.object({ - expand: z.array(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 getPromotionCodesPromotionCodeBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/promotion_codes/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/promotion_codes/route.ts index e94bc27b..ec620af0 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/promotion_codes/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/promotion_codes/route.ts @@ -71,7 +71,12 @@ const getPromotionCodesQuerySchema = z.object({ .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/computed_upfront_line_items/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/computed_upfront_line_items/route.ts index 5169bc89..156cfe1b 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/computed_upfront_line_items/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/computed_upfront_line_items/route.ts @@ -48,7 +48,12 @@ const getQuotesQuoteComputedUpfrontLineItemsParamSchema = z.object({ const getQuotesQuoteComputedUpfrontLineItemsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/line_items/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/line_items/route.ts index 5bb1a219..b15b989c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/line_items/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/line_items/route.ts @@ -48,7 +48,12 @@ const getQuotesQuoteLineItemsParamSchema = z.object({ const getQuotesQuoteLineItemsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/pdf/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/pdf/route.ts index e8964c8b..4f3eb1f3 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/pdf/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/pdf/route.ts @@ -39,7 +39,12 @@ export type GetQuotesQuotePdf = ( const getQuotesQuotePdfParamSchema = z.object({ quote: z.string().max(5000) }) const getQuotesQuotePdfQuerySchema = z.object({ - expand: z.array(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 getQuotesQuotePdfBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/route.ts index 21dd6097..fa0bc393 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/[quote]/route.ts @@ -58,7 +58,12 @@ export type PostQuotesQuote = ( const getQuotesQuoteParamSchema = z.object({ quote: z.string().max(5000) }) const getQuotesQuoteQuerySchema = z.object({ - expand: z.array(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 getQuotesQuoteBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/route.ts index 47c20fc2..ffde6a0b 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/quotes/route.ts @@ -57,7 +57,12 @@ export type PostQuotes = ( const getQuotesQuerySchema = z.object({ customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/early_fraud_warnings/[early_fraud_warning]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/early_fraud_warnings/[early_fraud_warning]/route.ts index b520d5d3..ad06fb7d 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/early_fraud_warnings/[early_fraud_warning]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/early_fraud_warnings/[early_fraud_warning]/route.ts @@ -42,7 +42,12 @@ const getRadarEarlyFraudWarningsEarlyFraudWarningParamSchema = z.object({ }) const getRadarEarlyFraudWarningsEarlyFraudWarningQuerySchema = z.object({ - expand: z.array(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 getRadarEarlyFraudWarningsEarlyFraudWarningBodySchema = z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/early_fraud_warnings/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/early_fraud_warnings/route.ts index 67febaf4..e2b26a80 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/early_fraud_warnings/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/early_fraud_warnings/route.ts @@ -55,7 +55,12 @@ const getRadarEarlyFraudWarningsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_list_items/[item]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_list_items/[item]/route.ts index 086d70ae..8bb14fc4 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_list_items/[item]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_list_items/[item]/route.ts @@ -110,7 +110,12 @@ const getRadarValueListItemsItemParamSchema = z.object({ }) const getRadarValueListItemsItemQuerySchema = z.object({ - expand: z.array(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 getRadarValueListItemsItemBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_list_items/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_list_items/route.ts index 3e4eb650..a86329d4 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_list_items/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_list_items/route.ts @@ -66,7 +66,12 @@ const getRadarValueListItemsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_lists/[value_list]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_lists/[value_list]/route.ts index 03146dc9..9bbd5455 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_lists/[value_list]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_lists/[value_list]/route.ts @@ -127,7 +127,12 @@ const getRadarValueListsValueListParamSchema = z.object({ }) const getRadarValueListsValueListQuerySchema = z.object({ - expand: z.array(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 getRadarValueListsValueListBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_lists/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_lists/route.ts index 57a5f1a4..e5987f54 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_lists/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/radar/value_lists/route.ts @@ -68,7 +68,12 @@ const getRadarValueListsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/refunds/[refund]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/refunds/[refund]/route.ts index 4936a658..a020faff 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/refunds/[refund]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/refunds/[refund]/route.ts @@ -57,7 +57,12 @@ export type PostRefundsRefund = ( const getRefundsRefundParamSchema = z.object({ refund: z.string() }) const getRefundsRefundQuerySchema = z.object({ - expand: z.array(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 getRefundsRefundBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/refunds/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/refunds/route.ts index d8b697e7..7b69c6e4 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/refunds/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/refunds/route.ts @@ -68,7 +68,12 @@ const getRefundsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().optional(), - expand: z.array(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().optional(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_runs/[report_run]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_runs/[report_run]/route.ts index ce601b74..4207ca55 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_runs/[report_run]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_runs/[report_run]/route.ts @@ -42,7 +42,12 @@ const getReportingReportRunsReportRunParamSchema = z.object({ }) const getReportingReportRunsReportRunQuerySchema = z.object({ - expand: z.array(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 getReportingReportRunsReportRunBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_runs/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_runs/route.ts index c3d2bb6e..41562d8b 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_runs/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_runs/route.ts @@ -66,7 +66,12 @@ const getReportingReportRunsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_types/[report_type]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_types/[report_type]/route.ts index 4fa8e298..93a2cc1e 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_types/[report_type]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_types/[report_type]/route.ts @@ -42,7 +42,12 @@ const getReportingReportTypesReportTypeParamSchema = z.object({ }) const getReportingReportTypesReportTypeQuerySchema = z.object({ - expand: z.array(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 getReportingReportTypesReportTypeBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_types/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_types/route.ts index 03e69687..534d7c20 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_types/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reporting/report_types/route.ts @@ -42,7 +42,12 @@ export type GetReportingReportTypes = ( ) => Promise> const getReportingReportTypesQuerySchema = z.object({ - expand: z.array(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 getReportingReportTypesBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reviews/[review]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reviews/[review]/route.ts index 2760a975..e6d6716b 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reviews/[review]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reviews/[review]/route.ts @@ -40,7 +40,12 @@ export type GetReviewsReview = ( const getReviewsReviewParamSchema = z.object({ review: z.string().max(5000) }) const getReviewsReviewQuerySchema = z.object({ - expand: z.array(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 getReviewsReviewBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reviews/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reviews/route.ts index 71dbf3b6..751dcd0c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reviews/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/reviews/route.ts @@ -54,7 +54,12 @@ const getReviewsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_attempts/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_attempts/route.ts index 575e4dfe..ebe21126 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_attempts/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_attempts/route.ts @@ -54,7 +54,12 @@ const getSetupAttemptsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_intents/[intent]/confirm/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_intents/[intent]/confirm/route.ts index 62e26259..748d4c74 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_intents/[intent]/confirm/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_intents/[intent]/confirm/route.ts @@ -233,6 +233,7 @@ const postSetupIntentsIntentConfirmBodySchema = z link: z.object({}).optional(), metadata: z.record(z.string()).optional(), mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), oxxo: z.object({}).optional(), p24: z .object({ @@ -281,6 +282,7 @@ const postSetupIntentsIntentConfirmBodySchema = 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", @@ -303,6 +305,7 @@ const postSetupIntentsIntentConfirmBodySchema = z "konbini", "link", "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -313,6 +316,7 @@ const postSetupIntentsIntentConfirmBodySchema = z "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", "zip", @@ -356,6 +360,9 @@ const postSetupIntentsIntentConfirmBodySchema = z }) .optional(), amazon_pay: z.object({}).optional(), + bacs_debit: z + .object({ mandate_options: z.object({}).optional() }) + .optional(), card: z .object({ mandate_options: z @@ -379,6 +386,7 @@ const postSetupIntentsIntentConfirmBodySchema = z "diners", "discover", "eftpos_au", + "girocard", "interac", "jcb", "mastercard", @@ -429,6 +437,13 @@ const postSetupIntentsIntentConfirmBodySchema = z .object({ financial_connections: z .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), permissions: z .array( z.enum([ diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_intents/[intent]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_intents/[intent]/route.ts index 4619ebab..27a731ab 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_intents/[intent]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_intents/[intent]/route.ts @@ -61,7 +61,12 @@ const getSetupIntentsIntentParamSchema = z.object({ const getSetupIntentsIntentQuerySchema = z.object({ client_secret: z.string().max(5000).optional(), - expand: z.array(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 getSetupIntentsIntentBodySchema = z.object({}).optional() @@ -287,6 +292,7 @@ const postSetupIntentsIntentBodySchema = z link: z.object({}).optional(), metadata: z.record(z.string()).optional(), mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), oxxo: z.object({}).optional(), p24: z .object({ @@ -335,6 +341,7 @@ const postSetupIntentsIntentBodySchema = 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", @@ -357,6 +364,7 @@ const postSetupIntentsIntentBodySchema = z "konbini", "link", "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -367,6 +375,7 @@ const postSetupIntentsIntentBodySchema = z "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", "zip", @@ -410,6 +419,9 @@ const postSetupIntentsIntentBodySchema = z }) .optional(), amazon_pay: z.object({}).optional(), + bacs_debit: z + .object({ mandate_options: z.object({}).optional() }) + .optional(), card: z .object({ mandate_options: z @@ -433,6 +445,7 @@ const postSetupIntentsIntentBodySchema = z "diners", "discover", "eftpos_au", + "girocard", "interac", "jcb", "mastercard", @@ -483,6 +496,13 @@ const postSetupIntentsIntentBodySchema = z .object({ financial_connections: z .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), permissions: z .array( z.enum([ diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_intents/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_intents/route.ts index 879baf23..ef229ba3 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_intents/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/setup_intents/route.ts @@ -69,7 +69,12 @@ const getSetupIntentsQuerySchema = z.object({ .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), @@ -322,6 +327,7 @@ const postSetupIntentsBodySchema = z link: z.object({}).optional(), metadata: z.record(z.string()).optional(), mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), oxxo: z.object({}).optional(), p24: z .object({ @@ -370,6 +376,7 @@ const postSetupIntentsBodySchema = 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", @@ -392,6 +399,7 @@ const postSetupIntentsBodySchema = z "konbini", "link", "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -402,6 +410,7 @@ const postSetupIntentsBodySchema = z "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", "zip", @@ -445,6 +454,9 @@ const postSetupIntentsBodySchema = z }) .optional(), amazon_pay: z.object({}).optional(), + bacs_debit: z + .object({ mandate_options: z.object({}).optional() }) + .optional(), card: z .object({ mandate_options: z @@ -468,6 +480,7 @@ const postSetupIntentsBodySchema = z "diners", "discover", "eftpos_au", + "girocard", "interac", "jcb", "mastercard", @@ -518,6 +531,13 @@ const postSetupIntentsBodySchema = z .object({ financial_connections: z .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), permissions: z .array( z.enum([ diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/shipping_rates/[shipping_rate_token]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/shipping_rates/[shipping_rate_token]/route.ts index b7bbaf7c..d6fbf445 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/shipping_rates/[shipping_rate_token]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/shipping_rates/[shipping_rate_token]/route.ts @@ -60,7 +60,12 @@ const getShippingRatesShippingRateTokenParamSchema = z.object({ }) const getShippingRatesShippingRateTokenQuerySchema = z.object({ - expand: z.array(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 getShippingRatesShippingRateTokenBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/shipping_rates/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/shipping_rates/route.ts index edc0444d..5a68a344 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/shipping_rates/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/shipping_rates/route.ts @@ -69,7 +69,12 @@ const getShippingRatesQuerySchema = z.object({ .optional(), currency: z.string().optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sigma/scheduled_query_runs/[scheduled_query_run]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sigma/scheduled_query_runs/[scheduled_query_run]/route.ts index d4e28840..c4809e39 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sigma/scheduled_query_runs/[scheduled_query_run]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sigma/scheduled_query_runs/[scheduled_query_run]/route.ts @@ -42,7 +42,12 @@ const getSigmaScheduledQueryRunsScheduledQueryRunParamSchema = z.object({ }) const getSigmaScheduledQueryRunsScheduledQueryRunQuerySchema = z.object({ - expand: z.array(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 getSigmaScheduledQueryRunsScheduledQueryRunBodySchema = z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sigma/scheduled_query_runs/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sigma/scheduled_query_runs/route.ts index e38cb68f..1f7b1ba0 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sigma/scheduled_query_runs/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sigma/scheduled_query_runs/route.ts @@ -43,7 +43,12 @@ export type GetSigmaScheduledQueryRuns = ( const getSigmaScheduledQueryRunsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/mandate_notifications/[mandate_notification]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/mandate_notifications/[mandate_notification]/route.ts index d22e4b83..cbfff35f 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/mandate_notifications/[mandate_notification]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/mandate_notifications/[mandate_notification]/route.ts @@ -45,7 +45,14 @@ const getSourcesSourceMandateNotificationsMandateNotificationParamSchema = }) const getSourcesSourceMandateNotificationsMandateNotificationQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) const getSourcesSourceMandateNotificationsMandateNotificationBodySchema = z .object({}) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/route.ts index 1b0e368a..ed625972 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/route.ts @@ -58,7 +58,12 @@ const getSourcesSourceParamSchema = z.object({ source: z.string().max(5000) }) const getSourcesSourceQuerySchema = z.object({ client_secret: z.string().max(5000).optional(), - expand: z.array(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 getSourcesSourceBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/source_transactions/[source_transaction]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/source_transactions/[source_transaction]/route.ts index 41a20f81..54581419 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/source_transactions/[source_transaction]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/source_transactions/[source_transaction]/route.ts @@ -42,7 +42,14 @@ const getSourcesSourceSourceTransactionsSourceTransactionParamSchema = z.object( ) const getSourcesSourceSourceTransactionsSourceTransactionQuerySchema = z.object( - { expand: z.array(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 getSourcesSourceSourceTransactionsSourceTransactionBodySchema = z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/source_transactions/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/source_transactions/route.ts index 440090c6..223a9b93 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/source_transactions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/sources/[source]/source_transactions/route.ts @@ -48,7 +48,12 @@ const getSourcesSourceSourceTransactionsParamSchema = z.object({ const getSourcesSourceSourceTransactionsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_items/[item]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_items/[item]/route.ts index 79ce1eb4..78c9d6e1 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_items/[item]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_items/[item]/route.ts @@ -136,7 +136,12 @@ const getSubscriptionItemsItemParamSchema = z.object({ }) const getSubscriptionItemsItemQuerySchema = z.object({ - expand: z.array(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 getSubscriptionItemsItemBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_items/[subscription_item]/usage_record_summaries/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_items/[subscription_item]/usage_record_summaries/route.ts index c7c5088d..f9f256d0 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_items/[subscription_item]/usage_record_summaries/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_items/[subscription_item]/usage_record_summaries/route.ts @@ -50,7 +50,12 @@ const getSubscriptionItemsSubscriptionItemUsageRecordSummariesParamSchema = const getSubscriptionItemsSubscriptionItemUsageRecordSummariesQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_items/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_items/route.ts index 4a0cfdba..1ceca111 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_items/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_items/route.ts @@ -55,7 +55,12 @@ export type PostSubscriptionItems = ( const getSubscriptionItemsQuerySchema = z.object({ ending_before: z.string().optional(), - expand: z.array(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().optional(), subscription: z.string().max(5000), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_schedules/[schedule]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_schedules/[schedule]/route.ts index a12309f1..7558a796 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_schedules/[schedule]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_schedules/[schedule]/route.ts @@ -60,7 +60,12 @@ const getSubscriptionSchedulesScheduleParamSchema = z.object({ }) const getSubscriptionSchedulesScheduleQuerySchema = z.object({ - expand: z.array(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 getSubscriptionSchedulesScheduleBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_schedules/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_schedules/route.ts index a815d289..774d90d8 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_schedules/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscription_schedules/route.ts @@ -90,7 +90,12 @@ const getSubscriptionSchedulesQuerySchema = z.object({ .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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([ diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscriptions/[subscription_exposed_id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscriptions/[subscription_exposed_id]/route.ts index 6f5999f2..06d87459 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscriptions/[subscription_exposed_id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscriptions/[subscription_exposed_id]/route.ts @@ -151,7 +151,12 @@ const getSubscriptionsSubscriptionExposedIdParamSchema = z.object({ }) const getSubscriptionsSubscriptionExposedIdQuerySchema = z.object({ - expand: z.array(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 getSubscriptionsSubscriptionExposedIdBodySchema = z.object({}).optional() @@ -435,6 +440,7 @@ const postSubscriptionsSubscriptionExposedIdBodySchema = z "diners", "discover", "eftpos_au", + "girocard", "interac", "jcb", "mastercard", @@ -473,6 +479,13 @@ const postSubscriptionsSubscriptionExposedIdBodySchema = z z.object({ financial_connections: z .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), permissions: z .array( z.enum([ @@ -506,6 +519,7 @@ const postSubscriptionsSubscriptionExposedIdBodySchema = z "ach_credit_transfer", "ach_debit", "acss_debit", + "amazon_pay", "au_becs_debit", "bacs_debit", "bancontact", @@ -520,12 +534,15 @@ const postSubscriptionsSubscriptionExposedIdBodySchema = z "ideal", "konbini", "link", + "multibanco", "p24", "paynow", "paypal", "promptpay", + "revolut_pay", "sepa_debit", "sofort", + "swish", "us_bank_account", "wechat_pay", ]), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscriptions/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscriptions/route.ts index 44303e6d..39d33492 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscriptions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscriptions/route.ts @@ -94,7 +94,12 @@ const getSubscriptionsQuerySchema = z.object({ .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), @@ -372,6 +377,7 @@ const postSubscriptionsBodySchema = z.object({ "diners", "discover", "eftpos_au", + "girocard", "interac", "jcb", "mastercard", @@ -410,6 +416,13 @@ const postSubscriptionsBodySchema = z.object({ z.object({ financial_connections: z .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), permissions: z .array( z.enum([ @@ -441,6 +454,7 @@ const postSubscriptionsBodySchema = z.object({ "ach_credit_transfer", "ach_debit", "acss_debit", + "amazon_pay", "au_becs_debit", "bacs_debit", "bancontact", @@ -455,12 +469,15 @@ const postSubscriptionsBodySchema = z.object({ "ideal", "konbini", "link", + "multibanco", "p24", "paynow", "paypal", "promptpay", + "revolut_pay", "sepa_debit", "sofort", + "swish", "us_bank_account", "wechat_pay", ]), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscriptions/search/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscriptions/search/route.ts index 37bd022e..a4bd645d 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscriptions/search/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/subscriptions/search/route.ts @@ -44,7 +44,12 @@ export type GetSubscriptionsSearch = ( ) => Promise> const getSubscriptionsSearchQuerySchema = z.object({ - expand: z.array(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(), page: z.string().max(5000).optional(), query: z.string().max(5000), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/calculations/[calculation]/line_items/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/calculations/[calculation]/line_items/route.ts index c36667fe..57ae9761 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/calculations/[calculation]/line_items/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/calculations/[calculation]/line_items/route.ts @@ -48,7 +48,12 @@ const getTaxCalculationsCalculationLineItemsParamSchema = z.object({ const getTaxCalculationsCalculationLineItemsQuerySchema = z.object({ ending_before: z.string().max(500).optional(), - expand: z.array(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(500).optional(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/calculations/[calculation]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/calculations/[calculation]/route.ts new file mode 100644 index 00000000..d471fb19 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/calculations/[calculation]/route.ts @@ -0,0 +1,101 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_GetTaxCalculationsCalculationBodySchema, + t_GetTaxCalculationsCalculationParamSchema, + t_GetTaxCalculationsCalculationQuerySchema, + t_error, + t_tax_calculation, +} from "../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type GetTaxCalculationsCalculationResponder = { + with200(): KoaRuntimeResponse + withDefault(status: StatusCode): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type GetTaxCalculationsCalculation = ( + params: Params< + t_GetTaxCalculationsCalculationParamSchema, + t_GetTaxCalculationsCalculationQuerySchema, + t_GetTaxCalculationsCalculationBodySchema | undefined + >, + respond: GetTaxCalculationsCalculationResponder, + ctx: { request: NextRequest }, +) => Promise> + +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 getTaxCalculationsCalculationBodySchema = z.object({}).optional() + +export const _GET = + (implementation: GetTaxCalculationsCalculation) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + getTaxCalculationsCalculationParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: parseRequestInput( + getTaxCalculationsCalculationQuerySchema, + Object.fromEntries(request.nextUrl.searchParams.entries()), + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTaxCalculationsCalculationBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/calculations/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/calculations/route.ts index bb65d359..49de01d8 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/calculations/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/calculations/route.ts @@ -68,11 +68,13 @@ const postTaxCalculationsBodySchema = z.object({ "ca_pst_mb", "ca_pst_sk", "ca_qst", + "ch_uid", "ch_vat", "cl_tin", "cn_tin", "co_nit", "cr_tin", + "de_stn", "do_rcn", "ec_ruc", "eg_tin", @@ -144,6 +146,18 @@ const postTaxCalculationsBodySchema = z.object({ 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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/registrations/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/registrations/[id]/route.ts index 97554971..2a5e3811 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/registrations/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/registrations/[id]/route.ts @@ -57,7 +57,12 @@ export type PostTaxRegistrationsId = ( const getTaxRegistrationsIdParamSchema = z.object({ id: z.string().max(5000) }) const getTaxRegistrationsIdQuerySchema = z.object({ - expand: z.array(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 getTaxRegistrationsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/registrations/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/registrations/route.ts index 495d27c5..14da64ed 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/registrations/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/registrations/route.ts @@ -55,7 +55,12 @@ export type PostTaxRegistrations = ( const getTaxRegistrationsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), @@ -148,6 +153,7 @@ const postTaxRegistrationsBodySchema = z.object({ type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), }) .optional(), + bh: z.object({ type: z.enum(["standard"]) }).optional(), ca: z .object({ province_standard: z @@ -209,6 +215,7 @@ const postTaxRegistrationsBodySchema = z.object({ type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), }) .optional(), + eg: z.object({ type: z.enum(["simplified"]) }).optional(), es: z .object({ standard: z @@ -240,6 +247,7 @@ const postTaxRegistrationsBodySchema = z.object({ }) .optional(), gb: z.object({ type: z.enum(["standard"]) }).optional(), + ge: z.object({ type: z.enum(["simplified"]) }).optional(), gr: z .object({ standard: z @@ -293,7 +301,9 @@ const postTaxRegistrationsBodySchema = z.object({ }) .optional(), jp: z.object({ type: z.enum(["standard"]) }).optional(), + ke: 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 @@ -336,6 +346,7 @@ const postTaxRegistrationsBodySchema = z.object({ .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 @@ -348,6 +359,7 @@ const postTaxRegistrationsBodySchema = z.object({ .optional(), no: z.object({ type: z.enum(["standard"]) }).optional(), nz: z.object({ type: z.enum(["standard"]) }).optional(), + om: z.object({ type: z.enum(["standard"]) }).optional(), pl: z .object({ standard: z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/settings/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/settings/route.ts index c5aa25d9..05f30f76 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/settings/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/settings/route.ts @@ -49,7 +49,12 @@ export type PostTaxSettings = ( ) => Promise> const getTaxSettingsQuerySchema = z.object({ - expand: z.array(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 getTaxSettingsBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/transactions/[transaction]/line_items/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/transactions/[transaction]/line_items/route.ts index 599eebe1..fd300a24 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/transactions/[transaction]/line_items/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/transactions/[transaction]/line_items/route.ts @@ -48,7 +48,12 @@ const getTaxTransactionsTransactionLineItemsParamSchema = z.object({ const getTaxTransactionsTransactionLineItemsQuerySchema = z.object({ ending_before: z.string().max(500).optional(), - expand: z.array(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(500).optional(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/transactions/[transaction]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/transactions/[transaction]/route.ts index 870602de..9f578bb3 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/transactions/[transaction]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/transactions/[transaction]/route.ts @@ -42,7 +42,12 @@ const getTaxTransactionsTransactionParamSchema = z.object({ }) const getTaxTransactionsTransactionQuerySchema = z.object({ - expand: z.array(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 getTaxTransactionsTransactionBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/transactions/create_from_calculation/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/transactions/create_from_calculation/route.ts index cce19d37..5b85491a 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/transactions/create_from_calculation/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax/transactions/create_from_calculation/route.ts @@ -39,6 +39,7 @@ const postTaxTransactionsCreateFromCalculationBodySchema = 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), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_codes/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_codes/[id]/route.ts index 8ed6b281..02266789 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_codes/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_codes/[id]/route.ts @@ -40,7 +40,12 @@ export type GetTaxCodesId = ( const getTaxCodesIdParamSchema = z.object({ id: z.string().max(5000) }) const getTaxCodesIdQuerySchema = z.object({ - expand: z.array(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 getTaxCodesIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_codes/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_codes/route.ts index 22013fd7..0100a1c4 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_codes/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_codes/route.ts @@ -43,7 +43,12 @@ export type GetTaxCodes = ( const getTaxCodesQuerySchema = z.object({ ending_before: z.string().optional(), - expand: z.array(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().optional(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_ids/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_ids/[id]/route.ts index 9d119870..8b4d0ac8 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_ids/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_ids/[id]/route.ts @@ -106,7 +106,12 @@ export const _DELETE = const getTaxIdsIdParamSchema = z.object({ id: z.string().max(5000) }) const getTaxIdsIdQuerySchema = z.object({ - expand: z.array(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 getTaxIdsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_ids/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_ids/route.ts index e241aac2..c6815acb 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_ids/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_ids/route.ts @@ -55,7 +55,12 @@ export type PostTaxIds = ( const getTaxIdsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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({ @@ -144,11 +149,13 @@ const postTaxIdsBodySchema = z.object({ "ca_pst_mb", "ca_pst_sk", "ca_qst", + "ch_uid", "ch_vat", "cl_tin", "cn_tin", "co_nit", "cr_tin", + "de_stn", "do_rcn", "ec_ruc", "eg_tin", diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_rates/[tax_rate]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_rates/[tax_rate]/route.ts index 604936f6..72a26d5d 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_rates/[tax_rate]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_rates/[tax_rate]/route.ts @@ -60,7 +60,12 @@ const getTaxRatesTaxRateParamSchema = z.object({ }) const getTaxRatesTaxRateQuerySchema = z.object({ - expand: z.array(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 getTaxRatesTaxRateBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_rates/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_rates/route.ts index 7d21f566..2579e612 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_rates/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tax_rates/route.ts @@ -68,7 +68,12 @@ const getTaxRatesQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/configurations/[configuration]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/configurations/[configuration]/route.ts index 5b47d7e4..246c0ae6 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/configurations/[configuration]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/configurations/[configuration]/route.ts @@ -134,7 +134,12 @@ const getTerminalConfigurationsConfigurationParamSchema = z.object({ }) const getTerminalConfigurationsConfigurationQuerySchema = z.object({ - expand: z.array(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 getTerminalConfigurationsConfigurationBodySchema = z.object({}).optional() @@ -208,6 +213,23 @@ const postTerminalConfigurationsConfigurationBodySchema = z 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({ diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/configurations/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/configurations/route.ts index 8637ed0a..afb9f14d 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/configurations/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/configurations/route.ts @@ -60,7 +60,12 @@ export type PostTerminalConfigurations = ( const getTerminalConfigurationsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), @@ -127,6 +132,12 @@ const postTerminalConfigurationsBodySchema = z 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({ diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/locations/[location]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/locations/[location]/route.ts index ef3e2be3..43fa033e 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/locations/[location]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/locations/[location]/route.ts @@ -131,7 +131,12 @@ const getTerminalLocationsLocationParamSchema = z.object({ }) const getTerminalLocationsLocationQuerySchema = z.object({ - expand: z.array(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 getTerminalLocationsLocationBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/locations/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/locations/route.ts index 61758b54..5af60e4e 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/locations/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/locations/route.ts @@ -55,7 +55,12 @@ export type PostTerminalLocations = ( const getTerminalLocationsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/readers/[reader]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/readers/[reader]/route.ts index dfdad836..33a09faf 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/readers/[reader]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/readers/[reader]/route.ts @@ -127,7 +127,12 @@ const getTerminalReadersReaderParamSchema = z.object({ }) const getTerminalReadersReaderQuerySchema = z.object({ - expand: z.array(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 getTerminalReadersReaderBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/readers/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/readers/route.ts index 69889c74..4927ab21 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/readers/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/terminal/readers/route.ts @@ -62,11 +62,17 @@ const getTerminalReadersQuerySchema = z.object({ "mobile_phone_reader", "simulated_wisepos_e", "stripe_m2", + "stripe_s700", "verifone_P400", ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/confirmation_tokens/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/confirmation_tokens/route.ts index d93ac62e..f26db919 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/confirmation_tokens/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/confirmation_tokens/route.ts @@ -198,6 +198,7 @@ const postTestHelpersConfirmationTokensBodySchema = z link: z.object({}).optional(), metadata: z.record(z.string()).optional(), mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), oxxo: z.object({}).optional(), p24: z .object({ @@ -246,6 +247,7 @@ const postTestHelpersConfirmationTokensBodySchema = 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", @@ -268,6 +270,7 @@ const postTestHelpersConfirmationTokensBodySchema = z "konbini", "link", "mobilepay", + "multibanco", "oxxo", "p24", "paynow", @@ -278,6 +281,7 @@ const postTestHelpersConfirmationTokensBodySchema = z "sepa_debit", "sofort", "swish", + "twint", "us_bank_account", "wechat_pay", "zip", diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/authorizations/[authorization]/capture/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/authorizations/[authorization]/capture/route.ts index af5869d9..35546046 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/authorizations/[authorization]/capture/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/authorizations/[authorization]/capture/route.ts @@ -49,6 +49,45 @@ const postTestHelpersIssuingAuthorizationsAuthorizationCaptureBodySchema = z 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(), @@ -71,6 +110,8 @@ const postTestHelpersIssuingAuthorizationsAuthorizationCaptureBodySchema = z .optional(), fuel: z .object({ + industry_product_code: z.string().max(5000).optional(), + quantity_decimal: z.string().optional(), type: z .enum([ "diesel", @@ -80,9 +121,19 @@ const postTestHelpersIssuingAuthorizationsAuthorizationCaptureBodySchema = z "unleaded_super", ]) .optional(), - unit: z.enum(["liter", "other", "us_gallon"]).optional(), + unit: z + .enum([ + "charging_minute", + "imperial_gallon", + "kilogram", + "kilowatt_hour", + "liter", + "other", + "pound", + "us_gallon", + ]) + .optional(), unit_cost_decimal: z.string().optional(), - volume_decimal: z.string().optional(), }) .optional(), lodging: z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/authorizations/[authorization]/finalize_amount/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/authorizations/[authorization]/finalize_amount/route.ts new file mode 100644 index 00000000..7768c0af --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/authorizations/[authorization]/finalize_amount/route.ts @@ -0,0 +1,160 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountBodySchema, + t_PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountParamSchema, + t_error, + t_issuing_authorization, +} from "../../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountResponder = + { + with200(): KoaRuntimeResponse + withDefault(status: StatusCode): KoaRuntimeResponse + } & KoaRuntimeResponder + +export type PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmount = ( + params: Params< + t_PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountParamSchema, + void, + t_PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountBodySchema + >, + respond: PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountResponder, + ctx: { request: NextRequest }, +) => Promise> + +const postTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountParamSchema = + z.object({ authorization: z.string().max(5000) }) + +const postTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountBodySchema = + 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(), + }) + +export const _POST = + ( + implementation: PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmount, + ) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + postTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/authorizations/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/authorizations/route.ts index f9e88b0e..a3e91ee5 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/authorizations/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/authorizations/route.ts @@ -46,6 +46,73 @@ const postTestHelpersIssuingAuthorizationsBodySchema = z.object({ 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_data: z .object({ diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/settlements/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/settlements/route.ts new file mode 100644 index 00000000..f78d193e --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/settlements/route.ts @@ -0,0 +1,84 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_PostTestHelpersIssuingSettlementsBodySchema, + t_error, + t_issuing_settlement, +} from "../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type PostTestHelpersIssuingSettlementsResponder = { + with200(): KoaRuntimeResponse + withDefault(status: StatusCode): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type PostTestHelpersIssuingSettlements = ( + params: Params, + respond: PostTestHelpersIssuingSettlementsResponder, + ctx: { request: NextRequest }, +) => Promise> + +const postTestHelpersIssuingSettlementsBodySchema = 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: z.coerce.number().optional(), + net_total: z.coerce.number(), + network_settlement_identifier: z.string().max(5000).optional(), + transaction_count: z.coerce.number().optional(), + transaction_volume: z.coerce.number().optional(), +}) + +export const _POST = + (implementation: PostTestHelpersIssuingSettlements) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: undefined, + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingSettlementsBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/transactions/create_force_capture/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/transactions/create_force_capture/route.ts index b1c81c15..73fa69d9 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/transactions/create_force_capture/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/transactions/create_force_capture/route.ts @@ -354,6 +354,45 @@ const postTestHelpersIssuingTransactionsCreateForceCaptureBodySchema = z.object( .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(), @@ -376,6 +415,8 @@ const postTestHelpersIssuingTransactionsCreateForceCaptureBodySchema = z.object( .optional(), fuel: z .object({ + industry_product_code: z.string().max(5000).optional(), + quantity_decimal: z.string().optional(), type: z .enum([ "diesel", @@ -385,9 +426,19 @@ const postTestHelpersIssuingTransactionsCreateForceCaptureBodySchema = z.object( "unleaded_super", ]) .optional(), - unit: z.enum(["liter", "other", "us_gallon"]).optional(), + unit: z + .enum([ + "charging_minute", + "imperial_gallon", + "kilogram", + "kilowatt_hour", + "liter", + "other", + "pound", + "us_gallon", + ]) + .optional(), unit_cost_decimal: z.string().optional(), - volume_decimal: z.string().optional(), }) .optional(), lodging: z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/transactions/create_unlinked_refund/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/transactions/create_unlinked_refund/route.ts index efe8d046..18b34b9c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/transactions/create_unlinked_refund/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/issuing/transactions/create_unlinked_refund/route.ts @@ -354,6 +354,45 @@ const postTestHelpersIssuingTransactionsCreateUnlinkedRefundBodySchema = .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(), @@ -376,6 +415,8 @@ const postTestHelpersIssuingTransactionsCreateUnlinkedRefundBodySchema = .optional(), fuel: z .object({ + industry_product_code: z.string().max(5000).optional(), + quantity_decimal: z.string().optional(), type: z .enum([ "diesel", @@ -385,9 +426,19 @@ const postTestHelpersIssuingTransactionsCreateUnlinkedRefundBodySchema = "unleaded_super", ]) .optional(), - unit: z.enum(["liter", "other", "us_gallon"]).optional(), + unit: z + .enum([ + "charging_minute", + "imperial_gallon", + "kilogram", + "kilowatt_hour", + "liter", + "other", + "pound", + "us_gallon", + ]) + .optional(), unit_cost_decimal: z.string().optional(), - volume_decimal: z.string().optional(), }) .optional(), lodging: z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/test_clocks/[test_clock]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/test_clocks/[test_clock]/route.ts index 70c76450..53b5e7d6 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/test_clocks/[test_clock]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/test_clocks/[test_clock]/route.ts @@ -110,7 +110,12 @@ const getTestHelpersTestClocksTestClockParamSchema = z.object({ }) const getTestHelpersTestClocksTestClockQuerySchema = z.object({ - expand: z.array(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 getTestHelpersTestClocksTestClockBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/test_clocks/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/test_clocks/route.ts index d5ca1dcf..2b5b2d88 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/test_clocks/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/test_clocks/route.ts @@ -55,7 +55,12 @@ export type PostTestHelpersTestClocks = ( const getTestHelpersTestClocksQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/treasury/outbound_payments/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/treasury/outbound_payments/[id]/route.ts new file mode 100644 index 00000000..816afc51 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/treasury/outbound_payments/[id]/route.ts @@ -0,0 +1,100 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_PostTestHelpersTreasuryOutboundPaymentsIdBodySchema, + t_PostTestHelpersTreasuryOutboundPaymentsIdParamSchema, + t_error, + t_treasury_outbound_payment, +} from "../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type PostTestHelpersTreasuryOutboundPaymentsIdResponder = { + with200(): KoaRuntimeResponse + withDefault(status: StatusCode): KoaRuntimeResponse +} & KoaRuntimeResponder + +export type PostTestHelpersTreasuryOutboundPaymentsId = ( + params: Params< + t_PostTestHelpersTreasuryOutboundPaymentsIdParamSchema, + void, + t_PostTestHelpersTreasuryOutboundPaymentsIdBodySchema + >, + respond: PostTestHelpersTreasuryOutboundPaymentsIdResponder, + ctx: { request: NextRequest }, +) => Promise> + +const postTestHelpersTreasuryOutboundPaymentsIdParamSchema = z.object({ + id: z.string().max(5000), +}) + +const postTestHelpersTreasuryOutboundPaymentsIdBodySchema = 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(), + }), +}) + +export const _POST = + (implementation: PostTestHelpersTreasuryOutboundPaymentsId) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + postTestHelpersTreasuryOutboundPaymentsIdParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + postTestHelpersTreasuryOutboundPaymentsIdBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/treasury/outbound_transfers/[outbound_transfer]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/treasury/outbound_transfers/[outbound_transfer]/route.ts new file mode 100644 index 00000000..90e87c17 --- /dev/null +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/test_helpers/treasury/outbound_transfers/[outbound_transfer]/route.ts @@ -0,0 +1,101 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferBodySchema, + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferParamSchema, + t_error, + t_treasury_outbound_transfer, +} from "../../../../../models" +import { + KoaRuntimeError, + RequestInputType, +} from "@nahkies/typescript-koa-runtime/errors" +import { + KoaRuntimeResponder, + KoaRuntimeResponse, + StatusCode, +} from "@nahkies/typescript-koa-runtime/server" +import { Params, parseRequestInput } from "@nahkies/typescript-koa-runtime/zod" +import { NextRequest } from "next/server" +import { z } from "zod" + +export type PostTestHelpersTreasuryOutboundTransfersOutboundTransferResponder = + { + with200(): KoaRuntimeResponse + withDefault(status: StatusCode): KoaRuntimeResponse + } & KoaRuntimeResponder + +export type PostTestHelpersTreasuryOutboundTransfersOutboundTransfer = ( + params: Params< + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferParamSchema, + void, + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferBodySchema + >, + respond: PostTestHelpersTreasuryOutboundTransfersOutboundTransferResponder, + ctx: { request: NextRequest }, +) => Promise> + +const postTestHelpersTreasuryOutboundTransfersOutboundTransferParamSchema = + z.object({ outbound_transfer: z.string().max(5000) }) + +const postTestHelpersTreasuryOutboundTransfersOutboundTransferBodySchema = + 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(), + }), + }) + +export const _POST = + (implementation: PostTestHelpersTreasuryOutboundTransfersOutboundTransfer) => + async ( + request: NextRequest, + { params }: { params: unknown }, + ): Promise => { + const input = { + params: parseRequestInput( + postTestHelpersTreasuryOutboundTransfersOutboundTransferParamSchema, + params, + RequestInputType.RouteParam, + ), + // TODO: this swallows repeated parameters + query: undefined, + body: parseRequestInput( + postTestHelpersTreasuryOutboundTransfersOutboundTransferBodySchema, + await request.json(), + RequestInputType.RequestBody, + ), + } + + const responder = { + with200() { + return new KoaRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new KoaRuntimeResponse(status) + }, + } + + const { status, body } = await implementation(input, responder, { request }) + .then((it) => it.unpack()) + .catch((err) => { + throw KoaRuntimeError.HandlerError(err) + }) + + return body !== undefined + ? Response.json(body, { status }) + : new Response(undefined, { status }) + } diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tokens/[token]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tokens/[token]/route.ts index d8f15778..1310e867 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tokens/[token]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/tokens/[token]/route.ts @@ -40,7 +40,12 @@ export type GetTokensToken = ( const getTokensTokenParamSchema = z.object({ token: z.string().max(5000) }) const getTokensTokenQuerySchema = z.object({ - expand: z.array(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 getTokensTokenBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/topups/[topup]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/topups/[topup]/route.ts index 9a38fa25..18c43519 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/topups/[topup]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/topups/[topup]/route.ts @@ -57,7 +57,12 @@ export type PostTopupsTopup = ( const getTopupsTopupParamSchema = z.object({ topup: z.string().max(5000) }) const getTopupsTopupQuerySchema = z.object({ - expand: z.array(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 getTopupsTopupBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/topups/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/topups/route.ts index eb09daef..63114c28 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/topups/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/topups/route.ts @@ -77,7 +77,12 @@ const getTopupsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/[id]/reversals/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/[id]/reversals/route.ts index c11dfa8c..3538280b 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/[id]/reversals/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/[id]/reversals/route.ts @@ -66,7 +66,12 @@ const getTransfersIdReversalsParamSchema = z.object({ const getTransfersIdReversalsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/[transfer]/reversals/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/[transfer]/reversals/[id]/route.ts index a095084e..8f922695 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/[transfer]/reversals/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/[transfer]/reversals/[id]/route.ts @@ -60,7 +60,12 @@ const getTransfersTransferReversalsIdParamSchema = z.object({ }) const getTransfersTransferReversalsIdQuerySchema = z.object({ - expand: z.array(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 getTransfersTransferReversalsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/[transfer]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/[transfer]/route.ts index ffeab78c..c4bbe876 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/[transfer]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/[transfer]/route.ts @@ -59,7 +59,12 @@ const getTransfersTransferParamSchema = z.object({ }) const getTransfersTransferQuerySchema = z.object({ - expand: z.array(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 getTransfersTransferBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/route.ts index b4d35eda..568663a2 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/transfers/route.ts @@ -67,7 +67,12 @@ const getTransfersQuerySchema = z.object({ .optional(), destination: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/credit_reversals/[credit_reversal]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/credit_reversals/[credit_reversal]/route.ts index d69912ef..ff25bb5a 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/credit_reversals/[credit_reversal]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/credit_reversals/[credit_reversal]/route.ts @@ -42,7 +42,12 @@ const getTreasuryCreditReversalsCreditReversalParamSchema = z.object({ }) const getTreasuryCreditReversalsCreditReversalQuerySchema = z.object({ - expand: z.array(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 getTreasuryCreditReversalsCreditReversalBodySchema = z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/credit_reversals/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/credit_reversals/route.ts index 4939daff..5ef66b1e 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/credit_reversals/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/credit_reversals/route.ts @@ -55,7 +55,12 @@ export type PostTreasuryCreditReversals = ( const getTreasuryCreditReversalsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/debit_reversals/[debit_reversal]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/debit_reversals/[debit_reversal]/route.ts index 179be99d..15b7eb1a 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/debit_reversals/[debit_reversal]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/debit_reversals/[debit_reversal]/route.ts @@ -42,7 +42,12 @@ const getTreasuryDebitReversalsDebitReversalParamSchema = z.object({ }) const getTreasuryDebitReversalsDebitReversalQuerySchema = z.object({ - expand: z.array(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 getTreasuryDebitReversalsDebitReversalBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/debit_reversals/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/debit_reversals/route.ts index af95f280..9571adb8 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/debit_reversals/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/debit_reversals/route.ts @@ -55,7 +55,12 @@ export type PostTreasuryDebitReversals = ( const getTreasuryDebitReversalsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/financial_accounts/[financial_account]/features/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/financial_accounts/[financial_account]/features/route.ts index 62e96d07..d0ef4701 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/financial_accounts/[financial_account]/features/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/financial_accounts/[financial_account]/features/route.ts @@ -60,7 +60,14 @@ const getTreasuryFinancialAccountsFinancialAccountFeaturesParamSchema = z.object({ financial_account: z.string().max(5000) }) const getTreasuryFinancialAccountsFinancialAccountFeaturesQuerySchema = - z.object({ expand: z.array(z.string().max(5000)).optional() }) + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) const getTreasuryFinancialAccountsFinancialAccountFeaturesBodySchema = z .object({}) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/financial_accounts/[financial_account]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/financial_accounts/[financial_account]/route.ts index 9aa954f5..1eef95c8 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/financial_accounts/[financial_account]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/financial_accounts/[financial_account]/route.ts @@ -60,7 +60,12 @@ const getTreasuryFinancialAccountsFinancialAccountParamSchema = z.object({ }) const getTreasuryFinancialAccountsFinancialAccountQuerySchema = z.object({ - expand: z.array(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 getTreasuryFinancialAccountsFinancialAccountBodySchema = z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/financial_accounts/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/financial_accounts/route.ts index fe9e299f..d4c3eae4 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/financial_accounts/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/financial_accounts/route.ts @@ -67,7 +67,12 @@ const getTreasuryFinancialAccountsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/inbound_transfers/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/inbound_transfers/[id]/route.ts index e37598b2..bae5f21b 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/inbound_transfers/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/inbound_transfers/[id]/route.ts @@ -42,7 +42,12 @@ const getTreasuryInboundTransfersIdParamSchema = z.object({ }) const getTreasuryInboundTransfersIdQuerySchema = z.object({ - expand: z.array(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 getTreasuryInboundTransfersIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/inbound_transfers/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/inbound_transfers/route.ts index 59ebf826..3dd010e1 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/inbound_transfers/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/inbound_transfers/route.ts @@ -55,7 +55,12 @@ export type PostTreasuryInboundTransfers = ( const getTreasuryInboundTransfersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_payments/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_payments/[id]/route.ts index 880ece4a..0f481d23 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_payments/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_payments/[id]/route.ts @@ -42,7 +42,12 @@ const getTreasuryOutboundPaymentsIdParamSchema = z.object({ }) const getTreasuryOutboundPaymentsIdQuerySchema = z.object({ - expand: z.array(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 getTreasuryOutboundPaymentsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_payments/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_payments/route.ts index acecfb38..926c9d60 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_payments/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_payments/route.ts @@ -68,7 +68,12 @@ const getTreasuryOutboundPaymentsQuerySchema = z.object({ .optional(), customer: z.string().max(5000).optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_transfers/[outbound_transfer]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_transfers/[outbound_transfer]/route.ts index 876ff49a..4c2ab8d2 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_transfers/[outbound_transfer]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_transfers/[outbound_transfer]/route.ts @@ -42,7 +42,12 @@ const getTreasuryOutboundTransfersOutboundTransferParamSchema = z.object({ }) const getTreasuryOutboundTransfersOutboundTransferQuerySchema = z.object({ - expand: z.array(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 getTreasuryOutboundTransfersOutboundTransferBodySchema = z diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_transfers/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_transfers/route.ts index 9e80e889..4e2c52c9 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_transfers/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/outbound_transfers/route.ts @@ -55,7 +55,12 @@ export type PostTreasuryOutboundTransfers = ( const getTreasuryOutboundTransfersQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_credits/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_credits/[id]/route.ts index 21ab12ef..579f73a1 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_credits/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_credits/[id]/route.ts @@ -42,7 +42,12 @@ const getTreasuryReceivedCreditsIdParamSchema = z.object({ }) const getTreasuryReceivedCreditsIdQuerySchema = z.object({ - expand: z.array(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 getTreasuryReceivedCreditsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_credits/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_credits/route.ts index 3554de9f..f315b381 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_credits/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_credits/route.ts @@ -43,7 +43,12 @@ export type GetTreasuryReceivedCredits = ( const getTreasuryReceivedCreditsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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 diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_debits/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_debits/[id]/route.ts index 4c889c0e..1e92235c 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_debits/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_debits/[id]/route.ts @@ -42,7 +42,12 @@ const getTreasuryReceivedDebitsIdParamSchema = z.object({ }) const getTreasuryReceivedDebitsIdQuerySchema = z.object({ - expand: z.array(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 getTreasuryReceivedDebitsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_debits/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_debits/route.ts index 2a15761e..816d61b5 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_debits/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/received_debits/route.ts @@ -43,7 +43,12 @@ export type GetTreasuryReceivedDebits = ( const getTreasuryReceivedDebitsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transaction_entries/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transaction_entries/[id]/route.ts index 1e58a0ee..6b8e6ecb 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transaction_entries/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transaction_entries/[id]/route.ts @@ -42,7 +42,12 @@ const getTreasuryTransactionEntriesIdParamSchema = z.object({ }) const getTreasuryTransactionEntriesIdQuerySchema = z.object({ - expand: z.array(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 getTreasuryTransactionEntriesIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transaction_entries/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transaction_entries/route.ts index c1fdfc5f..9dd0fcfc 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transaction_entries/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transaction_entries/route.ts @@ -65,7 +65,12 @@ const getTreasuryTransactionEntriesQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transactions/[id]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transactions/[id]/route.ts index 95e3d41c..d568dfd8 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transactions/[id]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transactions/[id]/route.ts @@ -42,7 +42,12 @@ const getTreasuryTransactionsIdParamSchema = z.object({ }) const getTreasuryTransactionsIdQuerySchema = z.object({ - expand: z.array(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 getTreasuryTransactionsIdBodySchema = z.object({}).optional() diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transactions/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transactions/route.ts index 2590d644..2aad5da4 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transactions/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/treasury/transactions/route.ts @@ -54,7 +54,12 @@ const getTreasuryTransactionsQuerySchema = z.object({ ]) .optional(), ending_before: z.string().max(5000).optional(), - expand: z.array(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(), diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/webhook_endpoints/[webhook_endpoint]/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/webhook_endpoints/[webhook_endpoint]/route.ts index 2d8bdde5..fe5fbcdf 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/webhook_endpoints/[webhook_endpoint]/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/webhook_endpoints/[webhook_endpoint]/route.ts @@ -128,7 +128,12 @@ const getWebhookEndpointsWebhookEndpointParamSchema = z.object({ }) const getWebhookEndpointsWebhookEndpointQuerySchema = z.object({ - expand: z.array(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 getWebhookEndpointsWebhookEndpointBodySchema = z.object({}).optional() @@ -203,6 +208,7 @@ const postWebhookEndpointsWebhookEndpointBodySchema = z "application_fee.refund.updated", "application_fee.refunded", "balance.available", + "billing.alert.triggered", "billing_portal.configuration.created", "billing_portal.configuration.updated", "billing_portal.session.created", @@ -280,6 +286,7 @@ const postWebhookEndpointsWebhookEndpointBodySchema = z "invoice.finalization_failed", "invoice.finalized", "invoice.marked_uncollectible", + "invoice.overdue", "invoice.paid", "invoice.payment_action_required", "invoice.payment_failed", @@ -288,6 +295,7 @@ const postWebhookEndpointsWebhookEndpointBodySchema = z "invoice.upcoming", "invoice.updated", "invoice.voided", + "invoice.will_be_due", "invoiceitem.created", "invoiceitem.deleted", "issuing_authorization.created", @@ -300,8 +308,13 @@ const postWebhookEndpointsWebhookEndpointBodySchema = z "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", @@ -410,12 +423,14 @@ const postWebhookEndpointsWebhookEndpointBodySchema = z "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", diff --git a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/webhook_endpoints/route.ts b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/webhook_endpoints/route.ts index 01c23e60..6a842372 100644 --- a/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/webhook_endpoints/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/stripe.yaml/v1/webhook_endpoints/route.ts @@ -56,7 +56,12 @@ export type PostWebhookEndpoints = ( const getWebhookEndpointsQuerySchema = z.object({ ending_before: z.string().max(5000).optional(), - expand: z.array(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(), }) @@ -216,6 +221,7 @@ const postWebhookEndpointsBodySchema = z.object({ "2023-08-16", "2023-10-16", "2024-04-10", + "2024-06-20", ]) .optional(), connect: PermissiveBoolean.optional(), @@ -233,6 +239,7 @@ const postWebhookEndpointsBodySchema = z.object({ "application_fee.refund.updated", "application_fee.refunded", "balance.available", + "billing.alert.triggered", "billing_portal.configuration.created", "billing_portal.configuration.updated", "billing_portal.session.created", @@ -310,6 +317,7 @@ const postWebhookEndpointsBodySchema = z.object({ "invoice.finalization_failed", "invoice.finalized", "invoice.marked_uncollectible", + "invoice.overdue", "invoice.paid", "invoice.payment_action_required", "invoice.payment_failed", @@ -318,6 +326,7 @@ const postWebhookEndpointsBodySchema = z.object({ "invoice.upcoming", "invoice.updated", "invoice.voided", + "invoice.will_be_due", "invoiceitem.created", "invoiceitem.deleted", "issuing_authorization.created", @@ -330,8 +339,13 @@ const postWebhookEndpointsBodySchema = z.object({ "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", @@ -440,12 +454,14 @@ const postWebhookEndpointsBodySchema = z.object({ "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", diff --git a/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/clients/client.ts b/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/clients/client.ts index a9c5acdc..16cadbbc 100644 --- a/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/clients/client.ts +++ b/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/clients/client.ts @@ -2,7 +2,12 @@ /* tslint:disable */ /* eslint-disable */ -import { t_CreateUpdateTodoList, t_Error, t_TodoList } from "../models" +import { + t_CreateUpdateTodoList, + t_Error, + t_Statuses, + t_TodoList, +} from "../models" import { AbstractFetchClient, AbstractFetchClientConfig, @@ -23,15 +28,25 @@ export class ApiClient extends AbstractFetchClient { async getTodoLists( p: { created?: string - status?: "incomplete" | "complete" + statuses?: t_Statuses + tags?: string[] } = {}, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/list` - const query = this._query({ created: p["created"], status: p["status"] }) + const headers = this._headers({}, opts.headers) + const query = this._query({ + created: p["created"], + statuses: p["statuses"], + tags: p["tags"], + }) - return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch( + url + query, + { method: "GET", ...opts, headers }, + timeout, + ) } async getTodoListById( @@ -39,15 +54,16 @@ export class ApiClient extends AbstractFetchClient { listId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_TodoList> | Res | Res > > { const url = this.basePath + `/list/${p["listId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async updateTodoListById( @@ -56,21 +72,20 @@ export class ApiClient extends AbstractFetchClient { requestBody: t_CreateUpdateTodoList }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<200, t_TodoList> | Res | Res > > { const url = this.basePath + `/list/${p["listId"]}` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "PUT", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "PUT", body, ...opts, headers }, timeout) } async deleteTodoListById( @@ -78,15 +93,16 @@ export class ApiClient extends AbstractFetchClient { listId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< Res<204, void> | Res | Res > > { const url = this.basePath + `/list/${p["listId"]}` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "DELETE", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "DELETE", ...opts, headers }, timeout) } async getTodoListItems( @@ -94,7 +110,7 @@ export class ApiClient extends AbstractFetchClient { listId: string }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise< TypedFetchResponse< | Res< @@ -116,8 +132,9 @@ export class ApiClient extends AbstractFetchClient { > > { const url = this.basePath + `/list/${p["listId"]}/items` + const headers = this._headers({}, opts.headers) - return this._fetch(url, { method: "GET", ...(opts ?? {}) }, timeout) + return this._fetch(url, { method: "GET", ...opts, headers }, timeout) } async createTodoListItem( @@ -130,16 +147,15 @@ export class ApiClient extends AbstractFetchClient { } }, timeout?: number, - opts?: RequestInit, + opts: RequestInit = {}, ): Promise>> { const url = this.basePath + `/list/${p["listId"]}/items` - const headers = this._headers({ "Content-Type": "application/json" }) + const headers = this._headers( + { "Content-Type": "application/json" }, + opts.headers, + ) const body = JSON.stringify(p.requestBody) - return this._fetch( - url, - { method: "POST", headers, body, ...(opts ?? {}) }, - timeout, - ) + return this._fetch(url, { method: "POST", body, ...opts, headers }, timeout) } } diff --git a/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/list/route.ts b/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/list/route.ts index 9c24d92b..caab98cf 100644 --- a/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/list/route.ts +++ b/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/list/route.ts @@ -3,6 +3,7 @@ /* eslint-disable */ import { t_GetTodoListsQuerySchema, t_TodoList } from "../models" +import { s_Statuses } from "../schemas" import { KoaRuntimeError, RequestInputType, @@ -28,7 +29,18 @@ export type GetTodoLists = ( const getTodoListsQuerySchema = z.object({ created: z.string().datetime({ offset: true }).optional(), - status: z.enum(["incomplete", "complete"]).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(), }) export const _GET = diff --git a/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/models.ts b/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/models.ts index 9588fef4..2d4a45fb 100644 --- a/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/models.ts +++ b/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/models.ts @@ -11,6 +11,8 @@ export type t_CreateUpdateTodoList = { name: string } +export type t_Statuses = ("incomplete" | "complete")[] + export type t_TodoList = { created: string id: string @@ -44,7 +46,8 @@ export type t_GetTodoListItemsParamSchema = { export type t_GetTodoListsQuerySchema = { created?: string - status?: "incomplete" | "complete" + statuses?: t_Statuses + tags?: string[] } export type t_UpdateTodoListByIdBodySchema = { diff --git a/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/schemas.ts b/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/schemas.ts index 3c99ec6c..09f123e7 100644 --- a/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/schemas.ts +++ b/integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/schemas.ts @@ -6,6 +6,13 @@ 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(), @@ -14,8 +21,3 @@ export const s_TodoList = z.object({ created: z.string().datetime({ offset: true }), updated: z.string().datetime({ offset: true }), }) - -export const s_Error = z.object({ - message: z.string().optional(), - code: z.coerce.number().optional(), -}) diff --git a/packages/openapi-code-generator/src/cli.ts b/packages/openapi-code-generator/src/cli.ts index f4ee3059..6372c866 100644 --- a/packages/openapi-code-generator/src/cli.ts +++ b/packages/openapi-code-generator/src/cli.ts @@ -87,6 +87,7 @@ const program = new Command() .env("OPENAPI_TEMPLATE") .choices([ "typescript-koa", + "typescript-nextjs", "typescript-axios", "typescript-fetch", "typescript-angular", diff --git a/packages/openapi-code-generator/src/core/loaders/tsconfig.loader.ts b/packages/openapi-code-generator/src/core/loaders/tsconfig.loader.ts index ebbc56ac..00cc344f 100644 --- a/packages/openapi-code-generator/src/core/loaders/tsconfig.loader.ts +++ b/packages/openapi-code-generator/src/core/loaders/tsconfig.loader.ts @@ -11,7 +11,7 @@ import { export type CompilerOptions = Pick< TsCompilerOptions, - "exactOptionalPropertyTypes" + "exactOptionalPropertyTypes" | "paths" > export async function loadTsConfigCompilerOptions( diff --git a/packages/openapi-code-generator/src/typescript/common/typescript-emitter.ts b/packages/openapi-code-generator/src/typescript/common/typescript-emitter.ts index c8a93d5d..8f3e3936 100644 --- a/packages/openapi-code-generator/src/typescript/common/typescript-emitter.ts +++ b/packages/openapi-code-generator/src/typescript/common/typescript-emitter.ts @@ -9,7 +9,7 @@ export class TypescriptEmitter { constructor( private readonly fsAdaptor: IFsAdaptor, private readonly formatter: IFormatter, - private readonly config: { + public readonly config: { destinationDirectory: string allowUnusedImports: boolean }, diff --git a/packages/openapi-code-generator/src/typescript/typescript-nextjs/typescript-nextjs.generator.ts b/packages/openapi-code-generator/src/typescript/typescript-nextjs/typescript-nextjs.generator.ts index 7d607356..eedec9c3 100644 --- a/packages/openapi-code-generator/src/typescript/typescript-nextjs/typescript-nextjs.generator.ts +++ b/packages/openapi-code-generator/src/typescript/typescript-nextjs/typescript-nextjs.generator.ts @@ -3,32 +3,31 @@ import path from "node:path" import _ from "lodash" import { Project, - SourceFile, + type SourceFile, StructureKind, SyntaxKind, VariableDeclarationKind, } from "ts-morph" -import {CompilerOptions} from "../../core/file-loader" -import {Input} from "../../core/input" -import { +import type {Input} from "../../core/input" +import type {CompilerOptions} from "../../core/loaders/tsconfig.loader" +import type { IRModelObject, IROperation, IRParameter, } from "../../core/openapi-types-normalized" import { - HttpMethod, + type HttpMethod, isDefined, isHttpMethod, isTruthy, titleCase, } from "../../core/utils" -import {OpenapiGeneratorConfig} from "../../templates.types" -import {CompilationUnit, ICompilable} from "../common/compilation-units" +import type {OpenapiTypescriptGeneratorConfig} from "../../templates.types" +import {CompilationUnit, type ICompilable} from "../common/compilation-units" import {ImportBuilder} from "../common/import-builder" -import {emitGenerationResult} from "../common/output-utils" import {JoiBuilder} from "../common/schema-builders/joi-schema-builder" import { - SchemaBuilder, + type SchemaBuilder, schemaBuilderFactory, } from "../common/schema-builders/schema-builder" import {ZodBuilder} from "../common/schema-builders/zod-schema-builder" @@ -222,7 +221,7 @@ export class ServerRouterBuilder implements ICompilable { operationId: operation.operationId, statements: [ buildExport({ - name: titleCase(operation.operationId) + "Responder", + name: `${titleCase(operation.operationId)}Responder`, value: intersect( object([ ...responseSchemas.specific.map((it) => @@ -246,7 +245,7 @@ export class ServerRouterBuilder implements ICompilable { ? "" : " | undefined") }>, - respond: ${titleCase(operation.operationId) + "Responder"}, + respond: ${titleCase(operation.operationId)}Responder, ctx: {request: NextRequest} ) => Promise>`, kind: "type", @@ -365,12 +364,15 @@ export class NextJSAppRouterBuilder implements ICompilable { }) // Replace the params based on what inputs we have + // biome-ignore lint/style/noNonNullAssertion: const declarations = variableDeclaration.getDeclarations()[0]! + // biome-ignore lint/style/noNonNullAssertion: const innerFunction = declarations .getInitializerIfKindOrThrow(SyntaxKind.CallExpression) .getArguments()[0]! .asKind(SyntaxKind.ArrowFunction)! + // biome-ignore lint/complexity/noForEach: innerFunction?.getParameters().forEach((parameter) => { parameter.remove() }) @@ -397,9 +399,10 @@ export class NextJSAppRouterBuilder implements ICompilable { // Reconcile imports - attempt to find an existing one and replace it with correct one const imports = this.sourceFile.getImportDeclarations() const from = this.imports.normalizeFrom( - "./" + this.companionFilename, - "./" + this.filename, + `./${this.companionFilename}`, + `./${this.filename}`, ) + // biome-ignore lint/complexity/noForEach: imports .filter((it) => it.getModuleSpecifierValue().includes(from)) .forEach((it) => it.remove()) @@ -410,6 +413,7 @@ export class NextJSAppRouterBuilder implements ICompilable { }) // Remove any methods that were removed from the spec + // biome-ignore lint/complexity/noForEach: this.sourceFile .getVariableDeclarations() .filter((it) => { @@ -428,7 +432,7 @@ export class NextJSAppRouterBuilder implements ICompilable { } function findImportAlias(dest: string, compilerOptions: CompilerOptions) { - const relative = "./" + path.relative(process.cwd(), dest) + "/*" + const relative = `./${path.relative(process.cwd(), dest)}/*` const alias = Object.entries(compilerOptions.paths || {}).find(([, paths]) => paths.includes(relative), @@ -438,12 +442,13 @@ function findImportAlias(dest: string, compilerOptions: CompilerOptions) { } export async function generateTypescriptNextJS( - config: OpenapiGeneratorConfig, + config: OpenapiTypescriptGeneratorConfig, ): Promise { - const input = config.input - - const importAlias = findImportAlias(config.dest, config.compilerOptions) + const {input, emitter, allowAny} = config + const dest = emitter.config.destinationDirectory + const importAlias = findImportAlias(dest, config.compilerOptions) + // biome-ignore lint/complexity/useLiteralKeys: const subDirectory = process.env["OPENAPI_INTEGRATION_TESTS"] ? path.basename(config.input.loader.entryPointKey) : "" @@ -459,12 +464,14 @@ export async function generateTypescriptNextJS( [generatedDirectory, "models.ts"].join(path.sep), input, config.compilerOptions, + {allowAny}, ) const rootSchemaBuilder = await schemaBuilderFactory( [generatedDirectory, "schemas.ts"].join(path.sep), input, config.schemaBuilder, + {allowAny}, ) const project = new Project() @@ -493,14 +500,9 @@ export async function generateTypescriptNextJS( routeToNextJSFilepath(group.name), ) - const existing = fs.existsSync( - path.join(config.dest, nextJsAppRouterPath), - ) + const existing = fs.existsSync(path.join(dest, nextJsAppRouterPath)) ? fs - .readFileSync( - path.join(config.dest, nextJsAppRouterPath), - "utf-8", - ) + .readFileSync(path.join(dest, nextJsAppRouterPath), "utf-8") .toString() : "" const sourceFile = project.createSourceFile( @@ -515,10 +517,10 @@ export async function generateTypescriptNextJS( sourceFile, ) - group.operations.forEach((it) => { - routerBuilder.add(it) - nextJSAppRouterBuilder.add(it) - }) + for (const operation of group.operations) { + routerBuilder.add(operation) + nextJSAppRouterBuilder.add(operation) + } return [ routerBuilder.toCompilationUnit(), @@ -550,18 +552,12 @@ export async function generateTypescriptNextJS( input.allOperations().map((it) => fetchClientBuilder.add(it)) - await emitGenerationResult( - config.dest, - [ - ...serverRouters, - fetchClientBuilder.toCompilationUnit(), - rootTypeBuilder.toCompilationUnit(), - rootSchemaBuilder.toCompilationUnit(), - ], - { - allowUnusedImports: config.allowUnusedImports, - }, - ) + await emitter.emitGenerationResult([ + ...serverRouters, + fetchClientBuilder.toCompilationUnit(), + rootTypeBuilder.toCompilationUnit(), + rootSchemaBuilder.toCompilationUnit(), + ]) } function routeToNextJSFilepath(route: string): string { diff --git a/scripts/generate.mjs b/scripts/generate.mjs index 475ed417..fbd12000 100644 --- a/scripts/generate.mjs +++ b/scripts/generate.mjs @@ -33,10 +33,15 @@ async function runSingle(templatePath, input) { const filename = path.basename(input) const template = path.basename(templatePath) + const output = + template === "typescript-nextjs" + ? `integration-tests/${template}/src` + : `integration-tests/${template}/src/generated/${filename}` + const args = [ `--input="${input}"`, `--input-type=${inputType}`, - `--output="integration-tests/${template}/src/generated/${filename}"`, + `--output="${output}"`, `--template="${template}"`, "--schema-builder=zod", ] @@ -63,15 +68,19 @@ function runCmd(cmd) { console.info(cmd) - const child = exec(cmd, (err, stdout, stderr) => { - if (err) { - err.output = output - reject(err) - return - } + const child = exec( + cmd, + {env: {...process.env, OPENAPI_INTEGRATION_TESTS: "true"}}, + (err, stdout, stderr) => { + if (err) { + err.output = output + reject(err) + return + } - resolve(output) - }) + resolve(output) + }, + ) child.stdout.on("data", (it) => { output.push(it.trim())