From d942730e93927057d93d64b68eafbc5112d6f4b6 Mon Sep 17 00:00:00 2001 From: scalarbot Date: Fri, 19 Jun 2026 18:03:53 +0000 Subject: [PATCH] feat: scalar-typescript-sdk@0.2.0 --- .gitignore | 32 +- README.md | 561 +- api.md | 765 ++ openapi.augmented.json | 7611 +++++++++++++ package.json | 76 +- scalar-sdk.manifest.json | 9519 +++++++++++++++++ scripts/finalize-build.mjs | 49 + src/api-promise.ts | 81 + src/client.ts | 941 ++ src/core.ts | 13 - src/core/error.ts | 130 + src/core/uploads.ts | 4 + src/error.ts | 4 + .../authenticationExchangePersonalToken.ts | 186 - src/funcs/authenticationGetCurrentUser.ts | 173 - src/funcs/loginPortalsCreateLoginPortal.ts | 192 - src/funcs/loginPortalsDeleteLoginPortal.ts | 197 - src/funcs/loginPortalsGetLoginPortal.ts | 197 - src/funcs/loginPortalsListLoginPortals.ts | 173 - src/funcs/loginPortalsUpdateLoginPortal.ts | 198 - src/funcs/namespacesListNamespaces.ts | 173 - .../registryAddApiDocumentAccessGroup.ts | 205 - src/funcs/registryCreateApiDocument.ts | 198 - src/funcs/registryCreateApiDocumentVersion.ts | 203 - src/funcs/registryDeleteApiDocument.ts | 201 - src/funcs/registryDeleteApiDocumentVersion.ts | 208 - src/funcs/registryGetApiDocumentVersion.ts | 208 - .../registryGetApiDocumentVersionMetadata.ts | 212 - src/funcs/registryListAllApiDocuments.ts | 173 - src/funcs/registryListApiDocuments.ts | 197 - .../registryRemoveApiDocumentAccessGroup.ts | 207 - src/funcs/registryUpdateApiDocument.ts | 202 - src/funcs/registryUpdateApiDocumentVersion.ts | 209 - src/funcs/rulesAddRulesetAccessGroup.ts | 205 - src/funcs/rulesCreateRuleset.ts | 196 - src/funcs/rulesDeleteRuleset.ts | 199 - src/funcs/rulesGetRulesetDocument.ts | 201 - src/funcs/rulesListRulesets.ts | 197 - src/funcs/rulesRemoveRulesetAccessGroup.ts | 205 - src/funcs/rulesUpdateRuleset.ts | 200 - src/funcs/scalarDocsCreateGuide.ts | 191 - src/funcs/scalarDocsListGuides.ts | 173 - src/funcs/scalarDocsPublishGuide.ts | 197 - src/funcs/schemasAddSchemaAccessGroup.ts | 205 - src/funcs/schemasCreateSchema.ts | 196 - src/funcs/schemasCreateSchemaVersion.ts | 203 - src/funcs/schemasDeleteSchema.ts | 199 - src/funcs/schemasDeleteSchemaVersion.ts | 208 - src/funcs/schemasGetSchemaVersion.ts | 207 - src/funcs/schemasListSchemas.ts | 197 - src/funcs/schemasRemoveSchemaAccessGroup.ts | 205 - src/funcs/schemasUpdateSchema.ts | 200 - src/funcs/teamsListTeams.ts | 171 - src/funcs/themesCreateTheme.ts | 189 - src/funcs/themesDeleteTheme.ts | 195 - src/funcs/themesGetTheme.ts | 195 - src/funcs/themesListThemes.ts | 171 - src/funcs/themesReplaceThemeDocument.ts | 199 - src/funcs/themesUpdateTheme.ts | 196 - src/hooks/hooks.ts | 132 - src/hooks/index.ts | 6 - src/hooks/registration.ts | 14 - src/hooks/types.ts | 107 - src/index.ts | 29 +- src/internal/README.md | 3 + src/internal/builtin-types.ts | 93 + src/internal/detect-platform.ts | 196 + src/internal/errors.ts | 33 + src/internal/headers.ts | 97 + src/internal/qs/LICENSE.md | 13 + src/internal/qs/README.md | 3 + src/internal/qs/formats.ts | 10 + src/internal/qs/index.ts | 13 + src/internal/qs/stringify.ts | 385 + src/internal/qs/types.ts | 71 + src/internal/qs/utils.ts | 265 + src/internal/request-options.ts | 39 + src/internal/shim-types.ts | 26 + src/internal/shims.ts | 107 + src/internal/to-file.ts | 154 + src/internal/types.ts | 93 + src/internal/uploads.ts | 197 + src/internal/utils/env.ts | 18 + src/internal/utils/log.ts | 128 + src/internal/utils/path.ts | 88 + src/internal/utils/sleep.ts | 3 + src/internal/utils/uuid.ts | 17 + src/internal/utils/values.ts | 105 + src/lib/base64.ts | 37 - src/lib/config.ts | 64 - src/lib/dlv.ts | 53 - src/lib/encodings.ts | 483 - src/lib/files.ts | 82 - src/lib/http.ts | 323 - src/lib/is-plain-object.ts | 43 - src/lib/logger.ts | 9 - src/lib/matchers.ts | 342 - src/lib/primitives.ts | 150 - src/lib/retries.ts | 218 - src/lib/schemas.ts | 91 - src/lib/sdks.ts | 402 - src/lib/security.ts | 260 - src/lib/url.ts | 33 - src/models/components/accessgroup.ts | 62 - src/models/components/activedeployment.ts | 74 - src/models/components/apidocument.ts | 100 - src/models/components/githubproject.ts | 138 - .../components/githubprojectrepository.ts | 98 - src/models/components/httpmetadata.ts | 87 - src/models/components/index.ts | 24 - src/models/components/loginportal.ts | 70 - src/models/components/loginportalemail.ts | 110 - src/models/components/loginportalpage.ts | 116 - src/models/components/manageddocversion.ts | 217 - src/models/components/managedschemaversion.ts | 78 - src/models/components/method.ts | 37 - src/models/components/rule.ts | 76 - src/models/components/schema.ts | 89 - src/models/components/security.ts | 71 - src/models/components/team.ts | 72 - src/models/components/teamsummary.ts | 70 - src/models/components/theme.ts | 71 - src/models/components/uid.ts | 56 - src/models/components/user.ts | 90 - src/models/errors/apierror.ts | 34 - src/models/errors/fivehundred.ts | 83 - src/models/errors/fourhundred.ts | 83 - src/models/errors/fourhundredandfour.ts | 83 - src/models/errors/fourhundredandone.ts | 83 - src/models/errors/fourhundredandthree.ts | 83 - src/models/errors/fourhundredandtwentytwo.ts | 83 - src/models/errors/httpclienterrors.ts | 62 - src/models/errors/index.ts | 14 - src/models/errors/responsevalidationerror.ts | 50 - src/models/errors/scalarerror.ts | 27 - src/models/errors/sdkvalidationerror.ts | 109 - .../operations/addapidocumentaccessgroup.ts | 162 - .../operations/addrulesetaccessgroup.ts | 161 - src/models/operations/addschemaaccessgroup.ts | 161 - src/models/operations/createapidocument.ts | 320 - .../operations/createapidocumentversion.ts | 238 - src/models/operations/createguide.ts | 222 - src/models/operations/createloginportal.ts | 155 - src/models/operations/createruleset.ts | 227 - src/models/operations/createschema.ts | 231 - src/models/operations/createschemaversion.ts | 223 - src/models/operations/createtheme.ts | 153 - src/models/operations/deleteapidocument.ts | 145 - .../operations/deleteapidocumentversion.ts | 153 - src/models/operations/deleteloginportal.ts | 141 - src/models/operations/deleteruleset.ts | 145 - src/models/operations/deleteschema.ts | 145 - src/models/operations/deleteschemaversion.ts | 151 - src/models/operations/deletetheme.ts | 141 - .../operations/exchangepersonaltoken.ts | 211 - .../operations/getapidocumentversion.ts | 153 - .../getapidocumentversionmetadata.ts | 161 - src/models/operations/getcurrentuser.ts | 83 - src/models/operations/getloginportal.ts | 218 - src/models/operations/getrulesetdocument.ts | 145 - src/models/operations/getschemaversion.ts | 149 - src/models/operations/gettheme.ts | 139 - src/models/operations/index.ts | 50 - src/models/operations/listallapidocuments.ts | 87 - src/models/operations/listapidocuments.ts | 143 - src/models/operations/listguides.ts | 85 - src/models/operations/listloginportals.ts | 85 - src/models/operations/listnamespaces.ts | 83 - src/models/operations/listrulesets.ts | 141 - src/models/operations/listschemas.ts | 141 - src/models/operations/listteams.ts | 83 - src/models/operations/listthemes.ts | 83 - src/models/operations/publishguide.ts | 202 - .../removeapidocumentaccessgroup.ts | 167 - .../operations/removerulesetaccessgroup.ts | 161 - .../operations/removeschemaaccessgroup.ts | 161 - src/models/operations/replacethemedocument.ts | 217 - src/models/operations/updateapidocument.ts | 229 - .../operations/updateapidocumentversion.ts | 308 - src/models/operations/updateloginportal.ts | 213 - src/models/operations/updateruleset.ts | 231 - src/models/operations/updateschema.ts | 223 - src/models/operations/updatetheme.ts | 215 - src/resource.ts | 11 + src/resources/authentication.ts | 111 + src/resources/index.ts | 29 + src/resources/login-portals.ts | 222 + src/resources/namespaces.ts | 60 + src/resources/registry.ts | 411 + src/resources/rules.ts | 249 + src/resources/scalar-docs.ts | 158 + src/resources/schemas.ts | 3 + src/resources/schemas/access-group.ts | 103 + src/resources/schemas/index.ts | 8 + src/resources/schemas/schemas.ts | 200 + src/resources/schemas/version.ts | 135 + src/resources/teams.ts | 76 + src/resources/themes.ts | 184 + src/sdk/authentication.ts | 43 - src/sdk/index.ts | 5 - src/sdk/loginportals.ts | 97 - src/sdk/namespaces.ts | 25 - src/sdk/registry.ts | 223 - src/sdk/rules.ts | 135 - src/sdk/scalardocs.ts | 61 - src/sdk/schemas.ts | 171 - src/sdk/sdk.ts | 61 - src/sdk/teams.ts | 25 - src/sdk/themes.ts | 115 - src/types/async.ts | 68 - src/types/blobs.ts | 31 - src/types/constdatetime.ts | 15 - src/types/enums.ts | 16 - src/types/fp.ts | 50 - src/types/index.ts | 11 - src/types/operations.ts | 105 - src/types/rfcdate.ts | 54 - src/types/streams.ts | 21 - src/uploads.ts | 3 + src/version.ts | 3 + tests/smoke-test.ts | 616 ++ tsconfig.cjs.json | 23 + tsconfig.json | 47 +- 223 files changed, 24056 insertions(+), 24202 deletions(-) create mode 100644 api.md create mode 100644 openapi.augmented.json create mode 100644 scalar-sdk.manifest.json create mode 100644 scripts/finalize-build.mjs create mode 100644 src/api-promise.ts create mode 100644 src/client.ts delete mode 100644 src/core.ts create mode 100644 src/core/error.ts create mode 100644 src/core/uploads.ts create mode 100644 src/error.ts delete mode 100644 src/funcs/authenticationExchangePersonalToken.ts delete mode 100644 src/funcs/authenticationGetCurrentUser.ts delete mode 100644 src/funcs/loginPortalsCreateLoginPortal.ts delete mode 100644 src/funcs/loginPortalsDeleteLoginPortal.ts delete mode 100644 src/funcs/loginPortalsGetLoginPortal.ts delete mode 100644 src/funcs/loginPortalsListLoginPortals.ts delete mode 100644 src/funcs/loginPortalsUpdateLoginPortal.ts delete mode 100644 src/funcs/namespacesListNamespaces.ts delete mode 100644 src/funcs/registryAddApiDocumentAccessGroup.ts delete mode 100644 src/funcs/registryCreateApiDocument.ts delete mode 100644 src/funcs/registryCreateApiDocumentVersion.ts delete mode 100644 src/funcs/registryDeleteApiDocument.ts delete mode 100644 src/funcs/registryDeleteApiDocumentVersion.ts delete mode 100644 src/funcs/registryGetApiDocumentVersion.ts delete mode 100644 src/funcs/registryGetApiDocumentVersionMetadata.ts delete mode 100644 src/funcs/registryListAllApiDocuments.ts delete mode 100644 src/funcs/registryListApiDocuments.ts delete mode 100644 src/funcs/registryRemoveApiDocumentAccessGroup.ts delete mode 100644 src/funcs/registryUpdateApiDocument.ts delete mode 100644 src/funcs/registryUpdateApiDocumentVersion.ts delete mode 100644 src/funcs/rulesAddRulesetAccessGroup.ts delete mode 100644 src/funcs/rulesCreateRuleset.ts delete mode 100644 src/funcs/rulesDeleteRuleset.ts delete mode 100644 src/funcs/rulesGetRulesetDocument.ts delete mode 100644 src/funcs/rulesListRulesets.ts delete mode 100644 src/funcs/rulesRemoveRulesetAccessGroup.ts delete mode 100644 src/funcs/rulesUpdateRuleset.ts delete mode 100644 src/funcs/scalarDocsCreateGuide.ts delete mode 100644 src/funcs/scalarDocsListGuides.ts delete mode 100644 src/funcs/scalarDocsPublishGuide.ts delete mode 100644 src/funcs/schemasAddSchemaAccessGroup.ts delete mode 100644 src/funcs/schemasCreateSchema.ts delete mode 100644 src/funcs/schemasCreateSchemaVersion.ts delete mode 100644 src/funcs/schemasDeleteSchema.ts delete mode 100644 src/funcs/schemasDeleteSchemaVersion.ts delete mode 100644 src/funcs/schemasGetSchemaVersion.ts delete mode 100644 src/funcs/schemasListSchemas.ts delete mode 100644 src/funcs/schemasRemoveSchemaAccessGroup.ts delete mode 100644 src/funcs/schemasUpdateSchema.ts delete mode 100644 src/funcs/teamsListTeams.ts delete mode 100644 src/funcs/themesCreateTheme.ts delete mode 100644 src/funcs/themesDeleteTheme.ts delete mode 100644 src/funcs/themesGetTheme.ts delete mode 100644 src/funcs/themesListThemes.ts delete mode 100644 src/funcs/themesReplaceThemeDocument.ts delete mode 100644 src/funcs/themesUpdateTheme.ts delete mode 100644 src/hooks/hooks.ts delete mode 100644 src/hooks/index.ts delete mode 100644 src/hooks/registration.ts delete mode 100644 src/hooks/types.ts create mode 100644 src/internal/README.md create mode 100644 src/internal/builtin-types.ts create mode 100644 src/internal/detect-platform.ts create mode 100644 src/internal/errors.ts create mode 100644 src/internal/headers.ts create mode 100644 src/internal/qs/LICENSE.md create mode 100644 src/internal/qs/README.md create mode 100644 src/internal/qs/formats.ts create mode 100644 src/internal/qs/index.ts create mode 100644 src/internal/qs/stringify.ts create mode 100644 src/internal/qs/types.ts create mode 100644 src/internal/qs/utils.ts create mode 100644 src/internal/request-options.ts create mode 100644 src/internal/shim-types.ts create mode 100644 src/internal/shims.ts create mode 100644 src/internal/to-file.ts create mode 100644 src/internal/types.ts create mode 100644 src/internal/uploads.ts create mode 100644 src/internal/utils/env.ts create mode 100644 src/internal/utils/log.ts create mode 100644 src/internal/utils/path.ts create mode 100644 src/internal/utils/sleep.ts create mode 100644 src/internal/utils/uuid.ts create mode 100644 src/internal/utils/values.ts delete mode 100644 src/lib/base64.ts delete mode 100644 src/lib/config.ts delete mode 100644 src/lib/dlv.ts delete mode 100644 src/lib/encodings.ts delete mode 100644 src/lib/files.ts delete mode 100644 src/lib/http.ts delete mode 100644 src/lib/is-plain-object.ts delete mode 100644 src/lib/logger.ts delete mode 100644 src/lib/matchers.ts delete mode 100644 src/lib/primitives.ts delete mode 100644 src/lib/retries.ts delete mode 100644 src/lib/schemas.ts delete mode 100644 src/lib/sdks.ts delete mode 100644 src/lib/security.ts delete mode 100644 src/lib/url.ts delete mode 100644 src/models/components/accessgroup.ts delete mode 100644 src/models/components/activedeployment.ts delete mode 100644 src/models/components/apidocument.ts delete mode 100644 src/models/components/githubproject.ts delete mode 100644 src/models/components/githubprojectrepository.ts delete mode 100644 src/models/components/httpmetadata.ts delete mode 100644 src/models/components/index.ts delete mode 100644 src/models/components/loginportal.ts delete mode 100644 src/models/components/loginportalemail.ts delete mode 100644 src/models/components/loginportalpage.ts delete mode 100644 src/models/components/manageddocversion.ts delete mode 100644 src/models/components/managedschemaversion.ts delete mode 100644 src/models/components/method.ts delete mode 100644 src/models/components/rule.ts delete mode 100644 src/models/components/schema.ts delete mode 100644 src/models/components/security.ts delete mode 100644 src/models/components/team.ts delete mode 100644 src/models/components/teamsummary.ts delete mode 100644 src/models/components/theme.ts delete mode 100644 src/models/components/uid.ts delete mode 100644 src/models/components/user.ts delete mode 100644 src/models/errors/apierror.ts delete mode 100644 src/models/errors/fivehundred.ts delete mode 100644 src/models/errors/fourhundred.ts delete mode 100644 src/models/errors/fourhundredandfour.ts delete mode 100644 src/models/errors/fourhundredandone.ts delete mode 100644 src/models/errors/fourhundredandthree.ts delete mode 100644 src/models/errors/fourhundredandtwentytwo.ts delete mode 100644 src/models/errors/httpclienterrors.ts delete mode 100644 src/models/errors/index.ts delete mode 100644 src/models/errors/responsevalidationerror.ts delete mode 100644 src/models/errors/scalarerror.ts delete mode 100644 src/models/errors/sdkvalidationerror.ts delete mode 100644 src/models/operations/addapidocumentaccessgroup.ts delete mode 100644 src/models/operations/addrulesetaccessgroup.ts delete mode 100644 src/models/operations/addschemaaccessgroup.ts delete mode 100644 src/models/operations/createapidocument.ts delete mode 100644 src/models/operations/createapidocumentversion.ts delete mode 100644 src/models/operations/createguide.ts delete mode 100644 src/models/operations/createloginportal.ts delete mode 100644 src/models/operations/createruleset.ts delete mode 100644 src/models/operations/createschema.ts delete mode 100644 src/models/operations/createschemaversion.ts delete mode 100644 src/models/operations/createtheme.ts delete mode 100644 src/models/operations/deleteapidocument.ts delete mode 100644 src/models/operations/deleteapidocumentversion.ts delete mode 100644 src/models/operations/deleteloginportal.ts delete mode 100644 src/models/operations/deleteruleset.ts delete mode 100644 src/models/operations/deleteschema.ts delete mode 100644 src/models/operations/deleteschemaversion.ts delete mode 100644 src/models/operations/deletetheme.ts delete mode 100644 src/models/operations/exchangepersonaltoken.ts delete mode 100644 src/models/operations/getapidocumentversion.ts delete mode 100644 src/models/operations/getapidocumentversionmetadata.ts delete mode 100644 src/models/operations/getcurrentuser.ts delete mode 100644 src/models/operations/getloginportal.ts delete mode 100644 src/models/operations/getrulesetdocument.ts delete mode 100644 src/models/operations/getschemaversion.ts delete mode 100644 src/models/operations/gettheme.ts delete mode 100644 src/models/operations/index.ts delete mode 100644 src/models/operations/listallapidocuments.ts delete mode 100644 src/models/operations/listapidocuments.ts delete mode 100644 src/models/operations/listguides.ts delete mode 100644 src/models/operations/listloginportals.ts delete mode 100644 src/models/operations/listnamespaces.ts delete mode 100644 src/models/operations/listrulesets.ts delete mode 100644 src/models/operations/listschemas.ts delete mode 100644 src/models/operations/listteams.ts delete mode 100644 src/models/operations/listthemes.ts delete mode 100644 src/models/operations/publishguide.ts delete mode 100644 src/models/operations/removeapidocumentaccessgroup.ts delete mode 100644 src/models/operations/removerulesetaccessgroup.ts delete mode 100644 src/models/operations/removeschemaaccessgroup.ts delete mode 100644 src/models/operations/replacethemedocument.ts delete mode 100644 src/models/operations/updateapidocument.ts delete mode 100644 src/models/operations/updateapidocumentversion.ts delete mode 100644 src/models/operations/updateloginportal.ts delete mode 100644 src/models/operations/updateruleset.ts delete mode 100644 src/models/operations/updateschema.ts delete mode 100644 src/models/operations/updatetheme.ts create mode 100644 src/resource.ts create mode 100644 src/resources/authentication.ts create mode 100644 src/resources/index.ts create mode 100644 src/resources/login-portals.ts create mode 100644 src/resources/namespaces.ts create mode 100644 src/resources/registry.ts create mode 100644 src/resources/rules.ts create mode 100644 src/resources/scalar-docs.ts create mode 100644 src/resources/schemas.ts create mode 100644 src/resources/schemas/access-group.ts create mode 100644 src/resources/schemas/index.ts create mode 100644 src/resources/schemas/schemas.ts create mode 100644 src/resources/schemas/version.ts create mode 100644 src/resources/teams.ts create mode 100644 src/resources/themes.ts delete mode 100644 src/sdk/authentication.ts delete mode 100644 src/sdk/index.ts delete mode 100644 src/sdk/loginportals.ts delete mode 100644 src/sdk/namespaces.ts delete mode 100644 src/sdk/registry.ts delete mode 100644 src/sdk/rules.ts delete mode 100644 src/sdk/scalardocs.ts delete mode 100644 src/sdk/schemas.ts delete mode 100644 src/sdk/sdk.ts delete mode 100644 src/sdk/teams.ts delete mode 100644 src/sdk/themes.ts delete mode 100644 src/types/async.ts delete mode 100644 src/types/blobs.ts delete mode 100644 src/types/constdatetime.ts delete mode 100644 src/types/enums.ts delete mode 100644 src/types/fp.ts delete mode 100644 src/types/index.ts delete mode 100644 src/types/operations.ts delete mode 100644 src/types/rfcdate.ts delete mode 100644 src/types/streams.ts create mode 100644 src/uploads.ts create mode 100644 src/version.ts create mode 100644 tests/smoke-test.ts create mode 100644 tsconfig.cjs.json diff --git a/.gitignore b/.gitignore index ccddd9f..1f138a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,6 @@ -/models -/models/errors -/types -/node_modules -/lib -/sdk -/funcs -/react-query -/mcp-server -/hooks -/index.* -/core.* -/bin -/cjs -/esm -/dist -/.tsbuildinfo -/.eslintcache -/.tshy -/.tshy-* -/__tests__ -.DS_Store -**/.speakeasy/temp/ -**/.speakeasy/logs/ -.DS_Store -/.speakeasy/reports +node_modules/ +dist/ +*.tsbuildinfo +.env +.env.* + diff --git a/README.md b/README.md index 5d8dd7f..9d6d307 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,7 @@ -# scalar-typescript-sdk +# Scalar API -Developer-friendly, idiomatic Typescript SDK for the *scalar-typescript-sdk* API. - -
- - - - -
- -
- -## Summary - -Scalar API: API for managing Scalar platform resources. +Generated TypeScript SDK for Scalar API. +API for managing Scalar platform resources. ## TypeScript SDK @@ -81,505 +69,164 @@ const authedScalar = new Scalar({ ### Read more - [@scalar/sdk on npm](https://www.npmjs.com/package/@scalar/sdk) - - - -## Table of Contents - -* [@scalar/sdk](#scalarsdk) - * [TypeScript SDK](#typescript-sdk) - * [SDK Installation](#sdk-installation) - * [Requirements](#requirements) - * [SDK Example Usage](#sdk-example-usage) - * [Authentication](#authentication) - * [Available Resources and Operations](#available-resources-and-operations) - * [Standalone functions](#standalone-functions) - * [Retries](#retries) - * [Error Handling](#error-handling) - * [Server Selection](#server-selection) - * [Custom HTTP Client](#custom-http-client) - * [Debugging](#debugging) -* [Development](#development) - * [Maturity](#maturity) - * [Contributions](#contributions) - - - - -## SDK Installation - -The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers. - -### NPM - -```bash -npm add @scalar/sdk -``` - -### PNPM - -```bash -pnpm add @scalar/sdk -``` - -### Bun - -```bash -bun add @scalar/sdk -``` - -### Yarn - -```bash -yarn add @scalar/sdk zod - -# Note that Yarn does not install peer dependencies automatically. You will need -# to install zod as shown above. -``` -> [!NOTE] -> This package is published with CommonJS and ES Modules (ESM) support. - - - -## Requirements - -For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md). - - - -## SDK Example Usage - -### Example - -```typescript -import { Scalar } from "@scalar/sdk"; +
-const scalar = new Scalar({ - bearerAuth: "", -}); +## Contents -async function run() { - const result = await scalar.registry.listAllApiDocuments(); +- [Installation](#installation) +- [Usage](#usage) +- [API Reference](./api.md) +- [Authentication](#authentication) +- [Errors](#errors) +- [Client Options](#client-options) +- [Request Options](#request-options) +- [Retries and Timeouts](#retries-and-timeouts) +- [Helpers](#helpers) +- [Logging](#logging) +- [Requirements](#requirements) - console.log(result); -} +
-run(); +## Installation +```sh +npm install @scalar/sdk ``` - - -## Authentication - -### Per-Client Security Schemes - -This SDK supports the following security scheme globally: +
-| Name | Type | Scheme | -| ------------ | ---- | ----------- | -| `bearerAuth` | http | HTTP Bearer | +## Usage -To authenticate with the API the `bearerAuth` parameter must be set when initializing the SDK client instance. For example: -```typescript -import { Scalar } from "@scalar/sdk"; +```ts +import ScalarAPI from "@scalar/sdk"; -const scalar = new Scalar({ - bearerAuth: "", +const client = new ScalarAPI({ + bearerAuth: process.env["BEARER_AUTH"], // defaults to the BEARER_AUTH env var + environment: "production", }); -async function run() { - const result = await scalar.registry.listAllApiDocuments(); - - console.log(result); -} - -run(); - +const listAllAPIDocuments = await client.registry.listAllAPIDocuments(); +console.log(listAllAPIDocuments); ``` - - - -## Available Resources and Operations - -
-Available methods -### [authentication](docs/sdks/authentication/README.md) +The examples in the following sections assume a `client` configured as shown above. -* [exchangePersonalToken](docs/sdks/authentication/README.md#exchangepersonaltoken) - Exchange token -* [getCurrentUser](docs/sdks/authentication/README.md#getcurrentuser) - Get current user +See the [API reference](./api.md) for every available operation. -### [loginPortals](docs/sdks/loginportals/README.md) - -* [getLoginPortal](docs/sdks/loginportals/README.md#getloginportal) - Get a login portal -* [updateLoginPortal](docs/sdks/loginportals/README.md#updateloginportal) - Update portal metadata -* [deleteLoginPortal](docs/sdks/loginportals/README.md#deleteloginportal) - Delete a login portal -* [createLoginPortal](docs/sdks/loginportals/README.md#createloginportal) - Create a portal -* [listLoginPortals](docs/sdks/loginportals/README.md#listloginportals) - List all portals - -### [namespaces](docs/sdks/namespaces/README.md) - -* [listNamespaces](docs/sdks/namespaces/README.md#listnamespaces) - List namespaces - -### [registry](docs/sdks/registry/README.md) - -* [listAllApiDocuments](docs/sdks/registry/README.md#listallapidocuments) - List all API Documents -* [listApiDocuments](docs/sdks/registry/README.md#listapidocuments) - List API Documents in a namespace -* [createApiDocument](docs/sdks/registry/README.md#createapidocument) - Create API Document -* [updateApiDocument](docs/sdks/registry/README.md#updateapidocument) - Update API Document metadata -* [deleteApiDocument](docs/sdks/registry/README.md#deleteapidocument) - Delete API Document -* [getApiDocumentVersion](docs/sdks/registry/README.md#getapidocumentversion) - Get API Document -* [updateApiDocumentVersion](docs/sdks/registry/README.md#updateapidocumentversion) - Update API Document version -* [deleteApiDocumentVersion](docs/sdks/registry/README.md#deleteapidocumentversion) - Delete API Document version -* [getApiDocumentVersionMetadata](docs/sdks/registry/README.md#getapidocumentversionmetadata) - Get API Document version metadata -* [createApiDocumentVersion](docs/sdks/registry/README.md#createapidocumentversion) - Create API Document version -* [addApiDocumentAccessGroup](docs/sdks/registry/README.md#addapidocumentaccessgroup) - Add access group -* [removeApiDocumentAccessGroup](docs/sdks/registry/README.md#removeapidocumentaccessgroup) - Remove access group - -### [rules](docs/sdks/rules/README.md) - -* [listRulesets](docs/sdks/rules/README.md#listrulesets) - List all rules -* [createRuleset](docs/sdks/rules/README.md#createruleset) - Create a rule -* [updateRuleset](docs/sdks/rules/README.md#updateruleset) - Update rule metadata -* [deleteRuleset](docs/sdks/rules/README.md#deleteruleset) - Delete a rule -* [getRulesetDocument](docs/sdks/rules/README.md#getrulesetdocument) - Get a rule -* [addRulesetAccessGroup](docs/sdks/rules/README.md#addrulesetaccessgroup) - Add rule access group -* [removeRulesetAccessGroup](docs/sdks/rules/README.md#removerulesetaccessgroup) - Remove rule access group - - -### [scalarDocs](docs/sdks/scalardocs/README.md) - -* [listGuides](docs/sdks/scalardocs/README.md#listguides) - List all projects -* [createGuide](docs/sdks/scalardocs/README.md#createguide) - Create a project -* [publishGuide](docs/sdks/scalardocs/README.md#publishguide) - Publish a project - -### [schemas](docs/sdks/schemas/README.md) - -* [listSchemas](docs/sdks/schemas/README.md#listschemas) - List all shared components -* [createSchema](docs/sdks/schemas/README.md#createschema) - Create a shared component -* [updateSchema](docs/sdks/schemas/README.md#updateschema) - Update shared component metadata -* [deleteSchema](docs/sdks/schemas/README.md#deleteschema) - Delete a shared component -* [getSchemaVersion](docs/sdks/schemas/README.md#getschemaversion) - Get a shared component document -* [deleteSchemaVersion](docs/sdks/schemas/README.md#deleteschemaversion) - Delete a shared component version -* [createSchemaVersion](docs/sdks/schemas/README.md#createschemaversion) - Create a shared component version -* [addSchemaAccessGroup](docs/sdks/schemas/README.md#addschemaaccessgroup) - Add shared component access group -* [removeSchemaAccessGroup](docs/sdks/schemas/README.md#removeschemaaccessgroup) - Remove shared component access group - -### [teams](docs/sdks/teams/README.md) - -* [listTeams](docs/sdks/teams/README.md#listteams) - List teams - -### [themes](docs/sdks/themes/README.md) - -* [listThemes](docs/sdks/themes/README.md#listthemes) - List all themes -* [createTheme](docs/sdks/themes/README.md#createtheme) - Create a theme -* [updateTheme](docs/sdks/themes/README.md#updatetheme) - Update theme metadata -* [replaceThemeDocument](docs/sdks/themes/README.md#replacethemedocument) - Update theme document -* [deleteTheme](docs/sdks/themes/README.md#deletetheme) - Delete a theme -* [getTheme](docs/sdks/themes/README.md#gettheme) - Get a theme - -
- - - -## Standalone functions - -All the methods listed above are available as standalone functions. These -functions are ideal for use in applications running in the browser, serverless -runtimes or other environments where application bundle size is a primary -concern. When using a bundler to build your application, all unused -functionality will be either excluded from the final bundle or tree-shaken away. - -To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md). - -
- -Available standalone functions - -- [`authenticationExchangePersonalToken`](docs/sdks/authentication/README.md#exchangepersonaltoken) - Exchange token -- [`authenticationGetCurrentUser`](docs/sdks/authentication/README.md#getcurrentuser) - Get current user -- [`loginPortalsCreateLoginPortal`](docs/sdks/loginportals/README.md#createloginportal) - Create a portal -- [`loginPortalsDeleteLoginPortal`](docs/sdks/loginportals/README.md#deleteloginportal) - Delete a login portal -- [`loginPortalsGetLoginPortal`](docs/sdks/loginportals/README.md#getloginportal) - Get a login portal -- [`loginPortalsListLoginPortals`](docs/sdks/loginportals/README.md#listloginportals) - List all portals -- [`loginPortalsUpdateLoginPortal`](docs/sdks/loginportals/README.md#updateloginportal) - Update portal metadata -- [`namespacesListNamespaces`](docs/sdks/namespaces/README.md#listnamespaces) - List namespaces -- [`registryAddApiDocumentAccessGroup`](docs/sdks/registry/README.md#addapidocumentaccessgroup) - Add access group -- [`registryCreateApiDocument`](docs/sdks/registry/README.md#createapidocument) - Create API Document -- [`registryCreateApiDocumentVersion`](docs/sdks/registry/README.md#createapidocumentversion) - Create API Document version -- [`registryDeleteApiDocument`](docs/sdks/registry/README.md#deleteapidocument) - Delete API Document -- [`registryDeleteApiDocumentVersion`](docs/sdks/registry/README.md#deleteapidocumentversion) - Delete API Document version -- [`registryGetApiDocumentVersion`](docs/sdks/registry/README.md#getapidocumentversion) - Get API Document -- [`registryGetApiDocumentVersionMetadata`](docs/sdks/registry/README.md#getapidocumentversionmetadata) - Get API Document version metadata -- [`registryListAllApiDocuments`](docs/sdks/registry/README.md#listallapidocuments) - List all API Documents -- [`registryListApiDocuments`](docs/sdks/registry/README.md#listapidocuments) - List API Documents in a namespace -- [`registryRemoveApiDocumentAccessGroup`](docs/sdks/registry/README.md#removeapidocumentaccessgroup) - Remove access group -- [`registryUpdateApiDocument`](docs/sdks/registry/README.md#updateapidocument) - Update API Document metadata -- [`registryUpdateApiDocumentVersion`](docs/sdks/registry/README.md#updateapidocumentversion) - Update API Document version -- [`rulesAddRulesetAccessGroup`](docs/sdks/rules/README.md#addrulesetaccessgroup) - Add rule access group -- [`rulesCreateRuleset`](docs/sdks/rules/README.md#createruleset) - Create a rule -- [`rulesDeleteRuleset`](docs/sdks/rules/README.md#deleteruleset) - Delete a rule -- [`rulesGetRulesetDocument`](docs/sdks/rules/README.md#getrulesetdocument) - Get a rule -- [`rulesListRulesets`](docs/sdks/rules/README.md#listrulesets) - List all rules -- [`rulesRemoveRulesetAccessGroup`](docs/sdks/rules/README.md#removerulesetaccessgroup) - Remove rule access group -- [`rulesUpdateRuleset`](docs/sdks/rules/README.md#updateruleset) - Update rule metadata -- [`scalarDocsCreateGuide`](docs/sdks/scalardocs/README.md#createguide) - Create a project -- [`scalarDocsListGuides`](docs/sdks/scalardocs/README.md#listguides) - List all projects -- [`scalarDocsPublishGuide`](docs/sdks/scalardocs/README.md#publishguide) - Publish a project -- [`schemasAddSchemaAccessGroup`](docs/sdks/schemas/README.md#addschemaaccessgroup) - Add shared component access group -- [`schemasCreateSchema`](docs/sdks/schemas/README.md#createschema) - Create a shared component -- [`schemasCreateSchemaVersion`](docs/sdks/schemas/README.md#createschemaversion) - Create a shared component version -- [`schemasDeleteSchema`](docs/sdks/schemas/README.md#deleteschema) - Delete a shared component -- [`schemasDeleteSchemaVersion`](docs/sdks/schemas/README.md#deleteschemaversion) - Delete a shared component version -- [`schemasGetSchemaVersion`](docs/sdks/schemas/README.md#getschemaversion) - Get a shared component document -- [`schemasListSchemas`](docs/sdks/schemas/README.md#listschemas) - List all shared components -- [`schemasRemoveSchemaAccessGroup`](docs/sdks/schemas/README.md#removeschemaaccessgroup) - Remove shared component access group -- [`schemasUpdateSchema`](docs/sdks/schemas/README.md#updateschema) - Update shared component metadata -- [`teamsListTeams`](docs/sdks/teams/README.md#listteams) - List teams -- [`themesCreateTheme`](docs/sdks/themes/README.md#createtheme) - Create a theme -- [`themesDeleteTheme`](docs/sdks/themes/README.md#deletetheme) - Delete a theme -- [`themesGetTheme`](docs/sdks/themes/README.md#gettheme) - Get a theme -- [`themesListThemes`](docs/sdks/themes/README.md#listthemes) - List all themes -- [`themesReplaceThemeDocument`](docs/sdks/themes/README.md#replacethemedocument) - Update theme document -- [`themesUpdateTheme`](docs/sdks/themes/README.md#updatetheme) - Update theme metadata - -
- - - -## Retries - -Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK. - -To change the default retry strategy for a single API call, simply provide a retryConfig object to the call: -```typescript -import { Scalar } from "@scalar/sdk"; - -const scalar = new Scalar({ - bearerAuth: "", -}); - -async function run() { - const result = await scalar.registry.listAllApiDocuments({ - retries: { - strategy: "backoff", - backoff: { - initialInterval: 1, - maxInterval: 50, - exponent: 1.1, - maxElapsedTime: 100, - }, - retryConnectionErrors: false, - }, - }); - - console.log(result); -} - -run(); +
-``` +## Authentication -If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization: -```typescript -import { Scalar } from "@scalar/sdk"; - -const scalar = new Scalar({ - retryConfig: { - strategy: "backoff", - backoff: { - initialInterval: 1, - maxInterval: 50, - exponent: 1.1, - maxElapsedTime: 100, - }, - retryConnectionErrors: false, - }, - bearerAuth: "", -}); +Pass credentials to the generated client constructor. Environment variables are read automatically when supported by the target runtime. -async function run() { - const result = await scalar.registry.listAllApiDocuments(); +| Option | Type | Default | Description | +| --- | --- | --- | --- | +| `bearerAuth` | `string \| provider` | - | Credential for the BearerAuth scheme. Defaults to BEARER_AUTH. | - console.log(result); -} +Declared schemes: -run(); +- `BearerAuth` bearer token -``` - - - -## Error Handling - -[`ScalarError`](./src/models/errors/scalarerror.ts) is the base class for all HTTP error responses. It has the following properties: +
-| Property | Type | Description | -| ------------------------- | ---------- | --------------------------------------------------------------------------------------- | -| `error.message` | `string` | Error message | -| `error.httpMeta.response` | `Response` | HTTP response. Access to headers and more. | -| `error.httpMeta.request` | `Request` | HTTP request. Access to headers and more. | -| `error.data$` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). | +## Errors -### Example -```typescript -import { Scalar } from "@scalar/sdk"; -import * as errors from "@scalar/sdk/models/errors"; +Non-success responses throw generated API errors. Error objects expose status, headers, response body, and request metadata where the target runtime supports it. -const scalar = new Scalar({ - bearerAuth: "", -}); +```ts +import { APIError } from "@scalar/sdk"; -async function run() { - try { - const result = await scalar.registry.listAllApiDocuments(); - - console.log(result); - } catch (error) { - // The base class for HTTP error responses - if (error instanceof errors.ScalarError) { - console.log(error.message); - console.log(error.httpMeta.response.status); - console.log(error.httpMeta.response.headers); - console.log(error.httpMeta.request); - - // Depending on the method different errors may be thrown - if (error instanceof errors.FourHundred) { - console.log(error.data$.message); // string - console.log(error.data$.code); // string - } - } +try { + const listAllAPIDocuments = await client.registry.listAllAPIDocuments(); +} catch (err) { + if (err instanceof APIError) { + console.log(err.status, err.name, err.headers); } + throw err; } - -run(); - ``` -### Error Classes -**Primary errors:** -* [`ScalarError`](./src/models/errors/scalarerror.ts): The base class for HTTP error responses. - * [`FourHundred`](docs/models/errors/fourhundred.md): Bad request. Status code `400`. - * [`FourHundredAndOne`](docs/models/errors/fourhundredandone.md): No auth. Status code `401`. - * [`FourHundredAndThree`](docs/models/errors/fourhundredandthree.md): Forbidden. Status code `403`. - * [`FourHundredAndFour`](docs/models/errors/fourhundredandfour.md): Not found. Status code `404`. - * [`FourHundredAndTwentyTwo`](docs/models/errors/fourhundredandtwentytwo.md): Invalid payload. Status code `422`. - * [`FiveHundred`](docs/models/errors/fivehundred.md): Uncaught error. Status code `500`. - -
Less common errors (6) +Documented error statuses: `400`, `401`, `403`, `404`, `422`, `500`.
-**Network errors:** -* [`ConnectionError`](./src/models/errors/httpclienterrors.ts): HTTP client was unable to make a request to a server. -* [`RequestTimeoutError`](./src/models/errors/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal. -* [`RequestAbortedError`](./src/models/errors/httpclienterrors.ts): HTTP request was aborted by the client. -* [`InvalidRequestError`](./src/models/errors/httpclienterrors.ts): Any input used to create a request is invalid. -* [`UnexpectedClientError`](./src/models/errors/httpclienterrors.ts): Unrecognised or unexpected error. - - -**Inherit from [`ScalarError`](./src/models/errors/scalarerror.ts)**: -* [`ResponseValidationError`](./src/models/errors/responsevalidationerror.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string. +## Client Options -
- +Configure the generated client by setting any of these options when you create it. - -## Server Selection - -### Override Server URL Per-Client - -The default server can be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example: -```typescript -import { Scalar } from "@scalar/sdk"; +```ts +import ScalarAPI from "@scalar/sdk"; -const scalar = new Scalar({ - serverURL: "https://access.scalar.com", - bearerAuth: "", +const client = new ScalarAPI({ + timeout: 60000, + maxRetries: 2, + logLevel: "debug", }); - -async function run() { - const result = await scalar.registry.listAllApiDocuments(); - - console.log(result); -} - -run(); - ``` - - -## Custom HTTP Client +| Option | Type | Default | Description | +| --- | --- | --- | --- | +| `bearerAuth` | `string \| AuthTokenProvider` | `process.env["BEARER_AUTH"]` | Credential for the BearerAuth scheme. | +| `environment` | `Environment` | - | Select one of the configured API environments. | +| `baseURL` | `string \| null` | `process.env["SCALAR_BASE_URL"]` | Override the default API base URL. Pass `null` when selecting a configured environment. | +| `timeout` | `number` | `60000` | Maximum time in milliseconds to wait for a response before aborting a request. | +| `maxRetries` | `number` | `2` | Number of retries for temporary failures. | +| `defaultHeaders` | `HeadersInit` | - | Headers sent with every request. | +| `defaultQuery` | `Record` | - | Query parameters sent with every request. | +| `fetchOptions` | `RequestInit` | - | Additional fetch options sent with every request. | +| `fetch` | `Fetch` | - | Custom fetch implementation. | +| `logLevel` | `"off" \| "error" \| "warn" \| "info" \| "debug" \| null` | `process.env["SCALAR_LOG"]` | Controls request and retry debug logging. | +| `logger` | `Logger \| null` | `console` | Custom logger implementation. | -The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native -[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This -client is a thin wrapper around `fetch` and provides the ability to attach hooks -around the request lifecycle that can be used to modify the request or handle -errors and response. +
-The `HTTPClient` constructor takes an optional `fetcher` argument that can be -used to integrate a third-party HTTP client or when writing tests to mock out -the HTTP client and feed in fixtures. +## Request Options -The following example shows how to use the `"beforeRequest"` hook to to add a -custom header and a timeout to requests and how to use the `"requestError"` hook -to log errors: +| Option | Type | Default | Description | +| --- | --- | --- | --- | +| `headers` | `HeadersInit` | - | Per-request headers. | +| `query` | `Record` | - | Per-request query parameters. | +| `body` | `unknown` | - | Override the generated request body. | +| `timeout` | `number` | - | Per-request timeout in milliseconds. | +| `maxRetries` | `number` | - | Per-request retry count. | +| `signal` | `AbortSignal` | - | Abort an in-flight request. | +| `fetchOptions` | `RequestInit` | - | Per-request fetch options. | +| `idempotencyKey` | `string` | - | Idempotency key for retry-safe operations. | -```typescript -import { Scalar } from "@scalar/sdk"; -import { HTTPClient } from "@scalar/sdk/lib/http"; +
-const httpClient = new HTTPClient({ - // fetcher takes a function that has the same signature as native `fetch`. - fetcher: (request) => { - return fetch(request); - } -}); +## Retries and Timeouts -httpClient.addHook("beforeRequest", (request) => { - const nextRequest = new Request(request, { - signal: request.signal || AbortSignal.timeout(5000) - }); +Generated clients support request timeouts and retry temporary failures such as network errors, 408, 409, 429, and 5xx responses. Retry delays honor `Retry-After` headers when present. Tune the retry and timeout client options shown above, or override them per request. - nextRequest.headers.set("x-custom-header", "custom value"); +
- return nextRequest; -}); +## Helpers -httpClient.addHook("requestError", (error, request) => { - console.group("Request Error"); - console.log("Reason:", `${error}`); - console.log("Endpoint:", `${request.method} ${request.url}`); - console.groupEnd(); -}); +- Use `.withResponse()` on any request to inspect both parsed data and the raw `Response` object. +- Every operation returns an `APIPromise`, so you can `await` it directly or chain `.withResponse()`. -const sdk = new Scalar({ httpClient }); -``` - +
- -## Debugging +## Logging -You can setup your SDK to emit debug logs for SDK requests and responses. +- Set `logLevel: "debug"` to log request URLs, options, response status, response headers, and retry attempts. +- Pass a custom `logger` to route logs into your own observability pipeline. +- Set `logLevel: null` to disable environment-driven logging. -You can pass a logger that matches `console`'s interface as an SDK option. +
-> [!WARNING] -> Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production. +## Requirements -```typescript -import { Scalar } from "@scalar/sdk"; +- Node.js 20+, a modern browser, or any runtime with `fetch` support + +Powered by Scalar. -const sdk = new Scalar({ debugLogger: console }); -``` - ## Contributions -While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. -We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release. +This SDK is generated programmatically. Manual edits to generated files will be +overwritten on the next build. -### SDK Created by [Scalar](https://www.scalar.com/?utm_source=scalar-typescript-sdk&utm_campaign=typescript) \ No newline at end of file +### SDK created by [Scalar](https://www.scalar.com/?utm_source=scalar-typescript-sdk&utm_campaign=sdk) diff --git a/api.md b/api.md new file mode 100644 index 0000000..9c2b0e4 --- /dev/null +++ b/api.md @@ -0,0 +1,765 @@ +# Scalar TypeScript API + +Complete reference of every operation, grouped by resource. See [the README](./README.md) for usage and configuration. + +## Contents + +- [`Registry`](#registry) + - [List all API Documents](#list-all-api-documents) + - [List API Documents in a namespace](#list-api-documents-in-a-namespace) + - [Create API Document](#create-api-document) + - [Update API Document metadata](#update-api-document-metadata) + - [Delete API Document](#delete-api-document) + - [Get API Document](#get-api-document) + - [Update API Document version](#update-api-document-version) + - [Delete API Document version](#delete-api-document-version) + - [Get API Document version metadata](#get-api-document-version-metadata) + - [Create API Document version](#create-api-document-version) + - [Add access group](#add-access-group) + - [Remove access group](#remove-access-group) +- [`Schemas`](#schemas) + - [List all shared components](#list-all-shared-components) + - [Create a shared component](#create-a-shared-component) + - [Update shared component metadata](#update-shared-component-metadata) + - [Delete a shared component](#delete-a-shared-component) + - [`Schemas Version`](#schemas-version) + - [Get a shared component document](#get-a-shared-component-document) + - [Delete a shared component version](#delete-a-shared-component-version) + - [Create a shared component version](#create-a-shared-component-version) + - [`Schemas AccessGroup`](#schemas-accessgroup) + - [Add shared component access group](#add-shared-component-access-group) + - [Remove shared component access group](#remove-shared-component-access-group) +- [`LoginPortals`](#loginportals) + - [Get a login portal](#get-a-login-portal) + - [Update portal metadata](#update-portal-metadata) + - [Delete a login portal](#delete-a-login-portal) + - [Create a portal](#create-a-portal) + - [List all portals](#list-all-portals) +- [`Rules`](#rules) + - [List all rules](#list-all-rules) + - [Create a rule](#create-a-rule) + - [Update rule metadata](#update-rule-metadata) + - [Delete a rule](#delete-a-rule) + - [Get a rule](#get-a-rule) + - [Add rule access group](#add-rule-access-group) + - [Remove rule access group](#remove-rule-access-group) +- [`Themes`](#themes) + - [List all themes](#list-all-themes) + - [Create a theme](#create-a-theme) + - [Update theme metadata](#update-theme-metadata) + - [Update theme document](#update-theme-document) + - [Delete a theme](#delete-a-theme) + - [Get a theme](#get-a-theme) +- [`Teams`](#teams) + - [List teams](#list-teams) +- [`ScalarDocs`](#scalardocs) + - [List all projects](#list-all-projects) + - [Create a project](#create-a-project) + - [Publish a project](#publish-a-project) +- [`Namespaces`](#namespaces) + - [List namespaces](#list-namespaces) +- [`Authentication`](#authentication) + - [Exchange token](#exchange-token) + - [Get current user](#get-current-user) + +## Setup + +```ts +import ScalarAPI from "@scalar/sdk"; + +const client = new ScalarAPI({ + bearerAuth: process.env["BEARER_AUTH"], // defaults to the BEARER_AUTH env var + environment: "production", +}); +``` + +## `Registry` + +### List all API Documents + +List all API documents across every namespace the caller can access. + +| Direction | Type | +| --- | --- | +| Response | [`RegistryListAllAPIDocumentsResponse`](./src/resources/registry.ts) | + +```ts +const listAllAPIDocuments = await client.registry.listAllAPIDocuments(); +``` + +### List API Documents in a namespace + +List API documents in a namespace. + +| Direction | Type | +| --- | --- | +| Response | [`RegistryListAPIDocumentsResponse`](./src/resources/registry.ts) | + +```ts +const listAPIDocuments = await client.registry.listAPIDocuments("namespace"); +``` + +### Create API Document + +Create an API document. + +| Direction | Type | +| --- | --- | +| Request | [`RegistryCreateAPIDocumentParams`](./src/resources/registry.ts) | +| Response | [`RegistryCreateAPIDocumentResponse`](./src/resources/registry.ts) | + +```ts +const createAPIDocument = await client.registry.createAPIDocument("namespace", { + title: "", + version: "", + slug: "", + document: "", +}); +``` + +### Update API Document metadata + +Update metadata for an API document. + +| Direction | Type | +| --- | --- | +| Request | [`RegistryUpdateAPIDocumentParams`](./src/resources/registry.ts) | + +```ts +await client.registry.updateAPIDocument("slug", { + namespace: "namespace", +}); +``` + +### Delete API Document + +Delete an API document and all versions. + +| Direction | Type | +| --- | --- | +| Request | [`RegistryDeleteAPIDocumentParams`](./src/resources/registry.ts) | + +```ts +await client.registry.deleteAPIDocument("slug", { + namespace: "namespace", +}); +``` + +### Get API Document + +Get a specific API document version. + +| Direction | Type | +| --- | --- | +| Request | [`RegistryRetrieveAPIDocumentVersionParams`](./src/resources/registry.ts) | + +```ts +const string_ = await client.registry.retrieveAPIDocumentVersion("semver", { + namespace: "namespace", + slug: "slug", +}); +``` + +### Update API Document version + +Update the registry file content for an API document version. + +| Direction | Type | +| --- | --- | +| Request | [`RegistryUpdateAPIDocumentVersionParams`](./src/resources/registry.ts) | +| Response | [`RegistryUpdateAPIDocumentVersionResponse`](./src/resources/registry.ts) | + +```ts +const updateAPIDocumentVersion = await client.registry.updateAPIDocumentVersion("semver", { + namespace: "namespace", + slug: "slug", + document: "", +}); +``` + +### Delete API Document version + +Delete a specific API document version. + +| Direction | Type | +| --- | --- | +| Request | [`RegistryDeleteAPIDocumentVersionParams`](./src/resources/registry.ts) | + +```ts +await client.registry.deleteAPIDocumentVersion("semver", { + namespace: "namespace", + slug: "slug", +}); +``` + +### Get API Document version metadata + +Get metadata (uid, content shas, version sha, tags) for a specific API document version. + +| Direction | Type | +| --- | --- | +| Request | [`RegistryListAPIDocumentVersionMetadataParams`](./src/resources/registry.ts) | +| Response | [`ManagedDocVersion`](./src/resources/registry.ts) | + +```ts +const managedDocVersion = await client.registry.listAPIDocumentVersionMetadata("semver", { + namespace: "namespace", + slug: "slug", +}); +``` + +### Create API Document version + +Create a new API document version. + +| Direction | Type | +| --- | --- | +| Request | [`RegistryCreateAPIDocumentVersionParams`](./src/resources/registry.ts) | +| Response | [`ManagedDocVersion`](./src/resources/registry.ts) | + +```ts +const managedDocVersion = await client.registry.createAPIDocumentVersion("slug", { + namespace: "namespace", + version: "", + document: "", +}); +``` + +### Add access group + +Add an access group to an API document. + +| Direction | Type | +| --- | --- | +| Request | [`RegistryCreateAPIDocumentAccessGroupParams`](./src/resources/registry.ts) | + +```ts +await client.registry.createAPIDocumentAccessGroup("slug", { + namespace: "namespace", + accessGroupSlug: "", +}); +``` + +### Remove access group + +Remove an access group from an API document. + +| Direction | Type | +| --- | --- | +| Request | [`RegistryDeleteAPIDocumentAccessGroupParams`](./src/resources/registry.ts) | + +```ts +await client.registry.deleteAPIDocumentAccessGroup("slug", { + namespace: "namespace", + accessGroupSlug: "", +}); +``` + +## `Schemas` + +### List all shared components + +List schemas in a namespace. + +| Direction | Type | +| --- | --- | +| Response | [`SchemaListResponse`](./src/resources/schemas/schemas.ts) | + +```ts +const list = await client.schemas.list("namespace"); +``` + +### Create a shared component + +Create a schema in a namespace. + +| Direction | Type | +| --- | --- | +| Request | [`SchemaCreateParams`](./src/resources/schemas/schemas.ts) | +| Response | [`UID`](./src/resources/schemas/schemas.ts) | + +```ts +const uID = await client.schemas.create("namespace", { + title: "", + version: "", + slug: "", + document: "", +}); +``` + +### Update shared component metadata + +Update schema metadata. + +| Direction | Type | +| --- | --- | +| Request | [`SchemaUpdateParams`](./src/resources/schemas/schemas.ts) | + +```ts +await client.schemas.update("slug", { + namespace: "namespace", +}); +``` + +### Delete a shared component + +Delete a schema and all related versions. + +| Direction | Type | +| --- | --- | +| Request | [`SchemaDeleteParams`](./src/resources/schemas/schemas.ts) | + +```ts +await client.schemas.delete("slug", { + namespace: "namespace", +}); +``` + +### `Schemas Version` + +#### Get a shared component document + +Get a specific schema version document. + +| Direction | Type | +| --- | --- | +| Request | [`VersionRetrieveSchemaParams`](./src/resources/schemas/version.ts) | + +```ts +const string_ = await client.schemas.version.retrieveSchema("semver", { + namespace: "namespace", + slug: "slug", +}); +``` + +#### Delete a shared component version + +Delete a schema version. + +| Direction | Type | +| --- | --- | +| Request | [`VersionDeleteSchemaParams`](./src/resources/schemas/version.ts) | + +```ts +await client.schemas.version.deleteSchema("semver", { + namespace: "namespace", + slug: "slug", +}); +``` + +#### Create a shared component version + +Create a schema version. + +| Direction | Type | +| --- | --- | +| Request | [`VersionCreateSchemaParams`](./src/resources/schemas/version.ts) | +| Response | [`UID`](./src/resources/schemas/version.ts) | + +```ts +const uID = await client.schemas.version.createSchema("slug", { + namespace: "namespace", + version: "", + document: "", +}); +``` + +### `Schemas AccessGroup` + +#### Add shared component access group + +Add an access group to a schema. + +| Direction | Type | +| --- | --- | +| Request | [`AccessGroupCreateSchemaParams`](./src/resources/schemas/access-group.ts) | + +```ts +await client.schemas.accessGroup.createSchema("slug", { + namespace: "namespace", + accessGroupSlug: "", +}); +``` + +#### Remove shared component access group + +Remove an access group from a schema. + +| Direction | Type | +| --- | --- | +| Request | [`AccessGroupDeleteSchemaParams`](./src/resources/schemas/access-group.ts) | + +```ts +await client.schemas.accessGroup.deleteSchema("slug", { + namespace: "namespace", + accessGroupSlug: "", +}); +``` + +## `LoginPortals` + +### Get a login portal + +Get a login portal by slug. + +| Direction | Type | +| --- | --- | +| Response | [`LoginPortalRetrieveResponse`](./src/resources/login-portals.ts) | + +```ts +const retrieve = await client.loginPortals.retrieve("slug"); +``` + +### Update portal metadata + +Update metadata for a login portal. + +| Direction | Type | +| --- | --- | +| Request | [`LoginPortalUpdateParams`](./src/resources/login-portals.ts) | + +```ts +await client.loginPortals.update("slug", {}); +``` + +### Delete a login portal + +Delete a login portal. + +```ts +await client.loginPortals.delete("slug"); +``` + +### Create a portal + +Create a login portal for the current team. + +| Direction | Type | +| --- | --- | +| Request | [`LoginPortalCreateParams`](./src/resources/login-portals.ts) | +| Response | [`UID`](./src/resources/login-portals.ts) | + +```ts +const uID = await client.loginPortals.create({ + title: "", + slug: "", + email: { + logo: "", + logoSize: "100", + buttonText: "Login", + message: "Click to access private documentation hosted by scalar.com", + title: "Private Docs", + mainColor: "#2a2f45", + mainBackground: "#f6f6f6", + cardColor: "2a2f45", + cardBackground: "#fff", + buttonColor: "#fff", + buttonBackground: "#0f0f0f", + }, + page: { + title: "Scalar Private Docs", + description: "Login to access your documentation", + head: "", + script: "", + theme: "", + companyName: "", + logo: "", + logoUrl: "", + favicon: "", + termsLink: "", + privacyLink: "", + formTitle: "Scalar Private Docs", + formDescription: "Login to access your documentation", + formImage: "", + }, +}); +``` + +### List all portals + +List all login portals for the current team. + +| Direction | Type | +| --- | --- | +| Response | [`LoginPortalListResponse`](./src/resources/login-portals.ts) | + +```ts +const list = await client.loginPortals.list(); +``` + +## `Rules` + +### List all rules + +List all rulesets in a namespace. + +| Direction | Type | +| --- | --- | +| Response | [`RuleListRulesetsResponse`](./src/resources/rules.ts) | + +```ts +const listRulesets = await client.rules.listRulesets("namespace"); +``` + +### Create a rule + +Create a rule in a namespace. + +| Direction | Type | +| --- | --- | +| Request | [`RuleCreateRulesetParams`](./src/resources/rules.ts) | +| Response | [`UID`](./src/resources/rules.ts) | + +```ts +const uID = await client.rules.createRuleset("namespace", { + title: "", + slug: "", + document: "", +}); +``` + +### Update rule metadata + +Update rule metadata by slug. + +| Direction | Type | +| --- | --- | +| Request | [`RuleUpdateRulesetParams`](./src/resources/rules.ts) | + +```ts +await client.rules.updateRuleset("slug", { + namespace: "namespace", +}); +``` + +### Delete a rule + +Delete a rule by slug. + +| Direction | Type | +| --- | --- | +| Request | [`RuleDeleteRulesetParams`](./src/resources/rules.ts) | + +```ts +await client.rules.deleteRuleset("slug", { + namespace: "namespace", +}); +``` + +### Get a rule + +Get a rule document by slug. + +| Direction | Type | +| --- | --- | +| Request | [`RuleRetrieveRulesetDocumentParams`](./src/resources/rules.ts) | + +```ts +const string_ = await client.rules.retrieveRulesetDocument("slug", { + namespace: "namespace", +}); +``` + +### Add rule access group + +Grant an access group to a rule. + +| Direction | Type | +| --- | --- | +| Request | [`RuleCreateRulesetAccessGroupParams`](./src/resources/rules.ts) | + +```ts +await client.rules.createRulesetAccessGroup("slug", { + namespace: "namespace", + accessGroupSlug: "", +}); +``` + +### Remove rule access group + +Remove an access group from a rule. + +| Direction | Type | +| --- | --- | +| Request | [`RuleDeleteRulesetAccessGroupParams`](./src/resources/rules.ts) | + +```ts +await client.rules.deleteRulesetAccessGroup("slug", { + namespace: "namespace", + accessGroupSlug: "", +}); +``` + +## `Themes` + +### List all themes + +List all team themes. + +| Direction | Type | +| --- | --- | +| Response | [`ThemeListResponse`](./src/resources/themes.ts) | + +```ts +const list = await client.themes.list(); +``` + +### Create a theme + +Create a team theme. + +| Direction | Type | +| --- | --- | +| Request | [`ThemeCreateParams`](./src/resources/themes.ts) | +| Response | [`UID`](./src/resources/themes.ts) | + +```ts +const uID = await client.themes.create({ + name: "", + slug: "", + document: "", +}); +``` + +### Update theme metadata + +Update theme metadata. + +| Direction | Type | +| --- | --- | +| Request | [`ThemeUpdateParams`](./src/resources/themes.ts) | + +```ts +await client.themes.update("slug", {}); +``` + +### Update theme document + +Replace the theme document. + +| Direction | Type | +| --- | --- | +| Request | [`ThemeReplaceDocumentParams`](./src/resources/themes.ts) | + +```ts +await client.themes.replaceDocument("slug", { + document: "", +}); +``` + +### Delete a theme + +Delete a theme by slug. + +```ts +await client.themes.delete("slug"); +``` + +### Get a theme + +Get the theme document by slug. + +```ts +const string_ = await client.themes.retrieve("slug"); +``` + +## `Teams` + +### List teams + +List all available teams + +| Direction | Type | +| --- | --- | +| Response | [`TeamListResponse`](./src/resources/teams.ts) | + +```ts +const list = await client.teams.list(); +``` + +## `ScalarDocs` + +### List all projects + +List all guide projects. + +| Direction | Type | +| --- | --- | +| Response | [`ScalarDocListGuidesResponse`](./src/resources/scalar-docs.ts) | + +```ts +const listGuides = await client.scalarDocs.listGuides(); +``` + +### Create a project + +Create a guide project. + +| Direction | Type | +| --- | --- | +| Request | [`ScalarDocCreateGuideParams`](./src/resources/scalar-docs.ts) | +| Response | [`ScalarDocCreateGuideResponse`](./src/resources/scalar-docs.ts) | + +```ts +const createGuide = await client.scalarDocs.createGuide({ + name: "", + isPrivate: false, + allowedUsers: [], + allowedDomains: [], +}); +``` + +### Publish a project + +Start a new publish process. + +| Direction | Type | +| --- | --- | +| Response | [`ScalarDocPublishGuideResponse`](./src/resources/scalar-docs.ts) | + +```ts +const publishGuide = await client.scalarDocs.publishGuide("slug"); +``` + +## `Namespaces` + +### List namespaces + +Get all namespaces for the current team + +| Direction | Type | +| --- | --- | +| Response | [`NamespaceListResponse`](./src/resources/namespaces.ts) | + +```ts +const list = await client.namespaces.list(); +``` + +## `Authentication` + +### Exchange token + +Exchange an API key for an access token. + +| Direction | Type | +| --- | --- | +| Request | [`AuthenticationExchangePersonalTokenParams`](./src/resources/authentication.ts) | +| Response | [`AuthenticationExchangePersonalTokenResponse`](./src/resources/authentication.ts) | + +```ts +const exchangePersonalToken = await client.authentication.exchangePersonalToken({ + personalToken: "", +}); +``` + +### Get current user + +Get the authenticated user, including their available teams and theme. + +| Direction | Type | +| --- | --- | +| Response | [`User`](./src/resources/authentication.ts) | + +```ts +const user = await client.authentication.listCurrentUser(); +``` diff --git a/openapi.augmented.json b/openapi.augmented.json new file mode 100644 index 0000000..20a85dc --- /dev/null +++ b/openapi.augmented.json @@ -0,0 +1,7611 @@ +{ + "openapi": "3.1.1", + "info": { + "title": "Scalar API", + "description": "API for managing Scalar platform resources.\n\n## TypeScript SDK\n\nFor TypeScript, we provide a SDK that makes using our API even easier.\n\n### Install\n\n```bash\nnpm add @scalar/sdk\n```\n\n### Get a Scalar API key\n\nCreate an API key in your Scalar account:\n\n- Dashboard: https://dashboard.scalar.com/account\n- Store it in `.env`, for example:\n\n```bash\nSCALAR_API_KEY=your_personal_token\n```\n\n### Exchange your API key for an access token\n\nThe personal token is not an access token. Exchange it first with `postv1AuthExchange`.\n\nIf you use the personal token directly for authenticated API calls, the API returns `401 Invalid authentication token`.\n\n```ts\nimport { Scalar } from '@scalar/sdk'\n\nconst scalar = new Scalar()\n\nconst exchange = await scalar.auth.postv1AuthExchange({\n personalToken: process.env.SCALAR_API_KEY!,\n})\n\nconst accessToken = exchange.accessToken\n```\n\n### Use the access token\n\nConstruct a second client with bearer auth. Use this authenticated client for API calls.\n\n```ts\nimport { Scalar } from '@scalar/sdk'\n\nconst scalar = new Scalar()\n\nconst exchange = await scalar.auth.postv1AuthExchange({\n personalToken: process.env.SCALAR_API_KEY!,\n})\n\nconst authedScalar = new Scalar({\n bearerAuth: exchange.accessToken,\n})\n```\n\n### Notes\n\n- The exchange request itself can be made from a client constructed with no arguments (`new Scalar()`).\n- The exchanged access token is valid for 12 hours.\n- Timestamps are Unix seconds.\n\n### Read more\n\n- [@scalar/sdk on npm](https://www.npmjs.com/package/@scalar/sdk)", + "version": "0.1.5", + "contact": { + "name": "Marc from Scalar", + "url": "https://scalar.com", + "email": "support@scalar.com" + }, + "x-scalar-sdk-installation": [ + { + "lang": "TypeScript", + "description": "```sh\nnpm install @scalar/sdk\n```" + }, + { + "lang": "Python", + "description": "```sh\npip install scalarApi\n```" + }, + { + "lang": "Go", + "description": "```sh\ngo get scalar-api\n```" + } + ] + }, + "servers": [ + { + "url": "https://access.scalar.com" + } + ], + "tags": [ + { + "name": "Registry", + "description": "Registry" + }, + { + "name": "Schemas", + "description": "Schemas" + }, + { + "name": "Login Portals", + "description": "Login Portals" + }, + { + "name": "Rules", + "description": "Rules" + }, + { + "name": "Themes", + "description": "Themes" + }, + { + "name": "Teams", + "description": "Teams" + }, + { + "name": "Scalar Docs", + "description": "Scalar Docs" + }, + { + "name": "Namespaces", + "description": "Namespaces" + }, + { + "name": "Authentication", + "description": "Authentication" + } + ], + "components": { + "securitySchemes": { + "BearerAuth": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + }, + "schemas": { + "400": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "code": { + "type": "string" + } + }, + "required": [ + "message", + "code" + ] + }, + "401": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "code": { + "type": "string" + } + }, + "required": [ + "message", + "code" + ] + }, + "403": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "code": { + "type": "string" + } + }, + "required": [ + "message", + "code" + ] + }, + "404": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "code": { + "type": "string" + } + }, + "required": [ + "message", + "code" + ] + }, + "422": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "code": { + "type": "string" + } + }, + "required": [ + "message", + "code" + ] + }, + "500": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "code": { + "type": "string" + } + }, + "required": [ + "message", + "code" + ] + }, + "api-document": { + "type": "object", + "properties": { + "uid": { + "default": "nanoid()", + "$ref": "#/components/schemas/nanoid" + }, + "version": { + "$ref": "#/components/schemas/version" + }, + "title": { + "default": "", + "type": "string", + "maxLength": 100 + }, + "slug": { + "default": "randomManagedDocSlug()", + "$ref": "#/components/schemas/slug" + }, + "description": { + "default": "", + "type": "string" + }, + "namespace": { + "$ref": "#/components/schemas/namespace" + }, + "isPrivate": { + "default": false, + "type": "boolean" + }, + "tags": { + "default": [] + }, + "versions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/managed-doc-version" + } + } + }, + "required": [ + "uid", + "version", + "title", + "slug", + "description", + "namespace", + "isPrivate", + "tags", + "versions" + ], + "additionalProperties": false + }, + "nanoid": { + "type": "string", + "minLength": 5 + }, + "version": { + "type": "string", + "minLength": 1 + }, + "slug": { + "type": "string", + "minLength": 3, + "maxLength": 60, + "pattern": "^[a-z](?:[a-z0-9-]*[a-z0-9])?$" + }, + "namespace": { + "type": "string", + "minLength": 3, + "maxLength": 50, + "pattern": "^[a-zA-Z0-9-_]+$" + }, + "managed-doc-version": { + "type": "object", + "properties": { + "uid": { + "$ref": "#/components/schemas/nanoid" + }, + "createdAt": { + "type": "number" + }, + "version": { + "$ref": "#/components/schemas/version" + }, + "upgraded": { + "default": false, + "type": "boolean" + }, + "embedStatus": { + "default": null, + "anyOf": [ + { + "type": "string", + "enum": [ + "complete", + "failed" + ] + }, + { + "type": "null" + } + ] + }, + "tags": { + "default": [], + "type": "array", + "items": { + "type": "string" + } + }, + "tools": { + "type": "array", + "items": { + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "method": { + "$ref": "#/components/schemas/method" + }, + "enabledTools": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "execute-request", + "get-mini-openapi-spec" + ] + } + } + }, + "required": [ + "path", + "method", + "enabledTools" + ], + "additionalProperties": false + } + }, + "yamlSha": { + "type": "string" + }, + "jsonSha": { + "type": "string" + }, + "versionSha": { + "type": "string" + } + }, + "required": [ + "uid", + "createdAt", + "version", + "upgraded", + "embedStatus", + "tags" + ], + "additionalProperties": false + }, + "method": { + "type": "string", + "enum": [ + "delete", + "get", + "head", + "options", + "patch", + "post", + "put", + "trace" + ] + }, + "access-group": { + "type": "object", + "properties": { + "accessGroupSlug": { + "$ref": "#/components/schemas/slug" + } + }, + "required": [ + "accessGroupSlug" + ], + "additionalProperties": false + }, + "schema": { + "type": "object", + "properties": { + "uid": { + "default": "nanoid()", + "$ref": "#/components/schemas/nanoid" + }, + "title": { + "default": "", + "type": "string", + "maxLength": 100 + }, + "description": { + "default": "", + "type": "string" + }, + "slug": { + "default": "randomManagedDocSlug()", + "$ref": "#/components/schemas/slug" + }, + "namespace": { + "$ref": "#/components/schemas/namespace" + }, + "isPrivate": { + "default": false, + "type": "boolean" + }, + "versions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/managed-schema-version" + } + } + }, + "required": [ + "uid", + "title", + "description", + "slug", + "namespace", + "isPrivate", + "versions" + ], + "additionalProperties": false + }, + "managed-schema-version": { + "type": "object", + "properties": { + "uid": { + "default": "nanoid()", + "$ref": "#/components/schemas/nanoid" + }, + "createdAt": { + "default": "unixTimestamp()", + "$ref": "#/components/schemas/timestamp" + }, + "updatedAt": { + "default": "unixTimestamp()", + "$ref": "#/components/schemas/timestamp" + }, + "version": { + "default": "0.0.1", + "$ref": "#/components/schemas/version" + } + }, + "required": [ + "uid", + "createdAt", + "updatedAt", + "version" + ], + "additionalProperties": false + }, + "timestamp": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "uid": { + "type": "object", + "properties": { + "uid": { + "$ref": "#/components/schemas/nanoid" + } + }, + "required": [ + "uid" + ], + "additionalProperties": false + }, + "login-portal-email": { + "type": "object", + "properties": { + "logo": { + "default": "", + "type": "string" + }, + "logoSize": { + "default": "100", + "type": "string" + }, + "buttonText": { + "default": "Login", + "type": "string", + "maxLength": 50 + }, + "message": { + "default": "Click to access private documentation hosted by scalar.com", + "type": "string", + "maxLength": 1000 + }, + "title": { + "default": "Private Docs", + "type": "string", + "maxLength": 100 + }, + "mainColor": { + "default": "#2a2f45", + "type": "string", + "maxLength": 100 + }, + "mainBackground": { + "default": "#f6f6f6", + "type": "string", + "maxLength": 100 + }, + "cardColor": { + "default": "2a2f45", + "type": "string", + "maxLength": 100 + }, + "cardBackground": { + "default": "#fff", + "type": "string", + "maxLength": 100 + }, + "buttonColor": { + "default": "#fff", + "type": "string", + "maxLength": 100 + }, + "buttonBackground": { + "default": "#0f0f0f", + "type": "string", + "maxLength": 100 + } + }, + "required": [ + "logo", + "logoSize", + "buttonText", + "message", + "title", + "mainColor", + "mainBackground", + "cardColor", + "cardBackground", + "buttonColor", + "buttonBackground" + ], + "additionalProperties": false + }, + "login-portal-page": { + "type": "object", + "properties": { + "title": { + "default": "Scalar Private Docs", + "type": "string", + "maxLength": 100 + }, + "description": { + "default": "Login to access your documentation", + "type": "string", + "maxLength": 500 + }, + "head": { + "default": "", + "type": "string" + }, + "script": { + "default": "", + "type": "string" + }, + "theme": { + "default": "", + "type": "string" + }, + "companyName": { + "default": "", + "type": "string", + "maxLength": 100 + }, + "logo": { + "default": "", + "type": "string" + }, + "logoURL": { + "default": "", + "type": "string" + }, + "favicon": { + "default": "", + "type": "string" + }, + "termsLink": { + "default": "", + "type": "string" + }, + "privacyLink": { + "default": "", + "type": "string" + }, + "formTitle": { + "default": "Scalar Private Docs", + "type": "string", + "maxLength": 100 + }, + "formDescription": { + "default": "Login to access your documentation", + "type": "string", + "maxLength": 500 + }, + "formImage": { + "default": "", + "type": "string" + } + }, + "required": [ + "title", + "description", + "head", + "script", + "theme", + "companyName", + "logo", + "logoURL", + "favicon", + "termsLink", + "privacyLink", + "formTitle", + "formDescription", + "formImage" + ], + "additionalProperties": false + }, + "login-portal": { + "type": "object", + "properties": { + "uid": { + "$ref": "#/components/schemas/nanoid" + }, + "title": { + "type": "string", + "maxLength": 200 + }, + "slug": { + "$ref": "#/components/schemas/slug" + } + }, + "required": [ + "uid", + "title", + "slug" + ], + "additionalProperties": false + }, + "rule": { + "type": "object", + "properties": { + "uid": { + "default": "nanoid()", + "$ref": "#/components/schemas/nanoid" + }, + "title": { + "default": "", + "type": "string", + "maxLength": 100 + }, + "description": { + "default": "", + "type": "string" + }, + "slug": { + "default": "randomManagedDocSlug()", + "$ref": "#/components/schemas/slug" + }, + "namespace": { + "$ref": "#/components/schemas/namespace" + }, + "isPrivate": { + "default": false, + "type": "boolean" + } + }, + "required": [ + "uid", + "title", + "description", + "slug", + "namespace", + "isPrivate" + ], + "additionalProperties": false + }, + "theme": { + "type": "object", + "properties": { + "uid": { + "$ref": "#/components/schemas/nanoid" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "slug": { + "$ref": "#/components/schemas/slug" + } + }, + "required": [ + "uid", + "name", + "description", + "slug" + ], + "additionalProperties": false + }, + "team": { + "type": "object", + "properties": { + "uid": { + "$ref": "#/components/schemas/nanoid" + }, + "name": { + "$ref": "#/components/schemas/team-name" + }, + "imageUri": { + "$ref": "#/components/schemas/team-image" + }, + "slug": { + "$ref": "#/components/schemas/slug" + }, + "theme": { + "type": "string" + } + }, + "required": [ + "uid", + "name", + "slug", + "theme" + ], + "additionalProperties": false + }, + "team-name": { + "type": "string" + }, + "team-image": { + "type": "string" + }, + "github-project": { + "type": "object", + "properties": { + "uid": { + "default": "nanoid()", + "$ref": "#/components/schemas/nanoid" + }, + "createdAt": { + "default": "unixTimestamp()", + "$ref": "#/components/schemas/timestamp" + }, + "updatedAt": { + "default": "unixTimestamp()", + "$ref": "#/components/schemas/timestamp" + }, + "name": { + "type": "string" + }, + "activeDeployment": { + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/active-deployment" + }, + { + "type": "null" + } + ] + }, + "lastPublished": { + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/timestamp" + }, + { + "type": "null" + } + ] + }, + "lastPublishedUid": { + "default": null, + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "loginPortalUid": { + "default": "", + "type": "string" + }, + "activeThemeId": { + "default": "", + "type": "string" + }, + "typesenseId": { + "type": "number" + }, + "isPrivate": { + "default": false, + "type": "boolean" + }, + "agentEnabled": { + "default": false, + "type": "boolean" + }, + "accessGroups": { + "default": [] + }, + "slug": { + "$ref": "#/components/schemas/slug" + }, + "publishStatus": { + "default": "", + "type": "string" + }, + "publishMessage": { + "default": "", + "type": "string" + }, + "repository": { + "anyOf": [ + { + "$ref": "#/components/schemas/github-project-repository" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "uid", + "createdAt", + "updatedAt", + "name", + "activeDeployment", + "lastPublished", + "lastPublishedUid", + "loginPortalUid", + "activeThemeId", + "isPrivate", + "agentEnabled", + "accessGroups", + "slug", + "publishStatus", + "publishMessage" + ], + "additionalProperties": false + }, + "active-deployment": { + "type": "object", + "properties": { + "uid": { + "type": "string" + }, + "domain": { + "type": "string" + }, + "publishedAt": { + "$ref": "#/components/schemas/timestamp" + } + }, + "required": [ + "uid", + "domain", + "publishedAt" + ], + "additionalProperties": false + }, + "github-project-repository": { + "type": "object", + "properties": { + "linkedBy": { + "type": "string" + }, + "id": { + "type": "number" + }, + "name": { + "type": "string", + "minLength": 2 + }, + "configPath": { + "default": "", + "type": "string" + }, + "branch": { + "default": "", + "type": "string" + }, + "publishOnMerge": { + "default": false, + "type": "boolean" + }, + "publishPreviews": { + "default": false, + "type": "boolean" + }, + "prComments": { + "default": false, + "type": "boolean" + }, + "expired": { + "default": false, + "type": "boolean" + } + }, + "required": [ + "linkedBy", + "id", + "name", + "configPath", + "branch", + "publishOnMerge", + "publishPreviews", + "prComments", + "expired" + ], + "additionalProperties": false + }, + "email": { + "type": "string", + "format": "email", + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + }, + "team-summary": { + "type": "object", + "properties": { + "uid": { + "$ref": "#/components/schemas/nanoid" + }, + "name": { + "$ref": "#/components/schemas/team-name" + }, + "imageUri": { + "$ref": "#/components/schemas/team-image" + } + }, + "required": [ + "uid", + "name" + ], + "additionalProperties": false + }, + "user": { + "type": "object", + "properties": { + "uid": { + "default": "nanoid()", + "$ref": "#/components/schemas/nanoid" + }, + "createdAt": { + "default": "unixTimestamp()", + "$ref": "#/components/schemas/timestamp" + }, + "updatedAt": { + "default": "unixTimestamp()", + "$ref": "#/components/schemas/timestamp" + }, + "email": { + "$ref": "#/components/schemas/email" + }, + "theme": { + "type": "string" + }, + "activeTeamId": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "hasGithub": { + "default": false, + "type": "boolean" + }, + "teams": { + "type": "array", + "items": { + "$ref": "#/components/schemas/team-summary" + } + } + }, + "required": [ + "uid", + "createdAt", + "updatedAt", + "email", + "activeTeamId", + "hasGithub", + "teams" + ], + "additionalProperties": false + } + } + }, + "security": [ + { + "BearerAuth": [] + } + ], + "paths": { + "/v1/apis": { + "get": { + "tags": [ + "Registry" + ], + "description": "List all API documents across every namespace the caller can access.", + "summary": "List all API Documents", + "operationId": "listAllApiDocuments", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/api-document" + } + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst listAllAPIDocuments = await client.registry.listAllAPIDocuments();\nconsole.log(listAllAPIDocuments);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi registry list-all-api-documents --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nregistry = client.registry.list_all_api_documents()\nprint(registry)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tregistry, err := client.Registry.ListAllAPIDocuments(context.Background())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(registry)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.registry.RegistryListAllApiDocumentsParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval registry = client.registry().listAllApiDocuments(RegistryListAllApiDocumentsParams.none())\nprintln(registry)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.registry.list_all_api_documents\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.registry.RegistryListAllApiDocumentsParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nvar registry = client.registry().listAllApiDocuments();\nSystem.out.println(registry);" + } + ] + } + }, + "/v1/apis/{namespace}": { + "get": { + "tags": [ + "Registry" + ], + "description": "List API documents in a namespace.", + "summary": "List API Documents in a namespace", + "operationId": "listApiDocuments", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/api-document" + } + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst listAPIDocuments = await client.registry.listAPIDocuments(\"namespace\");\nconsole.log(listAPIDocuments);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi registry list-api-documents 'namespace' --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nregistry = client.registry.list_api_documents(\n namespace=\"namespace\",\n)\nprint(registry)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tregistry, err := client.Registry.ListAPIDocuments(context.Background(), \"namespace\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(registry)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.registry.RegistryListApiDocumentsParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RegistryListApiDocumentsParams.builder()\n .namespace(\"namespace\")\n .build()\nval registry = client.registry().listApiDocuments(params)\nprintln(registry)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.registry.list_api_documents(\"smoke-test\")\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.registry.RegistryListApiDocumentsParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRegistryListApiDocumentsParams params = RegistryListApiDocumentsParams.builder()\n .namespace(\"namespace\")\n .build();\nvar registry = client.registry().listApiDocuments(params);\nSystem.out.println(registry);" + } + ] + }, + "post": { + "tags": [ + "Registry" + ], + "description": "Create an API document.", + "summary": "Create API Document", + "operationId": "createApiDocument", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "uid": { + "type": "string" + }, + "versionUid": { + "type": "string" + }, + "title": { + "type": "string" + }, + "jsonSha": { + "type": "string" + }, + "yamlSha": { + "type": "string" + }, + "versionSha": { + "type": "string" + } + }, + "required": [ + "uid", + "versionUid", + "title", + "jsonSha", + "yamlSha", + "versionSha" + ], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "version": { + "$ref": "#/components/schemas/version" + }, + "slug": { + "type": "string" + }, + "ruleset": { + "type": "string" + }, + "isPrivate": { + "type": "boolean" + }, + "document": { + "type": "string" + } + }, + "required": [ + "title", + "version", + "slug", + "document" + ], + "additionalProperties": false + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst createAPIDocument = await client.registry.createAPIDocument(\"namespace\", {\n title: \"\",\n version: \"\",\n slug: \"\",\n document: \"\",\n});\nconsole.log(createAPIDocument);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi registry create-api-document 'namespace' --bearer-auth \"$BEARER_AUTH\" --title 'title' --version-command 'version' --slug 'slug' --document 'document'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nregistry = client.registry.create_api_document(\n namespace=\"namespace\",\n title=\"\",\n version=\"\",\n slug=\"\",\n document=\"\",\n idempotency_key=\"\",\n)\nprint(registry)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tregistry, err := client.Registry.NewAPIDocument(context.Background(), \"namespace\", sdk.RegistryNewAPIDocumentParams{\n\t\tDocument: \"\",\n\t\tSlug: \"\",\n\t\tTitle: \"\",\n\t\tVersion: \"\",\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(registry)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.registry.RegistryCreateApiDocumentParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RegistryCreateApiDocumentParams.builder()\n .namespace(\"namespace\")\n .title(\"title\")\n .version(\"version\")\n .slug(\"slug\")\n .document(\"document\")\n .build()\nval registry = client.registry().createApiDocument(params)\nprintln(registry)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.registry.create_api_document(\"smoke-test\", { title: \"title\", description: \"description\", version: \"version\", slug: \"slug\", ruleset: \"ruleset\", is_private: \"is_private\", document: \"document\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.registry.RegistryCreateApiDocumentParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRegistryCreateApiDocumentParams params = RegistryCreateApiDocumentParams.builder()\n .namespace(\"namespace\")\n .title(\"title\")\n .version(\"version\")\n .slug(\"slug\")\n .document(\"document\")\n .build();\nvar registry = client.registry().createApiDocument(params);\nSystem.out.println(registry);" + } + ] + } + }, + "/v1/apis/{namespace}/{slug}": { + "patch": { + "tags": [ + "Registry" + ], + "description": "Update metadata for an API document.", + "summary": "Update API Document metadata", + "operationId": "updateApiDocument", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "isPrivate": { + "type": "boolean" + }, + "ruleset": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.registry.updateAPIDocument(\"slug\", {\n namespace: \"namespace\",\n});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi registry update-api-document 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nregistry = client.registry.update_api_document(\n namespace=\"namespace\",\n slug=\"slug\",\n idempotency_key=\"\",\n)\nprint(registry)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tregistry, err := client.Registry.UpdateAPIDocument(context.Background(), \"namespace\", \"slug\", sdk.RegistryUpdateAPIDocumentParams{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(registry)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.registry.RegistryUpdateApiDocumentParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RegistryUpdateApiDocumentParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .build()\nval registry = client.registry().updateApiDocument(params)\nprintln(registry)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.registry.update_api_document(\"smoke-test\", { namespace: \"namespace\", title: \"title\", description: \"description\", is_private: \"is_private\", ruleset: \"ruleset\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.registry.RegistryUpdateApiDocumentParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRegistryUpdateApiDocumentParams params = RegistryUpdateApiDocumentParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .build();\nvar registry = client.registry().updateApiDocument(params);\nSystem.out.println(registry);" + } + ] + }, + "delete": { + "tags": [ + "Registry" + ], + "description": "Delete an API document and all versions.", + "summary": "Delete API Document", + "operationId": "deleteApiDocument", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.registry.deleteAPIDocument(\"slug\", {\n namespace: \"namespace\",\n});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi registry delete-api-document 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nregistry = client.registry.delete_api_document(\n namespace=\"namespace\",\n slug=\"slug\",\n idempotency_key=\"\",\n)\nprint(registry)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tregistry, err := client.Registry.DeleteAPIDocument(context.Background(), \"namespace\", \"slug\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(registry)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.registry.RegistryDeleteApiDocumentParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RegistryDeleteApiDocumentParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .build()\nval registry = client.registry().deleteApiDocument(params)\nprintln(registry)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.registry.delete_api_document(\"smoke-test\", { namespace: \"namespace\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.registry.RegistryDeleteApiDocumentParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRegistryDeleteApiDocumentParams params = RegistryDeleteApiDocumentParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .build();\nvar registry = client.registry().deleteApiDocument(params);\nSystem.out.println(registry);" + } + ] + } + }, + "/v1/apis/{namespace}/{slug}/version/{semver}": { + "get": { + "tags": [ + "Registry" + ], + "description": "Get a specific API document version.", + "summary": "Get API Document", + "operationId": "getApiDocumentVersion", + "responses": { + "200": { + "description": "Default Response", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "semver", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst string_ = await client.registry.retrieveAPIDocumentVersion(\"semver\", {\n namespace: \"namespace\",\n slug: \"slug\",\n});\nconsole.log(string_);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi registry retrieve-api-document-version 'semver' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --slug 'slug'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nregistry = client.registry.retrieve_api_document_version(\n namespace=\"namespace\",\n slug=\"slug\",\n semver=\"semver\",\n)\nprint(registry)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tregistry, err := client.Registry.GetAPIDocumentVersion(context.Background(), \"namespace\", \"slug\", \"semver\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(registry)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.registry.RegistryRetrieveApiDocumentVersionParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RegistryRetrieveApiDocumentVersionParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .semver(\"semver\")\n .build()\nval registry = client.registry().retrieveApiDocumentVersion(params)\nprintln(registry)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.registry.retrieve_api_document_version(\"smoke-test\", { namespace: \"namespace\", slug: \"slug\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.registry.RegistryRetrieveApiDocumentVersionParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRegistryRetrieveApiDocumentVersionParams params = RegistryRetrieveApiDocumentVersionParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .semver(\"semver\")\n .build();\nvar registry = client.registry().retrieveApiDocumentVersion(params);\nSystem.out.println(registry);" + } + ] + }, + "patch": { + "tags": [ + "Registry" + ], + "description": "Update the registry file content for an API document version.", + "summary": "Update API Document version", + "operationId": "updateApiDocumentVersion", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "jsonSha": { + "type": "string" + }, + "yamlSha": { + "type": "string" + }, + "versionSha": { + "type": "string" + } + }, + "required": [ + "jsonSha", + "yamlSha", + "versionSha" + ], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "document": { + "type": "string" + }, + "lastKnownVersionSha": { + "type": "string" + } + }, + "required": [ + "document" + ], + "additionalProperties": false + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "semver", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst updateAPIDocumentVersion = await client.registry.updateAPIDocumentVersion(\"semver\", {\n namespace: \"namespace\",\n slug: \"slug\",\n document: \"\",\n});\nconsole.log(updateAPIDocumentVersion);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi registry update-api-document-version 'semver' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --slug 'slug' --document 'document'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nregistry = client.registry.update_api_document_version(\n namespace=\"namespace\",\n slug=\"slug\",\n semver=\"semver\",\n document=\"\",\n idempotency_key=\"\",\n)\nprint(registry)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tregistry, err := client.Registry.UpdateAPIDocumentVersion(context.Background(), \"namespace\", \"slug\", \"semver\", sdk.RegistryUpdateAPIDocumentVersionParams{\n\t\tDocument: \"\",\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(registry)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.registry.RegistryUpdateApiDocumentVersionParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RegistryUpdateApiDocumentVersionParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .semver(\"semver\")\n .document(\"document\")\n .build()\nval registry = client.registry().updateApiDocumentVersion(params)\nprintln(registry)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.registry.update_api_document_version(\"smoke-test\", { namespace: \"namespace\", slug: \"slug\", document: \"document\", last_known_version_sha: \"last_known_version_sha\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.registry.RegistryUpdateApiDocumentVersionParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRegistryUpdateApiDocumentVersionParams params = RegistryUpdateApiDocumentVersionParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .semver(\"semver\")\n .document(\"document\")\n .build();\nvar registry = client.registry().updateApiDocumentVersion(params);\nSystem.out.println(registry);" + } + ] + }, + "delete": { + "tags": [ + "Registry" + ], + "description": "Delete a specific API document version.", + "summary": "Delete API Document version", + "operationId": "deleteApiDocumentVersion", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "semver", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.registry.deleteAPIDocumentVersion(\"semver\", {\n namespace: \"namespace\",\n slug: \"slug\",\n});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi registry delete-api-document-version 'semver' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --slug 'slug'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nregistry = client.registry.delete_api_document_version(\n namespace=\"namespace\",\n slug=\"slug\",\n semver=\"semver\",\n idempotency_key=\"\",\n)\nprint(registry)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tregistry, err := client.Registry.DeleteAPIDocumentVersion(context.Background(), \"namespace\", \"slug\", \"semver\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(registry)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.registry.RegistryDeleteApiDocumentVersionParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RegistryDeleteApiDocumentVersionParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .semver(\"semver\")\n .build()\nval registry = client.registry().deleteApiDocumentVersion(params)\nprintln(registry)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.registry.delete_api_document_version(\"smoke-test\", { namespace: \"namespace\", slug: \"slug\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.registry.RegistryDeleteApiDocumentVersionParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRegistryDeleteApiDocumentVersionParams params = RegistryDeleteApiDocumentVersionParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .semver(\"semver\")\n .build();\nvar registry = client.registry().deleteApiDocumentVersion(params);\nSystem.out.println(registry);" + } + ] + } + }, + "/v1/apis/{namespace}/{slug}/version/{semver}/metadata": { + "get": { + "tags": [ + "Registry" + ], + "description": "Get metadata (uid, content shas, version sha, tags) for a specific API document version.", + "summary": "Get API Document version metadata", + "operationId": "getApiDocumentVersionMetadata", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/managed-doc-version" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "semver", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst managedDocVersion = await client.registry.listAPIDocumentVersionMetadata(\"semver\", {\n namespace: \"namespace\",\n slug: \"slug\",\n});\nconsole.log(managedDocVersion);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi registry list-api-document-version-metadata 'semver' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --slug 'slug'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nregistry = client.registry.list_api_document_version_metadata(\n namespace=\"namespace\",\n slug=\"slug\",\n semver=\"semver\",\n)\nprint(registry)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tregistry, err := client.Registry.ListAPIDocumentVersionMetadata(context.Background(), \"namespace\", \"slug\", \"semver\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(registry)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.registry.RegistryListApiDocumentVersionMetadataParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RegistryListApiDocumentVersionMetadataParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .semver(\"semver\")\n .build()\nval registry = client.registry().listApiDocumentVersionMetadata(params)\nprintln(registry)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.registry.list_api_document_version_metadata(\"smoke-test\", { namespace: \"namespace\", slug: \"slug\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.registry.RegistryListApiDocumentVersionMetadataParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRegistryListApiDocumentVersionMetadataParams params = RegistryListApiDocumentVersionMetadataParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .semver(\"semver\")\n .build();\nvar registry = client.registry().listApiDocumentVersionMetadata(params);\nSystem.out.println(registry);" + } + ] + } + }, + "/v1/apis/{namespace}/{slug}/version": { + "post": { + "tags": [ + "Registry" + ], + "description": "Create a new API document version.", + "summary": "Create API Document version", + "operationId": "createApiDocumentVersion", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/managed-doc-version" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "version": { + "$ref": "#/components/schemas/version" + }, + "document": { + "type": "string" + }, + "force": { + "type": "boolean" + }, + "lastKnownVersionSha": { + "type": "string" + } + }, + "required": [ + "version", + "document" + ], + "additionalProperties": false + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst managedDocVersion = await client.registry.createAPIDocumentVersion(\"slug\", {\n namespace: \"namespace\",\n version: \"\",\n document: \"\",\n});\nconsole.log(managedDocVersion);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi registry create-api-document-version 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --version-command 'version' --document 'document'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nregistry = client.registry.create_api_document_version(\n namespace=\"namespace\",\n slug=\"slug\",\n version=\"\",\n document=\"\",\n idempotency_key=\"\",\n)\nprint(registry)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tregistry, err := client.Registry.NewAPIDocumentVersion(context.Background(), \"namespace\", \"slug\", sdk.RegistryNewAPIDocumentVersionParams{\n\t\tDocument: \"\",\n\t\tVersion: \"\",\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(registry)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.registry.RegistryCreateApiDocumentVersionParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RegistryCreateApiDocumentVersionParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .version(\"version\")\n .document(\"document\")\n .build()\nval registry = client.registry().createApiDocumentVersion(params)\nprintln(registry)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.registry.create_api_document_version(\"smoke-test\", { namespace: \"namespace\", version: \"version\", document: \"document\", force: \"force\", last_known_version_sha: \"last_known_version_sha\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.registry.RegistryCreateApiDocumentVersionParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRegistryCreateApiDocumentVersionParams params = RegistryCreateApiDocumentVersionParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .version(\"version\")\n .document(\"document\")\n .build();\nvar registry = client.registry().createApiDocumentVersion(params);\nSystem.out.println(registry);" + } + ] + } + }, + "/v1/apis/{namespace}/{slug}/access-group": { + "post": { + "tags": [ + "Registry" + ], + "description": "Add an access group to an API document.", + "summary": "Add access group", + "operationId": "addApiDocumentAccessGroup", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/access-group" + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.registry.createAPIDocumentAccessGroup(\"slug\", {\n namespace: \"namespace\",\n accessGroupSlug: \"\",\n});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi registry create-api-document-access-group 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --access-group-slug 'accessGroupSlug'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nregistry = client.registry.create_api_document_access_group(\n namespace=\"namespace\",\n slug=\"slug\",\n access_group_slug=\"\",\n idempotency_key=\"\",\n)\nprint(registry)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tregistry, err := client.Registry.NewAPIDocumentAccessGroup(context.Background(), \"namespace\", \"slug\", sdk.RegistryNewAPIDocumentAccessGroupParams{\n\t\tAccessGroup: sdk.AccessGroup{\n\t\tAccessGroupSlug: \"\",\n\t},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(registry)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.registry.RegistryCreateApiDocumentAccessGroupParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RegistryCreateApiDocumentAccessGroupParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .accessGroupSlug(\"accessGroupSlug\")\n .build()\nval registry = client.registry().createApiDocumentAccessGroup(params)\nprintln(registry)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.registry.create_api_document_access_group(\"smoke-test\", { namespace: \"namespace\", access_group_slug: \"access_group_slug\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.registry.RegistryCreateApiDocumentAccessGroupParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRegistryCreateApiDocumentAccessGroupParams params = RegistryCreateApiDocumentAccessGroupParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .accessGroupSlug(\"accessGroupSlug\")\n .build();\nvar registry = client.registry().createApiDocumentAccessGroup(params);\nSystem.out.println(registry);" + } + ] + }, + "delete": { + "tags": [ + "Registry" + ], + "description": "Remove an access group from an API document.", + "summary": "Remove access group", + "operationId": "removeApiDocumentAccessGroup", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/access-group" + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.registry.deleteAPIDocumentAccessGroup(\"slug\", {\n namespace: \"namespace\",\n accessGroupSlug: \"\",\n});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi registry delete-api-document-access-group 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --access-group-slug 'accessGroupSlug'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nregistry = client.registry.delete_api_document_access_group(\n namespace=\"namespace\",\n slug=\"slug\",\n access_group_slug=\"\",\n idempotency_key=\"\",\n)\nprint(registry)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tregistry, err := client.Registry.DeleteAPIDocumentAccessGroup(context.Background(), \"namespace\", \"slug\", sdk.RegistryDeleteAPIDocumentAccessGroupParams{\n\t\tAccessGroup: sdk.AccessGroup{\n\t\tAccessGroupSlug: \"\",\n\t},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(registry)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.registry.RegistryDeleteApiDocumentAccessGroupParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RegistryDeleteApiDocumentAccessGroupParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .accessGroupSlug(\"accessGroupSlug\")\n .build()\nval registry = client.registry().deleteApiDocumentAccessGroup(params)\nprintln(registry)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.registry.delete_api_document_access_group(\"smoke-test\", { namespace: \"namespace\", access_group_slug: \"access_group_slug\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.registry.RegistryDeleteApiDocumentAccessGroupParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRegistryDeleteApiDocumentAccessGroupParams params = RegistryDeleteApiDocumentAccessGroupParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .accessGroupSlug(\"accessGroupSlug\")\n .build();\nvar registry = client.registry().deleteApiDocumentAccessGroup(params);\nSystem.out.println(registry);" + } + ] + } + }, + "/v1/schemas/{namespace}": { + "get": { + "tags": [ + "Schemas" + ], + "description": "List schemas in a namespace.", + "summary": "List all shared components", + "operationId": "listSchemas", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/schema" + } + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst list = await client.schemas.list(\"namespace\");\nconsole.log(list);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi schemas list 'namespace' --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nschema = client.schemas.list(\n namespace=\"namespace\",\n)\nprint(schema)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tschema, err := client.Schemas.List(context.Background(), \"namespace\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(schema)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.schemas.SchemaListParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = SchemaListParams.builder()\n .namespace(\"namespace\")\n .build()\nval schema = client.schemas().list(params)\nprintln(schema)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.schemas.list(\"smoke-test\")\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.schemas.SchemaListParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nSchemaListParams params = SchemaListParams.builder()\n .namespace(\"namespace\")\n .build();\nvar schema = client.schemas().list(params);\nSystem.out.println(schema);" + } + ] + }, + "post": { + "tags": [ + "Schemas" + ], + "description": "Create a schema in a namespace.", + "summary": "Create a shared component", + "operationId": "createSchema", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/uid" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "version": { + "$ref": "#/components/schemas/version" + }, + "slug": { + "type": "string" + }, + "isPrivate": { + "type": "boolean" + }, + "document": { + "type": "string" + } + }, + "required": [ + "title", + "version", + "slug", + "document" + ], + "additionalProperties": false + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst uID = await client.schemas.create(\"namespace\", {\n title: \"\",\n version: \"\",\n slug: \"\",\n document: \"\",\n});\nconsole.log(uID);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi schemas create 'namespace' --bearer-auth \"$BEARER_AUTH\" --title 'title' --version-command 'version' --slug 'slug' --document 'document'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nschema = client.schemas.create(\n namespace=\"namespace\",\n title=\"\",\n version=\"\",\n slug=\"\",\n document=\"\",\n idempotency_key=\"\",\n)\nprint(schema)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tschema, err := client.Schemas.New(context.Background(), \"namespace\", sdk.SchemaNewParams{\n\t\tDocument: \"\",\n\t\tSlug: \"\",\n\t\tTitle: \"\",\n\t\tVersion: \"\",\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(schema)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.schemas.SchemaCreateParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = SchemaCreateParams.builder()\n .namespace(\"namespace\")\n .title(\"title\")\n .version(\"version\")\n .slug(\"slug\")\n .document(\"document\")\n .build()\nval schema = client.schemas().create(params)\nprintln(schema)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.schemas.create(\"smoke-test\", { title: \"title\", description: \"description\", version: \"version\", slug: \"slug\", is_private: \"is_private\", document: \"document\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.schemas.SchemaCreateParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nSchemaCreateParams params = SchemaCreateParams.builder()\n .namespace(\"namespace\")\n .title(\"title\")\n .version(\"version\")\n .slug(\"slug\")\n .document(\"document\")\n .build();\nvar schema = client.schemas().create(params);\nSystem.out.println(schema);" + } + ] + } + }, + "/v1/schemas/{namespace}/{slug}": { + "patch": { + "tags": [ + "Schemas" + ], + "description": "Update schema metadata.", + "summary": "Update shared component metadata", + "operationId": "updateSchema", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "isPrivate": { + "type": "boolean" + } + }, + "additionalProperties": false + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.schemas.update(\"slug\", {\n namespace: \"namespace\",\n});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi schemas update 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nschema = client.schemas.update(\n namespace=\"namespace\",\n slug=\"slug\",\n idempotency_key=\"\",\n)\nprint(schema)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tschema, err := client.Schemas.Update(context.Background(), \"namespace\", \"slug\", sdk.SchemaUpdateParams{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(schema)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.schemas.SchemaUpdateParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = SchemaUpdateParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .build()\nval schema = client.schemas().update(params)\nprintln(schema)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.schemas.update(\"smoke-test\", { namespace: \"namespace\", title: \"title\", description: \"description\", is_private: \"is_private\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.schemas.SchemaUpdateParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nSchemaUpdateParams params = SchemaUpdateParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .build();\nvar schema = client.schemas().update(params);\nSystem.out.println(schema);" + } + ] + }, + "delete": { + "tags": [ + "Schemas" + ], + "description": "Delete a schema and all related versions.", + "summary": "Delete a shared component", + "operationId": "deleteSchema", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.schemas.delete(\"slug\", {\n namespace: \"namespace\",\n});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi schemas delete 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nschema = client.schemas.delete(\n namespace=\"namespace\",\n slug=\"slug\",\n idempotency_key=\"\",\n)\nprint(schema)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tschema, err := client.Schemas.Delete(context.Background(), \"namespace\", \"slug\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(schema)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.schemas.SchemaDeleteParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = SchemaDeleteParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .build()\nval schema = client.schemas().delete(params)\nprintln(schema)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.schemas.delete(\"smoke-test\", { namespace: \"namespace\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.schemas.SchemaDeleteParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nSchemaDeleteParams params = SchemaDeleteParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .build();\nvar schema = client.schemas().delete(params);\nSystem.out.println(schema);" + } + ] + } + }, + "/v1/schemas/{namespace}/{slug}/version/{semver}": { + "get": { + "tags": [ + "Schemas" + ], + "description": "Get a specific schema version document.", + "summary": "Get a shared component document", + "operationId": "getSchemaVersion", + "responses": { + "200": { + "description": "Default Response", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "semver", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst string_ = await client.schemas.version.retrieveSchema(\"semver\", {\n namespace: \"namespace\",\n slug: \"slug\",\n});\nconsole.log(string_);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi schemas:version-command retrieve-schema 'semver' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --slug 'slug'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nversion = client.schemas.version.retrieve_schema(\n namespace=\"namespace\",\n slug=\"slug\",\n semver=\"semver\",\n)\nprint(version)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tversion, err := client.Schemas.Version.GetSchema(context.Background(), \"namespace\", \"slug\", \"semver\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(version)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.schemas.version.VersionRetrieveSchemaParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = VersionRetrieveSchemaParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .semver(\"semver\")\n .build()\nval version = client.schemas().version().retrieveSchema(params)\nprintln(version)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.schemas.version.retrieve_schema(\"smoke-test\", { namespace: \"namespace\", slug: \"slug\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.schemas.version.VersionRetrieveSchemaParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nVersionRetrieveSchemaParams params = VersionRetrieveSchemaParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .semver(\"semver\")\n .build();\nvar version = client.schemas().version().retrieveSchema(params);\nSystem.out.println(version);" + } + ] + }, + "delete": { + "tags": [ + "Schemas" + ], + "description": "Delete a schema version.", + "summary": "Delete a shared component version", + "operationId": "deleteSchemaVersion", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "semver", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.schemas.version.deleteSchema(\"semver\", {\n namespace: \"namespace\",\n slug: \"slug\",\n});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi schemas:version-command delete-schema 'semver' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --slug 'slug'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nversion = client.schemas.version.delete_schema(\n namespace=\"namespace\",\n slug=\"slug\",\n semver=\"semver\",\n idempotency_key=\"\",\n)\nprint(version)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tversion, err := client.Schemas.Version.DeleteSchema(context.Background(), \"namespace\", \"slug\", \"semver\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(version)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.schemas.version.VersionDeleteSchemaParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = VersionDeleteSchemaParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .semver(\"semver\")\n .build()\nval version = client.schemas().version().deleteSchema(params)\nprintln(version)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.schemas.version.delete_schema(\"smoke-test\", { namespace: \"namespace\", slug: \"slug\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.schemas.version.VersionDeleteSchemaParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nVersionDeleteSchemaParams params = VersionDeleteSchemaParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .semver(\"semver\")\n .build();\nvar version = client.schemas().version().deleteSchema(params);\nSystem.out.println(version);" + } + ] + } + }, + "/v1/schemas/{namespace}/{slug}/version": { + "post": { + "tags": [ + "Schemas" + ], + "description": "Create a schema version.", + "summary": "Create a shared component version", + "operationId": "createSchemaVersion", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/uid" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "version": { + "$ref": "#/components/schemas/version" + }, + "document": { + "type": "string" + } + }, + "required": [ + "version", + "document" + ], + "additionalProperties": false + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst uID = await client.schemas.version.createSchema(\"slug\", {\n namespace: \"namespace\",\n version: \"\",\n document: \"\",\n});\nconsole.log(uID);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi schemas:version-command create-schema 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --version-command 'version' --document 'document'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nversion = client.schemas.version.create_schema(\n namespace=\"namespace\",\n slug=\"slug\",\n version=\"\",\n document=\"\",\n idempotency_key=\"\",\n)\nprint(version)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tversion, err := client.Schemas.Version.NewSchema(context.Background(), \"namespace\", \"slug\", sdk.SchemaVersionNewSchemaParams{\n\t\tDocument: \"\",\n\t\tVersion: \"\",\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(version)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.schemas.version.VersionCreateSchemaParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = VersionCreateSchemaParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .version(\"version\")\n .document(\"document\")\n .build()\nval version = client.schemas().version().createSchema(params)\nprintln(version)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.schemas.version.create_schema(\"smoke-test\", { namespace: \"namespace\", version: \"version\", document: \"document\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.schemas.version.VersionCreateSchemaParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nVersionCreateSchemaParams params = VersionCreateSchemaParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .version(\"version\")\n .document(\"document\")\n .build();\nvar version = client.schemas().version().createSchema(params);\nSystem.out.println(version);" + } + ] + } + }, + "/v1/schemas/{namespace}/{slug}/access-group": { + "post": { + "tags": [ + "Schemas" + ], + "description": "Add an access group to a schema.", + "summary": "Add shared component access group", + "operationId": "addSchemaAccessGroup", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/access-group" + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.schemas.accessGroup.createSchema(\"slug\", {\n namespace: \"namespace\",\n accessGroupSlug: \"\",\n});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi schemas:access-group create-schema 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --access-group-slug 'accessGroupSlug'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\naccess_group = client.schemas.access_group.create_schema(\n namespace=\"namespace\",\n slug=\"slug\",\n access_group_slug=\"\",\n idempotency_key=\"\",\n)\nprint(access_group)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\taccessGroup, err := client.Schemas.AccessGroup.NewSchema(context.Background(), \"namespace\", \"slug\", sdk.SchemaAccessGroupNewSchemaParams{\n\t\tAccessGroup: sdk.AccessGroup{\n\t\tAccessGroupSlug: \"\",\n\t},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(accessGroup)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.schemas.accessgroup.AccessGroupCreateSchemaParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = AccessGroupCreateSchemaParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .accessGroupSlug(\"accessGroupSlug\")\n .build()\nval accessGroup = client.schemas().accessGroup().createSchema(params)\nprintln(accessGroup)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.schemas.accessGroup.create_schema(\"smoke-test\", { namespace: \"namespace\", access_group_slug: \"access_group_slug\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.schemas.accessgroup.AccessGroupCreateSchemaParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nAccessGroupCreateSchemaParams params = AccessGroupCreateSchemaParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .accessGroupSlug(\"accessGroupSlug\")\n .build();\nvar accessGroup = client.schemas().accessGroup().createSchema(params);\nSystem.out.println(accessGroup);" + } + ] + }, + "delete": { + "tags": [ + "Schemas" + ], + "description": "Remove an access group from a schema.", + "summary": "Remove shared component access group", + "operationId": "removeSchemaAccessGroup", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/access-group" + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.schemas.accessGroup.deleteSchema(\"slug\", {\n namespace: \"namespace\",\n accessGroupSlug: \"\",\n});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi schemas:access-group delete-schema 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --access-group-slug 'accessGroupSlug'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\naccess_group = client.schemas.access_group.delete_schema(\n namespace=\"namespace\",\n slug=\"slug\",\n access_group_slug=\"\",\n idempotency_key=\"\",\n)\nprint(access_group)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\taccessGroup, err := client.Schemas.AccessGroup.DeleteSchema(context.Background(), \"namespace\", \"slug\", sdk.SchemaAccessGroupDeleteSchemaParams{\n\t\tAccessGroup: sdk.AccessGroup{\n\t\tAccessGroupSlug: \"\",\n\t},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(accessGroup)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.schemas.accessgroup.AccessGroupDeleteSchemaParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = AccessGroupDeleteSchemaParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .accessGroupSlug(\"accessGroupSlug\")\n .build()\nval accessGroup = client.schemas().accessGroup().deleteSchema(params)\nprintln(accessGroup)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.schemas.accessGroup.delete_schema(\"smoke-test\", { namespace: \"namespace\", access_group_slug: \"access_group_slug\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.schemas.accessgroup.AccessGroupDeleteSchemaParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nAccessGroupDeleteSchemaParams params = AccessGroupDeleteSchemaParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .accessGroupSlug(\"accessGroupSlug\")\n .build();\nvar accessGroup = client.schemas().accessGroup().deleteSchema(params);\nSystem.out.println(accessGroup);" + } + ] + } + }, + "/v1/login-portals/{slug}": { + "get": { + "tags": [ + "Login Portals" + ], + "description": "Get a login portal by slug.", + "summary": "Get a login portal", + "operationId": "getLoginPortal", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "uid": { + "type": "string" + }, + "title": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "email": { + "$ref": "#/components/schemas/login-portal-email" + }, + "page": { + "$ref": "#/components/schemas/login-portal-page" + } + }, + "required": [ + "uid", + "title", + "slug", + "email", + "page" + ], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst retrieve = await client.loginPortals.retrieve(\"slug\");\nconsole.log(retrieve);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi login-portals retrieve 'slug' --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nlogin_portal = client.login_portals.retrieve(\n slug=\"slug\",\n)\nprint(login_portal)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tloginPortal, err := client.LoginPortals.Get(context.Background(), \"slug\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(loginPortal)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.loginportals.LoginPortalRetrieveParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = LoginPortalRetrieveParams.builder()\n .slug(\"slug\")\n .build()\nval loginPortal = client.loginPortals().retrieve(params)\nprintln(loginPortal)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.loginPortals.retrieve(\"smoke-test\")\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.loginportals.LoginPortalRetrieveParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nLoginPortalRetrieveParams params = LoginPortalRetrieveParams.builder()\n .slug(\"slug\")\n .build();\nvar loginPortal = client.loginPortals().retrieve(params);\nSystem.out.println(loginPortal);" + } + ] + }, + "patch": { + "tags": [ + "Login Portals" + ], + "description": "Update metadata for a login portal.", + "summary": "Update portal metadata", + "operationId": "updateLoginPortal", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "title": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.loginPortals.update(\"slug\", {});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi login-portals update 'slug' --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nlogin_portal = client.login_portals.update(\n slug=\"slug\",\n idempotency_key=\"\",\n)\nprint(login_portal)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tloginPortal, err := client.LoginPortals.Update(context.Background(), \"slug\", sdk.LoginPortalUpdateParams{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(loginPortal)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.loginportals.LoginPortalUpdateParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = LoginPortalUpdateParams.builder()\n .slug(\"slug\")\n .build()\nval loginPortal = client.loginPortals().update(params)\nprintln(loginPortal)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.loginPortals.update(\"smoke-test\", { title: \"title\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.loginportals.LoginPortalUpdateParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nLoginPortalUpdateParams params = LoginPortalUpdateParams.builder()\n .slug(\"slug\")\n .build();\nvar loginPortal = client.loginPortals().update(params);\nSystem.out.println(loginPortal);" + } + ] + }, + "delete": { + "tags": [ + "Login Portals" + ], + "description": "Delete a login portal.", + "summary": "Delete a login portal", + "operationId": "deleteLoginPortal", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.loginPortals.delete(\"slug\");" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi login-portals delete 'slug' --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nlogin_portal = client.login_portals.delete(\n slug=\"slug\",\n idempotency_key=\"\",\n)\nprint(login_portal)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tloginPortal, err := client.LoginPortals.Delete(context.Background(), \"slug\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(loginPortal)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.loginportals.LoginPortalDeleteParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = LoginPortalDeleteParams.builder()\n .slug(\"slug\")\n .build()\nval loginPortal = client.loginPortals().delete(params)\nprintln(loginPortal)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.loginPortals.delete(\"smoke-test\")\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.loginportals.LoginPortalDeleteParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nLoginPortalDeleteParams params = LoginPortalDeleteParams.builder()\n .slug(\"slug\")\n .build();\nvar loginPortal = client.loginPortals().delete(params);\nSystem.out.println(loginPortal);" + } + ] + } + }, + "/v1/login-portals": { + "post": { + "tags": [ + "Login Portals" + ], + "description": "Create a login portal for the current team.", + "summary": "Create a portal", + "operationId": "createLoginPortal", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/uid" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "email": { + "$ref": "#/components/schemas/login-portal-email" + }, + "page": { + "$ref": "#/components/schemas/login-portal-page" + } + }, + "required": [ + "title", + "slug", + "email", + "page" + ], + "additionalProperties": false + } + } + }, + "required": true + }, + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst uID = await client.loginPortals.create({\n title: \"\",\n slug: \"\",\n email: {\n logo: \"\",\n logoSize: \"100\",\n buttonText: \"Login\",\n message: \"Click to access private documentation hosted by scalar.com\",\n title: \"Private Docs\",\n mainColor: \"#2a2f45\",\n mainBackground: \"#f6f6f6\",\n cardColor: \"2a2f45\",\n cardBackground: \"#fff\",\n buttonColor: \"#fff\",\n buttonBackground: \"#0f0f0f\",\n },\n page: {\n title: \"Scalar Private Docs\",\n description: \"Login to access your documentation\",\n head: \"\",\n script: \"\",\n theme: \"\",\n companyName: \"\",\n logo: \"\",\n logoUrl: \"\",\n favicon: \"\",\n termsLink: \"\",\n privacyLink: \"\",\n formTitle: \"Scalar Private Docs\",\n formDescription: \"Login to access your documentation\",\n formImage: \"\",\n },\n});\nconsole.log(uID);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi login-portals create --bearer-auth \"$BEARER_AUTH\" --title 'title' --slug 'slug' --email '{\"logo\":\"\",\"logoSize\":\"100\",\"buttonText\":\"Login\",\"message\":\"Click to access private documentation hosted by scalar.com\",\"title\":\"Private Docs\",\"mainColor\":\"#2a2f45\",\"mainBackground\":\"#f6f6f6\",\"cardColor\":\"2a2f45\",\"cardBackground\":\"#fff\",\"buttonColor\":\"#fff\",\"buttonBackground\":\"#0f0f0f\"}' --page '{\"title\":\"Scalar Private Docs\",\"description\":\"Login to access your documentation\",\"head\":\"\",\"script\":\"\",\"theme\":\"\",\"companyName\":\"\",\"logo\":\"\",\"logoURL\":\"\",\"favicon\":\"\",\"termsLink\":\"\",\"privacyLink\":\"\",\"formTitle\":\"Scalar Private Docs\",\"formDescription\":\"Login to access your documentation\",\"formImage\":\"\"}'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nlogin_portal = client.login_portals.create(\n title=\"\",\n slug=\"\",\n email={\"logo\": \"\", \"logo_size\": \"100\", \"button_text\": \"Login\", \"message\": \"Click to access private documentation hosted by scalar.com\", \"title\": \"Private Docs\", \"main_color\": \"#2a2f45\", \"main_background\": \"#f6f6f6\", \"card_color\": \"2a2f45\", \"card_background\": \"#fff\", \"button_color\": \"#fff\", \"button_background\": \"#0f0f0f\"},\n page={\"title\": \"Scalar Private Docs\", \"description\": \"Login to access your documentation\", \"head\": \"\", \"script\": \"\", \"theme\": \"\", \"company_name\": \"\", \"logo\": \"\", \"logo_url\": \"\", \"favicon\": \"\", \"terms_link\": \"\", \"privacy_link\": \"\", \"form_title\": \"Scalar Private Docs\", \"form_description\": \"Login to access your documentation\", \"form_image\": \"\"},\n idempotency_key=\"\",\n)\nprint(login_portal)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tloginPortal, err := client.LoginPortals.New(context.Background(), sdk.LoginPortalNewParams{\n\t\tEmail: sdk.LoginPortalEmail{\n\t\t\tLogo: \"\",\n\t\t\tLogoSize: \"100\",\n\t\t\tButtonText: \"Login\",\n\t\t\tMessage: \"Click to access private documentation hosted by scalar.com\",\n\t\t\tTitle: \"Private Docs\",\n\t\t\tMainColor: \"#2a2f45\",\n\t\t\tMainBackground: \"#f6f6f6\",\n\t\t\tCardColor: \"2a2f45\",\n\t\t\tCardBackground: \"#fff\",\n\t\t\tButtonColor: \"#fff\",\n\t\t\tButtonBackground: \"#0f0f0f\",\n\t\t},\n\t\tPage: sdk.LoginPortalPage{\n\t\t\tTitle: \"Scalar Private Docs\",\n\t\t\tDescription: \"Login to access your documentation\",\n\t\t\tHead: \"\",\n\t\t\tScript: \"\",\n\t\t\tTheme: \"\",\n\t\t\tCompanyName: \"\",\n\t\t\tLogo: \"\",\n\t\t\tLogoURL: \"\",\n\t\t\tFavicon: \"\",\n\t\t\tTermsLink: \"\",\n\t\t\tPrivacyLink: \"\",\n\t\t\tFormTitle: \"Scalar Private Docs\",\n\t\t\tFormDescription: \"Login to access your documentation\",\n\t\t\tFormImage: \"\",\n\t\t},\n\t\tSlug: \"\",\n\t\tTitle: \"\",\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(loginPortal)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.loginportals.LoginPortalCreateParams\nimport com.scalar.api.models.loginportals.LoginPortalEmail\nimport com.scalar.api.models.loginportals.LoginPortalPage\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = LoginPortalCreateParams.builder()\n .title(\"title\")\n .slug(\"slug\")\n .email(LoginPortalEmail.builder()\n .logo(\"\")\n .logoSize(\"100\")\n .buttonText(\"Login\")\n .message(\"Click to access private documentation hosted by scalar.com\")\n .title(\"Private Docs\")\n .mainColor(\"#2a2f45\")\n .mainBackground(\"#f6f6f6\")\n .cardColor(\"2a2f45\")\n .cardBackground(\"#fff\")\n .buttonColor(\"#fff\")\n .buttonBackground(\"#0f0f0f\")\n .build())\n .page(LoginPortalPage.builder()\n .title(\"Scalar Private Docs\")\n .description(\"Login to access your documentation\")\n .head(\"\")\n .script(\"\")\n .theme(\"\")\n .companyName(\"\")\n .logo(\"\")\n .logoUrl(\"\")\n .favicon(\"\")\n .termsLink(\"\")\n .privacyLink(\"\")\n .formTitle(\"Scalar Private Docs\")\n .formDescription(\"Login to access your documentation\")\n .formImage(\"\")\n .build())\n .build()\nval loginPortal = client.loginPortals().create(params)\nprintln(loginPortal)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.loginPortals.create({ title: \"title\", slug: \"slug\", email: \"email\", page: \"page\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.loginportals.LoginPortalCreateParams;\nimport com.scalar.api.models.loginportals.LoginPortalEmail;\nimport com.scalar.api.models.loginportals.LoginPortalPage;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nLoginPortalCreateParams params = LoginPortalCreateParams.builder()\n .title(\"title\")\n .slug(\"slug\")\n .email(LoginPortalEmail.builder()\n .logo(\"\")\n .logoSize(\"100\")\n .buttonText(\"Login\")\n .message(\"Click to access private documentation hosted by scalar.com\")\n .title(\"Private Docs\")\n .mainColor(\"#2a2f45\")\n .mainBackground(\"#f6f6f6\")\n .cardColor(\"2a2f45\")\n .cardBackground(\"#fff\")\n .buttonColor(\"#fff\")\n .buttonBackground(\"#0f0f0f\")\n .build())\n .page(LoginPortalPage.builder()\n .title(\"Scalar Private Docs\")\n .description(\"Login to access your documentation\")\n .head(\"\")\n .script(\"\")\n .theme(\"\")\n .companyName(\"\")\n .logo(\"\")\n .logoUrl(\"\")\n .favicon(\"\")\n .termsLink(\"\")\n .privacyLink(\"\")\n .formTitle(\"Scalar Private Docs\")\n .formDescription(\"Login to access your documentation\")\n .formImage(\"\")\n .build())\n .build();\nvar loginPortal = client.loginPortals().create(params);\nSystem.out.println(loginPortal);" + } + ] + }, + "get": { + "tags": [ + "Login Portals" + ], + "description": "List all login portals for the current team.", + "summary": "List all portals", + "operationId": "listLoginPortals", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/login-portal" + } + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst list = await client.loginPortals.list();\nconsole.log(list);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi login-portals list --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nlogin_portal = client.login_portals.list()\nprint(login_portal)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tloginPortal, err := client.LoginPortals.List(context.Background())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(loginPortal)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.loginportals.LoginPortalListParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval loginPortal = client.loginPortals().list(LoginPortalListParams.none())\nprintln(loginPortal)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.loginPortals.list\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.loginportals.LoginPortalListParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nvar loginPortal = client.loginPortals().list();\nSystem.out.println(loginPortal);" + } + ] + } + }, + "/v1/rulesets/{namespace}": { + "get": { + "tags": [ + "Rules" + ], + "description": "List all rulesets in a namespace.", + "summary": "List all rules", + "operationId": "listRulesets", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/rule" + } + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst listRulesets = await client.rules.listRulesets(\"namespace\");\nconsole.log(listRulesets);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi rules list-rulesets 'namespace' --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nrule = client.rules.list_rulesets(\n namespace=\"namespace\",\n)\nprint(rule)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\trule, err := client.Rules.ListRulesets(context.Background(), \"namespace\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(rule)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.rules.RuleListRulesetsParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RuleListRulesetsParams.builder()\n .namespace(\"namespace\")\n .build()\nval rule = client.rules().listRulesets(params)\nprintln(rule)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.rules.list_rulesets(\"smoke-test\")\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.rules.RuleListRulesetsParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRuleListRulesetsParams params = RuleListRulesetsParams.builder()\n .namespace(\"namespace\")\n .build();\nvar rule = client.rules().listRulesets(params);\nSystem.out.println(rule);" + } + ] + }, + "post": { + "tags": [ + "Rules" + ], + "description": "Create a rule in a namespace.", + "summary": "Create a rule", + "operationId": "createRuleset", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/uid" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "isPrivate": { + "type": "boolean" + }, + "document": { + "type": "string" + } + }, + "required": [ + "title", + "slug", + "document" + ], + "additionalProperties": false + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst uID = await client.rules.createRuleset(\"namespace\", {\n title: \"\",\n slug: \"\",\n document: \"\",\n});\nconsole.log(uID);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi rules create-ruleset 'namespace' --bearer-auth \"$BEARER_AUTH\" --title 'title' --slug 'slug' --document 'document'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nrule = client.rules.create_ruleset(\n namespace=\"namespace\",\n title=\"\",\n slug=\"\",\n document=\"\",\n idempotency_key=\"\",\n)\nprint(rule)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\trule, err := client.Rules.NewRuleset(context.Background(), \"namespace\", sdk.RuleNewRulesetParams{\n\t\tDocument: \"\",\n\t\tSlug: \"\",\n\t\tTitle: \"\",\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(rule)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.rules.RuleCreateRulesetParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RuleCreateRulesetParams.builder()\n .namespace(\"namespace\")\n .title(\"title\")\n .slug(\"slug\")\n .document(\"document\")\n .build()\nval rule = client.rules().createRuleset(params)\nprintln(rule)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.rules.create_ruleset(\"smoke-test\", { title: \"title\", description: \"description\", slug: \"slug\", is_private: \"is_private\", document: \"document\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.rules.RuleCreateRulesetParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRuleCreateRulesetParams params = RuleCreateRulesetParams.builder()\n .namespace(\"namespace\")\n .title(\"title\")\n .slug(\"slug\")\n .document(\"document\")\n .build();\nvar rule = client.rules().createRuleset(params);\nSystem.out.println(rule);" + } + ] + } + }, + "/v1/rulesets/{namespace}/{slug}": { + "patch": { + "tags": [ + "Rules" + ], + "description": "Update rule metadata by slug.", + "summary": "Update rule metadata", + "operationId": "updateRuleset", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "namespace": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "isPrivate": { + "type": "boolean" + } + }, + "additionalProperties": false + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.rules.updateRuleset(\"slug\", {\n namespace: \"namespace\",\n});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi rules update-ruleset 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nrule = client.rules.update_ruleset(\n namespace=\"namespace\",\n slug=\"slug\",\n idempotency_key=\"\",\n)\nprint(rule)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\trule, err := client.Rules.UpdateRuleset(context.Background(), \"namespace\", \"slug\", sdk.RuleUpdateRulesetParams{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(rule)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.rules.RuleUpdateRulesetParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RuleUpdateRulesetParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .build()\nval rule = client.rules().updateRuleset(params)\nprintln(rule)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.rules.update_ruleset(\"smoke-test\", { namespace: \"namespace\", namespace_2: \"namespace_2\", slug_2: \"slug_2\", title: \"title\", description: \"description\", is_private: \"is_private\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.rules.RuleUpdateRulesetParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRuleUpdateRulesetParams params = RuleUpdateRulesetParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .build();\nvar rule = client.rules().updateRuleset(params);\nSystem.out.println(rule);" + } + ] + }, + "delete": { + "tags": [ + "Rules" + ], + "description": "Delete a rule by slug.", + "summary": "Delete a rule", + "operationId": "deleteRuleset", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.rules.deleteRuleset(\"slug\", {\n namespace: \"namespace\",\n});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi rules delete-ruleset 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nrule = client.rules.delete_ruleset(\n namespace=\"namespace\",\n slug=\"slug\",\n idempotency_key=\"\",\n)\nprint(rule)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\trule, err := client.Rules.DeleteRuleset(context.Background(), \"namespace\", \"slug\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(rule)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.rules.RuleDeleteRulesetParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RuleDeleteRulesetParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .build()\nval rule = client.rules().deleteRuleset(params)\nprintln(rule)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.rules.delete_ruleset(\"smoke-test\", { namespace: \"namespace\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.rules.RuleDeleteRulesetParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRuleDeleteRulesetParams params = RuleDeleteRulesetParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .build();\nvar rule = client.rules().deleteRuleset(params);\nSystem.out.println(rule);" + } + ] + }, + "get": { + "tags": [ + "Rules" + ], + "description": "Get a rule document by slug.", + "summary": "Get a rule", + "operationId": "getRulesetDocument", + "responses": { + "200": { + "description": "Default Response", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst string_ = await client.rules.retrieveRulesetDocument(\"slug\", {\n namespace: \"namespace\",\n});\nconsole.log(string_);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi rules retrieve-ruleset-document 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nrule = client.rules.retrieve_ruleset_document(\n namespace=\"namespace\",\n slug=\"slug\",\n)\nprint(rule)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\trule, err := client.Rules.GetRulesetDocument(context.Background(), \"namespace\", \"slug\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(rule)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.rules.RuleRetrieveRulesetDocumentParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RuleRetrieveRulesetDocumentParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .build()\nval rule = client.rules().retrieveRulesetDocument(params)\nprintln(rule)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.rules.retrieve_ruleset_document(\"smoke-test\", { namespace: \"namespace\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.rules.RuleRetrieveRulesetDocumentParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRuleRetrieveRulesetDocumentParams params = RuleRetrieveRulesetDocumentParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .build();\nvar rule = client.rules().retrieveRulesetDocument(params);\nSystem.out.println(rule);" + } + ] + } + }, + "/v1/rulesets/{namespace}/{slug}/access-group": { + "post": { + "tags": [ + "Rules" + ], + "description": "Grant an access group to a rule.", + "summary": "Add rule access group", + "operationId": "addRulesetAccessGroup", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/access-group" + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.rules.createRulesetAccessGroup(\"slug\", {\n namespace: \"namespace\",\n accessGroupSlug: \"\",\n});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi rules create-ruleset-access-group 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --access-group-slug 'accessGroupSlug'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nrule = client.rules.create_ruleset_access_group(\n namespace=\"namespace\",\n slug=\"slug\",\n access_group_slug=\"\",\n idempotency_key=\"\",\n)\nprint(rule)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\trule, err := client.Rules.NewRulesetAccessGroup(context.Background(), \"namespace\", \"slug\", sdk.RuleNewRulesetAccessGroupParams{\n\t\tAccessGroup: sdk.AccessGroup{\n\t\tAccessGroupSlug: \"\",\n\t},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(rule)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.rules.RuleCreateRulesetAccessGroupParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RuleCreateRulesetAccessGroupParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .accessGroupSlug(\"accessGroupSlug\")\n .build()\nval rule = client.rules().createRulesetAccessGroup(params)\nprintln(rule)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.rules.create_ruleset_access_group(\"smoke-test\", { namespace: \"namespace\", access_group_slug: \"access_group_slug\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.rules.RuleCreateRulesetAccessGroupParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRuleCreateRulesetAccessGroupParams params = RuleCreateRulesetAccessGroupParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .accessGroupSlug(\"accessGroupSlug\")\n .build();\nvar rule = client.rules().createRulesetAccessGroup(params);\nSystem.out.println(rule);" + } + ] + }, + "delete": { + "tags": [ + "Rules" + ], + "description": "Remove an access group from a rule.", + "summary": "Remove rule access group", + "operationId": "removeRulesetAccessGroup", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/access-group" + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "namespace", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.rules.deleteRulesetAccessGroup(\"slug\", {\n namespace: \"namespace\",\n accessGroupSlug: \"\",\n});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi rules delete-ruleset-access-group 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --access-group-slug 'accessGroupSlug'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nrule = client.rules.delete_ruleset_access_group(\n namespace=\"namespace\",\n slug=\"slug\",\n access_group_slug=\"\",\n idempotency_key=\"\",\n)\nprint(rule)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\trule, err := client.Rules.DeleteRulesetAccessGroup(context.Background(), \"namespace\", \"slug\", sdk.RuleDeleteRulesetAccessGroupParams{\n\t\tAccessGroup: sdk.AccessGroup{\n\t\tAccessGroupSlug: \"\",\n\t},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(rule)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.rules.RuleDeleteRulesetAccessGroupParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = RuleDeleteRulesetAccessGroupParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .accessGroupSlug(\"accessGroupSlug\")\n .build()\nval rule = client.rules().deleteRulesetAccessGroup(params)\nprintln(rule)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.rules.delete_ruleset_access_group(\"smoke-test\", { namespace: \"namespace\", access_group_slug: \"access_group_slug\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.rules.RuleDeleteRulesetAccessGroupParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nRuleDeleteRulesetAccessGroupParams params = RuleDeleteRulesetAccessGroupParams.builder()\n .namespace(\"namespace\")\n .slug(\"slug\")\n .accessGroupSlug(\"accessGroupSlug\")\n .build();\nvar rule = client.rules().deleteRulesetAccessGroup(params);\nSystem.out.println(rule);" + } + ] + } + }, + "/v1/themes": { + "get": { + "tags": [ + "Themes" + ], + "description": "List all team themes.", + "summary": "List all themes", + "operationId": "listThemes", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/theme" + } + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst list = await client.themes.list();\nconsole.log(list);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi themes list --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\ntheme = client.themes.list()\nprint(theme)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\ttheme, err := client.Themes.List(context.Background())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(theme)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.themes.ThemeListParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval theme = client.themes().list(ThemeListParams.none())\nprintln(theme)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.themes.list\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.themes.ThemeListParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nvar theme = client.themes().list();\nSystem.out.println(theme);" + } + ] + }, + "post": { + "tags": [ + "Themes" + ], + "description": "Create a team theme.", + "summary": "Create a theme", + "operationId": "createTheme", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/uid" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "document": { + "type": "string" + } + }, + "required": [ + "name", + "slug", + "document" + ], + "additionalProperties": false + } + } + }, + "required": true + }, + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst uID = await client.themes.create({\n name: \"\",\n slug: \"\",\n document: \"\",\n});\nconsole.log(uID);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi themes create --bearer-auth \"$BEARER_AUTH\" --name 'name' --slug 'slug' --document 'document'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\ntheme = client.themes.create(\n name=\"\",\n slug=\"\",\n document=\"\",\n idempotency_key=\"\",\n)\nprint(theme)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\ttheme, err := client.Themes.New(context.Background(), sdk.ThemeNewParams{\n\t\tDocument: \"\",\n\t\tName: \"\",\n\t\tSlug: \"\",\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(theme)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.themes.ThemeCreateParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = ThemeCreateParams.builder()\n .name(\"name\")\n .slug(\"slug\")\n .document(\"document\")\n .build()\nval theme = client.themes().create(params)\nprintln(theme)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.themes.create({ name: \"name\", description: \"description\", slug: \"slug\", document: \"document\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.themes.ThemeCreateParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nThemeCreateParams params = ThemeCreateParams.builder()\n .name(\"name\")\n .slug(\"slug\")\n .document(\"document\")\n .build();\nvar theme = client.themes().create(params);\nSystem.out.println(theme);" + } + ] + } + }, + "/v1/themes/{slug}": { + "patch": { + "tags": [ + "Themes" + ], + "description": "Update theme metadata.", + "summary": "Update theme metadata", + "operationId": "updateTheme", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.themes.update(\"slug\", {});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi themes update 'slug' --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\ntheme = client.themes.update(\n slug=\"slug\",\n idempotency_key=\"\",\n)\nprint(theme)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\ttheme, err := client.Themes.Update(context.Background(), \"slug\", sdk.ThemeUpdateParams{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(theme)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.themes.ThemeUpdateParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = ThemeUpdateParams.builder()\n .slug(\"slug\")\n .build()\nval theme = client.themes().update(params)\nprintln(theme)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.themes.update(\"smoke-test\", { name: \"name\", description: \"description\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.themes.ThemeUpdateParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nThemeUpdateParams params = ThemeUpdateParams.builder()\n .slug(\"slug\")\n .build();\nvar theme = client.themes().update(params);\nSystem.out.println(theme);" + } + ] + }, + "put": { + "tags": [ + "Themes" + ], + "description": "Replace the theme document.", + "summary": "Update theme document", + "operationId": "replaceThemeDocument", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "document": { + "type": "string" + } + }, + "required": [ + "document" + ], + "additionalProperties": false + } + } + }, + "required": true + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.themes.replaceDocument(\"slug\", {\n document: \"\",\n});" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi themes replace-document 'slug' --bearer-auth \"$BEARER_AUTH\" --document 'document'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\ntheme = client.themes.replace_document(\n slug=\"slug\",\n document=\"\",\n idempotency_key=\"\",\n)\nprint(theme)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\ttheme, err := client.Themes.ReplaceDocument(context.Background(), \"slug\", sdk.ThemeReplaceDocumentParams{\n\t\tDocument: \"\",\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(theme)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.themes.ThemeReplaceDocumentParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = ThemeReplaceDocumentParams.builder()\n .slug(\"slug\")\n .document(\"document\")\n .build()\nval theme = client.themes().replaceDocument(params)\nprintln(theme)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.themes.replace_document(\"smoke-test\", { document: \"document\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.themes.ThemeReplaceDocumentParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nThemeReplaceDocumentParams params = ThemeReplaceDocumentParams.builder()\n .slug(\"slug\")\n .document(\"document\")\n .build();\nvar theme = client.themes().replaceDocument(params);\nSystem.out.println(theme);" + } + ] + }, + "delete": { + "tags": [ + "Themes" + ], + "description": "Delete a theme by slug.", + "summary": "Delete a theme", + "operationId": "deleteTheme", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "null" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nawait client.themes.delete(\"slug\");" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi themes delete 'slug' --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\ntheme = client.themes.delete(\n slug=\"slug\",\n idempotency_key=\"\",\n)\nprint(theme)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\ttheme, err := client.Themes.Delete(context.Background(), \"slug\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(theme)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.themes.ThemeDeleteParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = ThemeDeleteParams.builder()\n .slug(\"slug\")\n .build()\nval theme = client.themes().delete(params)\nprintln(theme)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.themes.delete(\"smoke-test\")\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.themes.ThemeDeleteParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nThemeDeleteParams params = ThemeDeleteParams.builder()\n .slug(\"slug\")\n .build();\nvar theme = client.themes().delete(params);\nSystem.out.println(theme);" + } + ] + }, + "get": { + "tags": [ + "Themes" + ], + "description": "Get the theme document by slug.", + "summary": "Get a theme", + "operationId": "getTheme", + "responses": { + "200": { + "description": "Default Response", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst string_ = await client.themes.retrieve(\"slug\");\nconsole.log(string_);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi themes retrieve 'slug' --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\ntheme = client.themes.retrieve(\n slug=\"slug\",\n)\nprint(theme)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\ttheme, err := client.Themes.Get(context.Background(), \"slug\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(theme)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.themes.ThemeRetrieveParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = ThemeRetrieveParams.builder()\n .slug(\"slug\")\n .build()\nval theme = client.themes().retrieve(params)\nprintln(theme)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.themes.retrieve(\"smoke-test\")\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.themes.ThemeRetrieveParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nThemeRetrieveParams params = ThemeRetrieveParams.builder()\n .slug(\"slug\")\n .build();\nvar theme = client.themes().retrieve(params);\nSystem.out.println(theme);" + } + ] + } + }, + "/v1/teams": { + "get": { + "tags": [ + "Teams" + ], + "description": "List all available teams", + "summary": "List teams", + "operationId": "listTeams", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/team" + } + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst list = await client.teams.list();\nconsole.log(list);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi teams list --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nteam = client.teams.list()\nprint(team)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tteam, err := client.Teams.List(context.Background())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(team)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.teams.TeamListParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval team = client.teams().list(TeamListParams.none())\nprintln(team)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.teams.list\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.teams.TeamListParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nvar team = client.teams().list();\nSystem.out.println(team);" + } + ] + } + }, + "/v1/guides": { + "get": { + "tags": [ + "Scalar Docs" + ], + "description": "List all guide projects.", + "summary": "List all projects", + "operationId": "listGuides", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/github-project" + } + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst listGuides = await client.scalarDocs.listGuides();\nconsole.log(listGuides);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi scalar-docs list-guides --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nscalar_doc = client.scalar_docs.list_guides()\nprint(scalar_doc)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tscalarDoc, err := client.ScalarDocs.ListGuides(context.Background())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(scalarDoc)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.scalardocs.ScalarDocListGuidesParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval scalarDoc = client.scalarDocs().listGuides(ScalarDocListGuidesParams.none())\nprintln(scalarDoc)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.scalarDocs.list_guides\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.scalardocs.ScalarDocListGuidesParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nvar scalarDoc = client.scalarDocs().listGuides();\nSystem.out.println(scalarDoc);" + } + ] + }, + "post": { + "tags": [ + "Scalar Docs" + ], + "description": "Create a guide project.", + "summary": "Create a project", + "operationId": "createGuide", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "uid": { + "type": "string" + }, + "slug": { + "type": "string" + } + }, + "required": [ + "uid", + "slug" + ], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "slug": { + "$ref": "#/components/schemas/slug" + }, + "isPrivate": { + "default": false, + "type": "boolean" + }, + "allowedUsers": { + "default": [], + "type": "array", + "items": { + "type": "string" + } + }, + "allowedDomains": { + "default": [], + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "name", + "isPrivate", + "allowedUsers", + "allowedDomains" + ], + "additionalProperties": false + } + } + }, + "required": true + }, + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst createGuide = await client.scalarDocs.createGuide({\n name: \"\",\n isPrivate: false,\n allowedUsers: [],\n allowedDomains: [],\n});\nconsole.log(createGuide);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi scalar-docs create-guide --bearer-auth \"$BEARER_AUTH\" --name 'name' --is-private" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nscalar_doc = client.scalar_docs.create_guide(\n name=\"\",\n is_private=False,\n allowed_users=[],\n allowed_domains=[],\n idempotency_key=\"\",\n)\nprint(scalar_doc)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tscalarDoc, err := client.ScalarDocs.NewGuide(context.Background(), sdk.ScalarDocNewGuideParams{\n\t\tAllowedDomains: []string{\"\"},\n\t\tAllowedUsers: []string{\"\"},\n\t\tIsPrivate: false,\n\t\tName: \"\",\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(scalarDoc)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.scalardocs.ScalarDocCreateGuideParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = ScalarDocCreateGuideParams.builder()\n .name(\"name\")\n .isPrivate(false)\n .allowedUsers(listOf(\"allowedUser\"))\n .allowedDomains(listOf(\"allowedDomain\"))\n .build()\nval scalarDoc = client.scalarDocs().createGuide(params)\nprintln(scalarDoc)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.scalarDocs.create_guide({ name: \"name\", slug: \"slug\", is_private: \"is_private\", allowed_users: \"allowed_users\", allowed_domains: \"allowed_domains\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.scalardocs.ScalarDocCreateGuideParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nScalarDocCreateGuideParams params = ScalarDocCreateGuideParams.builder()\n .name(\"name\")\n .isPrivate(false)\n .allowedUsers(java.util.List.of(\"allowedUser\"))\n .allowedDomains(java.util.List.of(\"allowedDomain\"))\n .build();\nvar scalarDoc = client.scalarDocs().createGuide(params);\nSystem.out.println(scalarDoc);" + } + ] + } + }, + "/v1/guides/{slug}/publish": { + "post": { + "tags": [ + "Scalar Docs" + ], + "description": "Start a new publish process.", + "summary": "Publish a project", + "operationId": "publishGuide", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "publishUid": { + "type": "string" + } + }, + "required": [ + "publishUid" + ], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "slug", + "required": true + } + ], + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst publishGuide = await client.scalarDocs.publishGuide(\"slug\");\nconsole.log(publishGuide);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi scalar-docs publish-guide 'slug' --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nscalar_doc = client.scalar_docs.publish_guide(\n slug=\"slug\",\n idempotency_key=\"\",\n)\nprint(scalar_doc)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tscalarDoc, err := client.ScalarDocs.PublishGuide(context.Background(), \"slug\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(scalarDoc)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.scalardocs.ScalarDocPublishGuideParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = ScalarDocPublishGuideParams.builder()\n .slug(\"slug\")\n .build()\nval scalarDoc = client.scalarDocs().publishGuide(params)\nprintln(scalarDoc)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.scalarDocs.publish_guide(\"smoke-test\")\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.scalardocs.ScalarDocPublishGuideParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nScalarDocPublishGuideParams params = ScalarDocPublishGuideParams.builder()\n .slug(\"slug\")\n .build();\nvar scalarDoc = client.scalarDocs().publishGuide(params);\nSystem.out.println(scalarDoc);" + } + ] + } + }, + "/v1/namespaces": { + "get": { + "tags": [ + "Namespaces" + ], + "description": "Get all namespaces for the current team", + "summary": "List namespaces", + "operationId": "listNamespaces", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst list = await client.namespaces.list();\nconsole.log(list);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi namespaces list --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nnamespace = client.namespaces.list()\nprint(namespace)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tnamespace, err := client.Namespaces.List(context.Background())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(namespace)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.namespaces.NamespaceListParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval namespace = client.namespaces().list(NamespaceListParams.none())\nprintln(namespace)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.namespace(\"namespace\").list\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.namespaces.NamespaceListParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nvar namespace = client.namespaces().list();\nSystem.out.println(namespace);" + } + ] + } + }, + "/v1/auth/exchange": { + "post": { + "tags": [ + "Authentication" + ], + "description": "Exchange an API key for an access token.", + "summary": "Exchange token", + "operationId": "exchangePersonalToken", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "accessToken": { + "type": "string" + } + }, + "required": [ + "accessToken" + ], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "security": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "personalToken": { + "type": "string" + } + }, + "required": [ + "personalToken" + ], + "additionalProperties": false + } + } + }, + "required": true + }, + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst exchangePersonalToken = await client.authentication.exchangePersonalToken({\n personalToken: \"\",\n});\nconsole.log(exchangePersonalToken);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi authentication exchange-personal-token --bearer-auth \"$BEARER_AUTH\" --personal-token 'personalToken'" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nauthentication = client.authentication.exchange_personal_token(\n personal_token=\"\",\n idempotency_key=\"\",\n)\nprint(authentication)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tauthentication, err := client.Authentication.ExchangePersonalToken(context.Background(), sdk.AuthenticationExchangePersonalTokenParams{\n\t\tPersonalToken: \"\",\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(authentication)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.authentication.AuthenticationExchangePersonalTokenParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval params = AuthenticationExchangePersonalTokenParams.builder()\n .personalToken(\"personalToken\")\n .build()\nval authentication = client.authentication().exchangePersonalToken(params)\nprintln(authentication)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.authentication.exchange_personal_token({ personal_token: \"personal_token\" })\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.authentication.AuthenticationExchangePersonalTokenParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nAuthenticationExchangePersonalTokenParams params = AuthenticationExchangePersonalTokenParams.builder()\n .personalToken(\"personalToken\")\n .build();\nvar authentication = client.authentication().exchangePersonalToken(params);\nSystem.out.println(authentication);" + } + ] + } + }, + "/v1/auth/me": { + "get": { + "tags": [ + "Authentication" + ], + "description": "Get the authenticated user, including their available teams and theme.", + "summary": "Get current user", + "operationId": "getCurrentUser", + "responses": { + "200": { + "description": "Default Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/user" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400" + } + } + } + }, + "401": { + "description": "No auth", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/401" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/403" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404" + } + } + } + }, + "422": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/422" + } + } + } + }, + "500": { + "description": "Uncaught error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/500" + } + } + } + } + }, + "x-codeSamples": [ + { + "label": "TypeScript", + "lang": "TypeScript", + "source": "import ScalarAPI from \"@scalar/sdk\";\n\nconst client = new ScalarAPI({\n bearerAuth: process.env[\"BEARER_AUTH\"], // defaults to the BEARER_AUTH env var\n environment: \"production\",\n});\n\nconst user = await client.authentication.listCurrentUser();\nconsole.log(user);" + }, + { + "label": "Shell", + "lang": "Shell", + "source": "scalarapi authentication list-current-user --bearer-auth \"$BEARER_AUTH\"" + }, + { + "label": "Python", + "lang": "Python", + "source": "import os\n\nfrom scalar_api import ScalarApi\n\nclient = ScalarApi(\n bearer_auth=os.environ.get(\"BEARER_AUTH\"),\n)\n\nauthentication = client.authentication.list_current_user()\nprint(authentication)" + }, + { + "label": "Go", + "lang": "Go", + "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tsdk \"scalar-api\"\n\t\"scalar-api/option\"\n)\n\nfunc main() {\n\tclient := sdk.NewClient(\n\t\toption.WithBearerAuth(os.Getenv(\"BEARER_AUTH\")),\n\t)\n\n\tauthentication, err := client.Authentication.ListCurrentUser(context.Background())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(authentication)\n}" + }, + { + "label": "Kotlin", + "lang": "Kotlin", + "source": "import com.scalar.api.client.ScalarApiClient\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient\nimport com.scalar.api.models.authentication.AuthenticationListCurrentUserParams\n\nval client: ScalarApiClient = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build()\n\nval authentication = client.authentication().listCurrentUser(AuthenticationListCurrentUserParams.none())\nprintln(authentication)" + }, + { + "label": "Ruby", + "lang": "Ruby", + "source": "require \"json\"\nrequire \"scalar-api\"\n\nclient = ScalarApi::Client.new(\n bearer_auth: ENV[\"BEARER_AUTH\"],\n)\n\nresponse = client.authentication.list_current_user\nputs response.inspect" + }, + { + "label": "Java", + "lang": "Java", + "source": "import com.scalar.api.client.ScalarApiClient;\nimport com.scalar.api.client.okhttp.ScalarApiOkHttpClient;\nimport com.scalar.api.models.authentication.AuthenticationListCurrentUserParams;\n\nScalarApiClient client = ScalarApiOkHttpClient.builder()\n .bearerAuth(System.getenv(\"BEARER_AUTH\"))\n .build();\n\nvar authentication = client.authentication().listCurrentUser();\nSystem.out.println(authentication);" + } + ] + } + } + } +} diff --git a/package.json b/package.json index ca6eb3e..7e66d26 100644 --- a/package.json +++ b/package.json @@ -1,42 +1,54 @@ { "name": "@scalar/sdk", - "version": "0.1.5", - "author": "Scalar", + "version": "0.2.0", + "description": "API for managing Scalar platform resources.", "type": "module", - "tshy": { - "sourceDialects": [ - "@scalar/sdk/source" - ], - "exports": { - ".": "./src/index.ts", - "./package.json": "./package.json", - "./types": "./src/types/index.ts", - "./models/errors": "./src/models/errors/index.ts", - "./models/components": "./src/models/components/index.ts", - "./models/operations": "./src/models/operations/index.ts", - "./*.js": "./src/*.ts", - "./*": "./src/*.ts" - } - }, "sideEffects": false, + "main": "./dist/cjs/index.js", + "module": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + "exports": { + ".": { + "types": "./dist/esm/index.d.ts", + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js", + "default": "./dist/esm/index.js" + }, + "./resources/*": { + "types": "./dist/esm/resources/*.d.ts", + "import": "./dist/esm/resources/*.js", + "require": "./dist/cjs/resources/*.js", + "default": "./dist/esm/resources/*.js" + }, + "./*.mjs": { + "types": "./dist/esm/*.d.ts", + "import": "./dist/esm/*.js", + "default": "./dist/esm/*.js" + }, + "./*.js": { + "types": "./dist/esm/*.d.ts", + "require": "./dist/cjs/*.js", + "default": "./dist/cjs/*.js" + }, + "./*": { + "types": "./dist/esm/*.d.ts", + "import": "./dist/esm/*.js", + "require": "./dist/cjs/*.js", + "default": "./dist/esm/*.js" + }, + "./package.json": "./package.json" + }, + "files": [ + "dist", + "api.md" + ], "scripts": { - "lint": "eslint --cache --max-warnings=0 src", - "build": "tshy", + "build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && node scripts/finalize-build.mjs", + "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.cjs.json --noEmit", "prepublishOnly": "npm run build" }, - "peerDependencies": { - "zod": ">= 3" - }, + "dependencies": {}, "devDependencies": { - "@eslint/js": "^9.19.0", - "eslint": "^9.19.0", - "globals": "^15.14.0", - "tshy": "^2.0.0", - "typescript": "^5.4.5", - "typescript-eslint": "^8.22.0", - "zod": "^3.25.17" - }, - "dependencies": { - + "typescript": "^6.0.0" } } diff --git a/scalar-sdk.manifest.json b/scalar-sdk.manifest.json new file mode 100644 index 0000000..6fd1088 --- /dev/null +++ b/scalar-sdk.manifest.json @@ -0,0 +1,9519 @@ +{ + "name": "ScalarApi", + "slug": "scalarApi", + "version": "0.2.1", + "servers": [ + "https://access.scalar.com" + ], + "environments": { + "production": "https://access.scalar.com", + "local": "http://127.0.0.1:4010" + }, + "environmentOrder": [ + "production", + "local" + ], + "auth": [ + "bearer" + ], + "authDetails": [ + { + "kind": "bearer", + "id": "BearerAuth", + "bearerFormat": "JWT" + } + ], + "clientHeaderParams": [], + "schemas": [ + { + "name": "_400", + "source": "_400", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "message", + "publicName": "message", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "code", + "publicName": "code", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "_401", + "source": "_401", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "message", + "publicName": "message", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "code", + "publicName": "code", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "_403", + "source": "_403", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "message", + "publicName": "message", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "code", + "publicName": "code", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "_404", + "source": "_404", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "message", + "publicName": "message", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "code", + "publicName": "code", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "_422", + "source": "_422", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "message", + "publicName": "message", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "code", + "publicName": "code", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "_500", + "source": "_500", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "message", + "publicName": "message", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "code", + "publicName": "code", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "ApiDocument", + "source": "ApiDocument", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Nanoid" + } + }, + { + "name": "version", + "publicName": "version", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Version" + } + }, + { + "name": "title", + "publicName": "title", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 100 + } + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Slug" + } + }, + { + "name": "description", + "publicName": "description", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "namespace", + "publicName": "namespace", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Namespace" + } + }, + { + "name": "isPrivate", + "publicName": "isPrivate", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "tags", + "publicName": "tags", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "versions", + "publicName": "versions", + "required": true, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "ref", + "name": "ManagedDocVersion" + } + } + } + ], + "additionalProperties": false + } + }, + { + "name": "Nanoid", + "source": "Nanoid", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "minLength": 5 + } + } + }, + { + "name": "Version", + "source": "Version", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "minLength": 1 + } + } + }, + { + "name": "Slug", + "source": "Slug", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "pattern": "^[a-z](?:[a-z0-9-]*[a-z0-9])?$", + "minLength": 3, + "maxLength": 60 + } + } + }, + { + "name": "Namespace", + "source": "Namespace", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 3, + "maxLength": 50 + } + } + }, + { + "name": "ManagedDocVersion", + "source": "ManagedDocVersion", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Nanoid" + } + }, + { + "name": "createdAt", + "publicName": "createdAt", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "number" + } + }, + { + "name": "version", + "publicName": "version", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Version" + } + }, + { + "name": "upgraded", + "publicName": "upgraded", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "embedStatus", + "publicName": "embedStatus", + "required": true, + "deprecated": false, + "type": { + "kind": "union", + "variants": [ + { + "kind": "enum", + "values": [ + "complete", + "failed" + ], + "names": [ + "Complete", + "Failed" + ], + "deprecations": [ + false, + false + ] + }, + { + "kind": "null" + } + ] + } + }, + { + "name": "tags", + "publicName": "tags", + "required": true, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "primitive", + "type": "string" + } + } + }, + { + "name": "tools", + "publicName": "tools", + "required": false, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "object", + "properties": [ + { + "name": "path", + "publicName": "path", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "method", + "publicName": "method", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Method" + } + }, + { + "name": "enabledTools", + "publicName": "enabledTools", + "required": true, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "enum", + "values": [ + "execute-request", + "get-mini-openapi-spec" + ], + "names": [ + "ExecuteRequest", + "GetMiniOpenapiSpec" + ], + "deprecations": [ + false, + false + ] + } + } + } + ], + "additionalProperties": false + } + } + }, + { + "name": "yamlSha", + "publicName": "yamlSha", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "jsonSha", + "publicName": "jsonSha", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "versionSha", + "publicName": "versionSha", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "Method", + "source": "Method", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "enum", + "values": [ + "delete", + "get", + "head", + "options", + "patch", + "post", + "put", + "trace" + ], + "names": [ + "Delete", + "Get", + "Head", + "Options", + "Patch", + "Post", + "Put", + "Trace" + ], + "deprecations": [ + false, + false, + false, + false, + false, + false, + false, + false + ] + } + }, + { + "name": "AccessGroup", + "source": "AccessGroup", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "accessGroupSlug", + "publicName": "accessGroupSlug", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Slug" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "Schema", + "source": "Schema", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Nanoid" + } + }, + { + "name": "title", + "publicName": "title", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 100 + } + } + }, + { + "name": "description", + "publicName": "description", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Slug" + } + }, + { + "name": "namespace", + "publicName": "namespace", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Namespace" + } + }, + { + "name": "isPrivate", + "publicName": "isPrivate", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "versions", + "publicName": "versions", + "required": true, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "ref", + "name": "ManagedSchemaVersion" + } + } + } + ], + "additionalProperties": false + } + }, + { + "name": "ManagedSchemaVersion", + "source": "ManagedSchemaVersion", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Nanoid" + } + }, + { + "name": "createdAt", + "publicName": "createdAt", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Timestamp" + } + }, + { + "name": "updatedAt", + "publicName": "updatedAt", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Timestamp" + } + }, + { + "name": "version", + "publicName": "version", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Version" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "Timestamp", + "source": "Timestamp", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "primitive", + "type": "integer", + "validation": {} + } + }, + { + "name": "Uid", + "source": "Uid", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Nanoid" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "LoginPortalEmail", + "source": "LoginPortalEmail", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "logo", + "publicName": "logo", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "logoSize", + "publicName": "logoSize", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "buttonText", + "publicName": "buttonText", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 50 + } + } + }, + { + "name": "message", + "publicName": "message", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 1000 + } + } + }, + { + "name": "title", + "publicName": "title", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 100 + } + } + }, + { + "name": "mainColor", + "publicName": "mainColor", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 100 + } + } + }, + { + "name": "mainBackground", + "publicName": "mainBackground", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 100 + } + } + }, + { + "name": "cardColor", + "publicName": "cardColor", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 100 + } + } + }, + { + "name": "cardBackground", + "publicName": "cardBackground", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 100 + } + } + }, + { + "name": "buttonColor", + "publicName": "buttonColor", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 100 + } + } + }, + { + "name": "buttonBackground", + "publicName": "buttonBackground", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 100 + } + } + } + ], + "additionalProperties": false + } + }, + { + "name": "LoginPortalPage", + "source": "LoginPortalPage", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "title", + "publicName": "title", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 100 + } + } + }, + { + "name": "description", + "publicName": "description", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 500 + } + } + }, + { + "name": "head", + "publicName": "head", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "script", + "publicName": "script", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "theme", + "publicName": "theme", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "companyName", + "publicName": "companyName", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 100 + } + } + }, + { + "name": "logo", + "publicName": "logo", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "logoURL", + "publicName": "logoURL", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "favicon", + "publicName": "favicon", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "termsLink", + "publicName": "termsLink", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "privacyLink", + "publicName": "privacyLink", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "formTitle", + "publicName": "formTitle", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 100 + } + } + }, + { + "name": "formDescription", + "publicName": "formDescription", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 500 + } + } + }, + { + "name": "formImage", + "publicName": "formImage", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "LoginPortal", + "source": "LoginPortal", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Nanoid" + } + }, + { + "name": "title", + "publicName": "title", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 200 + } + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Slug" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "Rule", + "source": "Rule", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Nanoid" + } + }, + { + "name": "title", + "publicName": "title", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "maxLength": 100 + } + } + }, + { + "name": "description", + "publicName": "description", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Slug" + } + }, + { + "name": "namespace", + "publicName": "namespace", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Namespace" + } + }, + { + "name": "isPrivate", + "publicName": "isPrivate", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "Theme", + "source": "Theme", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Nanoid" + } + }, + { + "name": "name", + "publicName": "name", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "description", + "publicName": "description", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Slug" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "Team", + "source": "Team", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Nanoid" + } + }, + { + "name": "name", + "publicName": "name", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "TeamName" + } + }, + { + "name": "imageUri", + "publicName": "imageUri", + "required": false, + "deprecated": false, + "type": { + "kind": "ref", + "name": "TeamImage" + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Slug" + } + }, + { + "name": "theme", + "publicName": "theme", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "TeamName", + "source": "TeamName", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "TeamImage", + "source": "TeamImage", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "GithubProject", + "source": "GithubProject", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Nanoid" + } + }, + { + "name": "createdAt", + "publicName": "createdAt", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Timestamp" + } + }, + { + "name": "updatedAt", + "publicName": "updatedAt", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Timestamp" + } + }, + { + "name": "name", + "publicName": "name", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "activeDeployment", + "publicName": "activeDeployment", + "required": true, + "deprecated": false, + "type": { + "kind": "union", + "variants": [ + { + "kind": "ref", + "name": "ActiveDeployment" + }, + { + "kind": "null" + } + ] + } + }, + { + "name": "lastPublished", + "publicName": "lastPublished", + "required": true, + "deprecated": false, + "type": { + "kind": "union", + "variants": [ + { + "kind": "ref", + "name": "Timestamp" + }, + { + "kind": "null" + } + ] + } + }, + { + "name": "lastPublishedUid", + "publicName": "lastPublishedUid", + "required": true, + "deprecated": false, + "type": { + "kind": "union", + "variants": [ + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "null" + } + ] + } + }, + { + "name": "loginPortalUid", + "publicName": "loginPortalUid", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "activeThemeId", + "publicName": "activeThemeId", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "typesenseId", + "publicName": "typesenseId", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "number" + } + }, + { + "name": "isPrivate", + "publicName": "isPrivate", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "agentEnabled", + "publicName": "agentEnabled", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "accessGroups", + "publicName": "accessGroups", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "slug", + "publicName": "slug", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Slug" + } + }, + { + "name": "publishStatus", + "publicName": "publishStatus", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "publishMessage", + "publicName": "publishMessage", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "repository", + "publicName": "repository", + "required": false, + "deprecated": false, + "type": { + "kind": "union", + "variants": [ + { + "kind": "ref", + "name": "GithubProjectRepository" + }, + { + "kind": "null" + } + ] + } + } + ], + "additionalProperties": false + } + }, + { + "name": "ActiveDeployment", + "source": "ActiveDeployment", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "domain", + "publicName": "domain", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "publishedAt", + "publicName": "publishedAt", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Timestamp" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "GithubProjectRepository", + "source": "GithubProjectRepository", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "linkedBy", + "publicName": "linkedBy", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "id", + "publicName": "id", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "number" + } + }, + { + "name": "name", + "publicName": "name", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "validation": { + "minLength": 2 + } + } + }, + { + "name": "configPath", + "publicName": "configPath", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "branch", + "publicName": "branch", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "publishOnMerge", + "publicName": "publishOnMerge", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "publishPreviews", + "publicName": "publishPreviews", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "prComments", + "publicName": "prComments", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "expired", + "publicName": "expired", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "Email", + "source": "Email", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string", + "format": "email", + "validation": { + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + } + } + }, + { + "name": "TeamSummary", + "source": "TeamSummary", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Nanoid" + } + }, + { + "name": "name", + "publicName": "name", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "TeamName" + } + }, + { + "name": "imageUri", + "publicName": "imageUri", + "required": false, + "deprecated": false, + "type": { + "kind": "ref", + "name": "TeamImage" + } + } + ], + "additionalProperties": false + } + }, + { + "name": "User", + "source": "User", + "publicAliases": [], + "deprecated": false, + "type": { + "kind": "object", + "properties": [ + { + "name": "uid", + "publicName": "uid", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Nanoid" + } + }, + { + "name": "createdAt", + "publicName": "createdAt", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Timestamp" + } + }, + { + "name": "updatedAt", + "publicName": "updatedAt", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Timestamp" + } + }, + { + "name": "email", + "publicName": "email", + "required": true, + "deprecated": false, + "type": { + "kind": "ref", + "name": "Email" + } + }, + { + "name": "theme", + "publicName": "theme", + "required": false, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "string" + } + }, + { + "name": "activeTeamId", + "publicName": "activeTeamId", + "required": true, + "deprecated": false, + "type": { + "kind": "union", + "variants": [ + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "null" + } + ] + } + }, + { + "name": "hasGithub", + "publicName": "hasGithub", + "required": true, + "deprecated": false, + "type": { + "kind": "primitive", + "type": "boolean" + } + }, + { + "name": "teams", + "publicName": "teams", + "required": true, + "deprecated": false, + "type": { + "kind": "array", + "items": { + "kind": "ref", + "name": "TeamSummary" + } + } + } + ], + "additionalProperties": false + } + } + ], + "resources": [ + "registry", + "schemas", + "schemas.version", + "schemas.accessGroup", + "loginPortals", + "rules", + "themes", + "teams", + "scalarDocs", + "namespaces", + "authentication" + ], + "publicResources": [ + "registry", + "schemas", + "schemas.version", + "schemas.accessGroup", + "loginPortals", + "rules", + "themes", + "teams", + "scalarDocs", + "namespaces", + "authentication" + ], + "operations": [ + { + "resource": "registry", + "publicResource": "registry", + "operation": "listAllApiDocuments", + "publicOperation": "listAllApiDocuments", + "deprecated": false, + "method": "GET", + "path": "/v1/apis", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "listApiDocuments", + "publicOperation": "listApiDocuments", + "deprecated": false, + "method": "GET", + "path": "/v1/apis/{namespace}", + "pathParams": [ + "namespace" + ], + "publicPathParams": [ + "namespace" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryListApiDocumentsParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "createApiDocument", + "publicOperation": "createApiDocument", + "deprecated": false, + "method": "POST", + "path": "/v1/apis/{namespace}", + "pathParams": [ + "namespace" + ], + "publicPathParams": [ + "namespace" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "title", + "description", + "version", + "slug", + "ruleset", + "isPrivate", + "document" + ], + "publicBodyParams": [ + "title", + "description", + "version", + "slug", + "ruleset", + "isPrivate", + "document" + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryCreateApiDocumentParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "updateApiDocument", + "publicOperation": "updateApiDocument", + "deprecated": false, + "method": "PATCH", + "path": "/v1/apis/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "title", + "description", + "isPrivate", + "ruleset" + ], + "publicBodyParams": [ + "title", + "description", + "isPrivate", + "ruleset" + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryUpdateApiDocumentParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "deleteApiDocument", + "publicOperation": "deleteApiDocument", + "deprecated": false, + "method": "DELETE", + "path": "/v1/apis/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryDeleteApiDocumentParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "retrieveApiDocumentVersion", + "publicOperation": "retrieveApiDocumentVersion", + "deprecated": false, + "method": "GET", + "path": "/v1/apis/{namespace}/{slug}/version/{semver}", + "pathParams": [ + "namespace", + "slug", + "semver" + ], + "publicPathParams": [ + "namespace", + "slug", + "semver" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryRetrieveApiDocumentVersionParams" + }, + "response": { + "status": "200", + "contentType": "text/plain", + "encoding": "text", + "contents": [ + { + "contentType": "text/plain", + "encoding": "text" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "updateApiDocumentVersion", + "publicOperation": "updateApiDocumentVersion", + "deprecated": false, + "method": "PATCH", + "path": "/v1/apis/{namespace}/{slug}/version/{semver}", + "pathParams": [ + "namespace", + "slug", + "semver" + ], + "publicPathParams": [ + "namespace", + "slug", + "semver" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "document", + "lastKnownVersionSha" + ], + "publicBodyParams": [ + "document", + "lastKnownVersionSha" + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryUpdateApiDocumentVersionParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "deleteApiDocumentVersion", + "publicOperation": "deleteApiDocumentVersion", + "deprecated": false, + "method": "DELETE", + "path": "/v1/apis/{namespace}/{slug}/version/{semver}", + "pathParams": [ + "namespace", + "slug", + "semver" + ], + "publicPathParams": [ + "namespace", + "slug", + "semver" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryDeleteApiDocumentVersionParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "listApiDocumentVersionMetadata", + "publicOperation": "listApiDocumentVersionMetadata", + "deprecated": false, + "method": "GET", + "path": "/v1/apis/{namespace}/{slug}/version/{semver}/metadata", + "pathParams": [ + "namespace", + "slug", + "semver" + ], + "publicPathParams": [ + "namespace", + "slug", + "semver" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryListApiDocumentVersionMetadataParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "ManagedDocVersion", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "createApiDocumentVersion", + "publicOperation": "createApiDocumentVersion", + "deprecated": false, + "method": "POST", + "path": "/v1/apis/{namespace}/{slug}/version", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "version", + "document", + "force", + "lastKnownVersionSha" + ], + "publicBodyParams": [ + "version", + "document", + "force", + "lastKnownVersionSha" + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryCreateApiDocumentVersionParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "ManagedDocVersion", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "createApiDocumentAccessGroup", + "publicOperation": "createApiDocumentAccessGroup", + "deprecated": false, + "method": "POST", + "path": "/v1/apis/{namespace}/{slug}/access-group", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryCreateApiDocumentAccessGroupParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "registry", + "publicResource": "registry", + "operation": "deleteApiDocumentAccessGroup", + "publicOperation": "deleteApiDocumentAccessGroup", + "deprecated": false, + "method": "DELETE", + "path": "/v1/apis/{namespace}/{slug}/access-group", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RegistryDeleteApiDocumentAccessGroupParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas", + "publicResource": "schemas", + "operation": "list", + "publicOperation": "list", + "deprecated": false, + "method": "GET", + "path": "/v1/schemas/{namespace}", + "pathParams": [ + "namespace" + ], + "publicPathParams": [ + "namespace" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "SchemaListParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas", + "publicResource": "schemas", + "operation": "create", + "publicOperation": "create", + "deprecated": false, + "method": "POST", + "path": "/v1/schemas/{namespace}", + "pathParams": [ + "namespace" + ], + "publicPathParams": [ + "namespace" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "title", + "description", + "version", + "slug", + "isPrivate", + "document" + ], + "publicBodyParams": [ + "title", + "description", + "version", + "slug", + "isPrivate", + "document" + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "SchemaCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "Uid", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas", + "publicResource": "schemas", + "operation": "update", + "publicOperation": "update", + "deprecated": false, + "method": "PATCH", + "path": "/v1/schemas/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "title", + "description", + "isPrivate" + ], + "publicBodyParams": [ + "title", + "description", + "isPrivate" + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "SchemaUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas", + "publicResource": "schemas", + "operation": "delete", + "publicOperation": "delete", + "deprecated": false, + "method": "DELETE", + "path": "/v1/schemas/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "SchemaDeleteParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas.version", + "publicResource": "schemas.version", + "operation": "retrieveSchema", + "publicOperation": "retrieveSchema", + "deprecated": false, + "method": "GET", + "path": "/v1/schemas/{namespace}/{slug}/version/{semver}", + "pathParams": [ + "namespace", + "slug", + "semver" + ], + "publicPathParams": [ + "namespace", + "slug", + "semver" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "VersionRetrieveSchemaParams" + }, + "response": { + "status": "200", + "contentType": "text/plain", + "encoding": "text", + "contents": [ + { + "contentType": "text/plain", + "encoding": "text" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas.version", + "publicResource": "schemas.version", + "operation": "deleteSchema", + "publicOperation": "deleteSchema", + "deprecated": false, + "method": "DELETE", + "path": "/v1/schemas/{namespace}/{slug}/version/{semver}", + "pathParams": [ + "namespace", + "slug", + "semver" + ], + "publicPathParams": [ + "namespace", + "slug", + "semver" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "semver", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "VersionDeleteSchemaParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas.version", + "publicResource": "schemas.version", + "operation": "createSchema", + "publicOperation": "createSchema", + "deprecated": false, + "method": "POST", + "path": "/v1/schemas/{namespace}/{slug}/version", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "version", + "document" + ], + "publicBodyParams": [ + "version", + "document" + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "VersionCreateSchemaParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "Uid", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas.accessGroup", + "publicResource": "schemas.accessGroup", + "operation": "createSchema", + "publicOperation": "createSchema", + "deprecated": false, + "method": "POST", + "path": "/v1/schemas/{namespace}/{slug}/access-group", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "AccessGroupCreateSchemaParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "schemas.accessGroup", + "publicResource": "schemas.accessGroup", + "operation": "deleteSchema", + "publicOperation": "deleteSchema", + "deprecated": false, + "method": "DELETE", + "path": "/v1/schemas/{namespace}/{slug}/access-group", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "AccessGroupDeleteSchemaParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "loginPortals", + "publicResource": "loginPortals", + "operation": "retrieve", + "publicOperation": "retrieve", + "deprecated": false, + "method": "GET", + "path": "/v1/login-portals/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "LoginPortalRetrieveParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "loginPortals", + "publicResource": "loginPortals", + "operation": "update", + "publicOperation": "update", + "deprecated": false, + "method": "PATCH", + "path": "/v1/login-portals/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "title" + ], + "publicBodyParams": [ + "title" + ], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "LoginPortalUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "loginPortals", + "publicResource": "loginPortals", + "operation": "delete", + "publicOperation": "delete", + "deprecated": false, + "method": "DELETE", + "path": "/v1/login-portals/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "LoginPortalDeleteParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "loginPortals", + "publicResource": "loginPortals", + "operation": "create", + "publicOperation": "create", + "deprecated": false, + "method": "POST", + "path": "/v1/login-portals", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "title", + "slug", + "email", + "page" + ], + "publicBodyParams": [ + "title", + "slug", + "email", + "page" + ], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "LoginPortalCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "Uid", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "loginPortals", + "publicResource": "loginPortals", + "operation": "list", + "publicOperation": "list", + "deprecated": false, + "method": "GET", + "path": "/v1/login-portals", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "rules", + "publicResource": "rules", + "operation": "listRulesets", + "publicOperation": "listRulesets", + "deprecated": false, + "method": "GET", + "path": "/v1/rulesets/{namespace}", + "pathParams": [ + "namespace" + ], + "publicPathParams": [ + "namespace" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RuleListRulesetsParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "rules", + "publicResource": "rules", + "operation": "createRuleset", + "publicOperation": "createRuleset", + "deprecated": false, + "method": "POST", + "path": "/v1/rulesets/{namespace}", + "pathParams": [ + "namespace" + ], + "publicPathParams": [ + "namespace" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "title", + "description", + "slug", + "isPrivate", + "document" + ], + "publicBodyParams": [ + "title", + "description", + "slug", + "isPrivate", + "document" + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RuleCreateRulesetParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "Uid", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "rules", + "publicResource": "rules", + "operation": "updateRuleset", + "publicOperation": "updateRuleset", + "deprecated": false, + "method": "PATCH", + "path": "/v1/rulesets/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "namespace", + "slug", + "title", + "description", + "isPrivate" + ], + "publicBodyParams": [ + "namespace", + "slug", + "title", + "description", + "isPrivate" + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RuleUpdateRulesetParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "rules", + "publicResource": "rules", + "operation": "deleteRuleset", + "publicOperation": "deleteRuleset", + "deprecated": false, + "method": "DELETE", + "path": "/v1/rulesets/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RuleDeleteRulesetParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "rules", + "publicResource": "rules", + "operation": "retrieveRulesetDocument", + "publicOperation": "retrieveRulesetDocument", + "deprecated": false, + "method": "GET", + "path": "/v1/rulesets/{namespace}/{slug}", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RuleRetrieveRulesetDocumentParams" + }, + "response": { + "status": "200", + "contentType": "text/plain", + "encoding": "text", + "contents": [ + { + "contentType": "text/plain", + "encoding": "text" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "rules", + "publicResource": "rules", + "operation": "createRulesetAccessGroup", + "publicOperation": "createRulesetAccessGroup", + "deprecated": false, + "method": "POST", + "path": "/v1/rulesets/{namespace}/{slug}/access-group", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RuleCreateRulesetAccessGroupParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "rules", + "publicResource": "rules", + "operation": "deleteRulesetAccessGroup", + "publicOperation": "deleteRulesetAccessGroup", + "deprecated": false, + "method": "DELETE", + "path": "/v1/rulesets/{namespace}/{slug}/access-group", + "pathParams": [ + "namespace", + "slug" + ], + "publicPathParams": [ + "namespace", + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "accessGroupSlug" + ], + "publicBodyParams": [ + "accessGroupSlug" + ], + "pathParamDetails": [ + { + "name": "namespace", + "required": true, + "style": "simple", + "explode": false + }, + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "RuleDeleteRulesetAccessGroupParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "themes", + "publicResource": "themes", + "operation": "list", + "publicOperation": "list", + "deprecated": false, + "method": "GET", + "path": "/v1/themes", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "themes", + "publicResource": "themes", + "operation": "create", + "publicOperation": "create", + "deprecated": false, + "method": "POST", + "path": "/v1/themes", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "name", + "description", + "slug", + "document" + ], + "publicBodyParams": [ + "name", + "description", + "slug", + "document" + ], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "ThemeCreateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "Uid", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "themes", + "publicResource": "themes", + "operation": "update", + "publicOperation": "update", + "deprecated": false, + "method": "PATCH", + "path": "/v1/themes/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "name", + "description" + ], + "publicBodyParams": [ + "name", + "description" + ], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "ThemeUpdateParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "themes", + "publicResource": "themes", + "operation": "replaceDocument", + "publicOperation": "replaceDocument", + "deprecated": false, + "method": "PUT", + "path": "/v1/themes/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "document" + ], + "publicBodyParams": [ + "document" + ], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "ThemeReplaceDocumentParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "themes", + "publicResource": "themes", + "operation": "delete", + "publicOperation": "delete", + "deprecated": false, + "method": "DELETE", + "path": "/v1/themes/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "ThemeDeleteParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "themes", + "publicResource": "themes", + "operation": "retrieve", + "publicOperation": "retrieve", + "deprecated": false, + "method": "GET", + "path": "/v1/themes/{slug}", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "ThemeRetrieveParams" + }, + "response": { + "status": "200", + "contentType": "text/plain", + "encoding": "text", + "contents": [ + { + "contentType": "text/plain", + "encoding": "text" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "teams", + "publicResource": "teams", + "operation": "list", + "publicOperation": "list", + "deprecated": false, + "method": "GET", + "path": "/v1/teams", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "listGuides", + "publicOperation": "listGuides", + "deprecated": false, + "method": "GET", + "path": "/v1/guides", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "createGuide", + "publicOperation": "createGuide", + "deprecated": false, + "method": "POST", + "path": "/v1/guides", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "name", + "slug", + "isPrivate", + "allowedUsers", + "allowedDomains" + ], + "publicBodyParams": [ + "name", + "slug", + "isPrivate", + "allowedUsers", + "allowedDomains" + ], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "ScalarDocCreateGuideParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "scalarDocs", + "publicResource": "scalarDocs", + "operation": "publishGuide", + "publicOperation": "publishGuide", + "deprecated": false, + "method": "POST", + "path": "/v1/guides/{slug}/publish", + "pathParams": [ + "slug" + ], + "publicPathParams": [ + "slug" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [ + { + "name": "slug", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "ScalarDocPublishGuideParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "namespaces", + "publicResource": "namespaces", + "operation": "list", + "publicOperation": "list", + "deprecated": false, + "method": "GET", + "path": "/v1/namespaces", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "authentication", + "publicResource": "authentication", + "operation": "exchangePersonalToken", + "publicOperation": "exchangePersonalToken", + "deprecated": false, + "method": "POST", + "path": "/v1/auth/exchange", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "personalToken" + ], + "publicBodyParams": [ + "personalToken" + ], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "AuthenticationExchangePersonalTokenParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": true, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + }, + { + "resource": "authentication", + "publicResource": "authentication", + "operation": "listCurrentUser", + "publicOperation": "listCurrentUser", + "deprecated": false, + "method": "GET", + "path": "/v1/auth/me", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "responseModel": { + "name": "User", + "publicAliases": [] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "404", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_400", + "publicAliases": [] + } + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_401", + "publicAliases": [] + } + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_403", + "publicAliases": [] + } + }, + { + "status": "404", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_404", + "publicAliases": [] + } + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_422", + "publicAliases": [] + } + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "model": { + "name": "_500", + "publicAliases": [] + } + } + ], + "responseLinks": [], + "transport": "http" + } + ], + "webhooks": [] +} diff --git a/scripts/finalize-build.mjs b/scripts/finalize-build.mjs new file mode 100644 index 0000000..11472f1 --- /dev/null +++ b/scripts/finalize-build.mjs @@ -0,0 +1,49 @@ +import { readdir, readFile, writeFile } from 'node:fs/promises' +import { dirname, extname, resolve } from 'node:path' +import { fileURLToPath } from 'node:url' + +const root = resolve(dirname(fileURLToPath(import.meta.url)), '..') +const RELATIVE_SPECIFIER_RE = /(from\s+["']|import\(\s*["'])(\.{1,2}\/[^"']+)(["'])/g + +await Promise.all([ + rewriteRelativeSpecifiers(resolve(root, 'dist/esm')), + markCommonJsOutput(resolve(root, 'dist/cjs')), +]) + +async function rewriteRelativeSpecifiers(dir) { + let entries + try { + entries = await readdir(dir, { withFileTypes: true }) + } catch (error) { + if (error && error.code === 'ENOENT') return + throw error + } + + await Promise.all( + entries.map(async (entry) => { + const path = resolve(dir, entry.name) + if (entry.isDirectory()) { + await rewriteRelativeSpecifiers(path) + return + } + if (!path.endsWith('.js') && !path.endsWith('.d.ts')) return + const source = await readFile(path, 'utf8') + await writeFile(path, source.replace(RELATIVE_SPECIFIER_RE, addJsExtension), 'utf8') + }), + ) +} + +async function markCommonJsOutput(dir) { + try { + await readdir(dir) + await writeFile(resolve(dir, 'package.json'), '{\n "type": "commonjs"\n}\n', 'utf8') + } catch (error) { + if (error && error.code === 'ENOENT') return + throw error + } +} + +function addJsExtension(match, prefix, specifier, suffix) { + if (extname(specifier)) return match + return `${prefix}${specifier}.js${suffix}` +} diff --git a/src/api-promise.ts b/src/api-promise.ts new file mode 100644 index 0000000..4194b0c --- /dev/null +++ b/src/api-promise.ts @@ -0,0 +1,81 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import type { ScalarAPI } from './client'; +import type { FinalRequestOptions } from './internal/request-options'; + +export type APIResponseProps = { + readonly response: Response; + readonly options: FinalRequestOptions; + readonly controller: AbortController; + readonly requestLogID?: string | undefined; + readonly retryOfRequestLogID?: string | undefined; + readonly startTime?: number | undefined; +}; + +export type ParseResponse = (client: ScalarAPI, props: APIResponseProps) => T | Promise; + +export const defaultParseResponse = async (_client: unknown, props: APIResponseProps): Promise => { + const { response } = props; + if (response.status === 204) return null as T; + if (props.options.__binaryResponse) return response as T; + const contentType = response.headers.get('content-type'); + const mediaType = contentType?.split(';')[0]?.trim(); + const isJson = mediaType?.includes('application/json') || mediaType?.endsWith('+json'); + if (isJson && response.headers.get('content-length') === '0') return undefined as T; + if (isJson) return (await response.json()) as T; + return (await response.text()) as unknown as T; +}; + +/** A Promise subclass providing SDK response helpers. */ +export class APIPromise extends Promise { + private parsedPromise: Promise | undefined; + + constructor( + private readonly client: ScalarAPI, + private readonly responsePromise: Promise, + private readonly parseResponse: ParseResponse = defaultParseResponse, + ) { + super((resolve) => { + resolve(undefined as T); + }); + } + + _thenUnwrap(transform: (data: T, props: APIResponseProps) => U): APIPromise { + return new APIPromise(this.client, this.responsePromise, async (client, props) => + transform(await this.parseResponse(client, props), props), + ); + } + + asResponse(): Promise { + return this.responsePromise.then((props) => props.response); + } + + async withResponse(): Promise<{ data: T; response: Response }> { + const [data, response] = await Promise.all([this.parse(), this.asResponse()]); + return { data, response }; + } + + private parse(): Promise { + if (!this.parsedPromise) { + this.parsedPromise = this.responsePromise.then((props) => this.parseResponse(this.client, props)); + } + return this.parsedPromise; + } + + override then( + onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, + onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | undefined | null, + ): Promise { + return this.parse().then(onfulfilled, onrejected); + } + + override catch( + onrejected?: ((reason: unknown) => TResult | PromiseLike) | undefined | null, + ): Promise { + return this.parse().catch(onrejected); + } + + override finally(onfinally?: (() => void) | undefined | null): Promise { + return this.parse().finally(onfinally); + } +} diff --git a/src/client.ts b/src/client.ts new file mode 100644 index 0000000..138c171 --- /dev/null +++ b/src/client.ts @@ -0,0 +1,941 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { APIPromise, type APIResponseProps } from './api-promise'; +import * as Errors from './error'; +import { uuid4 } from './internal/utils/uuid'; +import { validatePositiveInteger, isAbsoluteURL, safeJSON, isEmptyObj } from './internal/utils/values'; +import { sleep } from './internal/utils/sleep'; +import { castToError, isAbortError } from './internal/errors'; +import { getPlatformHeaders } from './internal/detect-platform'; +import * as Shims from './internal/shims'; +import * as Opts from './internal/request-options'; +import { readEnv } from './internal/utils/env'; +import { formatRequestDetails, loggerFor, parseLogLevel, type LogLevel, type Logger } from './internal/utils/log'; +export type { Logger, LogLevel } from './internal/utils/log'; +import type { RequestInit, RequestInfo, BodyInit, Fetch } from './internal/builtin-types'; +import { buildHeaders, type HeadersLike } from './internal/headers'; +import type { FinalRequestOptions, RequestOptions } from './internal/request-options'; +import type { HTTPMethod, FinalizedRequestInit, MergedRequestInit, PromiseOrValue } from './internal/types'; +import { stringify as stringifyQuery } from './internal/qs/stringify'; +import type { StringifyOptions } from './internal/qs/types'; +import { toFile } from './core/uploads'; +import { VERSION } from './version'; +import { Registry, type Version, type AccessGroup, type RegistryListAllAPIDocumentsResponse, type RegistryListAPIDocumentsResponse, type RegistryCreateAPIDocumentResponse, type RegistryUpdateAPIDocumentVersionResponse, type ManagedDocVersion, type RegistryCreateAPIDocumentParams, type RegistryUpdateAPIDocumentParams, type RegistryDeleteAPIDocumentParams, type RegistryRetrieveAPIDocumentVersionParams, type RegistryUpdateAPIDocumentVersionParams, type RegistryDeleteAPIDocumentVersionParams, type RegistryListAPIDocumentVersionMetadataParams, type RegistryCreateAPIDocumentVersionParams, type RegistryCreateAPIDocumentAccessGroupParams, type RegistryDeleteAPIDocumentAccessGroupParams } from "./resources/registry"; +import { Schemas, type SchemaListResponse, type UID, type SchemaCreateParams, type SchemaUpdateParams, type SchemaDeleteParams } from "./resources/schemas/schemas"; +import { LoginPortals, type LoginPortalEmail, type LoginPortalPage, type LoginPortalRetrieveResponse, type LoginPortalListResponse, type LoginPortalUpdateParams, type LoginPortalCreateParams } from "./resources/login-portals"; +import { Rules, type RuleListRulesetsResponse, type RuleCreateRulesetParams, type RuleUpdateRulesetParams, type RuleDeleteRulesetParams, type RuleRetrieveRulesetDocumentParams, type RuleCreateRulesetAccessGroupParams, type RuleDeleteRulesetAccessGroupParams } from "./resources/rules"; +import { Themes, type ThemeListResponse, type ThemeCreateParams, type ThemeUpdateParams, type ThemeReplaceDocumentParams } from "./resources/themes"; +import { Teams, type TeamListResponse } from "./resources/teams"; +import { ScalarDocs, type Slug, type ScalarDocListGuidesResponse, type ScalarDocCreateGuideResponse, type ScalarDocPublishGuideResponse, type ScalarDocCreateGuideParams } from "./resources/scalar-docs"; +import { Namespaces, type NamespaceListResponse } from "./resources/namespaces"; +import { Authentication, type AuthenticationExchangePersonalTokenResponse, type User, type AuthenticationExchangePersonalTokenParams } from "./resources/authentication"; + +export type AuthTokenProvider = () => string | Promise; + +const queryArrayFormat: NonNullable = "indices"; +const queryAllowDots = false; + +const environments = { + production: "https://access.scalar.com", + local: "http://127.0.0.1:4010", +}; +type Environment = keyof typeof environments; + +export interface ClientOptions { + /** + * The token used for authentication. + */ + bearerAuth?: string | AuthTokenProvider | undefined; + + /** + * Specifies the environment to use for the API. + * + * Each environment maps to a different base URL: + * - `production` corresponds to `https://access.scalar.com` + * - `local` corresponds to `http://127.0.0.1:4010` + */ + environment?: Environment | undefined; + + /** + * Override the default base URL for the API, e.g., "https://api.example.com/v2/" + * + * Defaults to process.env["SCALAR_BASE_URL"]. + */ + baseURL?: string | null | undefined; + + /** + * The maximum amount of time (in milliseconds) that the client should wait for a response + * from the server before timing out a single request. + * + * Note that request timeouts are retried by default, so in a worst-case scenario you may wait + * much longer than this timeout before the promise succeeds or fails. + * + * @unit milliseconds + */ + timeout?: number | undefined; + + /** + * Additional `RequestInit` options to be passed to `fetch` calls. + * Properties will be overridden by per-request `fetchOptions`. + */ + fetchOptions?: MergedRequestInit | undefined; + + /** + * Specify a custom `fetch` function implementation. + * + * If not provided, we expect that `fetch` is defined globally. + */ + fetch?: Fetch | undefined; + + /** + * The maximum number of times that the client will retry a request in case of a + * temporary failure, like a network error or a 5XX error from the server. + * + * @default 2 + */ + maxRetries?: number | undefined; + + /** + * Default headers to include with every request to the API. + * + * These can be removed in individual requests by explicitly setting the + * header to `null` in request options. + */ + defaultHeaders?: HeadersLike | undefined; + + /** + * Default query parameters to include with every request to the API. + * + * These can be removed in individual requests by explicitly setting the + * param to `undefined` in request options. + */ + defaultQuery?: Record | undefined; + + /** + * Set the log level. + * + * Defaults to process.env["SCALAR_LOG"] or 'warn' if it isn't set. + */ + logLevel?: LogLevel | undefined; + + /** + * Set the logger. + * + * Defaults to globalThis.console. + */ + logger?: Logger | undefined; +} + +export type ScalarAPIOptions = ClientOptions; + +/** + * API Client for interfacing with the ScalarApi API. + */ +export class ScalarAPI { + bearerAuth: string | AuthTokenProvider | undefined; + + baseURL: string; + maxRetries: number; + timeout: number; + logger: Logger; + logLevel: LogLevel | undefined; + fetchOptions: MergedRequestInit | undefined; + private fetch: Fetch; + #encoder: Opts.RequestEncoder; + protected idempotencyHeader?: string; + private _baseURLOverridden: boolean; + private _defaultBaseURL: string; + private _options: ClientOptions; + + /** + * API Client for interfacing with the ScalarApi API. + * + * @param {string | AuthTokenProvider | undefined} [opts.bearerAuth=process.env["BEARER_AUTH"] ?? undefined] + * @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API. + * @param {string} [opts.baseURL=process.env["SCALAR_BASE_URL"] ?? https://access.scalar.com] - Override the default base URL for the API. + * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. + * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls. + * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. + * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. + * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API. + * @param {Record} opts.defaultQuery - Default query parameters to include with every request to the API. + */ + constructor({ + baseURL = readEnv("SCALAR_BASE_URL"), + bearerAuth = readEnv("BEARER_AUTH"), + ...opts + }: ClientOptions = {}) { + const options: ClientOptions = { + bearerAuth, + ...opts, + baseURL: baseURL || null, + }; + const environment = options.environment ?? "production"; + const baseURLOverridden = baseURL !== null && baseURL !== undefined && baseURL !== ""; + if (baseURLOverridden && options.environment) throw new Errors.ScalarAPIError("Ambiguous URL; The `baseURL` option (or SCALAR_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null"); + const defaultBaseURL = environments[environment]; + this.baseURL = options.baseURL || defaultBaseURL; + this.timeout = options.timeout ?? ScalarAPI.DEFAULT_TIMEOUT /* 1 minute */; + this.logger = options.logger ?? console; + const defaultLogLevel = 'warn'; + // Set default logLevel early so that we can log a warning in parseLogLevel. + this.logLevel = defaultLogLevel; + this.logLevel = + parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ?? + parseLogLevel(readEnv("SCALAR_LOG"), "process.env[\"SCALAR_LOG\"]", this) ?? + defaultLogLevel; + this.fetchOptions = options.fetchOptions; + this.maxRetries = options.maxRetries ?? 2; + this.fetch = options.fetch ?? Shims.getDefaultFetch(); + this.#encoder = Opts.FallbackEncoder; + + const customHeadersEnv = readEnv("SCALAR_CUSTOM_HEADERS"); + if (customHeadersEnv) { + const parsed: Record = {}; + for (const line of customHeadersEnv.split('\n')) { + const colon = line.indexOf(':'); + if (colon >= 0) { + parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim(); + } + } + options.defaultHeaders = { ...parsed, ...options.defaultHeaders }; + } + + this._options = { ...options, baseURL: baseURLOverridden ? this.baseURL : undefined, environment }; + this._baseURLOverridden = baseURLOverridden; + this._defaultBaseURL = defaultBaseURL; + + this.bearerAuth = bearerAuth; + } + + withOptions(options: Partial): this { + const client = new (this.constructor as new (props: ClientOptions) => this)({ + ...this._options, + ...(this.#baseURLOverridden() ? { baseURL: this.baseURL } : {}), + maxRetries: this.maxRetries, + timeout: this.timeout, + logger: this.logger, + logLevel: this.logLevel, + fetch: this.fetch, + fetchOptions: this.fetchOptions, + bearerAuth: this.bearerAuth, + ...options, + }); + return client; + } + + #baseURLOverridden(): boolean { + // A named environment selects a default URL; only explicit overrides should bypass per-request defaults. + return this._baseURLOverridden || this.baseURL !== this._defaultBaseURL; + } + + protected defaultQuery(): Record | undefined { + return this._options.defaultQuery; + } + + protected stringifyQuery(query: object | Record): string { + return stringifyQuery(query, { arrayFormat: queryArrayFormat, allowDots: queryAllowDots }); + } + + private getUserAgent(): string { + return `${this.constructor.name}/JS ${VERSION}`; + } + + protected defaultIdempotencyKey(): string { + return `scalar-node-retry-${uuid4()}`; + } + + protected makeStatusError( + status: number, + error: object | undefined, + message: string | undefined, + headers: Headers, + ): Errors.APIError { + return Errors.APIError.generate(status, error, message, headers); + } + + buildURL( + path: string, + query: Record | null | undefined, + defaultBaseURL?: string | undefined, + ): string { + const baseURL = (!this.#baseURLOverridden() && defaultBaseURL) || this.baseURL; + // Guarantee exactly one "/" between baseURL and path so that bases without a trailing slash + // and paths without a leading slash do not fuse into a malformed URL (e.g. ".../v1" + "widgets"). + const url = + isAbsoluteURL(path) ? + new URL(path) + : new URL((baseURL.endsWith('/') ? baseURL : baseURL + '/') + (path.startsWith('/') ? path.slice(1) : path)); + + const defaultQuery = this.defaultQuery(); + const pathQuery = Object.fromEntries(url.searchParams); + if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) { + query = { ...pathQuery, ...defaultQuery, ...query }; + } + + if (typeof query === "object" && query && !Array.isArray(query)) { + url.search = this.stringifyQuery(query); + } + + return url.toString(); + } + + /** + * Used as a callback for mutating the given `FinalRequestOptions` object. + */ + protected async prepareOptions(options: FinalRequestOptions): Promise {} + + /** + * Used as a callback for mutating the given `RequestInit` object. + * + * This is useful for cases where you want to add certain headers based off of + * the request properties, e.g. `method` or `url`. + */ + protected async prepareRequest( + request: RequestInit, + { url, options }: { url: string; options: FinalRequestOptions }, + ): Promise {} + + get(path: string, opts?: PromiseOrValue): APIPromise { + return this.methodRequest('get', path, opts); + } + + post(path: string, opts?: PromiseOrValue): APIPromise { + return this.methodRequest('post', path, opts); + } + + patch(path: string, opts?: PromiseOrValue): APIPromise { + return this.methodRequest('patch', path, opts); + } + + put(path: string, opts?: PromiseOrValue): APIPromise { + return this.methodRequest('put', path, opts); + } + + delete(path: string, opts?: PromiseOrValue): APIPromise { + return this.methodRequest('delete', path, opts); + } + + private methodRequest( + method: HTTPMethod, + path: string, + opts?: PromiseOrValue, + ): APIPromise { + return this.request( + Promise.resolve(opts).then((opts) => { + return { method, path, ...opts } as FinalRequestOptions; + }), + ); + } + + request( + options: PromiseOrValue, + remainingRetries: number | null = null, + ): APIPromise { + return new APIPromise(this, this.makeRequest(options, remainingRetries, undefined)); + } + + private async makeRequest( + optionsInput: PromiseOrValue, + retriesRemaining: number | null, + retryOfRequestLogID: string | undefined, + ): Promise { + const options = await optionsInput; + const maxRetries = options.maxRetries ?? this.maxRetries; + if (retriesRemaining == null) { + retriesRemaining = maxRetries; + } + + await this.prepareOptions(options); + + const { req, url, timeout } = await this.buildRequest(options, { + retryCount: maxRetries - retriesRemaining, + }); + + await this.prepareRequest(req, { url, options }); + + /** Not an API request ID, just for correlating local log entries. */ + const requestLogID = 'log_' + ((Math.random() * (1 << 24)) | 0).toString(16).padStart(6, '0'); + const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`; + const startTime = Date.now(); + + loggerFor(this).debug( + `[${requestLogID}] sending request`, + formatRequestDetails({ + retryOfRequestLogID, + method: options.method, + url, + options, + headers: req.headers, + }), + ); + + if (options.signal?.aborted) { + throw new Errors.APIUserAbortError(); + } + + const controller = new AbortController(); + const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError); + const headersTime = Date.now(); + + if (response instanceof globalThis.Error) { + const retryMessage = `retrying, ${retriesRemaining} attempts remaining`; + if (options.signal?.aborted) { + throw new Errors.APIUserAbortError(); + } + // detect native connection timeout errors + // deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)" + // undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)" + // others do not provide enough information to distinguish timeouts from other connection errors + const isTimeout = + isAbortError(response) || + /timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : '')); + if (retriesRemaining) { + loggerFor(this).info( + `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`, + ); + loggerFor(this).debug( + `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`, + formatRequestDetails({ + retryOfRequestLogID, + url, + durationMs: headersTime - startTime, + message: response.message, + }), + ); + return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID); + } + loggerFor(this).info( + `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`, + ); + loggerFor(this).debug( + `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`, + formatRequestDetails({ + retryOfRequestLogID, + url, + durationMs: headersTime - startTime, + message: response.message, + }), + ); + if (isTimeout) { + throw new Errors.APIConnectionTimeoutError(); + } + throw new Errors.APIConnectionError({ cause: response }); + } + + const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${ + response.ok ? 'succeeded' : 'failed' + } with status ${response.status} in ${headersTime - startTime}ms`; + + if (!response.ok) { + const shouldRetry = await this.shouldRetry(response); + if (retriesRemaining && shouldRetry) { + const retryMessage = `retrying, ${retriesRemaining} attempts remaining`; + + // We don't need the body of this response. + await Shims.CancelReadableStream(response.body); + loggerFor(this).info(`${responseInfo} - ${retryMessage}`); + loggerFor(this).debug( + `[${requestLogID}] response error (${retryMessage})`, + formatRequestDetails({ + retryOfRequestLogID, + url: response.url, + status: response.status, + headers: response.headers, + durationMs: headersTime - startTime, + }), + ); + return this.retryRequest( + options, + retriesRemaining, + retryOfRequestLogID ?? requestLogID, + response.headers, + ); + } + + const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`; + + loggerFor(this).info(`${responseInfo} - ${retryMessage}`); + + const errText = await response.text().catch((err: any) => castToError(err).message); + const errJSON = safeJSON(errText) as any; + const errMessage = errJSON ? undefined : errText; + + loggerFor(this).debug( + `[${requestLogID}] response error (${retryMessage})`, + formatRequestDetails({ + retryOfRequestLogID, + url: response.url, + status: response.status, + headers: response.headers, + message: errMessage, + durationMs: Date.now() - startTime, + }), + ); + + const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers); + throw err; + } + + loggerFor(this).info(responseInfo); + loggerFor(this).debug( + `[${requestLogID}] response start`, + formatRequestDetails({ + retryOfRequestLogID, + url: response.url, + status: response.status, + headers: response.headers, + durationMs: headersTime - startTime, + }), + ); + + return { response, options, controller, requestLogID, retryOfRequestLogID, startTime }; + } + + async fetchWithTimeout(url: RequestInfo, init: RequestInit | undefined, ms: number, controller: AbortController): Promise { + const { signal, method, ...options } = init || {}; + const abort = this._makeAbort(controller); + if (signal) signal.addEventListener('abort', abort, { once: true }); + + const timeout = setTimeout(abort, ms); + + const isReadableBody = + ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) || + (typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body); + + const fetchOptions: RequestInit = { + signal: controller.signal as any, + ...(isReadableBody ? { duplex: 'half' } : {}), + method: 'GET', + ...options, + }; + if (method) { + // Custom methods like 'patch' need to be uppercased + // See https://github.com/nodejs/undici/issues/2294 + fetchOptions.method = method.toUpperCase(); + } + + try { + // use undefined this binding; fetch errors if bound to something else in browser/cloudflare + return await this.fetch.call(undefined, url, fetchOptions); + } finally { + clearTimeout(timeout); + } + } + + private async shouldRetry(response: Response): Promise { + // Note this is not a standard header. + const shouldRetryHeader = response.headers.get('x-should-retry'); + + // If the server explicitly says whether or not to retry, obey. + if (shouldRetryHeader === 'true') return true; + if (shouldRetryHeader === 'false') return false; + + // Retry on request timeouts. + if (response.status === 408) return true; + + // Retry on lock timeouts. + if (response.status === 409) return true; + + // Retry on rate limits. + if (response.status === 429) return true; + + // Retry internal errors. + if (response.status >= 500) return true; + + return false; + } + + private async retryRequest( + options: FinalRequestOptions, + retriesRemaining: number, + requestLogID: string, + responseHeaders?: Headers | undefined, + ): Promise { + let timeoutMillis: number | undefined; + + // Note the `retry-after-ms` header may not be standard, but is a good idea and we'd like proactive support for it. + const retryAfterMillisHeader = responseHeaders?.get('retry-after-ms'); + if (retryAfterMillisHeader) { + const timeoutMs = parseFloat(retryAfterMillisHeader); + if (!Number.isNaN(timeoutMs)) { + timeoutMillis = timeoutMs; + } + } + + // About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After + const retryAfterHeader = responseHeaders?.get('retry-after'); + if (retryAfterHeader && !timeoutMillis) { + const timeoutSeconds = parseFloat(retryAfterHeader); + if (!Number.isNaN(timeoutSeconds)) { + timeoutMillis = timeoutSeconds * 1000; + } else { + timeoutMillis = Date.parse(retryAfterHeader) - Date.now(); + } + } + + // If the API asks us to wait a certain amount of time, just do what it says, + // but cap server-provided delays at 60s so an oversized or malformed Retry-After + // (e.g. `retry-after-ms: 999999999`, a past HTTP-date, or a value that Date.parse + // failed on) cannot block retries for an unbounded amount of time. Otherwise fall + // back to the default exponential-backoff calculation. + const maxRetryAfterMillis = 60 * 1000; + if ( + timeoutMillis === undefined || + !Number.isFinite(timeoutMillis) || + timeoutMillis <= 0 || + timeoutMillis > maxRetryAfterMillis + ) { + const maxRetries = options.maxRetries ?? this.maxRetries; + timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries); + } + await sleep(timeoutMillis); + + return this.makeRequest(options, retriesRemaining - 1, requestLogID); + } + + private calculateDefaultRetryTimeoutMillis(retriesRemaining: number, maxRetries: number): number { + const initialRetryDelay = 0.5; + const maxRetryDelay = 8.0; + + const numRetries = maxRetries - retriesRemaining; + + // Apply exponential backoff, but not more than the max. + const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay); + + // Apply some jitter, take up to at most 25 percent of the retry time. + const jitter = 1 - Math.random() * 0.25; + + return sleepSeconds * jitter * 1000; + } + + async buildRequest( + inputOptions: FinalRequestOptions, + { retryCount = 0 }: { retryCount?: number } = {}, + ): Promise<{ req: FinalizedRequestInit; url: string; timeout: number }> { + const options = { ...inputOptions }; + const { method, path, query, defaultBaseURL } = options; + + const url = this.buildURL(path!, query as Record, defaultBaseURL); + if ('timeout' in options) validatePositiveInteger('timeout', options.timeout); + options.timeout = options.timeout ?? this.timeout; + const { bodyHeaders, body } = this.buildBody({ options }); + const reqHeaders = await this.buildHeaders({ options, method, bodyHeaders, retryCount, url }); + + const req: FinalizedRequestInit = { + method, + headers: reqHeaders, + ...(options.signal && { signal: options.signal }), + ...((globalThis as any).ReadableStream && + body instanceof (globalThis as any).ReadableStream && { duplex: 'half' }), + // `buildBody` already collapses no-body into `undefined`; here we only need to drop that + // sentinel. A truthiness spread would also strip an intentional empty-string body. + ...(body !== undefined && { body }), + ...((this.fetchOptions as any) ?? {}), + ...((options.fetchOptions as any) ?? {}), + }; + return { req, url, timeout: options.timeout }; + } + + private async buildHeaders({ + options, + method, + bodyHeaders, + retryCount, + url, + }: { + options: FinalRequestOptions; + method: HTTPMethod; + bodyHeaders: HeadersLike; + retryCount: number; + url: string; + }): Promise { + let idempotencyHeaders: HeadersLike = {}; + if (this.idempotencyHeader && method !== 'get') { + if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey(); + idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey; + } + + const headers = buildHeaders([ + idempotencyHeaders, + { + Accept: 'application/json', + 'User-Agent': this.getUserAgent(), + 'X-Scalar-Retry-Count': String(retryCount), + ...(options.timeout ? { 'X-Scalar-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}), + ...getPlatformHeaders(), + }, + await this.authHeaders(options), + this._options.defaultHeaders, + bodyHeaders, + options.headers, + ]); + appendAuthCookies(headers.values, await this.authCookiesAsync()); + + this.validateAuth(url, headers.values, options); + + return headers.values; + } + + private _makeAbort(controller: AbortController) { + // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure + // would capture all request options, and cause a memory leak. + return () => controller.abort(); + } + + private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): { + bodyHeaders: HeadersLike; + body: BodyInit | undefined; + } { + // Skip only `null`/`undefined` so an intentional empty-string (or 0/false) payload still + // reaches the encoder. A plain `!body` check would silently drop those falsy-but-valid bodies, + // and `null` must be excluded here too because the iterator check below uses `in`, which + // throws on null. + if (body == null) { + return { bodyHeaders: undefined, body: undefined }; + } + const headers = buildHeaders([rawHeaders]); + if ( + // Pass raw type verbatim + ArrayBuffer.isView(body) || + body instanceof ArrayBuffer || + body instanceof DataView || + // Always pass strings through verbatim. The previous guard required a caller-set + // `content-type` and otherwise fell through to `FallbackEncoder`, which JSON.stringifies + // the value and labels it `application/json` — silently quoting plain-text payloads and + // mislabeling them as JSON. fetch defaults a string body to `text/plain;charset=UTF-8` + // when no `content-type` is set, which is a safer default than misclaiming JSON. + typeof body === 'string' || + // `Blob` is superset of `File` + ((globalThis as any).Blob && body instanceof (globalThis as any).Blob) || + // `FormData` -> `multipart/form-data` + body instanceof FormData || + // `URLSearchParams` -> `application/x-www-form-urlencoded` + body instanceof URLSearchParams || + // Send chunked stream (each chunk has own `length`) + ((globalThis as any).ReadableStream && body instanceof (globalThis as any).ReadableStream) + ) { + return { bodyHeaders: undefined, body: body as BodyInit }; + } else if ( + typeof body === 'object' && + (Symbol.asyncIterator in body || + (Symbol.iterator in body && 'next' in body && typeof body.next === 'function')) + ) { + return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable) }; + } else if ( + typeof body === 'object' && + headers.values.get('content-type') === 'application/x-www-form-urlencoded' + ) { + return { + bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' }, + body: this.stringifyQuery(body), + }; + } else { + return this.#encoder({ body, headers }); + } + } + + private validateAuth(url: string, headers: Headers, options: FinalRequestOptions): void { + if (headers.has("Authorization")) return; + if (headerExplicitlyOmitted(options.headers, "Authorization")) return; + throw new Errors.AuthenticationError(401, {}, "Could not resolve authentication method. Expected Authorization to be set.", headers); + } + + authHeadersSync(): Record { + const headers: Record = {}; + const bearerAuth = this.resolveAuthOptionSync("bearerAuth", this.bearerAuth); + if (bearerAuth) headers['Authorization'] = `Bearer ${bearerAuth}`; + return headers; + } + + webSocketAuthHeaders(): Record { + const bearerAuth = this.resolveAuthOptionSync("bearerAuth", this.bearerAuth); + if (bearerAuth) return { Authorization: `Bearer ${bearerAuth}` }; + return {}; + } + + protected async authHeaders(options: FinalRequestOptions): Promise { + return buildHeaders([await this.authHeadersAsync()]); + } + + private async authQueryAsync(): Promise> { + const query: Record = {}; + return query; + } + + private async authCookiesAsync(): Promise> { + const cookies: Record = {}; + return cookies; + } + + private async authHeadersAsync(): Promise> { + const headers: Record = {}; + const bearerAuth = await this.resolveAuthOption("bearerAuth", this.bearerAuth); + if (bearerAuth) headers['Authorization'] = `Bearer ${bearerAuth}`; + return headers; + } + + private async resolveAuthOption(optionName: string, value: string | AuthTokenProvider | null | undefined): Promise { + if (value == null) return undefined; + const token = typeof value === "function" ? await value() : value; + if (!token) throw new Errors.ScalarAPIError(`Expected '${optionName}' to resolve to a non-empty string.`); + return token; + } + + private resolveAuthOptionSync(optionName: string, value: string | AuthTokenProvider | null | undefined): string | undefined { + if (value == null) return undefined; + const token = typeof value === "function" ? value() : value; + if (typeof token !== "string" || !token) throw new Errors.ScalarAPIError(`Expected '${optionName}' to resolve to a non-empty string.`); + return token; + } + + static ScalarAPI = this; + static DEFAULT_TIMEOUT = 60000; // 1 minute + + static ScalarAPIError = Errors.ScalarAPIError; + static APIError = Errors.APIError; + static APIConnectionError = Errors.APIConnectionError; + static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError; + static APIUserAbortError = Errors.APIUserAbortError; + static NotFoundError = Errors.NotFoundError; + static ConflictError = Errors.ConflictError; + static RateLimitError = Errors.RateLimitError; + static BadRequestError = Errors.BadRequestError; + static AuthenticationError = Errors.AuthenticationError; + static InternalServerError = Errors.InternalServerError; + static PermissionDeniedError = Errors.PermissionDeniedError; + static UnprocessableEntityError = Errors.UnprocessableEntityError; + + static toFile = toFile; + + registry: Registry = new Registry(this); + schemas: Schemas = new Schemas(this); + loginPortals: LoginPortals = new LoginPortals(this); + rules: Rules = new Rules(this); + themes: Themes = new Themes(this); + teams: Teams = new Teams(this); + scalarDocs: ScalarDocs = new ScalarDocs(this); + namespaces: Namespaces = new Namespaces(this); + authentication: Authentication = new Authentication(this); +} + +ScalarAPI.Registry = Registry; +ScalarAPI.Schemas = Schemas; +ScalarAPI.LoginPortals = LoginPortals; +ScalarAPI.Rules = Rules; +ScalarAPI.Themes = Themes; +ScalarAPI.Teams = Teams; +ScalarAPI.ScalarDocs = ScalarDocs; +ScalarAPI.Namespaces = Namespaces; +ScalarAPI.Authentication = Authentication; + +export declare namespace ScalarAPI { + export type RequestOptions = Opts.RequestOptions; + export { + Registry as Registry, + type Version as Version, + type AccessGroup as AccessGroup, + type RegistryListAllAPIDocumentsResponse as RegistryListAllAPIDocumentsResponse, + type RegistryListAPIDocumentsResponse as RegistryListAPIDocumentsResponse, + type RegistryCreateAPIDocumentResponse as RegistryCreateAPIDocumentResponse, + type RegistryUpdateAPIDocumentVersionResponse as RegistryUpdateAPIDocumentVersionResponse, + type ManagedDocVersion as ManagedDocVersion, + type RegistryCreateAPIDocumentParams as RegistryCreateAPIDocumentParams, + type RegistryUpdateAPIDocumentParams as RegistryUpdateAPIDocumentParams, + type RegistryDeleteAPIDocumentParams as RegistryDeleteAPIDocumentParams, + type RegistryRetrieveAPIDocumentVersionParams as RegistryRetrieveAPIDocumentVersionParams, + type RegistryUpdateAPIDocumentVersionParams as RegistryUpdateAPIDocumentVersionParams, + type RegistryDeleteAPIDocumentVersionParams as RegistryDeleteAPIDocumentVersionParams, + type RegistryListAPIDocumentVersionMetadataParams as RegistryListAPIDocumentVersionMetadataParams, + type RegistryCreateAPIDocumentVersionParams as RegistryCreateAPIDocumentVersionParams, + type RegistryCreateAPIDocumentAccessGroupParams as RegistryCreateAPIDocumentAccessGroupParams, + type RegistryDeleteAPIDocumentAccessGroupParams as RegistryDeleteAPIDocumentAccessGroupParams, + }; + + export { + Schemas as Schemas, + type SchemaListResponse as SchemaListResponse, + type UID as UID, + type SchemaCreateParams as SchemaCreateParams, + type SchemaUpdateParams as SchemaUpdateParams, + type SchemaDeleteParams as SchemaDeleteParams, + }; + + export { + LoginPortals as LoginPortals, + type LoginPortalEmail as LoginPortalEmail, + type LoginPortalPage as LoginPortalPage, + type LoginPortalRetrieveResponse as LoginPortalRetrieveResponse, + type LoginPortalListResponse as LoginPortalListResponse, + type LoginPortalUpdateParams as LoginPortalUpdateParams, + type LoginPortalCreateParams as LoginPortalCreateParams, + }; + + export { + Rules as Rules, + type RuleListRulesetsResponse as RuleListRulesetsResponse, + type RuleCreateRulesetParams as RuleCreateRulesetParams, + type RuleUpdateRulesetParams as RuleUpdateRulesetParams, + type RuleDeleteRulesetParams as RuleDeleteRulesetParams, + type RuleRetrieveRulesetDocumentParams as RuleRetrieveRulesetDocumentParams, + type RuleCreateRulesetAccessGroupParams as RuleCreateRulesetAccessGroupParams, + type RuleDeleteRulesetAccessGroupParams as RuleDeleteRulesetAccessGroupParams, + }; + + export { + Themes as Themes, + type ThemeListResponse as ThemeListResponse, + type ThemeCreateParams as ThemeCreateParams, + type ThemeUpdateParams as ThemeUpdateParams, + type ThemeReplaceDocumentParams as ThemeReplaceDocumentParams, + }; + + export { + Teams as Teams, + type TeamListResponse as TeamListResponse, + }; + + export { + ScalarDocs as ScalarDocs, + type Slug as Slug, + type ScalarDocListGuidesResponse as ScalarDocListGuidesResponse, + type ScalarDocCreateGuideResponse as ScalarDocCreateGuideResponse, + type ScalarDocPublishGuideResponse as ScalarDocPublishGuideResponse, + type ScalarDocCreateGuideParams as ScalarDocCreateGuideParams, + }; + + export { + Namespaces as Namespaces, + type NamespaceListResponse as NamespaceListResponse, + }; + + export { + Authentication as Authentication, + type AuthenticationExchangePersonalTokenResponse as AuthenticationExchangePersonalTokenResponse, + type User as User, + type AuthenticationExchangePersonalTokenParams as AuthenticationExchangePersonalTokenParams, + }; +} + + +const headerExplicitlyOmitted = (source: HeadersLike | undefined, name: string): boolean => { + if (!source || Array.isArray(source) || source instanceof Headers) return false; + const target = name.toLowerCase(); + return Object.entries(source).some(([key, value]) => key.toLowerCase() === target && value === null); +}; + +const appendAuthCookies = (headers: Headers, cookies: Record): void => { + for (const [name, value] of Object.entries(cookies)) { + if (cookieHeaderHas(headers.get("Cookie"), name)) continue; + const cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value); + const existing = headers.get("Cookie"); + headers.set("Cookie", existing ? existing + "; " + cookie : cookie); + } +}; + +const cookieHeaderHas = (value: string | null, name: string): boolean => { + if (!value) return false; + const target = encodeURIComponent(name) + "="; + return value.split(";").some((cookie) => cookie.trim().startsWith(target)); +}; + diff --git a/src/core.ts b/src/core.ts deleted file mode 100644 index c60d397..0000000 --- a/src/core.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ClientSDK } from "./lib/sdks.js"; - -/** - * A minimal client to use when calling standalone SDK functions. Typically, an - * instance of this class would be instantiated once at the start of an - * application and passed around through some dependency injection mechanism to - * parts of an application that need to make SDK calls. - */ -export class ScalarCore extends ClientSDK {} diff --git a/src/core/error.ts b/src/core/error.ts new file mode 100644 index 0000000..1051616 --- /dev/null +++ b/src/core/error.ts @@ -0,0 +1,130 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { castToError } from '../internal/errors'; + +export class ScalarAPIError extends Error {} + +export class APIError< + TStatus extends number | undefined = number | undefined, + THeaders extends Headers | undefined = Headers | undefined, + TError extends Object | undefined = Object | undefined, +> extends ScalarAPIError { + /** HTTP status for the response that caused the error */ + readonly status: TStatus; + /** HTTP headers for the response that caused the error */ + readonly headers: THeaders; + /** JSON body of the response that caused the error */ + readonly error: TError; + + constructor(status: TStatus, error: TError, message: string | undefined, headers: THeaders) { + super(`${APIError.makeMessage(status, error, message)}`); + this.status = status; + this.headers = headers; + this.error = error; + } + + private static makeMessage(status: number | undefined, error: any, message: string | undefined) { + const msg = + error?.message ? + typeof error.message === 'string' ? + error.message + : JSON.stringify(error.message) + : error ? JSON.stringify(error) + : message; + + if (status && msg) { + return `${status} ${msg}`; + } + if (status) { + return `${status} status code (no body)`; + } + if (msg) { + return msg; + } + return '(no status code or body)'; + } + + static generate( + status: number | undefined, + errorResponse: Object | undefined, + message: string | undefined, + headers: Headers | undefined, + ): APIError { + if (!status || !headers) { + return new APIConnectionError({ message, cause: castToError(errorResponse) }); + } + + const error = errorResponse as Record; + + if (status === 400) { + return new BadRequestError(status, error, message, headers); + } + + if (status === 401) { + return new AuthenticationError(status, error, message, headers); + } + + if (status === 403) { + return new PermissionDeniedError(status, error, message, headers); + } + + if (status === 404) { + return new NotFoundError(status, error, message, headers); + } + + if (status === 409) { + return new ConflictError(status, error, message, headers); + } + + if (status === 422) { + return new UnprocessableEntityError(status, error, message, headers); + } + + if (status === 429) { + return new RateLimitError(status, error, message, headers); + } + + if (status >= 500) { + return new InternalServerError(status, error, message, headers); + } + + return new APIError(status, error, message, headers); + } +} + +export class APIUserAbortError extends APIError { + constructor({ message }: { message?: string } = {}) { + super(undefined, undefined, message || 'Request was aborted.', undefined); + } +} + +export class APIConnectionError extends APIError { + constructor({ message, cause }: { message?: string | undefined; cause?: Error | undefined }) { + super(undefined, undefined, message || 'Connection error.', undefined); + // in some environments the 'cause' property is already declared + // @ts-ignore + if (cause) this.cause = cause; + } +} + +export class APIConnectionTimeoutError extends APIConnectionError { + constructor({ message }: { message?: string } = {}) { + super({ message: message ?? 'Request timed out.' }); + } +} + +export class BadRequestError extends APIError<400, Headers> {} + +export class AuthenticationError extends APIError<401, Headers> {} + +export class PermissionDeniedError extends APIError<403, Headers> {} + +export class NotFoundError extends APIError<404, Headers> {} + +export class ConflictError extends APIError<409, Headers> {} + +export class UnprocessableEntityError extends APIError<422, Headers> {} + +export class RateLimitError extends APIError<429, Headers> {} + +export class InternalServerError extends APIError {} diff --git a/src/core/uploads.ts b/src/core/uploads.ts new file mode 100644 index 0000000..536cfe6 --- /dev/null +++ b/src/core/uploads.ts @@ -0,0 +1,4 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +export { type Uploadable } from '../internal/uploads'; +export { toFile, type ToFileInput } from '../internal/to-file'; diff --git a/src/error.ts b/src/error.ts new file mode 100644 index 0000000..834f539 --- /dev/null +++ b/src/error.ts @@ -0,0 +1,4 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +/** @deprecated Import from ./core/error instead */ +export * from './core/error'; diff --git a/src/funcs/authenticationExchangePersonalToken.ts b/src/funcs/authenticationExchangePersonalToken.ts deleted file mode 100644 index ffeae34..0000000 --- a/src/funcs/authenticationExchangePersonalToken.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Exchange token - * - * @remarks - * Exchange an API key for an access token. - */ -export function authenticationExchangePersonalToken( - client: ScalarCore, - request: operations.ExchangePersonalTokenRequestBody, - options?: RequestOptions, -): APIPromise< - Result< - operations.ExchangePersonalTokenResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.ExchangePersonalTokenRequestBody, - options?: RequestOptions, -): Promise< - [ - Result< - operations.ExchangePersonalTokenResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.ExchangePersonalTokenRequestBody$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload, { explode: true }); - - const path = pathToFunc("/v1/auth/exchange")(); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "exchangePersonalToken", - oAuth2Scopes: [], - - resolvedSecurity: null, - - securitySource: null, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - method: "POST", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.ExchangePersonalTokenResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.ExchangePersonalTokenResponse$inboundSchema, { - key: "object", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/authenticationGetCurrentUser.ts b/src/funcs/authenticationGetCurrentUser.ts deleted file mode 100644 index f5b773e..0000000 --- a/src/funcs/authenticationGetCurrentUser.ts +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Get current user - * - * @remarks - * Get the authenticated user, including their available teams and theme. - */ -export function authenticationGetCurrentUser( - client: ScalarCore, - options?: RequestOptions, -): APIPromise< - Result< - operations.GetCurrentUserResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - options, - )); -} - -async function $do( - client: ScalarCore, - options?: RequestOptions, -): Promise< - [ - Result< - operations.GetCurrentUserResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const path = pathToFunc("/v1/auth/me")(); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "getCurrentUser", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.GetCurrentUserResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.GetCurrentUserResponse$inboundSchema, { - key: "user", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/loginPortalsCreateLoginPortal.ts b/src/funcs/loginPortalsCreateLoginPortal.ts deleted file mode 100644 index ea3c504..0000000 --- a/src/funcs/loginPortalsCreateLoginPortal.ts +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Create a portal - * - * @remarks - * Create a login portal for the current team. - */ -export function loginPortalsCreateLoginPortal( - client: ScalarCore, - request: operations.CreateLoginPortalRequestBody, - options?: RequestOptions, -): APIPromise< - Result< - operations.CreateLoginPortalResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.CreateLoginPortalRequestBody, - options?: RequestOptions, -): Promise< - [ - Result< - operations.CreateLoginPortalResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.CreateLoginPortalRequestBody$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload, { explode: true }); - - const path = pathToFunc("/v1/login-portals")(); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "createLoginPortal", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "POST", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.CreateLoginPortalResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.CreateLoginPortalResponse$inboundSchema, { - key: "uid", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/loginPortalsDeleteLoginPortal.ts b/src/funcs/loginPortalsDeleteLoginPortal.ts deleted file mode 100644 index f7e4afb..0000000 --- a/src/funcs/loginPortalsDeleteLoginPortal.ts +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Delete a login portal - * - * @remarks - * Delete a login portal. - */ -export function loginPortalsDeleteLoginPortal( - client: ScalarCore, - request: operations.DeleteLoginPortalRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.DeleteLoginPortalResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.DeleteLoginPortalRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.DeleteLoginPortalResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.DeleteLoginPortalRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/login-portals/{slug}")(pathParams); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "deleteLoginPortal", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "DELETE", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.DeleteLoginPortalResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.DeleteLoginPortalResponse$inboundSchema, { - key: "any", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/loginPortalsGetLoginPortal.ts b/src/funcs/loginPortalsGetLoginPortal.ts deleted file mode 100644 index 40329cc..0000000 --- a/src/funcs/loginPortalsGetLoginPortal.ts +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Get a login portal - * - * @remarks - * Get a login portal by slug. - */ -export function loginPortalsGetLoginPortal( - client: ScalarCore, - request: operations.GetLoginPortalRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.GetLoginPortalResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.GetLoginPortalRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.GetLoginPortalResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.GetLoginPortalRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/login-portals/{slug}")(pathParams); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "getLoginPortal", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.GetLoginPortalResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.GetLoginPortalResponse$inboundSchema, { - key: "object", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/loginPortalsListLoginPortals.ts b/src/funcs/loginPortalsListLoginPortals.ts deleted file mode 100644 index e04eab1..0000000 --- a/src/funcs/loginPortalsListLoginPortals.ts +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * List all portals - * - * @remarks - * List all login portals for the current team. - */ -export function loginPortalsListLoginPortals( - client: ScalarCore, - options?: RequestOptions, -): APIPromise< - Result< - operations.ListLoginPortalsResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - options, - )); -} - -async function $do( - client: ScalarCore, - options?: RequestOptions, -): Promise< - [ - Result< - operations.ListLoginPortalsResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const path = pathToFunc("/v1/login-portals")(); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "listLoginPortals", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.ListLoginPortalsResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.ListLoginPortalsResponse$inboundSchema, { - key: "login-portals", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/loginPortalsUpdateLoginPortal.ts b/src/funcs/loginPortalsUpdateLoginPortal.ts deleted file mode 100644 index 45036ac..0000000 --- a/src/funcs/loginPortalsUpdateLoginPortal.ts +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Update portal metadata - * - * @remarks - * Update metadata for a login portal. - */ -export function loginPortalsUpdateLoginPortal( - client: ScalarCore, - request: operations.UpdateLoginPortalRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.UpdateLoginPortalResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.UpdateLoginPortalRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.UpdateLoginPortalResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.UpdateLoginPortalRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload.RequestBody, { explode: true }); - - const pathParams = { - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/login-portals/{slug}")(pathParams); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "updateLoginPortal", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "PATCH", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.UpdateLoginPortalResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.UpdateLoginPortalResponse$inboundSchema, { - key: "any", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/namespacesListNamespaces.ts b/src/funcs/namespacesListNamespaces.ts deleted file mode 100644 index 8fd757a..0000000 --- a/src/funcs/namespacesListNamespaces.ts +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * List namespaces - * - * @remarks - * Get all namespaces for the current team - */ -export function namespacesListNamespaces( - client: ScalarCore, - options?: RequestOptions, -): APIPromise< - Result< - operations.ListNamespacesResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - options, - )); -} - -async function $do( - client: ScalarCore, - options?: RequestOptions, -): Promise< - [ - Result< - operations.ListNamespacesResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const path = pathToFunc("/v1/namespaces")(); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "listNamespaces", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.ListNamespacesResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.ListNamespacesResponse$inboundSchema, { - key: "strings", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/registryAddApiDocumentAccessGroup.ts b/src/funcs/registryAddApiDocumentAccessGroup.ts deleted file mode 100644 index d19fa33..0000000 --- a/src/funcs/registryAddApiDocumentAccessGroup.ts +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Add access group - * - * @remarks - * Add an access group to an API document. - */ -export function registryAddApiDocumentAccessGroup( - client: ScalarCore, - request: operations.AddApiDocumentAccessGroupRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.AddApiDocumentAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.AddApiDocumentAccessGroupRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.AddApiDocumentAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.AddApiDocumentAccessGroupRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload["access-group"], { explode: true }); - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/apis/{namespace}/{slug}/access-group")( - pathParams, - ); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "addApiDocumentAccessGroup", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "POST", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.AddApiDocumentAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.AddApiDocumentAccessGroupResponse$inboundSchema, { - key: "any", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/registryCreateApiDocument.ts b/src/funcs/registryCreateApiDocument.ts deleted file mode 100644 index 6b918bf..0000000 --- a/src/funcs/registryCreateApiDocument.ts +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Create API Document - * - * @remarks - * Create an API document. - */ -export function registryCreateApiDocument( - client: ScalarCore, - request: operations.CreateApiDocumentRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.CreateApiDocumentResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.CreateApiDocumentRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.CreateApiDocumentResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.CreateApiDocumentRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload.RequestBody, { explode: true }); - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/apis/{namespace}")(pathParams); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "createApiDocument", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "POST", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.CreateApiDocumentResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.CreateApiDocumentResponse$inboundSchema, { - key: "object", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/registryCreateApiDocumentVersion.ts b/src/funcs/registryCreateApiDocumentVersion.ts deleted file mode 100644 index 4c76409..0000000 --- a/src/funcs/registryCreateApiDocumentVersion.ts +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Create API Document version - * - * @remarks - * Create a new API document version. - */ -export function registryCreateApiDocumentVersion( - client: ScalarCore, - request: operations.CreateApiDocumentVersionRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.CreateApiDocumentVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.CreateApiDocumentVersionRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.CreateApiDocumentVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.CreateApiDocumentVersionRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload.RequestBody, { explode: true }); - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/apis/{namespace}/{slug}/version")(pathParams); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "createApiDocumentVersion", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "POST", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.CreateApiDocumentVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.CreateApiDocumentVersionResponse$inboundSchema, { - key: "managed-doc-version", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/registryDeleteApiDocument.ts b/src/funcs/registryDeleteApiDocument.ts deleted file mode 100644 index 474fba6..0000000 --- a/src/funcs/registryDeleteApiDocument.ts +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Delete API Document - * - * @remarks - * Delete an API document and all versions. - */ -export function registryDeleteApiDocument( - client: ScalarCore, - request: operations.DeleteApiDocumentRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.DeleteApiDocumentResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.DeleteApiDocumentRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.DeleteApiDocumentResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.DeleteApiDocumentRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/apis/{namespace}/{slug}")(pathParams); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "deleteApiDocument", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "DELETE", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.DeleteApiDocumentResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.DeleteApiDocumentResponse$inboundSchema, { - key: "any", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/registryDeleteApiDocumentVersion.ts b/src/funcs/registryDeleteApiDocumentVersion.ts deleted file mode 100644 index 42c1eae..0000000 --- a/src/funcs/registryDeleteApiDocumentVersion.ts +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Delete API Document version - * - * @remarks - * Delete a specific API document version. - */ -export function registryDeleteApiDocumentVersion( - client: ScalarCore, - request: operations.DeleteApiDocumentVersionRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.DeleteApiDocumentVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.DeleteApiDocumentVersionRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.DeleteApiDocumentVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.DeleteApiDocumentVersionRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - semver: encodeSimple("semver", payload.semver, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/apis/{namespace}/{slug}/version/{semver}")( - pathParams, - ); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "deleteApiDocumentVersion", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "DELETE", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.DeleteApiDocumentVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.DeleteApiDocumentVersionResponse$inboundSchema, { - key: "any", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/registryGetApiDocumentVersion.ts b/src/funcs/registryGetApiDocumentVersion.ts deleted file mode 100644 index c121cb7..0000000 --- a/src/funcs/registryGetApiDocumentVersion.ts +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Get API Document - * - * @remarks - * Get a specific API document version. - */ -export function registryGetApiDocumentVersion( - client: ScalarCore, - request: operations.GetApiDocumentVersionRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.GetApiDocumentVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.GetApiDocumentVersionRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.GetApiDocumentVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.GetApiDocumentVersionRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - semver: encodeSimple("semver", payload.semver, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/apis/{namespace}/{slug}/version/{semver}")( - pathParams, - ); - - const headers = new Headers(compactMap({ - Accept: "text/plain", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "getApiDocumentVersion", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.GetApiDocumentVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.text(200, operations.GetApiDocumentVersionResponse$inboundSchema, { - key: "res", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/registryGetApiDocumentVersionMetadata.ts b/src/funcs/registryGetApiDocumentVersionMetadata.ts deleted file mode 100644 index 863f3b9..0000000 --- a/src/funcs/registryGetApiDocumentVersionMetadata.ts +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Get API Document version metadata - * - * @remarks - * Get metadata (uid, content shas, version sha, tags) for a specific API document version. - */ -export function registryGetApiDocumentVersionMetadata( - client: ScalarCore, - request: operations.GetApiDocumentVersionMetadataRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.GetApiDocumentVersionMetadataResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.GetApiDocumentVersionMetadataRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.GetApiDocumentVersionMetadataResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.GetApiDocumentVersionMetadataRequest$outboundSchema.parse( - value, - ), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - semver: encodeSimple("semver", payload.semver, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc( - "/v1/apis/{namespace}/{slug}/version/{semver}/metadata", - )(pathParams); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "getApiDocumentVersionMetadata", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.GetApiDocumentVersionMetadataResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json( - 200, - operations.GetApiDocumentVersionMetadataResponse$inboundSchema, - { key: "managed-doc-version" }, - ), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/registryListAllApiDocuments.ts b/src/funcs/registryListAllApiDocuments.ts deleted file mode 100644 index dad95f5..0000000 --- a/src/funcs/registryListAllApiDocuments.ts +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * List all API Documents - * - * @remarks - * List all API documents across every namespace the caller can access. - */ -export function registryListAllApiDocuments( - client: ScalarCore, - options?: RequestOptions, -): APIPromise< - Result< - operations.ListAllApiDocumentsResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - options, - )); -} - -async function $do( - client: ScalarCore, - options?: RequestOptions, -): Promise< - [ - Result< - operations.ListAllApiDocumentsResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const path = pathToFunc("/v1/apis")(); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "listAllApiDocuments", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.ListAllApiDocumentsResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.ListAllApiDocumentsResponse$inboundSchema, { - key: "api-documents", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/registryListApiDocuments.ts b/src/funcs/registryListApiDocuments.ts deleted file mode 100644 index 8613a1b..0000000 --- a/src/funcs/registryListApiDocuments.ts +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * List API Documents in a namespace - * - * @remarks - * List API documents in a namespace. - */ -export function registryListApiDocuments( - client: ScalarCore, - request: operations.ListApiDocumentsRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.ListApiDocumentsResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.ListApiDocumentsRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.ListApiDocumentsResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.ListApiDocumentsRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/apis/{namespace}")(pathParams); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "listApiDocuments", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.ListApiDocumentsResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.ListApiDocumentsResponse$inboundSchema, { - key: "api-documents", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/registryRemoveApiDocumentAccessGroup.ts b/src/funcs/registryRemoveApiDocumentAccessGroup.ts deleted file mode 100644 index 4cb06d5..0000000 --- a/src/funcs/registryRemoveApiDocumentAccessGroup.ts +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Remove access group - * - * @remarks - * Remove an access group from an API document. - */ -export function registryRemoveApiDocumentAccessGroup( - client: ScalarCore, - request: operations.RemoveApiDocumentAccessGroupRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.RemoveApiDocumentAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.RemoveApiDocumentAccessGroupRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.RemoveApiDocumentAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.RemoveApiDocumentAccessGroupRequest$outboundSchema.parse( - value, - ), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload["access-group"], { explode: true }); - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/apis/{namespace}/{slug}/access-group")( - pathParams, - ); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "removeApiDocumentAccessGroup", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "DELETE", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.RemoveApiDocumentAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.RemoveApiDocumentAccessGroupResponse$inboundSchema, { - key: "any", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/registryUpdateApiDocument.ts b/src/funcs/registryUpdateApiDocument.ts deleted file mode 100644 index 1b591c8..0000000 --- a/src/funcs/registryUpdateApiDocument.ts +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Update API Document metadata - * - * @remarks - * Update metadata for an API document. - */ -export function registryUpdateApiDocument( - client: ScalarCore, - request: operations.UpdateApiDocumentRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.UpdateApiDocumentResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.UpdateApiDocumentRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.UpdateApiDocumentResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.UpdateApiDocumentRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload.RequestBody, { explode: true }); - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/apis/{namespace}/{slug}")(pathParams); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "updateApiDocument", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "PATCH", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.UpdateApiDocumentResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.UpdateApiDocumentResponse$inboundSchema, { - key: "any", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/registryUpdateApiDocumentVersion.ts b/src/funcs/registryUpdateApiDocumentVersion.ts deleted file mode 100644 index 58e1c76..0000000 --- a/src/funcs/registryUpdateApiDocumentVersion.ts +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Update API Document version - * - * @remarks - * Update the registry file content for an API document version. - */ -export function registryUpdateApiDocumentVersion( - client: ScalarCore, - request: operations.UpdateApiDocumentVersionRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.UpdateApiDocumentVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.UpdateApiDocumentVersionRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.UpdateApiDocumentVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.UpdateApiDocumentVersionRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload.RequestBody, { explode: true }); - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - semver: encodeSimple("semver", payload.semver, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/apis/{namespace}/{slug}/version/{semver}")( - pathParams, - ); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "updateApiDocumentVersion", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "PATCH", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.UpdateApiDocumentVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.UpdateApiDocumentVersionResponse$inboundSchema, { - key: "object", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/rulesAddRulesetAccessGroup.ts b/src/funcs/rulesAddRulesetAccessGroup.ts deleted file mode 100644 index a4c0388..0000000 --- a/src/funcs/rulesAddRulesetAccessGroup.ts +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Add rule access group - * - * @remarks - * Grant an access group to a rule. - */ -export function rulesAddRulesetAccessGroup( - client: ScalarCore, - request: operations.AddRulesetAccessGroupRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.AddRulesetAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.AddRulesetAccessGroupRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.AddRulesetAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.AddRulesetAccessGroupRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload["access-group"], { explode: true }); - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/rulesets/{namespace}/{slug}/access-group")( - pathParams, - ); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "addRulesetAccessGroup", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "POST", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.AddRulesetAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.AddRulesetAccessGroupResponse$inboundSchema, { - key: "any", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/rulesCreateRuleset.ts b/src/funcs/rulesCreateRuleset.ts deleted file mode 100644 index e066497..0000000 --- a/src/funcs/rulesCreateRuleset.ts +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Create a rule - * - * @remarks - * Create a rule in a namespace. - */ -export function rulesCreateRuleset( - client: ScalarCore, - request: operations.CreateRulesetRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.CreateRulesetResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.CreateRulesetRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.CreateRulesetResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.CreateRulesetRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload.RequestBody, { explode: true }); - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/rulesets/{namespace}")(pathParams); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "createRuleset", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "POST", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.CreateRulesetResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.CreateRulesetResponse$inboundSchema, { key: "uid" }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/rulesDeleteRuleset.ts b/src/funcs/rulesDeleteRuleset.ts deleted file mode 100644 index e551a27..0000000 --- a/src/funcs/rulesDeleteRuleset.ts +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Delete a rule - * - * @remarks - * Delete a rule by slug. - */ -export function rulesDeleteRuleset( - client: ScalarCore, - request: operations.DeleteRulesetRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.DeleteRulesetResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.DeleteRulesetRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.DeleteRulesetResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.DeleteRulesetRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/rulesets/{namespace}/{slug}")(pathParams); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "deleteRuleset", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "DELETE", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.DeleteRulesetResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.DeleteRulesetResponse$inboundSchema, { key: "any" }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/rulesGetRulesetDocument.ts b/src/funcs/rulesGetRulesetDocument.ts deleted file mode 100644 index e470234..0000000 --- a/src/funcs/rulesGetRulesetDocument.ts +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Get a rule - * - * @remarks - * Get a rule document by slug. - */ -export function rulesGetRulesetDocument( - client: ScalarCore, - request: operations.GetRulesetDocumentRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.GetRulesetDocumentResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.GetRulesetDocumentRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.GetRulesetDocumentResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.GetRulesetDocumentRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/rulesets/{namespace}/{slug}")(pathParams); - - const headers = new Headers(compactMap({ - Accept: "text/plain", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "getRulesetDocument", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.GetRulesetDocumentResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.text(200, operations.GetRulesetDocumentResponse$inboundSchema, { - key: "res", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/rulesListRulesets.ts b/src/funcs/rulesListRulesets.ts deleted file mode 100644 index 5564b45..0000000 --- a/src/funcs/rulesListRulesets.ts +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * List all rules - * - * @remarks - * List all rulesets in a namespace. - */ -export function rulesListRulesets( - client: ScalarCore, - request: operations.ListRulesetsRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.ListRulesetsResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.ListRulesetsRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.ListRulesetsResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.ListRulesetsRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/rulesets/{namespace}")(pathParams); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "listRulesets", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.ListRulesetsResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.ListRulesetsResponse$inboundSchema, { - key: "rules", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/rulesRemoveRulesetAccessGroup.ts b/src/funcs/rulesRemoveRulesetAccessGroup.ts deleted file mode 100644 index cc14ddb..0000000 --- a/src/funcs/rulesRemoveRulesetAccessGroup.ts +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Remove rule access group - * - * @remarks - * Remove an access group from a rule. - */ -export function rulesRemoveRulesetAccessGroup( - client: ScalarCore, - request: operations.RemoveRulesetAccessGroupRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.RemoveRulesetAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.RemoveRulesetAccessGroupRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.RemoveRulesetAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.RemoveRulesetAccessGroupRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload["access-group"], { explode: true }); - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/rulesets/{namespace}/{slug}/access-group")( - pathParams, - ); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "removeRulesetAccessGroup", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "DELETE", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.RemoveRulesetAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.RemoveRulesetAccessGroupResponse$inboundSchema, { - key: "any", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/rulesUpdateRuleset.ts b/src/funcs/rulesUpdateRuleset.ts deleted file mode 100644 index 381cad9..0000000 --- a/src/funcs/rulesUpdateRuleset.ts +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Update rule metadata - * - * @remarks - * Update rule metadata by slug. - */ -export function rulesUpdateRuleset( - client: ScalarCore, - request: operations.UpdateRulesetRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.UpdateRulesetResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.UpdateRulesetRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.UpdateRulesetResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.UpdateRulesetRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload.RequestBody, { explode: true }); - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/rulesets/{namespace}/{slug}")(pathParams); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "updateRuleset", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "PATCH", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.UpdateRulesetResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.UpdateRulesetResponse$inboundSchema, { key: "any" }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/scalarDocsCreateGuide.ts b/src/funcs/scalarDocsCreateGuide.ts deleted file mode 100644 index b0cd796..0000000 --- a/src/funcs/scalarDocsCreateGuide.ts +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Create a project - * - * @remarks - * Create a guide project. - */ -export function scalarDocsCreateGuide( - client: ScalarCore, - request: operations.CreateGuideRequestBody, - options?: RequestOptions, -): APIPromise< - Result< - operations.CreateGuideResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.CreateGuideRequestBody, - options?: RequestOptions, -): Promise< - [ - Result< - operations.CreateGuideResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.CreateGuideRequestBody$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload, { explode: true }); - - const path = pathToFunc("/v1/guides")(); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "createGuide", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "POST", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.CreateGuideResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.CreateGuideResponse$inboundSchema, { - key: "object", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/scalarDocsListGuides.ts b/src/funcs/scalarDocsListGuides.ts deleted file mode 100644 index b1170e4..0000000 --- a/src/funcs/scalarDocsListGuides.ts +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * List all projects - * - * @remarks - * List all guide projects. - */ -export function scalarDocsListGuides( - client: ScalarCore, - options?: RequestOptions, -): APIPromise< - Result< - operations.ListGuidesResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - options, - )); -} - -async function $do( - client: ScalarCore, - options?: RequestOptions, -): Promise< - [ - Result< - operations.ListGuidesResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const path = pathToFunc("/v1/guides")(); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "listGuides", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.ListGuidesResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.ListGuidesResponse$inboundSchema, { - key: "github-projects", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/scalarDocsPublishGuide.ts b/src/funcs/scalarDocsPublishGuide.ts deleted file mode 100644 index bfa9c0f..0000000 --- a/src/funcs/scalarDocsPublishGuide.ts +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Publish a project - * - * @remarks - * Start a new publish process. - */ -export function scalarDocsPublishGuide( - client: ScalarCore, - request: operations.PublishGuideRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.PublishGuideResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.PublishGuideRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.PublishGuideResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.PublishGuideRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/guides/{slug}/publish")(pathParams); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "publishGuide", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "POST", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.PublishGuideResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.PublishGuideResponse$inboundSchema, { - key: "object", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/schemasAddSchemaAccessGroup.ts b/src/funcs/schemasAddSchemaAccessGroup.ts deleted file mode 100644 index a1a2bda..0000000 --- a/src/funcs/schemasAddSchemaAccessGroup.ts +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Add shared component access group - * - * @remarks - * Add an access group to a schema. - */ -export function schemasAddSchemaAccessGroup( - client: ScalarCore, - request: operations.AddSchemaAccessGroupRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.AddSchemaAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.AddSchemaAccessGroupRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.AddSchemaAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.AddSchemaAccessGroupRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload["access-group"], { explode: true }); - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/schemas/{namespace}/{slug}/access-group")( - pathParams, - ); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "addSchemaAccessGroup", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "POST", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.AddSchemaAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.AddSchemaAccessGroupResponse$inboundSchema, { - key: "any", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/schemasCreateSchema.ts b/src/funcs/schemasCreateSchema.ts deleted file mode 100644 index 65e9f09..0000000 --- a/src/funcs/schemasCreateSchema.ts +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Create a shared component - * - * @remarks - * Create a schema in a namespace. - */ -export function schemasCreateSchema( - client: ScalarCore, - request: operations.CreateSchemaRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.CreateSchemaResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.CreateSchemaRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.CreateSchemaResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.CreateSchemaRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload.RequestBody, { explode: true }); - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/schemas/{namespace}")(pathParams); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "createSchema", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "POST", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.CreateSchemaResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.CreateSchemaResponse$inboundSchema, { key: "uid" }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/schemasCreateSchemaVersion.ts b/src/funcs/schemasCreateSchemaVersion.ts deleted file mode 100644 index ed74613..0000000 --- a/src/funcs/schemasCreateSchemaVersion.ts +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Create a shared component version - * - * @remarks - * Create a schema version. - */ -export function schemasCreateSchemaVersion( - client: ScalarCore, - request: operations.CreateSchemaVersionRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.CreateSchemaVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.CreateSchemaVersionRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.CreateSchemaVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.CreateSchemaVersionRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload.RequestBody, { explode: true }); - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/schemas/{namespace}/{slug}/version")(pathParams); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "createSchemaVersion", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "POST", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.CreateSchemaVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.CreateSchemaVersionResponse$inboundSchema, { - key: "uid", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/schemasDeleteSchema.ts b/src/funcs/schemasDeleteSchema.ts deleted file mode 100644 index 724c24e..0000000 --- a/src/funcs/schemasDeleteSchema.ts +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Delete a shared component - * - * @remarks - * Delete a schema and all related versions. - */ -export function schemasDeleteSchema( - client: ScalarCore, - request: operations.DeleteSchemaRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.DeleteSchemaResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.DeleteSchemaRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.DeleteSchemaResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.DeleteSchemaRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/schemas/{namespace}/{slug}")(pathParams); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "deleteSchema", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "DELETE", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.DeleteSchemaResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.DeleteSchemaResponse$inboundSchema, { key: "any" }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/schemasDeleteSchemaVersion.ts b/src/funcs/schemasDeleteSchemaVersion.ts deleted file mode 100644 index 5f2fc71..0000000 --- a/src/funcs/schemasDeleteSchemaVersion.ts +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Delete a shared component version - * - * @remarks - * Delete a schema version. - */ -export function schemasDeleteSchemaVersion( - client: ScalarCore, - request: operations.DeleteSchemaVersionRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.DeleteSchemaVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.DeleteSchemaVersionRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.DeleteSchemaVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.DeleteSchemaVersionRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - semver: encodeSimple("semver", payload.semver, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/schemas/{namespace}/{slug}/version/{semver}")( - pathParams, - ); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "deleteSchemaVersion", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "DELETE", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.DeleteSchemaVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.DeleteSchemaVersionResponse$inboundSchema, { - key: "any", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/schemasGetSchemaVersion.ts b/src/funcs/schemasGetSchemaVersion.ts deleted file mode 100644 index 439a823..0000000 --- a/src/funcs/schemasGetSchemaVersion.ts +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Get a shared component document - * - * @remarks - * Get a specific schema version document. - */ -export function schemasGetSchemaVersion( - client: ScalarCore, - request: operations.GetSchemaVersionRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.GetSchemaVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.GetSchemaVersionRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.GetSchemaVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.GetSchemaVersionRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - semver: encodeSimple("semver", payload.semver, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/schemas/{namespace}/{slug}/version/{semver}")( - pathParams, - ); - - const headers = new Headers(compactMap({ - Accept: "text/plain", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "getSchemaVersion", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.GetSchemaVersionResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.text(200, operations.GetSchemaVersionResponse$inboundSchema, { - key: "res", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/schemasListSchemas.ts b/src/funcs/schemasListSchemas.ts deleted file mode 100644 index 0d5e898..0000000 --- a/src/funcs/schemasListSchemas.ts +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * List all shared components - * - * @remarks - * List schemas in a namespace. - */ -export function schemasListSchemas( - client: ScalarCore, - request: operations.ListSchemasRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.ListSchemasResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.ListSchemasRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.ListSchemasResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.ListSchemasRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/schemas/{namespace}")(pathParams); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "listSchemas", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.ListSchemasResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.ListSchemasResponse$inboundSchema, { - key: "schemata", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/schemasRemoveSchemaAccessGroup.ts b/src/funcs/schemasRemoveSchemaAccessGroup.ts deleted file mode 100644 index ad92b07..0000000 --- a/src/funcs/schemasRemoveSchemaAccessGroup.ts +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Remove shared component access group - * - * @remarks - * Remove an access group from a schema. - */ -export function schemasRemoveSchemaAccessGroup( - client: ScalarCore, - request: operations.RemoveSchemaAccessGroupRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.RemoveSchemaAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.RemoveSchemaAccessGroupRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.RemoveSchemaAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.RemoveSchemaAccessGroupRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload["access-group"], { explode: true }); - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/schemas/{namespace}/{slug}/access-group")( - pathParams, - ); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "removeSchemaAccessGroup", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "DELETE", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.RemoveSchemaAccessGroupResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.RemoveSchemaAccessGroupResponse$inboundSchema, { - key: "any", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/schemasUpdateSchema.ts b/src/funcs/schemasUpdateSchema.ts deleted file mode 100644 index 8311959..0000000 --- a/src/funcs/schemasUpdateSchema.ts +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Update shared component metadata - * - * @remarks - * Update schema metadata. - */ -export function schemasUpdateSchema( - client: ScalarCore, - request: operations.UpdateSchemaRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.UpdateSchemaResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.UpdateSchemaRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.UpdateSchemaResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.UpdateSchemaRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload.RequestBody, { explode: true }); - - const pathParams = { - namespace: encodeSimple("namespace", payload.namespace, { - explode: false, - charEncoding: "percent", - }), - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/schemas/{namespace}/{slug}")(pathParams); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "updateSchema", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "PATCH", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.UpdateSchemaResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.UpdateSchemaResponse$inboundSchema, { key: "any" }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/teamsListTeams.ts b/src/funcs/teamsListTeams.ts deleted file mode 100644 index 564bf6d..0000000 --- a/src/funcs/teamsListTeams.ts +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * List teams - * - * @remarks - * List all available teams - */ -export function teamsListTeams( - client: ScalarCore, - options?: RequestOptions, -): APIPromise< - Result< - operations.ListTeamsResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - options, - )); -} - -async function $do( - client: ScalarCore, - options?: RequestOptions, -): Promise< - [ - Result< - operations.ListTeamsResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const path = pathToFunc("/v1/teams")(); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "listTeams", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.ListTeamsResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.ListTeamsResponse$inboundSchema, { key: "teams" }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/themesCreateTheme.ts b/src/funcs/themesCreateTheme.ts deleted file mode 100644 index 06a2be4..0000000 --- a/src/funcs/themesCreateTheme.ts +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Create a theme - * - * @remarks - * Create a team theme. - */ -export function themesCreateTheme( - client: ScalarCore, - request: operations.CreateThemeRequestBody, - options?: RequestOptions, -): APIPromise< - Result< - operations.CreateThemeResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.CreateThemeRequestBody, - options?: RequestOptions, -): Promise< - [ - Result< - operations.CreateThemeResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.CreateThemeRequestBody$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload, { explode: true }); - - const path = pathToFunc("/v1/themes")(); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "createTheme", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "POST", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.CreateThemeResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.CreateThemeResponse$inboundSchema, { key: "uid" }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/themesDeleteTheme.ts b/src/funcs/themesDeleteTheme.ts deleted file mode 100644 index 4339ff3..0000000 --- a/src/funcs/themesDeleteTheme.ts +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Delete a theme - * - * @remarks - * Delete a theme by slug. - */ -export function themesDeleteTheme( - client: ScalarCore, - request: operations.DeleteThemeRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.DeleteThemeResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.DeleteThemeRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.DeleteThemeResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.DeleteThemeRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/themes/{slug}")(pathParams); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "deleteTheme", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "DELETE", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.DeleteThemeResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.DeleteThemeResponse$inboundSchema, { key: "any" }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/themesGetTheme.ts b/src/funcs/themesGetTheme.ts deleted file mode 100644 index 53ae358..0000000 --- a/src/funcs/themesGetTheme.ts +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Get a theme - * - * @remarks - * Get the theme document by slug. - */ -export function themesGetTheme( - client: ScalarCore, - request: operations.GetThemeRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.GetThemeResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.GetThemeRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.GetThemeResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.GetThemeRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = null; - - const pathParams = { - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/themes/{slug}")(pathParams); - - const headers = new Headers(compactMap({ - Accept: "text/plain", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "getTheme", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.GetThemeResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.text(200, operations.GetThemeResponse$inboundSchema, { key: "res" }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/themesListThemes.ts b/src/funcs/themesListThemes.ts deleted file mode 100644 index befc9ca..0000000 --- a/src/funcs/themesListThemes.ts +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * List all themes - * - * @remarks - * List all team themes. - */ -export function themesListThemes( - client: ScalarCore, - options?: RequestOptions, -): APIPromise< - Result< - operations.ListThemesResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - options, - )); -} - -async function $do( - client: ScalarCore, - options?: RequestOptions, -): Promise< - [ - Result< - operations.ListThemesResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const path = pathToFunc("/v1/themes")(); - - const headers = new Headers(compactMap({ - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "listThemes", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path, - headers: headers, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.ListThemesResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.ListThemesResponse$inboundSchema, { key: "themes" }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/themesReplaceThemeDocument.ts b/src/funcs/themesReplaceThemeDocument.ts deleted file mode 100644 index b1f30d0..0000000 --- a/src/funcs/themesReplaceThemeDocument.ts +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Update theme document - * - * @remarks - * Replace the theme document. - */ -export function themesReplaceThemeDocument( - client: ScalarCore, - request: operations.ReplaceThemeDocumentRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.ReplaceThemeDocumentResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.ReplaceThemeDocumentRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.ReplaceThemeDocumentResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => - operations.ReplaceThemeDocumentRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload.RequestBody, { explode: true }); - - const pathParams = { - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/themes/{slug}")(pathParams); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "replaceThemeDocument", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "PUT", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.ReplaceThemeDocumentResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.ReplaceThemeDocumentResponse$inboundSchema, { - key: "any", - }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/funcs/themesUpdateTheme.ts b/src/funcs/themesUpdateTheme.ts deleted file mode 100644 index d3d5244..0000000 --- a/src/funcs/themesUpdateTheme.ts +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; -import * as M from "../lib/matchers.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import * as errors from "../models/errors/index.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ScalarError } from "../models/errors/scalarerror.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import * as operations from "../models/operations/index.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Update theme metadata - * - * @remarks - * Update theme metadata. - */ -export function themesUpdateTheme( - client: ScalarCore, - request: operations.UpdateThemeRequest, - options?: RequestOptions, -): APIPromise< - Result< - operations.UpdateThemeResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - > -> { - return new APIPromise($do( - client, - request, - options, - )); -} - -async function $do( - client: ScalarCore, - request: operations.UpdateThemeRequest, - options?: RequestOptions, -): Promise< - [ - Result< - operations.UpdateThemeResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >, - APICall, - ] -> { - const parsed = safeParse( - request, - (value) => operations.UpdateThemeRequest$outboundSchema.parse(value), - "Input validation failed", - ); - if (!parsed.ok) { - return [parsed, { status: "invalid" }]; - } - const payload = parsed.value; - const body = encodeJSON("body", payload.RequestBody, { explode: true }); - - const pathParams = { - slug: encodeSimple("slug", payload.slug, { - explode: false, - charEncoding: "percent", - }), - }; - - const path = pathToFunc("/v1/themes/{slug}")(pathParams); - - const headers = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - - const secConfig = await extractSecurity(client._options.bearerAuth); - const securityInput = secConfig == null ? {} : { bearerAuth: secConfig }; - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client._options, - baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "updateTheme", - oAuth2Scopes: [], - - resolvedSecurity: requestSecurity, - - securitySource: client._options.bearerAuth, - retryConfig: options?.retries - || client._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], - }; - - const requestRes = client._createRequest(context, { - security: requestSecurity, - method: "PATCH", - baseURL: options?.serverURL, - path: path, - headers: headers, - body: body, - userAgent: client._options.userAgent, - timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req = requestRes.value; - - const doResult = await client._do(req, { - context, - errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req }]; - } - const response = doResult.value; - - const responseFields = { - HttpMeta: { Response: response, Request: req }, - }; - - const [result] = await M.match< - operations.UpdateThemeResponse, - | errors.FourHundred - | errors.FourHundredAndOne - | errors.FourHundredAndThree - | errors.FourHundredAndFour - | errors.FourHundredAndTwentyTwo - | errors.FiveHundred - | ScalarError - | ResponseValidationError - | ConnectionError - | RequestAbortedError - | RequestTimeoutError - | InvalidRequestError - | UnexpectedClientError - | SDKValidationError - >( - M.json(200, operations.UpdateThemeResponse$inboundSchema, { key: "any" }), - M.jsonErr(400, errors.FourHundred$inboundSchema), - M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), - M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), - M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), - M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), - M.jsonErr(500, errors.FiveHundred$inboundSchema), - M.fail("4XX"), - M.fail("5XX"), - )(response, req, { extraFields: responseFields }); - if (!result.ok) { - return [result, { status: "complete", request: req, response }]; - } - - return [result, { status: "complete", request: req, response }]; -} diff --git a/src/hooks/hooks.ts b/src/hooks/hooks.ts deleted file mode 100644 index 7ed9e04..0000000 --- a/src/hooks/hooks.ts +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { SDKOptions } from "../lib/config.js"; -import { RequestInput } from "../lib/http.js"; -import { - AfterErrorContext, - AfterErrorHook, - AfterSuccessContext, - AfterSuccessHook, - BeforeCreateRequestContext, - BeforeCreateRequestHook, - BeforeRequestContext, - BeforeRequestHook, - Hook, - Hooks, - SDKInitHook, -} from "./types.js"; - -import { initHooks } from "./registration.js"; - -export class SDKHooks implements Hooks { - sdkInitHooks: SDKInitHook[] = []; - beforeCreateRequestHooks: BeforeCreateRequestHook[] = []; - beforeRequestHooks: BeforeRequestHook[] = []; - afterSuccessHooks: AfterSuccessHook[] = []; - afterErrorHooks: AfterErrorHook[] = []; - - constructor() { - const presetHooks: Array = []; - - for (const hook of presetHooks) { - if ("sdkInit" in hook) { - this.registerSDKInitHook(hook); - } - if ("beforeCreateRequest" in hook) { - this.registerBeforeCreateRequestHook(hook); - } - if ("beforeRequest" in hook) { - this.registerBeforeRequestHook(hook); - } - if ("afterSuccess" in hook) { - this.registerAfterSuccessHook(hook); - } - if ("afterError" in hook) { - this.registerAfterErrorHook(hook); - } - } - initHooks(this); - } - - registerSDKInitHook(hook: SDKInitHook) { - this.sdkInitHooks.push(hook); - } - - registerBeforeCreateRequestHook(hook: BeforeCreateRequestHook) { - this.beforeCreateRequestHooks.push(hook); - } - - registerBeforeRequestHook(hook: BeforeRequestHook) { - this.beforeRequestHooks.push(hook); - } - - registerAfterSuccessHook(hook: AfterSuccessHook) { - this.afterSuccessHooks.push(hook); - } - - registerAfterErrorHook(hook: AfterErrorHook) { - this.afterErrorHooks.push(hook); - } - - sdkInit(opts: SDKOptions): SDKOptions { - return this.sdkInitHooks.reduce((opts, hook) => hook.sdkInit(opts), opts); - } - - beforeCreateRequest( - hookCtx: BeforeCreateRequestContext, - input: RequestInput, - ): RequestInput { - let inp = input; - - for (const hook of this.beforeCreateRequestHooks) { - inp = hook.beforeCreateRequest(hookCtx, inp); - } - - return inp; - } - - async beforeRequest( - hookCtx: BeforeRequestContext, - request: Request, - ): Promise { - let req = request; - - for (const hook of this.beforeRequestHooks) { - req = await hook.beforeRequest(hookCtx, req); - } - - return req; - } - - async afterSuccess( - hookCtx: AfterSuccessContext, - response: Response, - ): Promise { - let res = response; - - for (const hook of this.afterSuccessHooks) { - res = await hook.afterSuccess(hookCtx, res); - } - - return res; - } - - async afterError( - hookCtx: AfterErrorContext, - response: Response | null, - error: unknown, - ): Promise<{ response: Response | null; error: unknown }> { - let res = response; - let err = error; - - for (const hook of this.afterErrorHooks) { - const result = await hook.afterError(hookCtx, res, err); - res = result.response; - err = result.error; - } - - return { response: res, error: err }; - } -} diff --git a/src/hooks/index.ts b/src/hooks/index.ts deleted file mode 100644 index f60ec7a..0000000 --- a/src/hooks/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -export * from "./hooks.js"; -export * from "./types.js"; diff --git a/src/hooks/registration.ts b/src/hooks/registration.ts deleted file mode 100644 index 7064973..0000000 --- a/src/hooks/registration.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Hooks } from "./types.js"; - -/* - * This file is only ever generated once on the first generation and then is free to be modified. - * Any hooks you wish to add should be registered in the initHooks function. Feel free to define them - * in this file or in separate files in the hooks folder. - */ - -// @ts-expect-error remove this line when you add your first hook and hooks is used -export function initHooks(hooks: Hooks) { - // Add hooks by calling hooks.register{ClientInit/BeforeCreateRequest/BeforeRequest/AfterSuccess/AfterError}Hook - // with an instance of a hook that implements that specific Hook interface - // Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance -} diff --git a/src/hooks/types.ts b/src/hooks/types.ts deleted file mode 100644 index 9c36bf0..0000000 --- a/src/hooks/types.ts +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { SDKOptions } from "../lib/config.js"; -import { RequestInput } from "../lib/http.js"; -import { RetryConfig } from "../lib/retries.js"; -import { SecurityState } from "../lib/security.js"; - -export type HookContext = { - baseURL: string | URL; - operationID: string; - oAuth2Scopes: string[] | null; - securitySource?: any | (() => Promise); - retryConfig: RetryConfig; - resolvedSecurity: SecurityState | null; - options: SDKOptions; -}; - -export type Awaitable = T | Promise; - -export type BeforeCreateRequestContext = HookContext & {}; -export type BeforeRequestContext = HookContext & {}; -export type AfterSuccessContext = HookContext & {}; -export type AfterErrorContext = HookContext & {}; - -/** - * SDKInitHook is called when the SDK is initializing. The - * hook can return a new baseURL and HTTP client to be used by the SDK. - */ -export interface SDKInitHook { - sdkInit: (opts: SDKOptions) => SDKOptions; -} - -export interface BeforeCreateRequestHook { - /** - * A hook that is called before the SDK creates a `Request` object. The hook - * can modify how a request is constructed since certain modifications, like - * changing the request URL, cannot be done on a request object directly. - */ - beforeCreateRequest: ( - hookCtx: BeforeCreateRequestContext, - input: RequestInput, - ) => RequestInput; -} - -export interface BeforeRequestHook { - /** - * A hook that is called before the SDK sends a request. The hook can - * introduce instrumentation code such as logging, tracing and metrics or - * replace the request before it is sent or throw an error to stop the - * request from being sent. - */ - beforeRequest: ( - hookCtx: BeforeRequestContext, - request: Request, - ) => Awaitable; -} - -export interface AfterSuccessHook { - /** - * A hook that is called after the SDK receives a response. The hook can - * introduce instrumentation code such as logging, tracing and metrics or - * modify the response before it is handled or throw an error to stop the - * response from being handled. - */ - afterSuccess: ( - hookCtx: AfterSuccessContext, - response: Response, - ) => Awaitable; -} - -export interface AfterErrorHook { - /** - * A hook that is called after the SDK encounters an error, or a - * non-successful response. The hook can introduce instrumentation code such - * as logging, tracing and metrics or modify the response or error values. - */ - afterError: ( - hookCtx: AfterErrorContext, - response: Response | null, - error: unknown, - ) => Awaitable<{ - response: Response | null; - error: unknown; - }>; -} - -export interface Hooks { - /** Registers a hook to be used by the SDK for initialization event. */ - registerSDKInitHook(hook: SDKInitHook): void; - /** Registers a hook to be used by the SDK for to modify `Request` construction. */ - registerBeforeCreateRequestHook(hook: BeforeCreateRequestHook): void; - /** Registers a hook to be used by the SDK for the before request event. */ - registerBeforeRequestHook(hook: BeforeRequestHook): void; - /** Registers a hook to be used by the SDK for the after success event. */ - registerAfterSuccessHook(hook: AfterSuccessHook): void; - /** Registers a hook to be used by the SDK for the after error event. */ - registerAfterErrorHook(hook: AfterErrorHook): void; -} - -export type Hook = - | SDKInitHook - | BeforeCreateRequestHook - | BeforeRequestHook - | AfterSuccessHook - | AfterErrorHook; diff --git a/src/index.ts b/src/index.ts index dbcba16..9eb60a9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,9 +1,22 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ +// File generated from our OpenAPI spec by Scalar. See README.md for details. -export * from "./lib/config.js"; -export * as files from "./lib/files.js"; -export { HTTPClient } from "./lib/http.js"; -export type { Fetcher, HTTPClientOptions } from "./lib/http.js"; -export * from "./sdk/sdk.js"; +export { ScalarAPI as default } from './client.js'; + +export { type Uploadable, toFile } from './core/uploads'; +export { APIPromise } from './api-promise'; +export { ScalarAPI, type ClientOptions, type ScalarAPIOptions, type Logger, type LogLevel } from './client.js'; +export { + ScalarAPIError, + APIError, + APIConnectionError, + APIConnectionTimeoutError, + APIUserAbortError, + NotFoundError, + ConflictError, + RateLimitError, + BadRequestError, + AuthenticationError, + InternalServerError, + PermissionDeniedError, + UnprocessableEntityError, +} from './error'; diff --git a/src/internal/README.md b/src/internal/README.md new file mode 100644 index 0000000..3ef5a25 --- /dev/null +++ b/src/internal/README.md @@ -0,0 +1,3 @@ +# `internal` + +The modules in this directory are not importable outside this package and will change between releases. diff --git a/src/internal/builtin-types.ts b/src/internal/builtin-types.ts new file mode 100644 index 0000000..40d03c4 --- /dev/null +++ b/src/internal/builtin-types.ts @@ -0,0 +1,93 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +export type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise; + +/** + * An alias to the builtin `RequestInit` type so we can + * easily alias it in import statements if there are name clashes. + * + * https://developer.mozilla.org/docs/Web/API/RequestInit + */ +type _RequestInit = RequestInit; + +/** + * An alias to the builtin `Response` type so we can + * easily alias it in import statements if there are name clashes. + * + * https://developer.mozilla.org/docs/Web/API/Response + */ +type _Response = Response; + +/** + * The type for the first argument to `fetch`. + * + * https://developer.mozilla.org/docs/Web/API/Window/fetch#resource + */ +type _RequestInfo = Request | URL | string; + +/** + * The type for constructing `RequestInit` Headers. + * + * https://developer.mozilla.org/docs/Web/API/RequestInit#setting_headers + */ +type _HeadersInit = RequestInit['headers']; + +/** + * The type for constructing `RequestInit` body. + * + * https://developer.mozilla.org/docs/Web/API/RequestInit#body + */ +type _BodyInit = RequestInit['body']; + +/** + * An alias to the builtin `Array` type so we can + * easily alias it in import statements if there are name clashes. + */ +type _Array = Array; + +/** + * An alias to the builtin `Record` type so we can + * easily alias it in import statements if there are name clashes. + */ +type _Record = Record; + +export type { + _Array as Array, + _BodyInit as BodyInit, + _HeadersInit as HeadersInit, + _Record as Record, + _RequestInfo as RequestInfo, + _RequestInit as RequestInit, + _Response as Response, +}; + +/** + * A copy of the builtin `EndingType` type as it isn't fully supported in certain + * environments and attempting to reference the global version will error. + * + * https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L27941 + */ +type EndingType = 'native' | 'transparent'; + +/** + * A copy of the builtin `BlobPropertyBag` type as it isn't fully supported in certain + * environments and attempting to reference the global version will error. + * + * https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L154 + * https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob#options + */ +export interface BlobPropertyBag { + endings?: EndingType; + type?: string; +} + +/** + * A copy of the builtin `FilePropertyBag` type as it isn't fully supported in certain + * environments and attempting to reference the global version will error. + * + * https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L503 + * https://developer.mozilla.org/en-US/docs/Web/API/File/File#options + */ +export interface FilePropertyBag extends BlobPropertyBag { + lastModified?: number; +} diff --git a/src/internal/detect-platform.ts b/src/internal/detect-platform.ts new file mode 100644 index 0000000..7fc9267 --- /dev/null +++ b/src/internal/detect-platform.ts @@ -0,0 +1,196 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { VERSION } from '../version'; + +export const isRunningInBrowser = () => { + return ( + // @ts-ignore + typeof window !== 'undefined' && + // @ts-ignore + typeof window.document !== 'undefined' && + // @ts-ignore + typeof navigator !== 'undefined' + ); +}; + +type DetectedPlatform = 'deno' | 'node' | 'edge' | 'unknown'; + +/** + * Note this does not detect 'browser'; for that, use getBrowserInfo(). + */ +function getDetectedPlatform(): DetectedPlatform { + if (typeof Deno !== 'undefined' && Deno.build != null) { + return 'deno'; + } + if (typeof EdgeRuntime !== 'undefined') { + return 'edge'; + } + if ( + Object.prototype.toString.call( + typeof (globalThis as any).process !== 'undefined' ? (globalThis as any).process : 0, + ) === '[object process]' + ) { + return 'node'; + } + return 'unknown'; +} + +declare const Deno: any; +declare const EdgeRuntime: any; +type Arch = 'x32' | 'x64' | 'arm' | 'arm64' | `other:${string}` | 'unknown'; +type PlatformName = + | 'MacOS' + | 'Linux' + | 'Windows' + | 'FreeBSD' + | 'OpenBSD' + | 'iOS' + | 'Android' + | `Other:${string}` + | 'Unknown'; +type Browser = 'ie' | 'edge' | 'chrome' | 'firefox' | 'safari'; +type PlatformProperties = { + 'X-Scalar-Lang': 'js'; + 'X-Scalar-Package-Version': string; + 'X-Scalar-OS': PlatformName; + 'X-Scalar-Arch': Arch; + 'X-Scalar-Runtime': 'node' | 'deno' | 'edge' | `browser:${Browser}` | 'unknown'; + 'X-Scalar-Runtime-Version': string; +}; +const getPlatformProperties = (): PlatformProperties => { + const detectedPlatform = getDetectedPlatform(); + if (detectedPlatform === 'deno') { + return { + 'X-Scalar-Lang': 'js', + 'X-Scalar-Package-Version': VERSION, + 'X-Scalar-OS': normalizePlatform(Deno.build.os), + 'X-Scalar-Arch': normalizeArch(Deno.build.arch), + 'X-Scalar-Runtime': 'deno', + 'X-Scalar-Runtime-Version': + typeof Deno.version === 'string' ? Deno.version : Deno.version?.deno ?? 'unknown', + }; + } + if (typeof EdgeRuntime !== 'undefined') { + return { + 'X-Scalar-Lang': 'js', + 'X-Scalar-Package-Version': VERSION, + 'X-Scalar-OS': 'Unknown', + 'X-Scalar-Arch': `other:${EdgeRuntime}`, + 'X-Scalar-Runtime': 'edge', + 'X-Scalar-Runtime-Version': (globalThis as any).process.version, + }; + } + // Check if Node.js + if (detectedPlatform === 'node') { + return { + 'X-Scalar-Lang': 'js', + 'X-Scalar-Package-Version': VERSION, + 'X-Scalar-OS': normalizePlatform((globalThis as any).process.platform ?? 'unknown'), + 'X-Scalar-Arch': normalizeArch((globalThis as any).process.arch ?? 'unknown'), + 'X-Scalar-Runtime': 'node', + 'X-Scalar-Runtime-Version': (globalThis as any).process.version ?? 'unknown', + }; + } + + const browserInfo = getBrowserInfo(); + if (browserInfo) { + return { + 'X-Scalar-Lang': 'js', + 'X-Scalar-Package-Version': VERSION, + 'X-Scalar-OS': 'Unknown', + 'X-Scalar-Arch': 'unknown', + 'X-Scalar-Runtime': `browser:${browserInfo.browser}`, + 'X-Scalar-Runtime-Version': browserInfo.version, + }; + } + + // TODO add support for Cloudflare workers, etc. + return { + 'X-Scalar-Lang': 'js', + 'X-Scalar-Package-Version': VERSION, + 'X-Scalar-OS': 'Unknown', + 'X-Scalar-Arch': 'unknown', + 'X-Scalar-Runtime': 'unknown', + 'X-Scalar-Runtime-Version': 'unknown', + }; +}; + +type BrowserInfo = { + browser: Browser; + version: string; +}; + +declare const navigator: { userAgent: string } | undefined; + +// Note: modified from https://github.com/JS-DevTools/host-environment/blob/b1ab79ecde37db5d6e163c050e54fe7d287d7c92/src/isomorphic.browser.ts +function getBrowserInfo(): BrowserInfo | null { + if (typeof navigator === 'undefined' || !navigator) { + return null; + } + + // NOTE: The order matters here! + const browserPatterns = [ + { key: 'edge' as const, pattern: /Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: 'ie' as const, pattern: /MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: 'ie' as const, pattern: /Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: 'chrome' as const, pattern: /Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: 'firefox' as const, pattern: /Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: 'safari' as const, pattern: /(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/ }, + ]; + + // Find the FIRST matching browser + for (const { key, pattern } of browserPatterns) { + const match = pattern.exec(navigator.userAgent); + if (match) { + const major = match[1] || 0; + const minor = match[2] || 0; + const patch = match[3] || 0; + + return { browser: key, version: `${major}.${minor}.${patch}` }; + } + } + + return null; +} + +const normalizeArch = (arch: string): Arch => { + // Node docs: + // - https://nodejs.org/api/process.html#processarch + // Deno docs: + // - https://doc.deno.land/deno/stable/~/Deno.build + if (arch === 'x32') return 'x32'; + if (arch === 'x86_64' || arch === 'x64') return 'x64'; + if (arch === 'arm') return 'arm'; + if (arch === 'aarch64' || arch === 'arm64') return 'arm64'; + if (arch) return `other:${arch}`; + return 'unknown'; +}; + +const normalizePlatform = (platform: string): PlatformName => { + // Node platforms: + // - https://nodejs.org/api/process.html#processplatform + // Deno platforms: + // - https://doc.deno.land/deno/stable/~/Deno.build + // - https://github.com/denoland/deno/issues/14799 + + platform = platform.toLowerCase(); + + // NOTE: this iOS check is untested and may not work + // Node does not work natively on IOS, there is a fork at + // https://github.com/nodejs-mobile/nodejs-mobile + // however it is unknown at the time of writing how to detect if it is running + if (platform.includes('ios')) return 'iOS'; + if (platform === 'android') return 'Android'; + if (platform === 'darwin') return 'MacOS'; + if (platform === 'win32') return 'Windows'; + if (platform === 'freebsd') return 'FreeBSD'; + if (platform === 'openbsd') return 'OpenBSD'; + if (platform === 'linux') return 'Linux'; + if (platform) return `Other:${platform}`; + return 'Unknown'; +}; + +let _platformHeaders: PlatformProperties; +export const getPlatformHeaders = () => { + return (_platformHeaders ??= getPlatformProperties()); +}; diff --git a/src/internal/errors.ts b/src/internal/errors.ts new file mode 100644 index 0000000..fed0efd --- /dev/null +++ b/src/internal/errors.ts @@ -0,0 +1,33 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +export function isAbortError(err: unknown) { + return ( + typeof err === 'object' && + err !== null && + // Spec-compliant fetch implementations + (('name' in err && (err as any).name === 'AbortError') || + // Expo fetch + ('message' in err && String((err as any).message).includes('FetchRequestCanceledException'))) + ); +} + +export const castToError = (err: any): Error => { + if (err instanceof Error) return err; + if (typeof err === 'object' && err !== null) { + try { + if (Object.prototype.toString.call(err) === '[object Error]') { + // @ts-ignore - not all envs have native support for cause yet + const error = new Error(err.message, err.cause ? { cause: err.cause } : {}); + if (err.stack) error.stack = err.stack; + // @ts-ignore - not all envs have native support for cause yet + if (err.cause && !error.cause) error.cause = err.cause; + if (err.name) error.name = err.name; + return error; + } + } catch {} + try { + return new Error(JSON.stringify(err)); + } catch {} + } + return new Error(err); +}; diff --git a/src/internal/headers.ts b/src/internal/headers.ts new file mode 100644 index 0000000..411434e --- /dev/null +++ b/src/internal/headers.ts @@ -0,0 +1,97 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { isReadonlyArray } from './utils/values'; + +type HeaderValue = string | undefined | null; +export type HeadersLike = + | Headers + | readonly HeaderValue[][] + | Record + | undefined + | null + | NullableHeaders; + +const brand_privateNullableHeaders = /* @__PURE__ */ Symbol('brand.privateNullableHeaders'); + +/** + * @internal + * Users can pass explicit nulls to unset default headers. When we parse them + * into a standard headers type we need to preserve that information. + */ +export type NullableHeaders = { + /** Brand check, prevent users from creating a NullableHeaders. */ + [brand_privateNullableHeaders]: true; + /** Parsed headers. */ + values: Headers; + /** Set of lowercase header names explicitly set to null. */ + nulls: Set; +}; + +function* iterateHeaders(headers: HeadersLike): IterableIterator { + if (!headers) return; + + if (brand_privateNullableHeaders in headers) { + const { values, nulls } = headers; + yield* values.entries(); + for (const name of nulls) { + yield [name, null]; + } + return; + } + + let shouldClear = false; + let iter: Iterable; + if (headers instanceof Headers) { + iter = headers.entries(); + } else if (isReadonlyArray(headers)) { + iter = headers; + } else { + shouldClear = true; + iter = Object.entries(headers ?? {}); + } + for (let row of iter) { + const name = row[0]; + if (typeof name !== 'string') throw new TypeError('expected header name to be a string'); + const values = isReadonlyArray(row[1]) ? row[1] : [row[1]]; + let didClear = false; + for (const value of values) { + if (value === undefined) continue; + + // Objects keys always overwrite older headers, they never append. + // Yield a null to clear the header before adding the new values. + if (shouldClear && !didClear) { + didClear = true; + yield [name, null]; + } + yield [name, value]; + } + } +} + +export const buildHeaders = (newHeaders: HeadersLike[]): NullableHeaders => { + const targetHeaders = new Headers(); + const nullHeaders = new Set(); + for (const headers of newHeaders) { + const seenHeaders = new Set(); + for (const [name, value] of iterateHeaders(headers)) { + const lowerName = name.toLowerCase(); + if (!seenHeaders.has(lowerName)) { + targetHeaders.delete(name); + seenHeaders.add(lowerName); + } + if (value === null) { + targetHeaders.delete(name); + nullHeaders.add(lowerName); + } else { + targetHeaders.append(name, value); + nullHeaders.delete(lowerName); + } + } + } + return { [brand_privateNullableHeaders]: true, values: targetHeaders, nulls: nullHeaders }; +}; + +export const isEmptyHeaders = (headers: HeadersLike) => { + for (const _ of iterateHeaders(headers)) return false; + return true; +}; diff --git a/src/internal/qs/LICENSE.md b/src/internal/qs/LICENSE.md new file mode 100644 index 0000000..3fda157 --- /dev/null +++ b/src/internal/qs/LICENSE.md @@ -0,0 +1,13 @@ +BSD 3-Clause License + +Copyright (c) 2014, Nathan LaFreniere and other [contributors](https://github.com/puruvj/neoqs/graphs/contributors) All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/internal/qs/README.md b/src/internal/qs/README.md new file mode 100644 index 0000000..67ae04e --- /dev/null +++ b/src/internal/qs/README.md @@ -0,0 +1,3 @@ +# qs + +This is a vendored version of [neoqs](https://github.com/PuruVJ/neoqs) which is a TypeScript rewrite of [qs](https://github.com/ljharb/qs), a query string library. diff --git a/src/internal/qs/formats.ts b/src/internal/qs/formats.ts new file mode 100644 index 0000000..e76a742 --- /dev/null +++ b/src/internal/qs/formats.ts @@ -0,0 +1,10 @@ +import type { Format } from './types'; + +export const default_format: Format = 'RFC3986'; +export const default_formatter = (v: PropertyKey) => String(v); +export const formatters: Record string> = { + RFC1738: (v: PropertyKey) => String(v).replace(/%20/g, '+'), + RFC3986: default_formatter, +}; +export const RFC1738 = 'RFC1738'; +export const RFC3986 = 'RFC3986'; diff --git a/src/internal/qs/index.ts b/src/internal/qs/index.ts new file mode 100644 index 0000000..c3a3620 --- /dev/null +++ b/src/internal/qs/index.ts @@ -0,0 +1,13 @@ +import { default_format, formatters, RFC1738, RFC3986 } from './formats'; + +const formats = { + formatters, + RFC1738, + RFC3986, + default: default_format, +}; + +export { stringify } from './stringify'; +export { formats }; + +export type { DefaultDecoder, DefaultEncoder, Format, ParseOptions, StringifyOptions } from './types'; diff --git a/src/internal/qs/stringify.ts b/src/internal/qs/stringify.ts new file mode 100644 index 0000000..7e71387 --- /dev/null +++ b/src/internal/qs/stringify.ts @@ -0,0 +1,385 @@ +import { encode, is_buffer, maybe_map, has } from './utils'; +import { default_format, default_formatter, formatters } from './formats'; +import type { NonNullableProperties, StringifyOptions } from './types'; +import { isArray } from '../utils/values'; + +const array_prefix_generators = { + brackets(prefix: PropertyKey) { + return String(prefix) + '[]'; + }, + comma: 'comma', + indices(prefix: PropertyKey, key: string) { + return String(prefix) + '[' + key + ']'; + }, + repeat(prefix: PropertyKey) { + return String(prefix); + }, +}; + +const push_to_array = function (arr: any[], value_or_array: any) { + Array.prototype.push.apply(arr, isArray(value_or_array) ? value_or_array : [value_or_array]); +}; + +let toISOString; + +const defaults = { + addQueryPrefix: false, + allowDots: false, + allowEmptyArrays: false, + arrayFormat: 'indices', + charset: 'utf-8', + charsetSentinel: false, + delimiter: '&', + encode: true, + encodeDotInKeys: false, + encoder: encode, + encodeValuesOnly: false, + format: default_format, + formatter: default_formatter, + /** @deprecated */ + indices: false, + serializeDate(date) { + return (toISOString ??= Function.prototype.call.bind(Date.prototype.toISOString))(date); + }, + skipNulls: false, + strictNullHandling: false, +} as NonNullableProperties; + +function is_non_nullish_primitive(v: unknown): v is string | number | boolean | symbol | bigint { + return ( + typeof v === 'string' || + typeof v === 'number' || + typeof v === 'boolean' || + typeof v === 'symbol' || + typeof v === 'bigint' + ); +} + +const sentinel = {}; + +function inner_stringify( + object: any, + prefix: PropertyKey, + generateArrayPrefix: StringifyOptions['arrayFormat'] | ((prefix: string, key: string) => string), + commaRoundTrip: boolean, + allowEmptyArrays: boolean, + strictNullHandling: boolean, + skipNulls: boolean, + encodeDotInKeys: boolean, + encoder: StringifyOptions['encoder'], + filter: StringifyOptions['filter'], + sort: StringifyOptions['sort'], + allowDots: StringifyOptions['allowDots'], + serializeDate: StringifyOptions['serializeDate'], + format: StringifyOptions['format'], + formatter: StringifyOptions['formatter'], + encodeValuesOnly: boolean, + charset: StringifyOptions['charset'], + sideChannel: WeakMap, +) { + let obj = object; + + let tmp_sc = sideChannel; + let step = 0; + let find_flag = false; + while ((tmp_sc = tmp_sc.get(sentinel)) !== void undefined && !find_flag) { + // Where object last appeared in the ref tree + const pos = tmp_sc.get(object); + step += 1; + if (typeof pos !== 'undefined') { + if (pos === step) { + throw new RangeError('Cyclic object value'); + } else { + find_flag = true; // Break while + } + } + if (typeof tmp_sc.get(sentinel) === 'undefined') { + step = 0; + } + } + + if (typeof filter === 'function') { + obj = filter(prefix, obj); + } else if (obj instanceof Date) { + obj = serializeDate?.(obj); + } else if (generateArrayPrefix === 'comma' && isArray(obj)) { + obj = maybe_map(obj, function (value) { + if (value instanceof Date) { + return serializeDate?.(value); + } + return value; + }); + } + + if (obj === null) { + if (strictNullHandling) { + return encoder && !encodeValuesOnly ? + // @ts-expect-error + encoder(prefix, defaults.encoder, charset, 'key', format) + : prefix; + } + + obj = ''; + } + + if (is_non_nullish_primitive(obj) || is_buffer(obj)) { + if (encoder) { + const key_value = + encodeValuesOnly ? prefix + // @ts-expect-error + : encoder(prefix, defaults.encoder, charset, 'key', format); + return [ + formatter?.(key_value) + + '=' + + // @ts-expect-error + formatter?.(encoder(obj, defaults.encoder, charset, 'value', format)), + ]; + } + return [formatter?.(prefix) + '=' + formatter?.(String(obj))]; + } + + const values: string[] = []; + + if (typeof obj === 'undefined') { + return values; + } + + let obj_keys; + if (generateArrayPrefix === 'comma' && isArray(obj)) { + // we need to join elements in + if (encodeValuesOnly && encoder) { + // @ts-expect-error values only + obj = maybe_map(obj, encoder); + } + obj_keys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }]; + } else if (isArray(filter)) { + obj_keys = filter; + } else { + const keys = Object.keys(obj); + obj_keys = sort ? keys.sort(sort) : keys; + } + + const encoded_prefix = encodeDotInKeys ? String(prefix).replace(/\./g, '%2E') : String(prefix); + + const adjusted_prefix = + commaRoundTrip && isArray(obj) && obj.length === 1 ? encoded_prefix + '[]' : encoded_prefix; + + if (allowEmptyArrays && isArray(obj) && obj.length === 0) { + return adjusted_prefix + '[]'; + } + + for (let j = 0; j < obj_keys.length; ++j) { + const key = obj_keys[j]; + const value = + // @ts-ignore + typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key as any]; + + if (skipNulls && value === null) { + continue; + } + + // @ts-ignore + const encoded_key = allowDots && encodeDotInKeys ? (key as any).replace(/\./g, '%2E') : key; + const key_prefix = + isArray(obj) ? + typeof generateArrayPrefix === 'function' ? + generateArrayPrefix(adjusted_prefix, encoded_key) + : adjusted_prefix + : adjusted_prefix + (allowDots ? '.' + encoded_key : '[' + encoded_key + ']'); + + sideChannel.set(object, step); + const valueSideChannel = new WeakMap(); + valueSideChannel.set(sentinel, sideChannel); + push_to_array( + values, + inner_stringify( + value, + key_prefix, + generateArrayPrefix, + commaRoundTrip, + allowEmptyArrays, + strictNullHandling, + skipNulls, + encodeDotInKeys, + // @ts-ignore + generateArrayPrefix === 'comma' && encodeValuesOnly && isArray(obj) ? null : encoder, + filter, + sort, + allowDots, + serializeDate, + format, + formatter, + encodeValuesOnly, + charset, + valueSideChannel, + ), + ); + } + + return values; +} + +function normalize_stringify_options( + opts: StringifyOptions = defaults, +): NonNullableProperties> & { indices?: boolean } { + if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') { + throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided'); + } + + if (typeof opts.encodeDotInKeys !== 'undefined' && typeof opts.encodeDotInKeys !== 'boolean') { + throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided'); + } + + if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') { + throw new TypeError('Encoder has to be a function.'); + } + + const charset = opts.charset || defaults.charset; + if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { + throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); + } + + let format = default_format; + if (typeof opts.format !== 'undefined') { + if (!has(formatters, opts.format)) { + throw new TypeError('Unknown format option provided.'); + } + format = opts.format; + } + const formatter = formatters[format]; + + let filter = defaults.filter; + if (typeof opts.filter === 'function' || isArray(opts.filter)) { + filter = opts.filter; + } + + let arrayFormat: StringifyOptions['arrayFormat']; + if (opts.arrayFormat && opts.arrayFormat in array_prefix_generators) { + arrayFormat = opts.arrayFormat; + } else if ('indices' in opts) { + arrayFormat = opts.indices ? 'indices' : 'repeat'; + } else { + arrayFormat = defaults.arrayFormat; + } + + if ('commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') { + throw new TypeError('`commaRoundTrip` must be a boolean, or absent'); + } + + const allowDots = + typeof opts.allowDots === 'undefined' ? + !!opts.encodeDotInKeys === true ? + true + : defaults.allowDots + : !!opts.allowDots; + + return { + addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix, + // @ts-ignore + allowDots: allowDots, + allowEmptyArrays: + typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays, + arrayFormat: arrayFormat, + charset: charset, + charsetSentinel: + typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, + commaRoundTrip: !!opts.commaRoundTrip, + delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter, + encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode, + encodeDotInKeys: + typeof opts.encodeDotInKeys === 'boolean' ? opts.encodeDotInKeys : defaults.encodeDotInKeys, + encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder, + encodeValuesOnly: + typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly, + filter: filter, + format: format, + formatter: formatter, + serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate, + skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls, + // @ts-ignore + sort: typeof opts.sort === 'function' ? opts.sort : null, + strictNullHandling: + typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling, + }; +} + +export function stringify(object: any, opts: StringifyOptions = {}) { + let obj = object; + const options = normalize_stringify_options(opts); + + let obj_keys: PropertyKey[] | undefined; + let filter; + + if (typeof options.filter === 'function') { + filter = options.filter; + obj = filter('', obj); + } else if (isArray(options.filter)) { + filter = options.filter; + obj_keys = filter; + } + + const keys: string[] = []; + + if (typeof obj !== 'object' || obj === null) { + return ''; + } + + const generateArrayPrefix = array_prefix_generators[options.arrayFormat]; + const commaRoundTrip = generateArrayPrefix === 'comma' && options.commaRoundTrip; + + if (!obj_keys) { + obj_keys = Object.keys(obj); + } + + if (options.sort) { + obj_keys.sort(options.sort); + } + + const sideChannel = new WeakMap(); + for (let i = 0; i < obj_keys.length; ++i) { + const key = obj_keys[i]!; + + if (options.skipNulls && obj[key] === null) { + continue; + } + push_to_array( + keys, + inner_stringify( + obj[key], + key, + // @ts-expect-error + generateArrayPrefix, + commaRoundTrip, + options.allowEmptyArrays, + options.strictNullHandling, + options.skipNulls, + options.encodeDotInKeys, + options.encode ? options.encoder : null, + options.filter, + options.sort, + options.allowDots, + options.serializeDate, + options.format, + options.formatter, + options.encodeValuesOnly, + options.charset, + sideChannel, + ), + ); + } + + const joined = keys.join(options.delimiter); + let prefix = options.addQueryPrefix === true ? '?' : ''; + + if (options.charsetSentinel) { + if (options.charset === 'iso-8859-1') { + // encodeURIComponent('✓'), the "numeric entity" representation of a checkmark + prefix += 'utf8=%26%2310003%3B&'; + } else { + // encodeURIComponent('✓') + prefix += 'utf8=%E2%9C%93&'; + } + } + + return joined.length > 0 ? prefix + joined : ''; +} diff --git a/src/internal/qs/types.ts b/src/internal/qs/types.ts new file mode 100644 index 0000000..7c28dbb --- /dev/null +++ b/src/internal/qs/types.ts @@ -0,0 +1,71 @@ +export type Format = 'RFC1738' | 'RFC3986'; + +export type DefaultEncoder = (str: any, defaultEncoder?: any, charset?: string) => string; +export type DefaultDecoder = (str: string, decoder?: any, charset?: string) => string; + +export type BooleanOptional = boolean | undefined; + +export type StringifyBaseOptions = { + delimiter?: string; + allowDots?: boolean; + encodeDotInKeys?: boolean; + strictNullHandling?: boolean; + skipNulls?: boolean; + encode?: boolean; + encoder?: ( + str: any, + defaultEncoder: DefaultEncoder, + charset: string, + type: 'key' | 'value', + format?: Format, + ) => string; + filter?: Array | ((prefix: PropertyKey, value: any) => any); + arrayFormat?: 'indices' | 'brackets' | 'repeat' | 'comma'; + indices?: boolean; + sort?: ((a: PropertyKey, b: PropertyKey) => number) | null; + serializeDate?: (d: Date) => string; + format?: 'RFC1738' | 'RFC3986'; + formatter?: (str: PropertyKey) => string; + encodeValuesOnly?: boolean; + addQueryPrefix?: boolean; + charset?: 'utf-8' | 'iso-8859-1'; + charsetSentinel?: boolean; + allowEmptyArrays?: boolean; + commaRoundTrip?: boolean; +}; + +export type StringifyOptions = StringifyBaseOptions; + +export type ParseBaseOptions = { + comma?: boolean; + delimiter?: string | RegExp; + depth?: number | false; + decoder?: (str: string, defaultDecoder: DefaultDecoder, charset: string, type: 'key' | 'value') => any; + arrayLimit?: number; + parseArrays?: boolean; + plainObjects?: boolean; + allowPrototypes?: boolean; + allowSparse?: boolean; + parameterLimit?: number; + strictDepth?: boolean; + strictNullHandling?: boolean; + ignoreQueryPrefix?: boolean; + charset?: 'utf-8' | 'iso-8859-1'; + charsetSentinel?: boolean; + interpretNumericEntities?: boolean; + allowEmptyArrays?: boolean; + duplicates?: 'combine' | 'first' | 'last'; + allowDots?: boolean; + decodeDotInKeys?: boolean; +}; + +export type ParseOptions = ParseBaseOptions; + +export type ParsedQs = { + [key: string]: undefined | string | string[] | ParsedQs | ParsedQs[]; +}; + +// Type to remove null or undefined union from each property +export type NonNullableProperties = { + [K in keyof T]-?: Exclude; +}; diff --git a/src/internal/qs/utils.ts b/src/internal/qs/utils.ts new file mode 100644 index 0000000..4cd5657 --- /dev/null +++ b/src/internal/qs/utils.ts @@ -0,0 +1,265 @@ +import { RFC1738 } from './formats'; +import type { DefaultEncoder, Format } from './types'; +import { isArray } from '../utils/values'; + +export let has = (obj: object, key: PropertyKey): boolean => ( + (has = (Object as any).hasOwn ?? Function.prototype.call.bind(Object.prototype.hasOwnProperty)), + has(obj, key) +); + +const hex_table = /* @__PURE__ */ (() => { + const array = []; + for (let i = 0; i < 256; ++i) { + array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); + } + + return array; +})(); + +function compact_queue>(queue: Array<{ obj: T; prop: string }>) { + while (queue.length > 1) { + const item = queue.pop(); + if (!item) continue; + + const obj = item.obj[item.prop]; + + if (isArray(obj)) { + const compacted: unknown[] = []; + + for (let j = 0; j < obj.length; ++j) { + if (typeof obj[j] !== 'undefined') { + compacted.push(obj[j]); + } + } + + // @ts-ignore + item.obj[item.prop] = compacted; + } + } +} + +function array_to_object(source: any[], options: { plainObjects: boolean }) { + const obj = options && options.plainObjects ? Object.create(null) : {}; + for (let i = 0; i < source.length; ++i) { + if (typeof source[i] !== 'undefined') { + obj[i] = source[i]; + } + } + + return obj; +} + +export function merge( + target: any, + source: any, + options: { plainObjects?: boolean; allowPrototypes?: boolean } = {}, +) { + if (!source) { + return target; + } + + if (typeof source !== 'object') { + if (isArray(target)) { + target.push(source); + } else if (target && typeof target === 'object') { + if ((options && (options.plainObjects || options.allowPrototypes)) || !has(Object.prototype, source)) { + target[source] = true; + } + } else { + return [target, source]; + } + + return target; + } + + if (!target || typeof target !== 'object') { + return [target].concat(source); + } + + let mergeTarget = target; + if (isArray(target) && !isArray(source)) { + // @ts-ignore + mergeTarget = array_to_object(target, options); + } + + if (isArray(target) && isArray(source)) { + source.forEach(function (item, i) { + if (has(target, i)) { + const targetItem = target[i]; + if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') { + target[i] = merge(targetItem, item, options); + } else { + target.push(item); + } + } else { + target[i] = item; + } + }); + return target; + } + + return Object.keys(source).reduce(function (acc, key) { + const value = source[key]; + + if (has(acc, key)) { + acc[key] = merge(acc[key], value, options); + } else { + acc[key] = value; + } + return acc; + }, mergeTarget); +} + +export function assign_single_source(target: any, source: any) { + return Object.keys(source).reduce(function (acc, key) { + acc[key] = source[key]; + return acc; + }, target); +} + +export function decode(str: string, _: any, charset: string) { + const strWithoutPlus = str.replace(/\+/g, ' '); + if (charset === 'iso-8859-1') { + // unescape never throws, no try...catch needed: + return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape); + } + // utf-8 + try { + return decodeURIComponent(strWithoutPlus); + } catch (e) { + return strWithoutPlus; + } +} + +const limit = 1024; + +export const encode: ( + str: any, + defaultEncoder: DefaultEncoder, + charset: string, + type: 'key' | 'value', + format: Format, +) => string = (str, _defaultEncoder, charset, _kind, format: Format) => { + // This code was originally written by Brian White for the io.js core querystring library. + // It has been adapted here for stricter adherence to RFC 3986 + if (str.length === 0) { + return str; + } + + let string = str; + if (typeof str === 'symbol') { + string = Symbol.prototype.toString.call(str); + } else if (typeof str !== 'string') { + string = String(str); + } + + if (charset === 'iso-8859-1') { + return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) { + return '%26%23' + parseInt($0.slice(2), 16) + '%3B'; + }); + } + + let out = ''; + for (let j = 0; j < string.length; j += limit) { + const segment = string.length >= limit ? string.slice(j, j + limit) : string; + const arr = []; + + for (let i = 0; i < segment.length; ++i) { + let c = segment.charCodeAt(i); + if ( + c === 0x2d || // - + c === 0x2e || // . + c === 0x5f || // _ + c === 0x7e || // ~ + (c >= 0x30 && c <= 0x39) || // 0-9 + (c >= 0x41 && c <= 0x5a) || // a-z + (c >= 0x61 && c <= 0x7a) || // A-Z + (format === RFC1738 && (c === 0x28 || c === 0x29)) // ( ) + ) { + arr[arr.length] = segment.charAt(i); + continue; + } + + if (c < 0x80) { + arr[arr.length] = hex_table[c]; + continue; + } + + if (c < 0x800) { + arr[arr.length] = hex_table[0xc0 | (c >> 6)]! + hex_table[0x80 | (c & 0x3f)]; + continue; + } + + if (c < 0xd800 || c >= 0xe000) { + arr[arr.length] = + hex_table[0xe0 | (c >> 12)]! + hex_table[0x80 | ((c >> 6) & 0x3f)] + hex_table[0x80 | (c & 0x3f)]; + continue; + } + + i += 1; + c = 0x10000 + (((c & 0x3ff) << 10) | (segment.charCodeAt(i) & 0x3ff)); + + arr[arr.length] = + hex_table[0xf0 | (c >> 18)]! + + hex_table[0x80 | ((c >> 12) & 0x3f)] + + hex_table[0x80 | ((c >> 6) & 0x3f)] + + hex_table[0x80 | (c & 0x3f)]; + } + + out += arr.join(''); + } + + return out; +}; + +export function compact(value: any) { + const queue = [{ obj: { o: value }, prop: 'o' }]; + const refs = []; + + for (let i = 0; i < queue.length; ++i) { + const item = queue[i]; + // @ts-ignore + const obj = item.obj[item.prop]; + + const keys = Object.keys(obj); + for (let j = 0; j < keys.length; ++j) { + const key = keys[j]!; + const val = obj[key]; + if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) { + queue.push({ obj: obj, prop: key }); + refs.push(val); + } + } + } + + compact_queue(queue); + + return value; +} + +export function is_regexp(obj: any) { + return Object.prototype.toString.call(obj) === '[object RegExp]'; +} + +export function is_buffer(obj: any) { + if (!obj || typeof obj !== 'object') { + return false; + } + + return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); +} + +export function combine(a: any, b: any) { + return [].concat(a, b); +} + +export function maybe_map(val: T[], fn: (v: T) => T) { + if (isArray(val)) { + const mapped = []; + for (let i = 0; i < val.length; i += 1) { + mapped.push(fn(val[i]!)); + } + return mapped; + } + return fn(val); +} diff --git a/src/internal/request-options.ts b/src/internal/request-options.ts new file mode 100644 index 0000000..4dc4258 --- /dev/null +++ b/src/internal/request-options.ts @@ -0,0 +1,39 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import type { BodyInit } from './builtin-types'; +import type { HTTPMethod, MergedRequestInit } from './types'; +import type { HeadersLike, NullableHeaders } from './headers'; + +export type RequestOptions = { + method?: HTTPMethod | undefined; + path?: string | undefined; + headers?: HeadersLike | undefined; + query?: object | undefined | null; + body?: unknown; + timeout?: number | undefined; + maxRetries?: number | undefined; + stream?: boolean | undefined; + signal?: AbortSignal | undefined | null; + fetchOptions?: MergedRequestInit | undefined; + idempotencyKey?: string | undefined; + defaultBaseURL?: string | undefined; + __binaryResponse?: boolean | undefined; +}; + +export type FinalRequestOptions = RequestOptions & { + method: HTTPMethod; + path: string; +}; + +export type EncodedContent = { bodyHeaders: HeadersLike; body: BodyInit }; +export type RequestEncoder = (request: { headers: NullableHeaders; body: unknown }) => EncodedContent; + +/** Fallback JSON encoder used when a request body is not already a fetch body type. */ +export const FallbackEncoder: RequestEncoder = ({ body }) => { + return { + bodyHeaders: { + 'content-type': 'application/json', + }, + body: JSON.stringify(body), + }; +}; diff --git a/src/internal/shim-types.ts b/src/internal/shim-types.ts new file mode 100644 index 0000000..6d992a5 --- /dev/null +++ b/src/internal/shim-types.ts @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +/** + * Shims for types that we can't always rely on being available globally. + * + * Note: these only exist at the type-level, there is no corresponding runtime + * version for any of these symbols. + */ + +type NeverToAny = T extends never ? any : T; + +/** @ts-ignore */ +type _DOMReadableStream = globalThis.ReadableStream; + +/** @ts-ignore */ +type _NodeReadableStream = import('stream/web').ReadableStream; + +type _ConditionalNodeReadableStream = + typeof globalThis extends { ReadableStream: any } ? never : _NodeReadableStream; + +type _ReadableStream = NeverToAny< + | ([0] extends [1 & _DOMReadableStream] ? never : _DOMReadableStream) + | ([0] extends [1 & _ConditionalNodeReadableStream] ? never : _ConditionalNodeReadableStream) +>; + +export type { _ReadableStream as ReadableStream }; diff --git a/src/internal/shims.ts b/src/internal/shims.ts new file mode 100644 index 0000000..90addd4 --- /dev/null +++ b/src/internal/shims.ts @@ -0,0 +1,107 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +/** + * This module provides internal shims and utility functions for environments where certain Node.js or global types may not be available. + * + * These are used to ensure we can provide a consistent behaviour between different JavaScript environments and good error + * messages in cases where an environment isn't fully supported. + */ + +import type { Fetch } from './builtin-types'; +import type { ReadableStream } from './shim-types'; + +export function getDefaultFetch(): Fetch { + if (typeof fetch !== 'undefined') { + return fetch as any; + } + + throw new Error( + '`fetch` is not defined as a global; Either pass `fetch` to the client, `new ScalarAPI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`', + ); +} + +type ReadableStreamArgs = ConstructorParameters; + +export function makeReadableStream(...args: ReadableStreamArgs): ReadableStream { + const ReadableStream = (globalThis as any).ReadableStream; + if (typeof ReadableStream === 'undefined') { + // Note: All of the platforms / runtimes we officially support already define + // `ReadableStream` as a global, so this should only ever be hit on unsupported runtimes. + throw new Error( + '`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`', + ); + } + + return new ReadableStream(...args); +} + +export function ReadableStreamFrom(iterable: Iterable | AsyncIterable): ReadableStream { + let iter: AsyncIterator | Iterator = + Symbol.asyncIterator in iterable ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator](); + + return makeReadableStream({ + start() {}, + async pull(controller: any) { + const { done, value } = await iter.next(); + if (done) { + controller.close(); + } else { + controller.enqueue(value); + } + }, + async cancel() { + await iter.return?.(); + }, + }); +} + +/** + * Most browsers don't yet have async iterable support for ReadableStream, + * and Node has a very different way of reading bytes from its "ReadableStream". + * + * This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490 + */ +export function ReadableStreamToAsyncIterable(stream: any): AsyncIterableIterator { + if (stream[Symbol.asyncIterator]) return stream; + + const reader = stream.getReader(); + return { + async next() { + try { + const result = await reader.read(); + if (result?.done) reader.releaseLock(); // release lock when stream becomes closed + return result; + } catch (e) { + reader.releaseLock(); // release lock when stream becomes errored + throw e; + } + }, + async return() { + const cancelPromise = reader.cancel(); + reader.releaseLock(); + await cancelPromise; + return { done: true, value: undefined }; + }, + [Symbol.asyncIterator]() { + return this; + }, + }; +} + +/** + * Cancels a ReadableStream we don't need to consume. + * See https://undici.nodejs.org/#/?id=garbage-collection + */ +export async function CancelReadableStream(stream: any): Promise { + if (stream === null || typeof stream !== 'object') return; + + if (stream[Symbol.asyncIterator]) { + await stream[Symbol.asyncIterator]().return?.(); + return; + } + + const reader = stream.getReader(); + const cancelPromise = reader.cancel(); + reader.releaseLock(); + await cancelPromise; +} diff --git a/src/internal/to-file.ts b/src/internal/to-file.ts new file mode 100644 index 0000000..30eada3 --- /dev/null +++ b/src/internal/to-file.ts @@ -0,0 +1,154 @@ +import { BlobPart, getName, makeFile, isAsyncIterable } from './uploads'; +import type { FilePropertyBag } from './builtin-types'; +import { checkFileSupport } from './uploads'; + +type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | DataView; + +/** + * Intended to match DOM Blob, node-fetch Blob, node:buffer Blob, etc. + * Don't add arrayBuffer here, node-fetch doesn't have it + */ +interface BlobLike { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */ + readonly size: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */ + readonly type: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */ + text(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */ + slice(start?: number, end?: number): BlobLike; +} + +/** + * This check adds the arrayBuffer() method type because it is available and used at runtime + */ +const isBlobLike = (value: any): value is BlobLike & { arrayBuffer(): Promise } => + value != null && + typeof value === 'object' && + typeof value.size === 'number' && + typeof value.type === 'string' && + typeof value.text === 'function' && + typeof value.slice === 'function' && + typeof value.arrayBuffer === 'function'; + +/** + * Intended to match DOM File, node:buffer File, undici File, etc. + */ +interface FileLike extends BlobLike { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */ + readonly lastModified: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */ + readonly name?: string | undefined; +} + +/** + * This check adds the arrayBuffer() method type because it is available and used at runtime + */ +const isFileLike = (value: any): value is FileLike & { arrayBuffer(): Promise } => + value != null && + typeof value === 'object' && + typeof value.name === 'string' && + typeof value.lastModified === 'number' && + isBlobLike(value); + +/** + * Intended to match DOM Response, node-fetch Response, undici Response, etc. + */ +export interface ResponseLike { + url: string; + blob(): Promise; +} + +const isResponseLike = (value: any): value is ResponseLike => + value != null && + typeof value === 'object' && + typeof value.url === 'string' && + typeof value.blob === 'function'; + +export type ToFileInput = + | FileLike + | ResponseLike + | Exclude + | AsyncIterable; + +/** + * Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats + * @param value the raw content of the file. Can be an {@link Uploadable}, BlobLikePart, or AsyncIterable of BlobLikeParts + * @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible + * @param {Object=} options additional properties + * @param {string=} options.type the MIME type of the content + * @param {number=} options.lastModified the last modified timestamp + * @returns a {@link File} with the given properties + */ +export async function toFile( + value: ToFileInput | PromiseLike, + name?: string | null | undefined, + options?: FilePropertyBag | undefined, +): Promise { + checkFileSupport(); + + // If it's a promise, resolve it. + value = await value; + + // If we've been given a `File` we don't need to do anything + if (isFileLike(value)) { + if (value instanceof File) { + return value; + } + return makeFile([await value.arrayBuffer()], value.name); + } + + if (isResponseLike(value)) { + const blob = await value.blob(); + name ||= new URL(value.url).pathname.split(/[\\/]/).pop(); + + return makeFile(await getBytes(blob), name, options); + } + + const parts = await getBytes(value); + + name ||= getName(value); + + if (!options?.type) { + const type = parts.find((part) => typeof part === 'object' && 'type' in part && part.type); + if (typeof type === 'string') { + options = { ...options, type }; + } + } + + return makeFile(parts, name, options); +} + +async function getBytes(value: BlobLikePart | AsyncIterable): Promise> { + let parts: Array = []; + if ( + typeof value === 'string' || + ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc. + value instanceof ArrayBuffer + ) { + parts.push(value); + } else if (isBlobLike(value)) { + parts.push(value instanceof Blob ? value : await value.arrayBuffer()); + } else if ( + isAsyncIterable(value) // includes Readable, ReadableStream, etc. + ) { + for await (const chunk of value) { + parts.push(...(await getBytes(chunk as BlobLikePart))); // TODO, consider validating? + } + } else { + const constructor = value?.constructor?.name; + throw new Error( + `Unexpected data type: ${typeof value}${ + constructor ? `; constructor: ${constructor}` : '' + }${propsForError(value)}`, + ); + } + + return parts; +} + +function propsForError(value: unknown): string { + if (typeof value !== 'object' || value === null) return ''; + const props = Object.getOwnPropertyNames(value); + return `; props: [${props.map((p) => `"${p}"`).join(', ')}]`; +} diff --git a/src/internal/types.ts b/src/internal/types.ts new file mode 100644 index 0000000..93a4f5a --- /dev/null +++ b/src/internal/types.ts @@ -0,0 +1,93 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +export type PromiseOrValue = T | Promise; +export type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete'; + +export type KeysEnum = { [P in keyof Required]: true }; + +export type FinalizedRequestInit = RequestInit & { headers: Headers }; + +type NotAny = [0] extends [1 & T] ? never : T; + +/** + * Some environments overload the global fetch function, and Parameters only gets the last signature. + */ +type OverloadedParameters = + T extends ( + { + (...args: infer A): unknown; + (...args: infer B): unknown; + (...args: infer C): unknown; + (...args: infer D): unknown; + } + ) ? + A | B | C | D + : T extends ( + { + (...args: infer A): unknown; + (...args: infer B): unknown; + (...args: infer C): unknown; + } + ) ? + A | B | C + : T extends ( + { + (...args: infer A): unknown; + (...args: infer B): unknown; + } + ) ? + A | B + : T extends (...args: infer A) => unknown ? A + : never; + +/** + * These imports attempt to get types from a parent package's dependencies. + * Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which + * would cause typescript to show types not present at runtime. To avoid this, we import + * directly from parent node_modules folders. + * + * We need to check multiple levels because we don't know what directory structure we'll be in. + * For example, pnpm generates directories like this: + * ``` + * node_modules + * ├── .pnpm + * │ └── pkg@1.0.0 + * │ └── node_modules + * │ └── pkg + * │ └── internal + * │ └── types.d.ts + * ├── pkg -> .pnpm/pkg@1.0.0/node_modules/pkg + * └── undici + * ``` + * + * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition + */ +/** @ts-ignore For users with \@types/node */ /* prettier-ignore */ +type UndiciTypesRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; +/** @ts-ignore For users with undici */ /* prettier-ignore */ +type UndiciRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; +/** @ts-ignore For users with \@types/bun */ /* prettier-ignore */ +type BunRequestInit = globalThis.FetchRequestInit; +/** @ts-ignore For users with node-fetch@2 */ /* prettier-ignore */ +type NodeFetch2RequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; +/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ /* prettier-ignore */ +type NodeFetch3RequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; +/** @ts-ignore For users who use Deno */ /* prettier-ignore */ +type FetchRequestInit = NonNullable[1]>; + +type RequestInits = + | NotAny + | NotAny + | NotAny + | NotAny + | NotAny + | NotAny + | NotAny; + +/** + * This type contains `RequestInit` options that may be available on the current runtime, + * including per-platform extensions like `dispatcher`, `agent`, `client`, etc. + */ +export type MergedRequestInit = RequestInits & + /** We don't include these in the types as they'll be overridden for every request. */ + Partial>; diff --git a/src/internal/uploads.ts b/src/internal/uploads.ts new file mode 100644 index 0000000..b1ab230 --- /dev/null +++ b/src/internal/uploads.ts @@ -0,0 +1,197 @@ +import { type RequestOptions } from './request-options'; +import type { FilePropertyBag, Fetch } from './builtin-types'; +import type { ScalarAPI } from '../client'; +import { ReadableStreamFrom } from './shims'; + +export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView; +type FsReadStream = AsyncIterable & { path: string | { toString(): string } }; + +// https://github.com/oven-sh/bun/issues/5980 +interface BunFile extends Blob { + readonly name?: string | undefined; +} + +export const checkFileSupport = () => { + if (typeof File === 'undefined') { + const { process } = globalThis as any; + const isOldNode = + typeof process?.versions?.node === 'string' && parseInt(process.versions.node.split('.')) < 20; + throw new Error( + '`File` is not defined as a global, which is required for file uploads.' + + (isOldNode ? + " Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`." + : ''), + ); + } +}; + +/** + * Typically, this is a native "File" class. + * + * We provide the {@link toFile} utility to convert a variety of objects + * into the File class. + * + * For convenience, you can also pass a fetch Response, or in Node, + * the result of fs.createReadStream(). + */ +export type Uploadable = Blob | File | Response | FsReadStream | BunFile; + +/** + * Construct a `File` instance. This is used to ensure a helpful error is thrown + * for environments that don't define a global `File` yet. + */ +export function makeFile( + fileBits: BlobPart[], + fileName: string | undefined, + options?: FilePropertyBag, +): File { + checkFileSupport(); + return new File(fileBits as any, fileName ?? 'unknown_file', options); +} + +export function getName(value: any): string | undefined { + return ( + ( + (typeof value === 'object' && + value !== null && + (('name' in value && value.name && String(value.name)) || + ('url' in value && value.url && String(value.url)) || + ('filename' in value && value.filename && String(value.filename)) || + ('path' in value && value.path && String(value.path)))) || + '' + ) + .split(/[\\/]/) + .pop() || undefined + ); +} + +export const isAsyncIterable = (value: any): value is AsyncIterable => + value != null && typeof value === 'object' && typeof value[Symbol.asyncIterator] === 'function'; + +/** + * Returns a multipart/form-data request if any part of the given request body contains a File / Blob value. + * Otherwise returns the request as is. + */ +export const maybeMultipartFormRequestOptions = async ( + opts: RequestOptions, + fetch: ScalarAPI | Fetch, +): Promise => { + if (!hasUploadableValue(opts.body)) return opts; + + return { ...opts, body: await createForm(opts.body, fetch) }; +}; + +type MultipartFormRequestOptions = Omit & { body: unknown }; + +export const multipartFormRequestOptions = async ( + opts: MultipartFormRequestOptions, + fetch: ScalarAPI | Fetch, +): Promise => { + return { ...opts, body: await createForm(opts.body, fetch) }; +}; + +const supportsFormDataMap = /* @__PURE__ */ new WeakMap>(); + +/** + * node-fetch doesn't support the global FormData object in recent node versions. Instead of sending + * properly-encoded form data, it just stringifies the object, resulting in a request body of "[object FormData]". + * This function detects if the fetch function provided supports the global FormData object to avoid + * confusing error messages later on. + */ +function supportsFormData(fetchObject: ScalarAPI | Fetch): Promise { + const fetch: Fetch = typeof fetchObject === 'function' ? fetchObject : (fetchObject as any).fetch; + const cached = supportsFormDataMap.get(fetch); + if (cached) return cached; + const promise = (async () => { + try { + const FetchResponse = ( + 'Response' in fetch ? + fetch.Response + : (await fetch('data:,')).constructor) as typeof Response; + const data = new FormData(); + if (data.toString() === (await new FetchResponse(data).text())) { + return false; + } + return true; + } catch { + // avoid false negatives + return true; + } + })(); + supportsFormDataMap.set(fetch, promise); + return promise; +} + +export const createForm = async >( + body: T | undefined, + fetch: ScalarAPI | Fetch, +): Promise => { + if (!(await supportsFormData(fetch))) { + throw new TypeError( + 'The provided fetch function does not support file uploads with the current global FormData class.', + ); + } + const form = new FormData(); + if (isUploadable(body)) { + // Multipart schemas can describe the whole request body as a single binary part. + await addFormValue(form, 'body', body); + return form; + } + await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value))); + return form; +}; + +// We check for Blob not File because Bun.File doesn't inherit from File, +// but they both inherit from Blob and have a `name` property at runtime. +const isBlob = (value: unknown): value is Blob => value instanceof Blob; + +const isUploadable = (value: unknown) => + typeof value === 'object' && + value !== null && + (value instanceof Response || isAsyncIterable(value) || isBlob(value)); + +const hasUploadableValue = (value: unknown): boolean => { + if (isUploadable(value)) return true; + if (Array.isArray(value)) return value.some(hasUploadableValue); + if (value && typeof value === 'object') { + for (const k in value) { + if (hasUploadableValue((value as any)[k])) return true; + } + } + return false; +}; + +const addFormValue = async (form: FormData, key: string, value: unknown): Promise => { + if (value === undefined) return; + if (value == null) { + throw new TypeError( + `Received null for "${key}"; to pass null in FormData, you must use the string 'null'`, + ); + } + + // TODO: make nested formats configurable + if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { + form.append(key, String(value)); + } else if (value instanceof Response) { + form.append(key, makeFile([await value.blob()], getName(value))); + } else if (isAsyncIterable(value)) { + form.append(key, makeFile([await new Response(ReadableStreamFrom(value)).blob()], getName(value))); + } else if (isBlob(value)) { + const name = getName(value); + if (name === undefined) { + form.append(key, value); + } else { + form.append(key, value, name); + } + } else if (Array.isArray(value)) { + await Promise.all(value.map((entry) => addFormValue(form, key + '[]', entry))); + } else if (typeof value === 'object') { + await Promise.all( + Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)), + ); + } else { + throw new TypeError( + `Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`, + ); + } +}; diff --git a/src/internal/utils/env.ts b/src/internal/utils/env.ts new file mode 100644 index 0000000..6212168 --- /dev/null +++ b/src/internal/utils/env.ts @@ -0,0 +1,18 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +/** + * Read an environment variable. + * + * Trims beginning and trailing whitespace. + * + * Will return undefined if the environment variable doesn't exist or cannot be accessed. + */ +export const readEnv = (env: string): string | undefined => { + if (typeof (globalThis as any).process !== 'undefined') { + return (globalThis as any).process.env?.[env]?.trim() || undefined; + } + if (typeof (globalThis as any).Deno !== 'undefined') { + return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined; + } + return undefined; +}; diff --git a/src/internal/utils/log.ts b/src/internal/utils/log.ts new file mode 100644 index 0000000..66df389 --- /dev/null +++ b/src/internal/utils/log.ts @@ -0,0 +1,128 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { hasOwn } from './values'; +import { type ScalarAPI } from '../../client'; +import { RequestOptions } from '../request-options'; + +type LogFn = (message: string, ...rest: unknown[]) => void; +export type Logger = { + error: LogFn; + warn: LogFn; + info: LogFn; + debug: LogFn; +}; +export type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug'; + +const levelNumbers = { + off: 0, + error: 200, + warn: 300, + info: 400, + debug: 500, +}; + +export const parseLogLevel = ( + maybeLevel: string | undefined, + sourceName: string, + client: ScalarAPI, +): LogLevel | undefined => { + if (!maybeLevel) { + return undefined; + } + if (hasOwn(levelNumbers, maybeLevel)) { + return maybeLevel; + } + loggerFor(client).warn( + `${sourceName} was set to ${JSON.stringify(maybeLevel)}, expected one of ${JSON.stringify( + Object.keys(levelNumbers), + )}`, + ); + return undefined; +}; + +function noop() {} + +function makeLogFn(fnLevel: keyof Logger, logger: Logger | undefined, logLevel: LogLevel) { + if (!logger || levelNumbers[fnLevel] > levelNumbers[logLevel]) { + return noop; + } else { + // Don't wrap logger functions, we want the stacktrace intact! + return logger[fnLevel].bind(logger); + } +} + +const noopLogger = { + error: noop, + warn: noop, + info: noop, + debug: noop, +}; + +let cachedLoggers = /* @__PURE__ */ new WeakMap(); + +export function loggerFor(client: ScalarAPI): Logger { + const logger = client.logger; + const logLevel = client.logLevel ?? 'off'; + if (!logger) { + return noopLogger; + } + + const cachedLogger = cachedLoggers.get(logger); + if (cachedLogger && cachedLogger[0] === logLevel) { + return cachedLogger[1]; + } + + const levelLogger = { + error: makeLogFn('error', logger, logLevel), + warn: makeLogFn('warn', logger, logLevel), + info: makeLogFn('info', logger, logLevel), + debug: makeLogFn('debug', logger, logLevel), + }; + + cachedLoggers.set(logger, [logLevel, levelLogger]); + + return levelLogger; +} + +export const formatRequestDetails = (details: { + options?: RequestOptions | undefined; + headers?: Headers | Record | undefined; + retryOfRequestLogID?: string | undefined; + retryOf?: string | undefined; + url?: string | undefined; + status?: number | undefined; + method?: string | undefined; + durationMs?: number | undefined; + message?: unknown; + body?: unknown; +}) => { + if (details.options) { + details.options = { ...details.options }; + delete details.options['headers']; // redundant + leaks internals + } + if (details.headers) { + details.headers = Object.fromEntries( + (details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map( + ([name, value]) => [ + name, + ( + name.toLowerCase() === 'authorization' || + name.toLowerCase() === 'api-key' || + name.toLowerCase() === 'x-api-key' || + name.toLowerCase() === 'cookie' || + name.toLowerCase() === 'set-cookie' + ) ? + '***' + : value, + ], + ), + ); + } + if ('retryOfRequestLogID' in details) { + if (details.retryOfRequestLogID) { + details.retryOf = details.retryOfRequestLogID; + } + delete details.retryOfRequestLogID; + } + return details; +}; diff --git a/src/internal/utils/path.ts b/src/internal/utils/path.ts new file mode 100644 index 0000000..4a3103d --- /dev/null +++ b/src/internal/utils/path.ts @@ -0,0 +1,88 @@ +import { ScalarAPIError } from '../../core/error'; + +/** + * Percent-encode everything that isn't safe to have in a path without encoding safe chars. + * + * Taken from https://datatracker.ietf.org/doc/html/rfc3986#section-3.3: + * > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" + * > sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" + * > pchar = unreserved / pct-encoded / sub-delims / ":" / "@" + */ +export function encodeURIPath(str: string) { + return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent); +} + +const EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null)); + +export const createPathTagFunction = (pathEncoder = encodeURIPath) => + function path(statics: readonly string[], ...params: readonly unknown[]): string { + // If there are no params, no processing is needed. + if (statics.length === 1) return statics[0]!; + + let postPath = false; + const invalidSegments = []; + const path = statics.reduce((previousValue, currentValue, index) => { + if (/[?#]/.test(currentValue)) { + postPath = true; + } + const value = params[index]; + let encoded = (postPath ? encodeURIComponent : pathEncoder)('' + value); + if ( + index !== params.length && + (value == null || + (typeof value === 'object' && + // handle values from other realms + value.toString === + Object.getPrototypeOf(Object.getPrototypeOf((value as any).hasOwnProperty ?? EMPTY) ?? EMPTY) + ?.toString)) + ) { + encoded = value + ''; + invalidSegments.push({ + start: previousValue.length + currentValue.length, + length: encoded.length, + error: `Value of type ${Object.prototype.toString + .call(value) + .slice(8, -1)} is not a valid path parameter`, + }); + } + return previousValue + currentValue + (index === params.length ? '' : encoded); + }, ''); + + const pathOnly = path.split(/[?#]/, 1)[0]!; + const invalidSegmentPattern = /(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi; + let match; + + // Find all invalid segments + while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) { + invalidSegments.push({ + start: match.index, + length: match[0].length, + error: `Value "${match[0]}" can\'t be safely passed as a path parameter`, + }); + } + + invalidSegments.sort((a, b) => a.start - b.start); + + if (invalidSegments.length > 0) { + let lastEnd = 0; + const underline = invalidSegments.reduce((acc, segment) => { + const spaces = ' '.repeat(segment.start - lastEnd); + const arrows = '^'.repeat(segment.length); + lastEnd = segment.start + segment.length; + return acc + spaces + arrows; + }, ''); + + throw new ScalarAPIError( + `Path parameters result in path with invalid segments:\n${invalidSegments + .map((e) => e.error) + .join('\n')}\n${path}\n${underline}`, + ); + } + + return path; + }; + +/** + * URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced. + */ +export const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath); diff --git a/src/internal/utils/sleep.ts b/src/internal/utils/sleep.ts new file mode 100644 index 0000000..f8d0a12 --- /dev/null +++ b/src/internal/utils/sleep.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); diff --git a/src/internal/utils/uuid.ts b/src/internal/utils/uuid.ts new file mode 100644 index 0000000..94878fa --- /dev/null +++ b/src/internal/utils/uuid.ts @@ -0,0 +1,17 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +/** + * https://stackoverflow.com/a/2117523 + */ +export let uuid4 = function () { + const { crypto } = globalThis as any; + if (crypto?.randomUUID) { + uuid4 = crypto.randomUUID.bind(crypto); + return crypto.randomUUID(); + } + const u8 = new Uint8Array(1); + const randomByte = crypto ? () => crypto.getRandomValues(u8)[0]! : () => (Math.random() * 0xff) & 0xff; + return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, (c) => + (+c ^ (randomByte() & (15 >> (+c / 4)))).toString(16), + ); +}; diff --git a/src/internal/utils/values.ts b/src/internal/utils/values.ts new file mode 100644 index 0000000..26a5efd --- /dev/null +++ b/src/internal/utils/values.ts @@ -0,0 +1,105 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { ScalarAPIError } from '../../core/error'; + +// https://url.spec.whatwg.org/#url-scheme-string +const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i; + +export const isAbsoluteURL = (url: string): boolean => { + return startsWithSchemeRegexp.test(url); +}; + +export let isArray = (val: unknown): val is unknown[] => ((isArray = Array.isArray), isArray(val)); +export let isReadonlyArray = isArray as (val: unknown) => val is readonly unknown[]; + +/** Returns an object if the given value isn't an object, otherwise returns as-is */ +export function maybeObj(x: unknown): object { + if (typeof x !== 'object') { + return {}; + } + + return x ?? {}; +} + +// https://stackoverflow.com/a/34491287 +export function isEmptyObj(obj: Object | null | undefined): boolean { + if (!obj) return true; + for (const _k in obj) return false; + return true; +} + +// https://eslint.org/docs/latest/rules/no-prototype-builtins +export function hasOwn(obj: T, key: PropertyKey): key is keyof T { + return Object.prototype.hasOwnProperty.call(obj, key); +} + +export function isObj(obj: unknown): obj is Record { + return obj != null && typeof obj === 'object' && !Array.isArray(obj); +} + +export const ensurePresent = (value: T | null | undefined): T => { + if (value == null) { + throw new ScalarAPIError(`Expected a value to be given but received ${value} instead.`); + } + + return value; +}; + +export const validatePositiveInteger = (name: string, n: unknown): number => { + if (typeof n !== 'number' || !Number.isInteger(n)) { + throw new ScalarAPIError(`${name} must be an integer`); + } + if (n < 0) { + throw new ScalarAPIError(`${name} must be a positive integer`); + } + return n; +}; + +export const coerceInteger = (value: unknown): number => { + if (typeof value === 'number') return Math.round(value); + if (typeof value === 'string') return parseInt(value, 10); + + throw new ScalarAPIError(`Could not coerce ${value} (type: ${typeof value}) into a number`); +}; + +export const coerceFloat = (value: unknown): number => { + if (typeof value === 'number') return value; + if (typeof value === 'string') return parseFloat(value); + + throw new ScalarAPIError(`Could not coerce ${value} (type: ${typeof value}) into a number`); +}; + +export const coerceBoolean = (value: unknown): boolean => { + if (typeof value === 'boolean') return value; + if (typeof value === 'string') return value === 'true'; + return Boolean(value); +}; + +export const maybeCoerceInteger = (value: unknown): number | undefined => { + if (value == null) { + return undefined; + } + return coerceInteger(value); +}; + +export const maybeCoerceFloat = (value: unknown): number | undefined => { + if (value == null) { + return undefined; + } + return coerceFloat(value); +}; + +export const maybeCoerceBoolean = (value: unknown): boolean | undefined => { + if (value == null) { + return undefined; + } + return coerceBoolean(value); +}; + +export const safeJSON = (text: string) => { + try { + return JSON.parse(text); + } catch (err) { + return undefined; + } +}; diff --git a/src/lib/base64.ts b/src/lib/base64.ts deleted file mode 100644 index c2d5b38..0000000 --- a/src/lib/base64.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; - -export function bytesToBase64(u8arr: Uint8Array): string { - return btoa(String.fromCodePoint(...u8arr)); -} - -export function bytesFromBase64(encoded: string): Uint8Array { - return Uint8Array.from(atob(encoded), (c) => c.charCodeAt(0)); -} - -export function stringToBytes(str: string): Uint8Array { - return new TextEncoder().encode(str); -} - -export function stringFromBytes(u8arr: Uint8Array): string { - return new TextDecoder().decode(u8arr); -} - -export function stringToBase64(str: string): string { - return bytesToBase64(stringToBytes(str)); -} - -export function stringFromBase64(b64str: string): string { - return stringFromBytes(bytesFromBase64(b64str)); -} - -export const zodOutbound = z - .instanceof(Uint8Array) - .or(z.string().transform(stringToBytes)); - -export const zodInbound = z - .instanceof(Uint8Array) - .or(z.string().transform(bytesFromBase64)); diff --git a/src/lib/config.ts b/src/lib/config.ts deleted file mode 100644 index e499ab1..0000000 --- a/src/lib/config.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { HTTPClient } from "./http.js"; -import { Logger } from "./logger.js"; -import { RetryConfig } from "./retries.js"; -import { Params, pathToFunc } from "./url.js"; - -/** - * Contains the list of servers available to the SDK - */ -export const ServerList = [ - "https://access.scalar.com", -] as const; - -export type SDKOptions = { - bearerAuth?: string | (() => Promise) | undefined; - - httpClient?: HTTPClient; - /** - * Allows overriding the default server used by the SDK - */ - serverIdx?: number | undefined; - /** - * Allows overriding the default server URL used by the SDK - */ - serverURL?: string | undefined; - /** - * Allows overriding the default user agent used by the SDK - */ - userAgent?: string | undefined; - /** - * Allows overriding the default retry config used by the SDK - */ - retryConfig?: RetryConfig; - timeoutMs?: number; - debugLogger?: Logger; -}; - -export function serverURLFromOptions(options: SDKOptions): URL | null { - let serverURL = options.serverURL; - - const params: Params = {}; - - if (!serverURL) { - const serverIdx = options.serverIdx ?? 0; - if (serverIdx < 0 || serverIdx >= ServerList.length) { - throw new Error(`Invalid server index ${serverIdx}`); - } - serverURL = ServerList[serverIdx] || ""; - } - - const u = pathToFunc(serverURL)(params); - return new URL(u); -} - -export const SDK_METADATA = { - language: "typescript", - openapiDocVersion: "0.1.5", - sdkVersion: "0.1.5", - genVersion: "2.634.2", - userAgent: "speakeasy-sdk/typescript 0.1.5 2.634.2 0.1.5 @scalar/sdk", -} as const; diff --git a/src/lib/dlv.ts b/src/lib/dlv.ts deleted file mode 100644 index e81091f..0000000 --- a/src/lib/dlv.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -/* -MIT License - -Copyright (c) 2024 Jason Miller (http://jasonformat.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -/** - * @param obj The object to walk - * @param key The key path to walk the object with - * @param def A default value to return if the result is undefined - * - * @example - * dlv(obj, "a.b.c.d") - * @example - * dlv(object, ["a", "b", "c", "d"]) - * @example - * dlv(object, "foo.bar.baz", "Hello, default value!") - */ -export function dlv( - obj: any, - key: string | string[], - def?: T, - p?: number, - undef?: never, -): T | undefined { - key = Array.isArray(key) ? key : key.split("."); - for (p = 0; p < key.length; p++) { - const k = key[p]; - obj = k != null && obj ? obj[k] : undef; - } - return obj === undef ? def : obj; -} diff --git a/src/lib/encodings.ts b/src/lib/encodings.ts deleted file mode 100644 index 25c9dcb..0000000 --- a/src/lib/encodings.ts +++ /dev/null @@ -1,483 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { bytesToBase64 } from "./base64.js"; -import { isPlainObject } from "./is-plain-object.js"; - -export class EncodingError extends Error { - constructor(message: string) { - super(message); - this.name = "EncodingError"; - } -} - -export function encodeMatrix( - key: string, - value: unknown, - options?: { explode?: boolean; charEncoding?: "percent" | "none" }, -): string | undefined { - let out = ""; - const pairs: [string, unknown][] = options?.explode - ? explode(key, value) - : [[key, value]]; - - if (pairs.every(([_, v]) => v == null)) { - return; - } - - const encodeString = (v: string) => { - return options?.charEncoding === "percent" ? encodeURIComponent(v) : v; - }; - const encodeValue = (v: unknown) => encodeString(serializeValue(v)); - - pairs.forEach(([pk, pv]) => { - let tmp = ""; - let encValue: string | null | undefined = null; - - if (pv == null) { - return; - } else if (Array.isArray(pv)) { - encValue = mapDefined(pv, (v) => `${encodeValue(v)}`)?.join(","); - } else if (isPlainObject(pv)) { - const mapped = mapDefinedEntries(Object.entries(pv), ([k, v]) => { - return `,${encodeString(k)},${encodeValue(v)}`; - }); - encValue = mapped?.join("").slice(1); - } else { - encValue = `${encodeValue(pv)}`; - } - - if (encValue == null) { - return; - } - - const keyPrefix = encodeString(pk); - tmp = `${keyPrefix}=${encValue}`; - // trim trailing '=' if value was empty - if (tmp === `${keyPrefix}=`) { - tmp = tmp.slice(0, -1); - } - - // If we end up with the nothing then skip forward - if (!tmp) { - return; - } - - out += `;${tmp}`; - }); - - return out; -} - -export function encodeLabel( - key: string, - value: unknown, - options?: { explode?: boolean; charEncoding?: "percent" | "none" }, -): string | undefined { - let out = ""; - const pairs: [string, unknown][] = options?.explode - ? explode(key, value) - : [[key, value]]; - - if (pairs.every(([_, v]) => v == null)) { - return; - } - - const encodeString = (v: string) => { - return options?.charEncoding === "percent" ? encodeURIComponent(v) : v; - }; - const encodeValue = (v: unknown) => encodeString(serializeValue(v)); - - pairs.forEach(([pk, pv]) => { - let encValue: string | null | undefined = ""; - - if (pv == null) { - return; - } else if (Array.isArray(pv)) { - encValue = mapDefined(pv, (v) => `${encodeValue(v)}`)?.join("."); - } else if (isPlainObject(pv)) { - const mapped = mapDefinedEntries(Object.entries(pv), ([k, v]) => { - return `.${encodeString(k)}.${encodeValue(v)}`; - }); - encValue = mapped?.join("").slice(1); - } else { - const k = - options?.explode && isPlainObject(value) ? `${encodeString(pk)}=` : ""; - encValue = `${k}${encodeValue(pv)}`; - } - - out += encValue == null ? "" : `.${encValue}`; - }); - - return out; -} - -type FormEncoder = ( - key: string, - value: unknown, - options?: { explode?: boolean; charEncoding?: "percent" | "none" }, -) => string | undefined; - -function formEncoder(sep: string): FormEncoder { - return ( - key: string, - value: unknown, - options?: { explode?: boolean; charEncoding?: "percent" | "none" }, - ) => { - let out = ""; - const pairs: [string, unknown][] = options?.explode - ? explode(key, value) - : [[key, value]]; - - if (pairs.every(([_, v]) => v == null)) { - return; - } - - const encodeString = (v: string) => { - return options?.charEncoding === "percent" ? encodeURIComponent(v) : v; - }; - - const encodeValue = (v: unknown) => encodeString(serializeValue(v)); - - const encodedSep = encodeString(sep); - - pairs.forEach(([pk, pv]) => { - let tmp = ""; - let encValue: string | null | undefined = null; - - if (pv == null) { - return; - } else if (Array.isArray(pv)) { - encValue = mapDefined(pv, (v) => `${encodeValue(v)}`)?.join(encodedSep); - } else if (isPlainObject(pv)) { - encValue = mapDefinedEntries(Object.entries(pv), ([k, v]) => { - return `${encodeString(k)}${encodedSep}${encodeValue(v)}`; - })?.join(encodedSep); - } else { - encValue = `${encodeValue(pv)}`; - } - - if (encValue == null) { - return; - } - - tmp = `${encodeString(pk)}=${encValue}`; - - // If we end up with the nothing then skip forward - if (!tmp || tmp === "=") { - return; - } - - out += `&${tmp}`; - }); - - return out.slice(1); - }; -} - -export const encodeForm = formEncoder(","); -export const encodeSpaceDelimited = formEncoder(" "); -export const encodePipeDelimited = formEncoder("|"); - -export function encodeBodyForm( - key: string, - value: unknown, - options?: { explode?: boolean; charEncoding?: "percent" | "none" }, -): string { - let out = ""; - const pairs: [string, unknown][] = options?.explode - ? explode(key, value) - : [[key, value]]; - - const encodeString = (v: string) => { - return options?.charEncoding === "percent" ? encodeURIComponent(v) : v; - }; - - const encodeValue = (v: unknown) => encodeString(serializeValue(v)); - - pairs.forEach(([pk, pv]) => { - let tmp = ""; - let encValue = ""; - - if (pv == null) { - return; - } else if (Array.isArray(pv)) { - encValue = JSON.stringify(pv, jsonReplacer); - } else if (isPlainObject(pv)) { - encValue = JSON.stringify(pv, jsonReplacer); - } else { - encValue = `${encodeValue(pv)}`; - } - - tmp = `${encodeString(pk)}=${encValue}`; - - // If we end up with the nothing then skip forward - if (!tmp || tmp === "=") { - return; - } - - out += `&${tmp}`; - }); - - return out.slice(1); -} - -export function encodeDeepObject( - key: string, - value: unknown, - options?: { charEncoding?: "percent" | "none" }, -): string | undefined { - if (value == null) { - return; - } - - if (!isPlainObject(value)) { - throw new EncodingError( - `Value of parameter '${key}' which uses deepObject encoding must be an object or null`, - ); - } - - return encodeDeepObjectObject(key, value, options); -} - -export function encodeDeepObjectObject( - key: string, - value: unknown, - options?: { charEncoding?: "percent" | "none" }, -): string | undefined { - if (value == null) { - return; - } - - let out = ""; - - const encodeString = (v: string) => { - return options?.charEncoding === "percent" ? encodeURIComponent(v) : v; - }; - - if (!isPlainObject(value)) { - throw new EncodingError(`Expected parameter '${key}' to be an object.`); - } - - Object.entries(value).forEach(([ck, cv]) => { - if (cv == null) { - return; - } - - const pk = `${key}[${ck}]`; - - if (isPlainObject(cv)) { - const objOut = encodeDeepObjectObject(pk, cv, options); - - out += objOut == null ? "" : `&${objOut}`; - - return; - } - - const pairs: unknown[] = Array.isArray(cv) ? cv : [cv]; - const encoded = mapDefined(pairs, (v) => { - return `${encodeString(pk)}=${encodeString(serializeValue(v))}`; - })?.join("&"); - - out += encoded == null ? "" : `&${encoded}`; - }); - - return out.slice(1); -} - -export function encodeJSON( - key: string, - value: unknown, - options?: { explode?: boolean; charEncoding?: "percent" | "none" }, -): string | undefined { - if (typeof value === "undefined") { - return; - } - - const encodeString = (v: string) => { - return options?.charEncoding === "percent" ? encodeURIComponent(v) : v; - }; - - const encVal = encodeString(JSON.stringify(value, jsonReplacer)); - - return options?.explode ? encVal : `${encodeString(key)}=${encVal}`; -} - -export const encodeSimple = ( - key: string, - value: unknown, - options?: { explode?: boolean; charEncoding?: "percent" | "none" }, -): string | undefined => { - let out = ""; - const pairs: [string, unknown][] = options?.explode - ? explode(key, value) - : [[key, value]]; - - if (pairs.every(([_, v]) => v == null)) { - return; - } - - const encodeString = (v: string) => { - return options?.charEncoding === "percent" ? encodeURIComponent(v) : v; - }; - const encodeValue = (v: unknown) => encodeString(serializeValue(v)); - - pairs.forEach(([pk, pv]) => { - let tmp: string | null | undefined = ""; - - if (pv == null) { - return; - } else if (Array.isArray(pv)) { - tmp = mapDefined(pv, (v) => `${encodeValue(v)}`)?.join(","); - } else if (isPlainObject(pv)) { - const mapped = mapDefinedEntries(Object.entries(pv), ([k, v]) => { - return `,${encodeString(k)},${encodeValue(v)}`; - }); - tmp = mapped?.join("").slice(1); - } else { - const k = options?.explode && isPlainObject(value) ? `${pk}=` : ""; - tmp = `${k}${encodeValue(pv)}`; - } - - out += tmp ? `,${tmp}` : ""; - }); - - return out.slice(1); -}; - -function explode(key: string, value: unknown): [string, unknown][] { - if (Array.isArray(value)) { - return value.map((v) => [key, v]); - } else if (isPlainObject(value)) { - const o = value ?? {}; - return Object.entries(o).map(([k, v]) => [k, v]); - } else { - return [[key, value]]; - } -} - -function serializeValue(value: unknown): string { - if (value == null) { - return ""; - } else if (value instanceof Date) { - return value.toISOString(); - } else if (value instanceof Uint8Array) { - return bytesToBase64(value); - } else if (typeof value === "object") { - return JSON.stringify(value, jsonReplacer); - } - - return `${value}`; -} - -function jsonReplacer(_: string, value: unknown): unknown { - if (value instanceof Uint8Array) { - return bytesToBase64(value); - } else { - return value; - } -} - -function mapDefined(inp: T[], mapper: (v: T) => R): R[] | null { - const res = inp.reduce((acc, v) => { - if (v == null) { - return acc; - } - - const m = mapper(v); - if (m == null) { - return acc; - } - - acc.push(m); - - return acc; - }, []); - - return res.length ? res : null; -} - -function mapDefinedEntries( - inp: Iterable<[K, V]>, - mapper: (v: [K, V]) => R, -): R[] | null { - const acc: R[] = []; - for (const [k, v] of inp) { - if (v == null) { - continue; - } - - const m = mapper([k, v]); - if (m == null) { - continue; - } - - acc.push(m); - } - - return acc.length ? acc : null; -} - -export function queryJoin(...args: (string | undefined)[]): string { - return args.filter(Boolean).join("&"); -} - -type QueryEncoderOptions = { - explode?: boolean; - charEncoding?: "percent" | "none"; -}; - -type QueryEncoder = ( - key: string, - value: unknown, - options?: QueryEncoderOptions, -) => string | undefined; - -type BulkQueryEncoder = ( - values: Record, - options?: QueryEncoderOptions, -) => string; - -export function queryEncoder(f: QueryEncoder): BulkQueryEncoder { - const bulkEncode = function ( - values: Record, - options?: QueryEncoderOptions, - ): string { - const opts: QueryEncoderOptions = { - ...options, - explode: options?.explode ?? true, - charEncoding: options?.charEncoding ?? "percent", - }; - - const encoded = Object.entries(values).map(([key, value]) => { - return f(key, value, opts); - }); - return queryJoin(...encoded); - }; - - return bulkEncode; -} - -export const encodeJSONQuery = queryEncoder(encodeJSON); -export const encodeFormQuery = queryEncoder(encodeForm); -export const encodeSpaceDelimitedQuery = queryEncoder(encodeSpaceDelimited); -export const encodePipeDelimitedQuery = queryEncoder(encodePipeDelimited); -export const encodeDeepObjectQuery = queryEncoder(encodeDeepObject); - -export function appendForm( - fd: FormData, - key: string, - value: unknown, - fileName?: string, -): void { - if (value == null) { - return; - } else if (value instanceof Blob && fileName) { - fd.append(key, value, fileName); - } else if (value instanceof Blob) { - fd.append(key, value); - } else { - fd.append(key, String(value)); - } -} diff --git a/src/lib/files.ts b/src/lib/files.ts deleted file mode 100644 index 0344cd0..0000000 --- a/src/lib/files.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -/** - * Consumes a stream and returns a concatenated array buffer. Useful in - * situations where we need to read the whole file because it forms part of a - * larger payload containing other fields, and we can't modify the underlying - * request structure. - */ -export async function readableStreamToArrayBuffer( - readable: ReadableStream, -): Promise { - const reader = readable.getReader(); - const chunks: Uint8Array[] = []; - - let totalLength = 0; - let done = false; - - while (!done) { - const { value, done: doneReading } = await reader.read(); - - if (doneReading) { - done = true; - } else { - chunks.push(value); - totalLength += value.length; - } - } - - const concatenatedChunks = new Uint8Array(totalLength); - let offset = 0; - - for (const chunk of chunks) { - concatenatedChunks.set(chunk, offset); - offset += chunk.length; - } - - return concatenatedChunks.buffer as ArrayBuffer; -} - -/** - * Determines the MIME content type based on a file's extension. - * Returns null if the extension is not recognized. - */ -export function getContentTypeFromFileName(fileName: string): string | null { - if (!fileName) return null; - - const ext = fileName.toLowerCase().split(".").pop(); - if (!ext) return null; - - const mimeTypes: Record = { - json: "application/json", - xml: "application/xml", - html: "text/html", - htm: "text/html", - txt: "text/plain", - csv: "text/csv", - pdf: "application/pdf", - png: "image/png", - jpg: "image/jpeg", - jpeg: "image/jpeg", - gif: "image/gif", - svg: "image/svg+xml", - js: "application/javascript", - css: "text/css", - zip: "application/zip", - tar: "application/x-tar", - gz: "application/gzip", - mp4: "video/mp4", - mp3: "audio/mpeg", - wav: "audio/wav", - webp: "image/webp", - ico: "image/x-icon", - woff: "font/woff", - woff2: "font/woff2", - ttf: "font/ttf", - otf: "font/otf", - }; - - return mimeTypes[ext] || null; -} diff --git a/src/lib/http.ts b/src/lib/http.ts deleted file mode 100644 index 13cf1fd..0000000 --- a/src/lib/http.ts +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -export type Fetcher = ( - input: RequestInfo | URL, - init?: RequestInit, -) => Promise; - -export type Awaitable = T | Promise; - -const DEFAULT_FETCHER: Fetcher = (input, init) => { - // If input is a Request and init is undefined, Bun will discard the method, - // headers, body and other options that were set on the request object. - // Node.js and browers would ignore an undefined init value. This check is - // therefore needed for interop with Bun. - if (init == null) { - return fetch(input); - } else { - return fetch(input, init); - } -}; - -export type RequestInput = { - /** - * The URL the request will use. - */ - url: URL; - /** - * Options used to create a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request). - */ - options?: RequestInit | undefined; -}; - -export interface HTTPClientOptions { - fetcher?: Fetcher; -} - -export type BeforeRequestHook = (req: Request) => Awaitable; -export type RequestErrorHook = (err: unknown, req: Request) => Awaitable; -export type ResponseHook = (res: Response, req: Request) => Awaitable; - -export class HTTPClient { - private fetcher: Fetcher; - private requestHooks: BeforeRequestHook[] = []; - private requestErrorHooks: RequestErrorHook[] = []; - private responseHooks: ResponseHook[] = []; - - constructor(private options: HTTPClientOptions = {}) { - this.fetcher = options.fetcher || DEFAULT_FETCHER; - } - - async request(request: Request): Promise { - let req = request; - for (const hook of this.requestHooks) { - const nextRequest = await hook(req); - if (nextRequest) { - req = nextRequest; - } - } - - try { - const res = await this.fetcher(req); - - for (const hook of this.responseHooks) { - await hook(res, req); - } - - return res; - } catch (err) { - for (const hook of this.requestErrorHooks) { - await hook(err, req); - } - - throw err; - } - } - - /** - * Registers a hook that is called before a request is made. The hook function - * can mutate the request or return a new request. This may be useful to add - * additional information to request such as request IDs and tracing headers. - */ - addHook(hook: "beforeRequest", fn: BeforeRequestHook): this; - /** - * Registers a hook that is called when a request cannot be made due to a - * network error. - */ - addHook(hook: "requestError", fn: RequestErrorHook): this; - /** - * Registers a hook that is called when a response has been received from the - * server. - */ - addHook(hook: "response", fn: ResponseHook): this; - addHook( - ...args: - | [hook: "beforeRequest", fn: BeforeRequestHook] - | [hook: "requestError", fn: RequestErrorHook] - | [hook: "response", fn: ResponseHook] - ) { - if (args[0] === "beforeRequest") { - this.requestHooks.push(args[1]); - } else if (args[0] === "requestError") { - this.requestErrorHooks.push(args[1]); - } else if (args[0] === "response") { - this.responseHooks.push(args[1]); - } else { - throw new Error(`Invalid hook type: ${args[0]}`); - } - return this; - } - - /** Removes a hook that was previously registered with `addHook`. */ - removeHook(hook: "beforeRequest", fn: BeforeRequestHook): this; - /** Removes a hook that was previously registered with `addHook`. */ - removeHook(hook: "requestError", fn: RequestErrorHook): this; - /** Removes a hook that was previously registered with `addHook`. */ - removeHook(hook: "response", fn: ResponseHook): this; - removeHook( - ...args: - | [hook: "beforeRequest", fn: BeforeRequestHook] - | [hook: "requestError", fn: RequestErrorHook] - | [hook: "response", fn: ResponseHook] - ): this { - let target: unknown[]; - if (args[0] === "beforeRequest") { - target = this.requestHooks; - } else if (args[0] === "requestError") { - target = this.requestErrorHooks; - } else if (args[0] === "response") { - target = this.responseHooks; - } else { - throw new Error(`Invalid hook type: ${args[0]}`); - } - - const index = target.findIndex((v) => v === args[1]); - if (index >= 0) { - target.splice(index, 1); - } - - return this; - } - - clone(): HTTPClient { - const child = new HTTPClient(this.options); - child.requestHooks = this.requestHooks.slice(); - child.requestErrorHooks = this.requestErrorHooks.slice(); - child.responseHooks = this.responseHooks.slice(); - - return child; - } -} - -export type StatusCodePredicate = number | string | (number | string)[]; - -// A semicolon surrounded by optional whitespace characters is used to separate -// segments in a media type string. -const mediaParamSeparator = /\s*;\s*/g; - -export function matchContentType(response: Response, pattern: string): boolean { - // `*` is a special case which means anything is acceptable. - if (pattern === "*") { - return true; - } - - let contentType = - response.headers.get("content-type")?.trim() || "application/octet-stream"; - contentType = contentType.toLowerCase(); - - const wantParts = pattern.toLowerCase().trim().split(mediaParamSeparator); - const [wantType = "", ...wantParams] = wantParts; - - if (wantType.split("/").length !== 2) { - return false; - } - - const gotParts = contentType.split(mediaParamSeparator); - const [gotType = "", ...gotParams] = gotParts; - - const [type = "", subtype = ""] = gotType.split("/"); - if (!type || !subtype) { - return false; - } - - if ( - wantType !== "*/*" && - gotType !== wantType && - `${type}/*` !== wantType && - `*/${subtype}` !== wantType - ) { - return false; - } - - if (gotParams.length < wantParams.length) { - return false; - } - - const params = new Set(gotParams); - for (const wantParam of wantParams) { - if (!params.has(wantParam)) { - return false; - } - } - - return true; -} - -const codeRangeRE = new RegExp("^[0-9]xx$", "i"); - -export function matchStatusCode( - response: Response, - codes: StatusCodePredicate, -): boolean { - const actual = `${response.status}`; - const expectedCodes = Array.isArray(codes) ? codes : [codes]; - if (!expectedCodes.length) { - return false; - } - - return expectedCodes.some((ec) => { - const code = `${ec}`; - - if (code === "default") { - return true; - } - - if (!codeRangeRE.test(`${code}`)) { - return code === actual; - } - - const expectFamily = code.charAt(0); - if (!expectFamily) { - throw new Error("Invalid status code range"); - } - - const actualFamily = actual.charAt(0); - if (!actualFamily) { - throw new Error(`Invalid response status code: ${actual}`); - } - - return actualFamily === expectFamily; - }); -} - -export function matchResponse( - response: Response, - code: StatusCodePredicate, - contentTypePattern: string, -): boolean { - return ( - matchStatusCode(response, code) && - matchContentType(response, contentTypePattern) - ); -} - -/** - * Uses various heurisitics to determine if an error is a connection error. - */ -export function isConnectionError(err: unknown): boolean { - if (typeof err !== "object" || err == null) { - return false; - } - - // Covers fetch in Deno as well - const isBrowserErr = - err instanceof TypeError && - err.message.toLowerCase().startsWith("failed to fetch"); - - const isNodeErr = - err instanceof TypeError && - err.message.toLowerCase().startsWith("fetch failed"); - - const isBunErr = "name" in err && err.name === "ConnectionError"; - - const isGenericErr = - "code" in err && - typeof err.code === "string" && - err.code.toLowerCase() === "econnreset"; - - return isBrowserErr || isNodeErr || isGenericErr || isBunErr; -} - -/** - * Uses various heurisitics to determine if an error is a timeout error. - */ -export function isTimeoutError(err: unknown): boolean { - if (typeof err !== "object" || err == null) { - return false; - } - - // Fetch in browser, Node.js, Bun, Deno - const isNative = "name" in err && err.name === "TimeoutError"; - const isLegacyNative = "code" in err && err.code === 23; - - // Node.js HTTP client and Axios - const isGenericErr = - "code" in err && - typeof err.code === "string" && - err.code.toLowerCase() === "econnaborted"; - - return isNative || isLegacyNative || isGenericErr; -} - -/** - * Uses various heurisitics to determine if an error is a abort error. - */ -export function isAbortError(err: unknown): boolean { - if (typeof err !== "object" || err == null) { - return false; - } - - // Fetch in browser, Node.js, Bun, Deno - const isNative = "name" in err && err.name === "AbortError"; - const isLegacyNative = "code" in err && err.code === 20; - - // Node.js HTTP client and Axios - const isGenericErr = - "code" in err && - typeof err.code === "string" && - err.code.toLowerCase() === "econnaborted"; - - return isNative || isLegacyNative || isGenericErr; -} diff --git a/src/lib/is-plain-object.ts b/src/lib/is-plain-object.ts deleted file mode 100644 index 61070d3..0000000 --- a/src/lib/is-plain-object.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -/* -MIT License - -Copyright (c) Sindre Sorhus (https://sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -// Taken from https://github.com/sindresorhus/is-plain-obj/blob/97f38e8836f86a642cce98fc6ab3058bc36df181/index.js - -export function isPlainObject(value: unknown): value is object { - if (typeof value !== "object" || value === null) { - return false; - } - - const prototype = Object.getPrototypeOf(value); - return ( - (prototype === null || - prototype === Object.prototype || - Object.getPrototypeOf(prototype) === null) && - !(Symbol.toStringTag in value) && - !(Symbol.iterator in value) - ); -} diff --git a/src/lib/logger.ts b/src/lib/logger.ts deleted file mode 100644 index d181f29..0000000 --- a/src/lib/logger.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -export interface Logger { - group(label?: string): void; - groupEnd(): void; - log(message: any, ...args: any[]): void; -} diff --git a/src/lib/matchers.ts b/src/lib/matchers.ts deleted file mode 100644 index f7392e5..0000000 --- a/src/lib/matchers.ts +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { APIError } from "../models/errors/apierror.js"; -import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; -import { ERR, OK, Result } from "../types/fp.js"; -import { matchResponse, matchStatusCode, StatusCodePredicate } from "./http.js"; -import { isPlainObject } from "./is-plain-object.js"; - -export type Encoding = - | "jsonl" - | "json" - | "text" - | "bytes" - | "stream" - | "sse" - | "nil" - | "fail"; - -const DEFAULT_CONTENT_TYPES: Record = { - jsonl: "application/jsonl", - json: "application/json", - text: "text/plain", - bytes: "application/octet-stream", - stream: "application/octet-stream", - sse: "text/event-stream", - nil: "*", - fail: "*", -}; - -type Schema = { parse(raw: unknown): T }; - -type MatchOptions = { - ctype?: string; - hdrs?: boolean; - key?: string; - sseSentinel?: string; -}; - -export type ValueMatcher = MatchOptions & { - enc: Encoding; - codes: StatusCodePredicate; - schema: Schema; -}; - -export type ErrorMatcher = MatchOptions & { - enc: Encoding; - codes: StatusCodePredicate; - schema: Schema; - err: true; -}; - -export type FailMatcher = { - enc: "fail"; - codes: StatusCodePredicate; -}; - -export type Matcher = ValueMatcher | ErrorMatcher | FailMatcher; - -export function jsonErr( - codes: StatusCodePredicate, - schema: Schema, - options?: MatchOptions, -): ErrorMatcher { - return { ...options, err: true, enc: "json", codes, schema }; -} -export function json( - codes: StatusCodePredicate, - schema: Schema, - options?: MatchOptions, -): ValueMatcher { - return { ...options, enc: "json", codes, schema }; -} - -export function jsonl( - codes: StatusCodePredicate, - schema: Schema, - options?: MatchOptions, -): ValueMatcher { - return { ...options, enc: "jsonl", codes, schema }; -} - -export function jsonlErr( - codes: StatusCodePredicate, - schema: Schema, - options?: MatchOptions, -): ErrorMatcher { - return { ...options, err: true, enc: "jsonl", codes, schema }; -} -export function textErr( - codes: StatusCodePredicate, - schema: Schema, - options?: MatchOptions, -): ErrorMatcher { - return { ...options, err: true, enc: "text", codes, schema }; -} -export function text( - codes: StatusCodePredicate, - schema: Schema, - options?: MatchOptions, -): ValueMatcher { - return { ...options, enc: "text", codes, schema }; -} - -export function bytesErr( - codes: StatusCodePredicate, - schema: Schema, - options?: MatchOptions, -): ErrorMatcher { - return { ...options, err: true, enc: "bytes", codes, schema }; -} -export function bytes( - codes: StatusCodePredicate, - schema: Schema, - options?: MatchOptions, -): ValueMatcher { - return { ...options, enc: "bytes", codes, schema }; -} - -export function streamErr( - codes: StatusCodePredicate, - schema: Schema, - options?: MatchOptions, -): ErrorMatcher { - return { ...options, err: true, enc: "stream", codes, schema }; -} -export function stream( - codes: StatusCodePredicate, - schema: Schema, - options?: MatchOptions, -): ValueMatcher { - return { ...options, enc: "stream", codes, schema }; -} - -export function sseErr( - codes: StatusCodePredicate, - schema: Schema, - options?: MatchOptions, -): ErrorMatcher { - return { ...options, err: true, enc: "sse", codes, schema }; -} -export function sse( - codes: StatusCodePredicate, - schema: Schema, - options?: MatchOptions, -): ValueMatcher { - return { ...options, enc: "sse", codes, schema }; -} - -export function nilErr( - codes: StatusCodePredicate, - schema: Schema, - options?: MatchOptions, -): ErrorMatcher { - return { ...options, err: true, enc: "nil", codes, schema }; -} -export function nil( - codes: StatusCodePredicate, - schema: Schema, - options?: MatchOptions, -): ValueMatcher { - return { ...options, enc: "nil", codes, schema }; -} - -export function fail(codes: StatusCodePredicate): FailMatcher { - return { enc: "fail", codes }; -} - -export type MatchedValue = Matchers extends Matcher[] - ? T - : never; -export type MatchedError = Matchers extends Matcher[] - ? E - : never; -export type MatchFunc = ( - response: Response, - request: Request, - options?: { resultKey?: string; extraFields?: Record }, -) => Promise<[result: Result, raw: unknown]>; - -export function match( - ...matchers: Array> -): MatchFunc { - return async function matchFunc( - response: Response, - request: Request, - options?: { resultKey?: string; extraFields?: Record }, - ): Promise< - [result: Result, raw: unknown] - > { - let raw: unknown; - let matcher: Matcher | undefined; - for (const match of matchers) { - const { codes } = match; - const ctpattern = "ctype" in match - ? match.ctype - : DEFAULT_CONTENT_TYPES[match.enc]; - if (ctpattern && matchResponse(response, codes, ctpattern)) { - matcher = match; - break; - } else if (!ctpattern && matchStatusCode(response, codes)) { - matcher = match; - break; - } - } - - if (!matcher) { - return [{ - ok: false, - error: new APIError("Unexpected Status or Content-Type", { - response, - request, - body: await response.text().catch(() => ""), - }), - }, raw]; - } - - const encoding = matcher.enc; - let body = ""; - switch (encoding) { - case "json": - body = await response.text(); - raw = JSON.parse(body); - break; - case "jsonl": - raw = response.body; - break; - case "bytes": - raw = new Uint8Array(await response.arrayBuffer()); - break; - case "stream": - raw = response.body; - break; - case "text": - body = await response.text(); - raw = body; - break; - case "sse": - raw = response.body; - break; - case "nil": - body = await response.text(); - raw = undefined; - break; - case "fail": - body = await response.text(); - raw = undefined; - break; - default: - encoding satisfies never; - throw new Error(`Unsupported response type: ${encoding}`); - } - - if (matcher.enc === "fail") { - return [{ - ok: false, - error: new APIError("API error occurred", { request, response, body }), - }, raw]; - } - - const resultKey = matcher.key || options?.resultKey; - let data: unknown; - - if ("err" in matcher) { - data = { - ...options?.extraFields, - ...(matcher.hdrs ? { Headers: unpackHeaders(response.headers) } : null), - ...(isPlainObject(raw) ? raw : null), - request$: request, - response$: response, - body$: body, - }; - } else if (resultKey) { - data = { - ...options?.extraFields, - ...(matcher.hdrs ? { Headers: unpackHeaders(response.headers) } : null), - [resultKey]: raw, - }; - } else { - data = { - ...options?.extraFields, - ...(matcher.hdrs ? { Headers: unpackHeaders(response.headers) } : null), - }; - } - - if ("err" in matcher) { - const result = safeParseResponse( - data, - (v: unknown) => matcher.schema.parse(v), - "Response validation failed", - { request, response, body }, - ); - return [result.ok ? { ok: false, error: result.value } : result, raw]; - } else { - return [ - safeParseResponse( - data, - (v: unknown) => matcher.schema.parse(v), - "Response validation failed", - { request, response, body }, - ), - raw, - ]; - } - }; -} - -const headerValRE = /, */; -/** - * Iterates over a Headers object and returns an object with all the header - * entries. Values are represented as an array to account for repeated headers. - */ -export function unpackHeaders(headers: Headers): Record { - const out: Record = {}; - - for (const [k, v] of headers.entries()) { - out[k] = v.split(headerValRE); - } - - return out; -} - -function safeParseResponse( - rawValue: Inp, - fn: (value: Inp) => Out, - errorMessage: string, - httpMeta: { response: Response; request: Request; body: string }, -): Result { - try { - return OK(fn(rawValue)); - } catch (err) { - return ERR( - new ResponseValidationError(errorMessage, { - cause: err, - rawValue, - rawMessage: errorMessage, - ...httpMeta, - }), - ); - } -} diff --git a/src/lib/primitives.ts b/src/lib/primitives.ts deleted file mode 100644 index d21f1dc..0000000 --- a/src/lib/primitives.ts +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -class InvariantError extends Error { - constructor(message: string) { - super(message); - this.name = "InvariantError"; - } -} - -export function invariant( - condition: unknown, - message: string, -): asserts condition { - if (!condition) { - throw new InvariantError(message); - } -} - -export type ExactPartial = { - [P in keyof T]?: T[P] | undefined; -}; - -export type Remap = { - [k in keyof Inp as Mapping[k] extends string /* if we have a string mapping for this key then use it */ - ? Mapping[k] - : Mapping[k] extends null /* if the mapping is to `null` then drop the key */ - ? never - : k /* otherwise keep the key as-is */]: Inp[k]; -}; - -/** - * Converts or omits an object's keys according to a mapping. - * - * @param inp An object whose keys will be remapped - * @param mappings A mapping of original keys to new keys. If a key is not present in the mapping, it will be left as is. If a key is mapped to `null`, it will be removed in the resulting object. - * @returns A new object with keys remapped or omitted according to the mappings - */ -export function remap< - Inp extends Record, - const Mapping extends { [k in keyof Inp]?: string | null }, ->(inp: Inp, mappings: Mapping): Remap { - let out: any = {}; - - if (!Object.keys(mappings).length) { - out = inp; - return out; - } - - for (const [k, v] of Object.entries(inp)) { - const j = mappings[k]; - if (j === null) { - continue; - } - out[j ?? k] = v; - } - - return out; -} - -export function combineSignals( - ...signals: Array -): AbortSignal | null { - const filtered: AbortSignal[] = []; - for (const signal of signals) { - if (signal) { - filtered.push(signal); - } - } - - switch (filtered.length) { - case 0: - case 1: - return filtered[0] || null; - default: - if ("any" in AbortSignal && typeof AbortSignal.any === "function") { - return AbortSignal.any(filtered); - } - return abortSignalAny(filtered); - } -} - -export function abortSignalAny(signals: AbortSignal[]): AbortSignal { - const controller = new AbortController(); - const result = controller.signal; - if (!signals.length) { - return controller.signal; - } - - if (signals.length === 1) { - return signals[0] || controller.signal; - } - - for (const signal of signals) { - if (signal.aborted) { - return signal; - } - } - - function abort(this: AbortSignal) { - controller.abort(this.reason); - clean(); - } - - const signalRefs: WeakRef[] = []; - function clean() { - for (const signalRef of signalRefs) { - const signal = signalRef.deref(); - if (signal) { - signal.removeEventListener("abort", abort); - } - } - } - - for (const signal of signals) { - signalRefs.push(new WeakRef(signal)); - signal.addEventListener("abort", abort); - } - - return result; -} - -export function compactMap( - values: Record, -): Record { - const out: Record = {}; - - for (const [k, v] of Object.entries(values)) { - if (typeof v !== "undefined") { - out[k] = v; - } - } - - return out; -} - -export function allRequired>( - v: V, -): - | { - [K in keyof V]: NonNullable; - } - | undefined { - if (Object.values(v).every((x) => x == null)) { - return void 0; - } - - return v as ReturnType>; -} diff --git a/src/lib/retries.ts b/src/lib/retries.ts deleted file mode 100644 index e3ce9ab..0000000 --- a/src/lib/retries.ts +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { isConnectionError, isTimeoutError } from "./http.js"; - -export type BackoffStrategy = { - initialInterval: number; - maxInterval: number; - exponent: number; - maxElapsedTime: number; -}; - -const defaultBackoff: BackoffStrategy = { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, -}; - -export type RetryConfig = - | { strategy: "none" } - | { - strategy: "backoff"; - backoff?: BackoffStrategy; - retryConnectionErrors?: boolean; - }; - -/** - * PermanentError is an error that is not recoverable. Throwing this error will - * cause a retry loop to terminate. - */ -export class PermanentError extends Error { - /** The underlying cause of the error. */ - override readonly cause: unknown; - - constructor(message: string, options?: { cause?: unknown }) { - let msg = message; - if (options?.cause) { - msg += `: ${options.cause}`; - } - - super(msg, options); - this.name = "PermanentError"; - // In older runtimes, the cause field would not have been assigned through - // the super() call. - if (typeof this.cause === "undefined") { - this.cause = options?.cause; - } - - Object.setPrototypeOf(this, PermanentError.prototype); - } -} - -/** - * TemporaryError is an error is used to signal that an HTTP request can be - * retried as part of a retry loop. If retry attempts are exhausted and this - * error is thrown, the response will be returned to the caller. - */ -export class TemporaryError extends Error { - response: Response; - - constructor(message: string, response: Response) { - super(message); - this.response = response; - this.name = "TemporaryError"; - - Object.setPrototypeOf(this, TemporaryError.prototype); - } -} - -export async function retry( - fetchFn: () => Promise, - options: { - config: RetryConfig; - statusCodes: string[]; - }, -): Promise { - switch (options.config.strategy) { - case "backoff": - return retryBackoff( - wrapFetcher(fetchFn, { - statusCodes: options.statusCodes, - retryConnectionErrors: !!options.config.retryConnectionErrors, - }), - options.config.backoff ?? defaultBackoff, - ); - default: - return await fetchFn(); - } -} - -function wrapFetcher( - fn: () => Promise, - options: { - statusCodes: string[]; - retryConnectionErrors: boolean; - }, -): () => Promise { - return async () => { - try { - const res = await fn(); - if (isRetryableResponse(res, options.statusCodes)) { - throw new TemporaryError( - "Response failed with retryable status code", - res, - ); - } - - return res; - } catch (err: unknown) { - if (err instanceof TemporaryError) { - throw err; - } - - if ( - options.retryConnectionErrors && - (isTimeoutError(err) || isConnectionError(err)) - ) { - throw err; - } - - throw new PermanentError("Permanent error", { cause: err }); - } - }; -} - -const codeRangeRE = new RegExp("^[0-9]xx$", "i"); - -function isRetryableResponse(res: Response, statusCodes: string[]): boolean { - const actual = `${res.status}`; - - return statusCodes.some((code) => { - if (!codeRangeRE.test(code)) { - return code === actual; - } - - const expectFamily = code.charAt(0); - if (!expectFamily) { - throw new Error("Invalid status code range"); - } - - const actualFamily = actual.charAt(0); - if (!actualFamily) { - throw new Error(`Invalid response status code: ${actual}`); - } - - return actualFamily === expectFamily; - }); -} - -async function retryBackoff( - fn: () => Promise, - strategy: BackoffStrategy, -): Promise { - const { maxElapsedTime, initialInterval, exponent, maxInterval } = strategy; - - const start = Date.now(); - let x = 0; - - while (true) { - try { - const res = await fn(); - return res; - } catch (err: unknown) { - if (err instanceof PermanentError) { - throw err.cause; - } - const elapsed = Date.now() - start; - if (elapsed > maxElapsedTime) { - if (err instanceof TemporaryError) { - return err.response; - } - - throw err; - } - - let retryInterval = 0; - if (err instanceof TemporaryError) { - retryInterval = retryIntervalFromResponse(err.response); - } - - if (retryInterval <= 0) { - retryInterval = - initialInterval * Math.pow(x, exponent) + Math.random() * 1000; - } - - const d = Math.min(retryInterval, maxInterval); - - await delay(d); - x++; - } - } -} - -function retryIntervalFromResponse(res: Response): number { - const retryVal = res.headers.get("retry-after") || ""; - if (!retryVal) { - return 0; - } - - const parsedNumber = Number(retryVal); - if (Number.isInteger(parsedNumber)) { - return parsedNumber * 1000; - } - - const parsedDate = Date.parse(retryVal); - if (Number.isInteger(parsedDate)) { - const deltaMS = parsedDate - Date.now(); - return deltaMS > 0 ? Math.ceil(deltaMS) : 0; - } - - return 0; -} - -async function delay(delay: number): Promise { - return new Promise((resolve) => setTimeout(resolve, delay)); -} diff --git a/src/lib/schemas.ts b/src/lib/schemas.ts deleted file mode 100644 index 0e340b7..0000000 --- a/src/lib/schemas.ts +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { - output, - ZodEffects, - ZodError, - ZodObject, - ZodRawShape, - ZodTypeAny, -} from "zod"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import { ERR, OK, Result } from "../types/fp.js"; - -/** - * Utility function that executes some code which may throw a ZodError. It - * intercepts this error and converts it to an SDKValidationError so as to not - * leak Zod implementation details to user code. - */ -export function parse( - rawValue: Inp, - fn: (value: Inp) => Out, - errorMessage: string, -): Out { - try { - return fn(rawValue); - } catch (err) { - if (err instanceof ZodError) { - throw new SDKValidationError(errorMessage, err, rawValue); - } - throw err; - } -} - -/** - * Utility function that executes some code which may result in a ZodError. It - * intercepts this error and converts it to an SDKValidationError so as to not - * leak Zod implementation details to user code. - */ -export function safeParse( - rawValue: Inp, - fn: (value: Inp) => Out, - errorMessage: string, -): Result { - try { - return OK(fn(rawValue)); - } catch (err) { - return ERR(new SDKValidationError(errorMessage, err, rawValue)); - } -} - -export function collectExtraKeys< - Shape extends ZodRawShape, - Catchall extends ZodTypeAny, - K extends string, ->( - obj: ZodObject, - extrasKey: K, - optional: boolean, -): ZodEffects< - typeof obj, - & output> - & { - [k in K]: Record>; - } -> { - return obj.transform((val) => { - const extras: Record> = {}; - const { shape } = obj; - for (const [key] of Object.entries(val)) { - if (key in shape) { - continue; - } - - const v = val[key]; - if (typeof v === "undefined") { - continue; - } - - extras[key] = v; - delete val[key]; - } - - if (optional && Object.keys(extras).length === 0) { - return val; - } - - return { ...val, [extrasKey]: extras }; - }); -} diff --git a/src/lib/sdks.ts b/src/lib/sdks.ts deleted file mode 100644 index fb7e9ac..0000000 --- a/src/lib/sdks.ts +++ /dev/null @@ -1,402 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { SDKHooks } from "../hooks/hooks.js"; -import { HookContext } from "../hooks/types.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import { ERR, OK, Result } from "../types/fp.js"; -import { stringToBase64 } from "./base64.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "./config.js"; -import { encodeForm } from "./encodings.js"; -import { - HTTPClient, - isAbortError, - isConnectionError, - isTimeoutError, - matchContentType, - matchStatusCode, -} from "./http.js"; -import { Logger } from "./logger.js"; -import { retry, RetryConfig } from "./retries.js"; -import { SecurityState } from "./security.js"; - -export type RequestOptions = { - /** - * Sets a timeout, in milliseconds, on HTTP requests made by an SDK method. If - * `fetchOptions.signal` is set then it will take precedence over this option. - */ - timeoutMs?: number; - /** - * Set or override a retry policy on HTTP calls. - */ - retries?: RetryConfig; - /** - * Specifies the status codes which should be retried using the given retry policy. - */ - retryCodes?: string[]; - /** - * Overrides the base server URL that will be used by an operation. - */ - serverURL?: string | URL; - /** - * @deprecated `fetchOptions` has been flattened into `RequestOptions`. - * - * Sets various request options on the `fetch` call made by an SDK method. - * - * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options|Request} - */ - fetchOptions?: Omit; -} & Omit; - -type RequestConfig = { - method: string; - path: string; - baseURL?: string | URL | undefined; - query?: string; - body?: RequestInit["body"]; - headers?: HeadersInit; - security?: SecurityState | null; - uaHeader?: string; - userAgent?: string | undefined; - timeoutMs?: number; -}; - -const gt: unknown = typeof globalThis === "undefined" ? null : globalThis; -const webWorkerLike = typeof gt === "object" - && gt != null - && "importScripts" in gt - && typeof gt["importScripts"] === "function"; -const isBrowserLike = webWorkerLike - || (typeof navigator !== "undefined" && "serviceWorker" in navigator) - || (typeof window === "object" && typeof window.document !== "undefined"); - -export class ClientSDK { - readonly #httpClient: HTTPClient; - readonly #hooks: SDKHooks; - readonly #logger?: Logger | undefined; - public readonly _baseURL: URL | null; - public readonly _options: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - if ( - typeof opt === "object" - && opt != null - && "hooks" in opt - && opt.hooks instanceof SDKHooks - ) { - this.#hooks = opt.hooks; - } else { - this.#hooks = new SDKHooks(); - } - const defaultHttpClient = new HTTPClient(); - options.httpClient = options.httpClient || defaultHttpClient; - options = this.#hooks.sdkInit(options); - - const url = serverURLFromOptions(options); - if (url) { - url.pathname = url.pathname.replace(/\/+$/, "") + "/"; - } - this._baseURL = url; - this.#httpClient = options.httpClient || defaultHttpClient; - - this._options = { ...options, hooks: this.#hooks }; - - this.#logger = this._options.debugLogger; - } - - public _createRequest( - context: HookContext, - conf: RequestConfig, - options?: RequestOptions, - ): Result { - const { method, path, query, headers: opHeaders, security } = conf; - - const base = conf.baseURL ?? this._baseURL; - if (!base) { - return ERR(new InvalidRequestError("No base URL provided for operation")); - } - const reqURL = new URL(base); - const inputURL = new URL(path, reqURL); - - if (path) { - reqURL.pathname += reqURL.pathname.endsWith("/") ? "" : "/"; - reqURL.pathname += inputURL.pathname.replace(/^\/+/, ""); - } - - let finalQuery = query || ""; - - const secQuery: string[] = []; - for (const [k, v] of Object.entries(security?.queryParams || {})) { - const q = encodeForm(k, v, { charEncoding: "percent" }); - if (typeof q !== "undefined") { - secQuery.push(q); - } - } - if (secQuery.length) { - finalQuery += `&${secQuery.join("&")}`; - } - - if (finalQuery) { - const q = finalQuery.startsWith("&") ? finalQuery.slice(1) : finalQuery; - reqURL.search = `?${q}`; - } - - const headers = new Headers(opHeaders); - - const username = security?.basic.username; - const password = security?.basic.password; - if (username != null || password != null) { - const encoded = stringToBase64( - [username || "", password || ""].join(":"), - ); - headers.set("Authorization", `Basic ${encoded}`); - } - - const securityHeaders = new Headers(security?.headers || {}); - for (const [k, v] of securityHeaders) { - headers.set(k, v); - } - - let cookie = headers.get("cookie") || ""; - for (const [k, v] of Object.entries(security?.cookies || {})) { - cookie += `; ${k}=${v}`; - } - cookie = cookie.startsWith("; ") ? cookie.slice(2) : cookie; - headers.set("cookie", cookie); - - const userHeaders = new Headers( - options?.headers ?? options?.fetchOptions?.headers, - ); - for (const [k, v] of userHeaders) { - headers.set(k, v); - } - - // Only set user agent header in non-browser-like environments since CORS - // policy disallows setting it in browsers e.g. Chrome throws an error. - if (!isBrowserLike) { - headers.set( - conf.uaHeader ?? "user-agent", - conf.userAgent ?? SDK_METADATA.userAgent, - ); - } - - const fetchOptions: Omit = { - ...options?.fetchOptions, - ...options, - }; - if (!fetchOptions?.signal && conf.timeoutMs && conf.timeoutMs > 0) { - const timeoutSignal = AbortSignal.timeout(conf.timeoutMs); - fetchOptions.signal = timeoutSignal; - } - - if (conf.body instanceof ReadableStream) { - Object.assign(fetchOptions, { duplex: "half" }); - } - - let input; - try { - input = this.#hooks.beforeCreateRequest(context, { - url: reqURL, - options: { - ...fetchOptions, - body: conf.body ?? null, - headers, - method, - }, - }); - } catch (err: unknown) { - return ERR( - new UnexpectedClientError("Create request hook failed to execute", { - cause: err, - }), - ); - } - - return OK(new Request(input.url, input.options)); - } - - public async _do( - request: Request, - options: { - context: HookContext; - errorCodes: number | string | (number | string)[]; - retryConfig: RetryConfig; - retryCodes: string[]; - }, - ): Promise< - Result< - Response, - | RequestAbortedError - | RequestTimeoutError - | ConnectionError - | UnexpectedClientError - > - > { - const { context, errorCodes } = options; - - return retry( - async () => { - const req = await this.#hooks.beforeRequest(context, request.clone()); - await logRequest(this.#logger, req).catch((e) => - this.#logger?.log("Failed to log request:", e) - ); - - let response = await this.#httpClient.request(req); - - try { - if (matchStatusCode(response, errorCodes)) { - const result = await this.#hooks.afterError( - context, - response, - null, - ); - if (result.error) { - throw result.error; - } - response = result.response || response; - } else { - response = await this.#hooks.afterSuccess(context, response); - } - } finally { - await logResponse(this.#logger, response, req) - .catch(e => this.#logger?.log("Failed to log response:", e)); - } - - return response; - }, - { config: options.retryConfig, statusCodes: options.retryCodes }, - ).then( - (r) => OK(r), - (err) => { - switch (true) { - case isAbortError(err): - return ERR( - new RequestAbortedError("Request aborted by client", { - cause: err, - }), - ); - case isTimeoutError(err): - return ERR( - new RequestTimeoutError("Request timed out", { cause: err }), - ); - case isConnectionError(err): - return ERR( - new ConnectionError("Unable to make request", { cause: err }), - ); - default: - return ERR( - new UnexpectedClientError("Unexpected HTTP client error", { - cause: err, - }), - ); - } - }, - ); - } -} - -const jsonLikeContentTypeRE = /(application|text)\/.*?\+*json.*/; -const jsonlLikeContentTypeRE = - /(application|text)\/(.*?\+*\bjsonl\b.*|.*?\+*\bx-ndjson\b.*)/; -async function logRequest(logger: Logger | undefined, req: Request) { - if (!logger) { - return; - } - - const contentType = req.headers.get("content-type"); - const ct = contentType?.split(";")[0] || ""; - - logger.group(`> Request: ${req.method} ${req.url}`); - - logger.group("Headers:"); - for (const [k, v] of req.headers.entries()) { - logger.log(`${k}: ${v}`); - } - logger.groupEnd(); - - logger.group("Body:"); - switch (true) { - case jsonLikeContentTypeRE.test(ct): - logger.log(await req.clone().json()); - break; - case ct.startsWith("text/"): - logger.log(await req.clone().text()); - break; - case ct === "multipart/form-data": { - const body = await req.clone().formData(); - for (const [k, v] of body) { - const vlabel = v instanceof Blob ? "" : v; - logger.log(`${k}: ${vlabel}`); - } - break; - } - default: - logger.log(`<${contentType}>`); - break; - } - logger.groupEnd(); - - logger.groupEnd(); -} - -async function logResponse( - logger: Logger | undefined, - res: Response, - req: Request, -) { - if (!logger) { - return; - } - - const contentType = res.headers.get("content-type"); - const ct = contentType?.split(";")[0] || ""; - - logger.group(`< Response: ${req.method} ${req.url}`); - logger.log("Status Code:", res.status, res.statusText); - - logger.group("Headers:"); - for (const [k, v] of res.headers.entries()) { - logger.log(`${k}: ${v}`); - } - logger.groupEnd(); - - logger.group("Body:"); - switch (true) { - case matchContentType(res, "application/json") - || jsonLikeContentTypeRE.test(ct) && !jsonlLikeContentTypeRE.test(ct): - logger.log(await res.clone().json()); - break; - case matchContentType(res, "application/jsonl") - || jsonlLikeContentTypeRE.test(ct): - logger.log(await res.clone().text()); - break; - case matchContentType(res, "text/event-stream"): - logger.log(`<${contentType}>`); - break; - case matchContentType(res, "text/*"): - logger.log(await res.clone().text()); - break; - case matchContentType(res, "multipart/form-data"): { - const body = await res.clone().formData(); - for (const [k, v] of body) { - const vlabel = v instanceof Blob ? "" : v; - logger.log(`${k}: ${vlabel}`); - } - break; - } - default: - logger.log(`<${contentType}>`); - break; - } - logger.groupEnd(); - - logger.groupEnd(); -} diff --git a/src/lib/security.ts b/src/lib/security.ts deleted file mode 100644 index 7f58945..0000000 --- a/src/lib/security.ts +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as components from "../models/components/index.js"; - -type OAuth2PasswordFlow = { - username: string; - password: string; - clientID?: string | undefined; - clientSecret?: string | undefined; - tokenURL: string; -}; - -export enum SecurityErrorCode { - Incomplete = "incomplete", - UnrecognisedSecurityType = "unrecognized_security_type", -} - -export class SecurityError extends Error { - constructor( - public code: SecurityErrorCode, - message: string, - ) { - super(message); - this.name = "SecurityError"; - } - - static incomplete(): SecurityError { - return new SecurityError( - SecurityErrorCode.Incomplete, - "Security requirements not met in order to perform the operation", - ); - } - static unrecognizedType(type: string): SecurityError { - return new SecurityError( - SecurityErrorCode.UnrecognisedSecurityType, - `Unrecognised security type: ${type}`, - ); - } -} - -export type SecurityState = { - basic: { username?: string | undefined; password?: string | undefined }; - headers: Record; - queryParams: Record; - cookies: Record; - oauth2: ({ type: "password" } & OAuth2PasswordFlow) | { type: "none" }; -}; - -type SecurityInputBasic = { - type: "http:basic"; - value: - | { username?: string | undefined; password?: string | undefined } - | null - | undefined; -}; - -type SecurityInputBearer = { - type: "http:bearer"; - value: string | null | undefined; - fieldName: string; -}; - -type SecurityInputAPIKey = { - type: "apiKey:header" | "apiKey:query" | "apiKey:cookie"; - value: string | null | undefined; - fieldName: string; -}; - -type SecurityInputOIDC = { - type: "openIdConnect"; - value: string | null | undefined; - fieldName: string; -}; - -type SecurityInputOAuth2 = { - type: "oauth2"; - value: string | null | undefined; - fieldName: string; -}; - -type SecurityInputOAuth2ClientCredentials = { - type: "oauth2:client_credentials"; - value: - | { clientID?: string | undefined; clientSecret?: string | undefined } - | null - | string - | undefined; - fieldName?: string; -}; - -type SecurityInputOAuth2PasswordCredentials = { - type: "oauth2:password"; - value: - | string - | null - | undefined; - fieldName?: string; -}; - -type SecurityInputCustom = { - type: "http:custom"; - value: any | null | undefined; - fieldName?: string; -}; - -export type SecurityInput = - | SecurityInputBasic - | SecurityInputBearer - | SecurityInputAPIKey - | SecurityInputOAuth2 - | SecurityInputOAuth2ClientCredentials - | SecurityInputOAuth2PasswordCredentials - | SecurityInputOIDC - | SecurityInputCustom; - -export function resolveSecurity( - ...options: SecurityInput[][] -): SecurityState | null { - const state: SecurityState = { - basic: {}, - headers: {}, - queryParams: {}, - cookies: {}, - oauth2: { type: "none" }, - }; - - const option = options.find((opts) => { - return opts.every((o) => { - if (o.value == null) { - return false; - } else if (o.type === "http:basic") { - return o.value.username != null || o.value.password != null; - } else if (o.type === "http:custom") { - return null; - } else if (o.type === "oauth2:password") { - return ( - typeof o.value === "string" && !!o.value - ); - } else if (o.type === "oauth2:client_credentials") { - if (typeof o.value == "string") { - return !!o.value; - } - return o.value.clientID != null || o.value.clientSecret != null; - } else if (typeof o.value === "string") { - return !!o.value; - } else { - throw new Error( - `Unrecognized security type: ${o.type} (value type: ${typeof o - .value})`, - ); - } - }); - }); - if (option == null) { - return null; - } - - option.forEach((spec) => { - if (spec.value == null) { - return; - } - - const { type } = spec; - - switch (type) { - case "apiKey:header": - state.headers[spec.fieldName] = spec.value; - break; - case "apiKey:query": - state.queryParams[spec.fieldName] = spec.value; - break; - case "apiKey:cookie": - state.cookies[spec.fieldName] = spec.value; - break; - case "http:basic": - applyBasic(state, spec); - break; - case "http:custom": - break; - case "http:bearer": - applyBearer(state, spec); - break; - case "oauth2": - applyBearer(state, spec); - break; - case "oauth2:password": - applyBearer(state, spec); - break; - case "oauth2:client_credentials": - break; - case "openIdConnect": - applyBearer(state, spec); - break; - default: - spec satisfies never; - throw SecurityError.unrecognizedType(type); - } - }); - - return state; -} - -function applyBasic( - state: SecurityState, - spec: SecurityInputBasic, -) { - if (spec.value == null) { - return; - } - - state.basic = spec.value; -} - -function applyBearer( - state: SecurityState, - spec: - | SecurityInputBearer - | SecurityInputOAuth2 - | SecurityInputOIDC - | SecurityInputOAuth2PasswordCredentials, -) { - if (typeof spec.value !== "string" || !spec.value) { - return; - } - - let value = spec.value; - if (value.slice(0, 7).toLowerCase() !== "bearer ") { - value = `Bearer ${value}`; - } - - if (spec.fieldName !== undefined) { - state.headers[spec.fieldName] = value; - } -} - -export function resolveGlobalSecurity( - security: Partial | null | undefined, -): SecurityState | null { - return resolveSecurity( - [ - { - fieldName: "Authorization", - type: "http:bearer", - value: security?.bearerAuth, - }, - ], - ); -} - -export async function extractSecurity< - T extends string | Record, ->(sec: T | (() => Promise) | undefined): Promise { - if (sec == null) { - return; - } - - return typeof sec === "function" ? sec() : sec; -} diff --git a/src/lib/url.ts b/src/lib/url.ts deleted file mode 100644 index 6bc6356..0000000 --- a/src/lib/url.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -const hasOwn = Object.prototype.hasOwnProperty; - -export type Params = Partial>; - -export function pathToFunc( - pathPattern: string, - options?: { charEncoding?: "percent" | "none" }, -): (params?: Params) => string { - const paramRE = /\{([a-zA-Z0-9_]+?)\}/g; - - return function buildURLPath(params: Record = {}): string { - return pathPattern.replace(paramRE, function (_, placeholder) { - if (!hasOwn.call(params, placeholder)) { - throw new Error(`Parameter '${placeholder}' is required`); - } - - const value = params[placeholder]; - if (typeof value !== "string" && typeof value !== "number") { - throw new Error( - `Parameter '${placeholder}' must be a string or number`, - ); - } - - return options?.charEncoding === "percent" - ? encodeURIComponent(`${value}`) - : `${value}`; - }); - }; -} diff --git a/src/models/components/accessgroup.ts b/src/models/components/accessgroup.ts deleted file mode 100644 index b030ee9..0000000 --- a/src/models/components/accessgroup.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type AccessGroup = { - accessGroupSlug: string; -}; - -/** @internal */ -export const AccessGroup$inboundSchema: z.ZodType< - AccessGroup, - z.ZodTypeDef, - unknown -> = z.object({ - accessGroupSlug: z.string(), -}); - -/** @internal */ -export type AccessGroup$Outbound = { - accessGroupSlug: string; -}; - -/** @internal */ -export const AccessGroup$outboundSchema: z.ZodType< - AccessGroup$Outbound, - z.ZodTypeDef, - AccessGroup -> = z.object({ - accessGroupSlug: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace AccessGroup$ { - /** @deprecated use `AccessGroup$inboundSchema` instead. */ - export const inboundSchema = AccessGroup$inboundSchema; - /** @deprecated use `AccessGroup$outboundSchema` instead. */ - export const outboundSchema = AccessGroup$outboundSchema; - /** @deprecated use `AccessGroup$Outbound` instead. */ - export type Outbound = AccessGroup$Outbound; -} - -export function accessGroupToJSON(accessGroup: AccessGroup): string { - return JSON.stringify(AccessGroup$outboundSchema.parse(accessGroup)); -} - -export function accessGroupFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => AccessGroup$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'AccessGroup' from JSON`, - ); -} diff --git a/src/models/components/activedeployment.ts b/src/models/components/activedeployment.ts deleted file mode 100644 index 113823a..0000000 --- a/src/models/components/activedeployment.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type ActiveDeployment = { - uid: string; - domain: string; - publishedAt: number; -}; - -/** @internal */ -export const ActiveDeployment$inboundSchema: z.ZodType< - ActiveDeployment, - z.ZodTypeDef, - unknown -> = z.object({ - uid: z.string(), - domain: z.string(), - publishedAt: z.number().int(), -}); - -/** @internal */ -export type ActiveDeployment$Outbound = { - uid: string; - domain: string; - publishedAt: number; -}; - -/** @internal */ -export const ActiveDeployment$outboundSchema: z.ZodType< - ActiveDeployment$Outbound, - z.ZodTypeDef, - ActiveDeployment -> = z.object({ - uid: z.string(), - domain: z.string(), - publishedAt: z.number().int(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ActiveDeployment$ { - /** @deprecated use `ActiveDeployment$inboundSchema` instead. */ - export const inboundSchema = ActiveDeployment$inboundSchema; - /** @deprecated use `ActiveDeployment$outboundSchema` instead. */ - export const outboundSchema = ActiveDeployment$outboundSchema; - /** @deprecated use `ActiveDeployment$Outbound` instead. */ - export type Outbound = ActiveDeployment$Outbound; -} - -export function activeDeploymentToJSON( - activeDeployment: ActiveDeployment, -): string { - return JSON.stringify( - ActiveDeployment$outboundSchema.parse(activeDeployment), - ); -} - -export function activeDeploymentFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ActiveDeployment$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ActiveDeployment' from JSON`, - ); -} diff --git a/src/models/components/apidocument.ts b/src/models/components/apidocument.ts deleted file mode 100644 index f16a67f..0000000 --- a/src/models/components/apidocument.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; -import { - ManagedDocVersion, - ManagedDocVersion$inboundSchema, - ManagedDocVersion$Outbound, - ManagedDocVersion$outboundSchema, -} from "./manageddocversion.js"; - -export type ApiDocument = { - uid: string; - version: string; - title?: string | undefined; - slug: string; - description?: string | undefined; - namespace: string; - isPrivate?: boolean | undefined; - tags?: any | undefined; - versions: Array; -}; - -/** @internal */ -export const ApiDocument$inboundSchema: z.ZodType< - ApiDocument, - z.ZodTypeDef, - unknown -> = z.object({ - uid: z.string(), - version: z.string(), - title: z.string().default(""), - slug: z.string(), - description: z.string().default(""), - namespace: z.string(), - isPrivate: z.boolean().default(false), - tags: z.any(), - versions: z.array(ManagedDocVersion$inboundSchema), -}); - -/** @internal */ -export type ApiDocument$Outbound = { - uid: string; - version: string; - title: string; - slug: string; - description: string; - namespace: string; - isPrivate: boolean; - tags?: any; - versions: Array; -}; - -/** @internal */ -export const ApiDocument$outboundSchema: z.ZodType< - ApiDocument$Outbound, - z.ZodTypeDef, - ApiDocument -> = z.object({ - uid: z.string(), - version: z.string(), - title: z.string().default(""), - slug: z.string(), - description: z.string().default(""), - namespace: z.string(), - isPrivate: z.boolean().default(false), - tags: z.any(), - versions: z.array(ManagedDocVersion$outboundSchema), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ApiDocument$ { - /** @deprecated use `ApiDocument$inboundSchema` instead. */ - export const inboundSchema = ApiDocument$inboundSchema; - /** @deprecated use `ApiDocument$outboundSchema` instead. */ - export const outboundSchema = ApiDocument$outboundSchema; - /** @deprecated use `ApiDocument$Outbound` instead. */ - export type Outbound = ApiDocument$Outbound; -} - -export function apiDocumentToJSON(apiDocument: ApiDocument): string { - return JSON.stringify(ApiDocument$outboundSchema.parse(apiDocument)); -} - -export function apiDocumentFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ApiDocument$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ApiDocument' from JSON`, - ); -} diff --git a/src/models/components/githubproject.ts b/src/models/components/githubproject.ts deleted file mode 100644 index 0af13de..0000000 --- a/src/models/components/githubproject.ts +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; -import { - ActiveDeployment, - ActiveDeployment$inboundSchema, - ActiveDeployment$Outbound, - ActiveDeployment$outboundSchema, -} from "./activedeployment.js"; -import { - GithubProjectRepository, - GithubProjectRepository$inboundSchema, - GithubProjectRepository$Outbound, - GithubProjectRepository$outboundSchema, -} from "./githubprojectrepository.js"; - -export type GithubProject = { - uid: string; - createdAt: number; - updatedAt: number; - name: string; - activeDeployment: ActiveDeployment | null; - lastPublished: number | null; - lastPublishedUid: string | null; - loginPortalUid?: string | undefined; - activeThemeId?: string | undefined; - typesenseId?: number | undefined; - isPrivate?: boolean | undefined; - agentEnabled?: boolean | undefined; - accessGroups?: any | undefined; - slug: string; - publishStatus?: string | undefined; - publishMessage?: string | undefined; - repository?: GithubProjectRepository | null | undefined; -}; - -/** @internal */ -export const GithubProject$inboundSchema: z.ZodType< - GithubProject, - z.ZodTypeDef, - unknown -> = z.object({ - uid: z.string(), - createdAt: z.number().int(), - updatedAt: z.number().int(), - name: z.string(), - activeDeployment: z.nullable(ActiveDeployment$inboundSchema), - lastPublished: z.nullable(z.number().int()), - lastPublishedUid: z.nullable(z.string()), - loginPortalUid: z.string().default(""), - activeThemeId: z.string().default(""), - typesenseId: z.number().optional(), - isPrivate: z.boolean().default(false), - agentEnabled: z.boolean().default(false), - accessGroups: z.any(), - slug: z.string(), - publishStatus: z.string().default(""), - publishMessage: z.string().default(""), - repository: z.nullable(GithubProjectRepository$inboundSchema).optional(), -}); - -/** @internal */ -export type GithubProject$Outbound = { - uid: string; - createdAt: number; - updatedAt: number; - name: string; - activeDeployment: ActiveDeployment$Outbound | null; - lastPublished: number | null; - lastPublishedUid: string | null; - loginPortalUid: string; - activeThemeId: string; - typesenseId?: number | undefined; - isPrivate: boolean; - agentEnabled: boolean; - accessGroups?: any; - slug: string; - publishStatus: string; - publishMessage: string; - repository?: GithubProjectRepository$Outbound | null | undefined; -}; - -/** @internal */ -export const GithubProject$outboundSchema: z.ZodType< - GithubProject$Outbound, - z.ZodTypeDef, - GithubProject -> = z.object({ - uid: z.string(), - createdAt: z.number().int(), - updatedAt: z.number().int(), - name: z.string(), - activeDeployment: z.nullable(ActiveDeployment$outboundSchema), - lastPublished: z.nullable(z.number().int()), - lastPublishedUid: z.nullable(z.string()), - loginPortalUid: z.string().default(""), - activeThemeId: z.string().default(""), - typesenseId: z.number().optional(), - isPrivate: z.boolean().default(false), - agentEnabled: z.boolean().default(false), - accessGroups: z.any(), - slug: z.string(), - publishStatus: z.string().default(""), - publishMessage: z.string().default(""), - repository: z.nullable(GithubProjectRepository$outboundSchema).optional(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GithubProject$ { - /** @deprecated use `GithubProject$inboundSchema` instead. */ - export const inboundSchema = GithubProject$inboundSchema; - /** @deprecated use `GithubProject$outboundSchema` instead. */ - export const outboundSchema = GithubProject$outboundSchema; - /** @deprecated use `GithubProject$Outbound` instead. */ - export type Outbound = GithubProject$Outbound; -} - -export function githubProjectToJSON(githubProject: GithubProject): string { - return JSON.stringify(GithubProject$outboundSchema.parse(githubProject)); -} - -export function githubProjectFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => GithubProject$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GithubProject' from JSON`, - ); -} diff --git a/src/models/components/githubprojectrepository.ts b/src/models/components/githubprojectrepository.ts deleted file mode 100644 index d808fe3..0000000 --- a/src/models/components/githubprojectrepository.ts +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type GithubProjectRepository = { - linkedBy: string; - id: number; - name: string; - configPath?: string | undefined; - branch?: string | undefined; - publishOnMerge?: boolean | undefined; - publishPreviews?: boolean | undefined; - prComments?: boolean | undefined; - expired?: boolean | undefined; -}; - -/** @internal */ -export const GithubProjectRepository$inboundSchema: z.ZodType< - GithubProjectRepository, - z.ZodTypeDef, - unknown -> = z.object({ - linkedBy: z.string(), - id: z.number(), - name: z.string(), - configPath: z.string().default(""), - branch: z.string().default(""), - publishOnMerge: z.boolean().default(false), - publishPreviews: z.boolean().default(false), - prComments: z.boolean().default(false), - expired: z.boolean().default(false), -}); - -/** @internal */ -export type GithubProjectRepository$Outbound = { - linkedBy: string; - id: number; - name: string; - configPath: string; - branch: string; - publishOnMerge: boolean; - publishPreviews: boolean; - prComments: boolean; - expired: boolean; -}; - -/** @internal */ -export const GithubProjectRepository$outboundSchema: z.ZodType< - GithubProjectRepository$Outbound, - z.ZodTypeDef, - GithubProjectRepository -> = z.object({ - linkedBy: z.string(), - id: z.number(), - name: z.string(), - configPath: z.string().default(""), - branch: z.string().default(""), - publishOnMerge: z.boolean().default(false), - publishPreviews: z.boolean().default(false), - prComments: z.boolean().default(false), - expired: z.boolean().default(false), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GithubProjectRepository$ { - /** @deprecated use `GithubProjectRepository$inboundSchema` instead. */ - export const inboundSchema = GithubProjectRepository$inboundSchema; - /** @deprecated use `GithubProjectRepository$outboundSchema` instead. */ - export const outboundSchema = GithubProjectRepository$outboundSchema; - /** @deprecated use `GithubProjectRepository$Outbound` instead. */ - export type Outbound = GithubProjectRepository$Outbound; -} - -export function githubProjectRepositoryToJSON( - githubProjectRepository: GithubProjectRepository, -): string { - return JSON.stringify( - GithubProjectRepository$outboundSchema.parse(githubProjectRepository), - ); -} - -export function githubProjectRepositoryFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => GithubProjectRepository$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GithubProjectRepository' from JSON`, - ); -} diff --git a/src/models/components/httpmetadata.ts b/src/models/components/httpmetadata.ts deleted file mode 100644 index 014bfb3..0000000 --- a/src/models/components/httpmetadata.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type HTTPMetadata = { - /** - * Raw HTTP response; suitable for custom response parsing - */ - response: Response; - /** - * Raw HTTP request; suitable for debugging - */ - request: Request; -}; - -/** @internal */ -export const HTTPMetadata$inboundSchema: z.ZodType< - HTTPMetadata, - z.ZodTypeDef, - unknown -> = z.object({ - Response: z.instanceof(Response), - Request: z.instanceof(Request), -}).transform((v) => { - return remap$(v, { - "Response": "response", - "Request": "request", - }); -}); - -/** @internal */ -export type HTTPMetadata$Outbound = { - Response: never; - Request: never; -}; - -/** @internal */ -export const HTTPMetadata$outboundSchema: z.ZodType< - HTTPMetadata$Outbound, - z.ZodTypeDef, - HTTPMetadata -> = z.object({ - response: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - request: z.instanceof(Request).transform(() => { - throw new Error("Response cannot be serialized"); - }), -}).transform((v) => { - return remap$(v, { - response: "Response", - request: "Request", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace HTTPMetadata$ { - /** @deprecated use `HTTPMetadata$inboundSchema` instead. */ - export const inboundSchema = HTTPMetadata$inboundSchema; - /** @deprecated use `HTTPMetadata$outboundSchema` instead. */ - export const outboundSchema = HTTPMetadata$outboundSchema; - /** @deprecated use `HTTPMetadata$Outbound` instead. */ - export type Outbound = HTTPMetadata$Outbound; -} - -export function httpMetadataToJSON(httpMetadata: HTTPMetadata): string { - return JSON.stringify(HTTPMetadata$outboundSchema.parse(httpMetadata)); -} - -export function httpMetadataFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => HTTPMetadata$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'HTTPMetadata' from JSON`, - ); -} diff --git a/src/models/components/index.ts b/src/models/components/index.ts deleted file mode 100644 index 37552d0..0000000 --- a/src/models/components/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -export * from "./accessgroup.js"; -export * from "./activedeployment.js"; -export * from "./apidocument.js"; -export * from "./githubproject.js"; -export * from "./githubprojectrepository.js"; -export * from "./httpmetadata.js"; -export * from "./loginportal.js"; -export * from "./loginportalemail.js"; -export * from "./loginportalpage.js"; -export * from "./manageddocversion.js"; -export * from "./managedschemaversion.js"; -export * from "./method.js"; -export * from "./rule.js"; -export * from "./schema.js"; -export * from "./security.js"; -export * from "./team.js"; -export * from "./teamsummary.js"; -export * from "./theme.js"; -export * from "./uid.js"; -export * from "./user.js"; diff --git a/src/models/components/loginportal.ts b/src/models/components/loginportal.ts deleted file mode 100644 index 1bdd683..0000000 --- a/src/models/components/loginportal.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type LoginPortal = { - uid: string; - title: string; - slug: string; -}; - -/** @internal */ -export const LoginPortal$inboundSchema: z.ZodType< - LoginPortal, - z.ZodTypeDef, - unknown -> = z.object({ - uid: z.string(), - title: z.string(), - slug: z.string(), -}); - -/** @internal */ -export type LoginPortal$Outbound = { - uid: string; - title: string; - slug: string; -}; - -/** @internal */ -export const LoginPortal$outboundSchema: z.ZodType< - LoginPortal$Outbound, - z.ZodTypeDef, - LoginPortal -> = z.object({ - uid: z.string(), - title: z.string(), - slug: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace LoginPortal$ { - /** @deprecated use `LoginPortal$inboundSchema` instead. */ - export const inboundSchema = LoginPortal$inboundSchema; - /** @deprecated use `LoginPortal$outboundSchema` instead. */ - export const outboundSchema = LoginPortal$outboundSchema; - /** @deprecated use `LoginPortal$Outbound` instead. */ - export type Outbound = LoginPortal$Outbound; -} - -export function loginPortalToJSON(loginPortal: LoginPortal): string { - return JSON.stringify(LoginPortal$outboundSchema.parse(loginPortal)); -} - -export function loginPortalFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => LoginPortal$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'LoginPortal' from JSON`, - ); -} diff --git a/src/models/components/loginportalemail.ts b/src/models/components/loginportalemail.ts deleted file mode 100644 index 38ae958..0000000 --- a/src/models/components/loginportalemail.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type LoginPortalEmail = { - logo?: string | undefined; - logoSize?: string | undefined; - buttonText?: string | undefined; - message?: string | undefined; - title?: string | undefined; - mainColor?: string | undefined; - mainBackground?: string | undefined; - cardColor?: string | undefined; - cardBackground?: string | undefined; - buttonColor?: string | undefined; - buttonBackground?: string | undefined; -}; - -/** @internal */ -export const LoginPortalEmail$inboundSchema: z.ZodType< - LoginPortalEmail, - z.ZodTypeDef, - unknown -> = z.object({ - logo: z.string().default(""), - logoSize: z.string().default("100"), - buttonText: z.string().default("Login"), - message: z.string().default( - "Click to access private documentation hosted by scalar.com", - ), - title: z.string().default("Private Docs"), - mainColor: z.string().default("#2a2f45"), - mainBackground: z.string().default("#f6f6f6"), - cardColor: z.string().default("2a2f45"), - cardBackground: z.string().default("#fff"), - buttonColor: z.string().default("#fff"), - buttonBackground: z.string().default("#0f0f0f"), -}); - -/** @internal */ -export type LoginPortalEmail$Outbound = { - logo: string; - logoSize: string; - buttonText: string; - message: string; - title: string; - mainColor: string; - mainBackground: string; - cardColor: string; - cardBackground: string; - buttonColor: string; - buttonBackground: string; -}; - -/** @internal */ -export const LoginPortalEmail$outboundSchema: z.ZodType< - LoginPortalEmail$Outbound, - z.ZodTypeDef, - LoginPortalEmail -> = z.object({ - logo: z.string().default(""), - logoSize: z.string().default("100"), - buttonText: z.string().default("Login"), - message: z.string().default( - "Click to access private documentation hosted by scalar.com", - ), - title: z.string().default("Private Docs"), - mainColor: z.string().default("#2a2f45"), - mainBackground: z.string().default("#f6f6f6"), - cardColor: z.string().default("2a2f45"), - cardBackground: z.string().default("#fff"), - buttonColor: z.string().default("#fff"), - buttonBackground: z.string().default("#0f0f0f"), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace LoginPortalEmail$ { - /** @deprecated use `LoginPortalEmail$inboundSchema` instead. */ - export const inboundSchema = LoginPortalEmail$inboundSchema; - /** @deprecated use `LoginPortalEmail$outboundSchema` instead. */ - export const outboundSchema = LoginPortalEmail$outboundSchema; - /** @deprecated use `LoginPortalEmail$Outbound` instead. */ - export type Outbound = LoginPortalEmail$Outbound; -} - -export function loginPortalEmailToJSON( - loginPortalEmail: LoginPortalEmail, -): string { - return JSON.stringify( - LoginPortalEmail$outboundSchema.parse(loginPortalEmail), - ); -} - -export function loginPortalEmailFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => LoginPortalEmail$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'LoginPortalEmail' from JSON`, - ); -} diff --git a/src/models/components/loginportalpage.ts b/src/models/components/loginportalpage.ts deleted file mode 100644 index c96d1a1..0000000 --- a/src/models/components/loginportalpage.ts +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type LoginPortalPage = { - title?: string | undefined; - description?: string | undefined; - head?: string | undefined; - script?: string | undefined; - theme?: string | undefined; - companyName?: string | undefined; - logo?: string | undefined; - logoURL?: string | undefined; - favicon?: string | undefined; - termsLink?: string | undefined; - privacyLink?: string | undefined; - formTitle?: string | undefined; - formDescription?: string | undefined; - formImage?: string | undefined; -}; - -/** @internal */ -export const LoginPortalPage$inboundSchema: z.ZodType< - LoginPortalPage, - z.ZodTypeDef, - unknown -> = z.object({ - title: z.string().default("Scalar Private Docs"), - description: z.string().default("Login to access your documentation"), - head: z.string().default(""), - script: z.string().default(""), - theme: z.string().default(""), - companyName: z.string().default(""), - logo: z.string().default(""), - logoURL: z.string().default(""), - favicon: z.string().default(""), - termsLink: z.string().default(""), - privacyLink: z.string().default(""), - formTitle: z.string().default("Scalar Private Docs"), - formDescription: z.string().default("Login to access your documentation"), - formImage: z.string().default(""), -}); - -/** @internal */ -export type LoginPortalPage$Outbound = { - title: string; - description: string; - head: string; - script: string; - theme: string; - companyName: string; - logo: string; - logoURL: string; - favicon: string; - termsLink: string; - privacyLink: string; - formTitle: string; - formDescription: string; - formImage: string; -}; - -/** @internal */ -export const LoginPortalPage$outboundSchema: z.ZodType< - LoginPortalPage$Outbound, - z.ZodTypeDef, - LoginPortalPage -> = z.object({ - title: z.string().default("Scalar Private Docs"), - description: z.string().default("Login to access your documentation"), - head: z.string().default(""), - script: z.string().default(""), - theme: z.string().default(""), - companyName: z.string().default(""), - logo: z.string().default(""), - logoURL: z.string().default(""), - favicon: z.string().default(""), - termsLink: z.string().default(""), - privacyLink: z.string().default(""), - formTitle: z.string().default("Scalar Private Docs"), - formDescription: z.string().default("Login to access your documentation"), - formImage: z.string().default(""), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace LoginPortalPage$ { - /** @deprecated use `LoginPortalPage$inboundSchema` instead. */ - export const inboundSchema = LoginPortalPage$inboundSchema; - /** @deprecated use `LoginPortalPage$outboundSchema` instead. */ - export const outboundSchema = LoginPortalPage$outboundSchema; - /** @deprecated use `LoginPortalPage$Outbound` instead. */ - export type Outbound = LoginPortalPage$Outbound; -} - -export function loginPortalPageToJSON( - loginPortalPage: LoginPortalPage, -): string { - return JSON.stringify(LoginPortalPage$outboundSchema.parse(loginPortalPage)); -} - -export function loginPortalPageFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => LoginPortalPage$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'LoginPortalPage' from JSON`, - ); -} diff --git a/src/models/components/manageddocversion.ts b/src/models/components/manageddocversion.ts deleted file mode 100644 index d2d81e4..0000000 --- a/src/models/components/manageddocversion.ts +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { ClosedEnum } from "../../types/enums.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; -import { - Method, - Method$inboundSchema, - Method$outboundSchema, -} from "./method.js"; - -export const EmbedStatus = { - Complete: "complete", - Failed: "failed", -} as const; -export type EmbedStatus = ClosedEnum; - -export const EnabledTools = { - ExecuteRequest: "execute-request", - GetMiniOpenapiSpec: "get-mini-openapi-spec", -} as const; -export type EnabledTools = ClosedEnum; - -export type Tools = { - path: string; - method: Method; - enabledTools: Array; -}; - -export type ManagedDocVersion = { - uid: string; - createdAt: number; - version: string; - upgraded?: boolean | undefined; - embedStatus: EmbedStatus | null; - tags: Array; - tools?: Array | undefined; - yamlSha?: string | undefined; - jsonSha?: string | undefined; - versionSha?: string | undefined; -}; - -/** @internal */ -export const EmbedStatus$inboundSchema: z.ZodNativeEnum = z - .nativeEnum(EmbedStatus); - -/** @internal */ -export const EmbedStatus$outboundSchema: z.ZodNativeEnum = - EmbedStatus$inboundSchema; - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace EmbedStatus$ { - /** @deprecated use `EmbedStatus$inboundSchema` instead. */ - export const inboundSchema = EmbedStatus$inboundSchema; - /** @deprecated use `EmbedStatus$outboundSchema` instead. */ - export const outboundSchema = EmbedStatus$outboundSchema; -} - -/** @internal */ -export const EnabledTools$inboundSchema: z.ZodNativeEnum = - z.nativeEnum(EnabledTools); - -/** @internal */ -export const EnabledTools$outboundSchema: z.ZodNativeEnum = - EnabledTools$inboundSchema; - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace EnabledTools$ { - /** @deprecated use `EnabledTools$inboundSchema` instead. */ - export const inboundSchema = EnabledTools$inboundSchema; - /** @deprecated use `EnabledTools$outboundSchema` instead. */ - export const outboundSchema = EnabledTools$outboundSchema; -} - -/** @internal */ -export const Tools$inboundSchema: z.ZodType = z - .object({ - path: z.string(), - method: Method$inboundSchema, - enabledTools: z.array(EnabledTools$inboundSchema), - }); - -/** @internal */ -export type Tools$Outbound = { - path: string; - method: string; - enabledTools: Array; -}; - -/** @internal */ -export const Tools$outboundSchema: z.ZodType< - Tools$Outbound, - z.ZodTypeDef, - Tools -> = z.object({ - path: z.string(), - method: Method$outboundSchema, - enabledTools: z.array(EnabledTools$outboundSchema), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace Tools$ { - /** @deprecated use `Tools$inboundSchema` instead. */ - export const inboundSchema = Tools$inboundSchema; - /** @deprecated use `Tools$outboundSchema` instead. */ - export const outboundSchema = Tools$outboundSchema; - /** @deprecated use `Tools$Outbound` instead. */ - export type Outbound = Tools$Outbound; -} - -export function toolsToJSON(tools: Tools): string { - return JSON.stringify(Tools$outboundSchema.parse(tools)); -} - -export function toolsFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => Tools$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'Tools' from JSON`, - ); -} - -/** @internal */ -export const ManagedDocVersion$inboundSchema: z.ZodType< - ManagedDocVersion, - z.ZodTypeDef, - unknown -> = z.object({ - uid: z.string(), - createdAt: z.number(), - version: z.string(), - upgraded: z.boolean().default(false), - embedStatus: z.nullable(EmbedStatus$inboundSchema), - tags: z.array(z.string()), - tools: z.array(z.lazy(() => Tools$inboundSchema)).optional(), - yamlSha: z.string().optional(), - jsonSha: z.string().optional(), - versionSha: z.string().optional(), -}); - -/** @internal */ -export type ManagedDocVersion$Outbound = { - uid: string; - createdAt: number; - version: string; - upgraded: boolean; - embedStatus: string | null; - tags: Array; - tools?: Array | undefined; - yamlSha?: string | undefined; - jsonSha?: string | undefined; - versionSha?: string | undefined; -}; - -/** @internal */ -export const ManagedDocVersion$outboundSchema: z.ZodType< - ManagedDocVersion$Outbound, - z.ZodTypeDef, - ManagedDocVersion -> = z.object({ - uid: z.string(), - createdAt: z.number(), - version: z.string(), - upgraded: z.boolean().default(false), - embedStatus: z.nullable(EmbedStatus$outboundSchema), - tags: z.array(z.string()), - tools: z.array(z.lazy(() => Tools$outboundSchema)).optional(), - yamlSha: z.string().optional(), - jsonSha: z.string().optional(), - versionSha: z.string().optional(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ManagedDocVersion$ { - /** @deprecated use `ManagedDocVersion$inboundSchema` instead. */ - export const inboundSchema = ManagedDocVersion$inboundSchema; - /** @deprecated use `ManagedDocVersion$outboundSchema` instead. */ - export const outboundSchema = ManagedDocVersion$outboundSchema; - /** @deprecated use `ManagedDocVersion$Outbound` instead. */ - export type Outbound = ManagedDocVersion$Outbound; -} - -export function managedDocVersionToJSON( - managedDocVersion: ManagedDocVersion, -): string { - return JSON.stringify( - ManagedDocVersion$outboundSchema.parse(managedDocVersion), - ); -} - -export function managedDocVersionFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ManagedDocVersion$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ManagedDocVersion' from JSON`, - ); -} diff --git a/src/models/components/managedschemaversion.ts b/src/models/components/managedschemaversion.ts deleted file mode 100644 index 384835b..0000000 --- a/src/models/components/managedschemaversion.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type ManagedSchemaVersion = { - uid: string; - createdAt: number; - updatedAt: number; - version: string; -}; - -/** @internal */ -export const ManagedSchemaVersion$inboundSchema: z.ZodType< - ManagedSchemaVersion, - z.ZodTypeDef, - unknown -> = z.object({ - uid: z.string(), - createdAt: z.number().int(), - updatedAt: z.number().int(), - version: z.string(), -}); - -/** @internal */ -export type ManagedSchemaVersion$Outbound = { - uid: string; - createdAt: number; - updatedAt: number; - version: string; -}; - -/** @internal */ -export const ManagedSchemaVersion$outboundSchema: z.ZodType< - ManagedSchemaVersion$Outbound, - z.ZodTypeDef, - ManagedSchemaVersion -> = z.object({ - uid: z.string(), - createdAt: z.number().int(), - updatedAt: z.number().int(), - version: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ManagedSchemaVersion$ { - /** @deprecated use `ManagedSchemaVersion$inboundSchema` instead. */ - export const inboundSchema = ManagedSchemaVersion$inboundSchema; - /** @deprecated use `ManagedSchemaVersion$outboundSchema` instead. */ - export const outboundSchema = ManagedSchemaVersion$outboundSchema; - /** @deprecated use `ManagedSchemaVersion$Outbound` instead. */ - export type Outbound = ManagedSchemaVersion$Outbound; -} - -export function managedSchemaVersionToJSON( - managedSchemaVersion: ManagedSchemaVersion, -): string { - return JSON.stringify( - ManagedSchemaVersion$outboundSchema.parse(managedSchemaVersion), - ); -} - -export function managedSchemaVersionFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ManagedSchemaVersion$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ManagedSchemaVersion' from JSON`, - ); -} diff --git a/src/models/components/method.ts b/src/models/components/method.ts deleted file mode 100644 index 09ddb78..0000000 --- a/src/models/components/method.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ClosedEnum } from "../../types/enums.js"; - -export const Method = { - Delete: "delete", - Get: "get", - Head: "head", - Options: "options", - Patch: "patch", - Post: "post", - Put: "put", - Trace: "trace", -} as const; -export type Method = ClosedEnum; - -/** @internal */ -export const Method$inboundSchema: z.ZodNativeEnum = z - .nativeEnum(Method); - -/** @internal */ -export const Method$outboundSchema: z.ZodNativeEnum = - Method$inboundSchema; - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace Method$ { - /** @deprecated use `Method$inboundSchema` instead. */ - export const inboundSchema = Method$inboundSchema; - /** @deprecated use `Method$outboundSchema` instead. */ - export const outboundSchema = Method$outboundSchema; -} diff --git a/src/models/components/rule.ts b/src/models/components/rule.ts deleted file mode 100644 index 6dce7b3..0000000 --- a/src/models/components/rule.ts +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type Rule = { - uid: string; - title?: string | undefined; - description?: string | undefined; - slug: string; - namespace: string; - isPrivate?: boolean | undefined; -}; - -/** @internal */ -export const Rule$inboundSchema: z.ZodType = z - .object({ - uid: z.string(), - title: z.string().default(""), - description: z.string().default(""), - slug: z.string(), - namespace: z.string(), - isPrivate: z.boolean().default(false), - }); - -/** @internal */ -export type Rule$Outbound = { - uid: string; - title: string; - description: string; - slug: string; - namespace: string; - isPrivate: boolean; -}; - -/** @internal */ -export const Rule$outboundSchema: z.ZodType = - z.object({ - uid: z.string(), - title: z.string().default(""), - description: z.string().default(""), - slug: z.string(), - namespace: z.string(), - isPrivate: z.boolean().default(false), - }); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace Rule$ { - /** @deprecated use `Rule$inboundSchema` instead. */ - export const inboundSchema = Rule$inboundSchema; - /** @deprecated use `Rule$outboundSchema` instead. */ - export const outboundSchema = Rule$outboundSchema; - /** @deprecated use `Rule$Outbound` instead. */ - export type Outbound = Rule$Outbound; -} - -export function ruleToJSON(rule: Rule): string { - return JSON.stringify(Rule$outboundSchema.parse(rule)); -} - -export function ruleFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => Rule$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'Rule' from JSON`, - ); -} diff --git a/src/models/components/schema.ts b/src/models/components/schema.ts deleted file mode 100644 index 9b6c68b..0000000 --- a/src/models/components/schema.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; -import { - ManagedSchemaVersion, - ManagedSchemaVersion$inboundSchema, - ManagedSchemaVersion$Outbound, - ManagedSchemaVersion$outboundSchema, -} from "./managedschemaversion.js"; - -export type Schema = { - uid: string; - title?: string | undefined; - description?: string | undefined; - slug: string; - namespace: string; - isPrivate?: boolean | undefined; - versions: Array; -}; - -/** @internal */ -export const Schema$inboundSchema: z.ZodType = z - .object({ - uid: z.string(), - title: z.string().default(""), - description: z.string().default(""), - slug: z.string(), - namespace: z.string(), - isPrivate: z.boolean().default(false), - versions: z.array(ManagedSchemaVersion$inboundSchema), - }); - -/** @internal */ -export type Schema$Outbound = { - uid: string; - title: string; - description: string; - slug: string; - namespace: string; - isPrivate: boolean; - versions: Array; -}; - -/** @internal */ -export const Schema$outboundSchema: z.ZodType< - Schema$Outbound, - z.ZodTypeDef, - Schema -> = z.object({ - uid: z.string(), - title: z.string().default(""), - description: z.string().default(""), - slug: z.string(), - namespace: z.string(), - isPrivate: z.boolean().default(false), - versions: z.array(ManagedSchemaVersion$outboundSchema), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace Schema$ { - /** @deprecated use `Schema$inboundSchema` instead. */ - export const inboundSchema = Schema$inboundSchema; - /** @deprecated use `Schema$outboundSchema` instead. */ - export const outboundSchema = Schema$outboundSchema; - /** @deprecated use `Schema$Outbound` instead. */ - export type Outbound = Schema$Outbound; -} - -export function schemaToJSON(schema: Schema): string { - return JSON.stringify(Schema$outboundSchema.parse(schema)); -} - -export function schemaFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => Schema$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'Schema' from JSON`, - ); -} diff --git a/src/models/components/security.ts b/src/models/components/security.ts deleted file mode 100644 index c88c60c..0000000 --- a/src/models/components/security.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type Security = { - bearerAuth?: string | undefined; -}; - -/** @internal */ -export const Security$inboundSchema: z.ZodType< - Security, - z.ZodTypeDef, - unknown -> = z.object({ - BearerAuth: z.string().optional(), -}).transform((v) => { - return remap$(v, { - "BearerAuth": "bearerAuth", - }); -}); - -/** @internal */ -export type Security$Outbound = { - BearerAuth?: string | undefined; -}; - -/** @internal */ -export const Security$outboundSchema: z.ZodType< - Security$Outbound, - z.ZodTypeDef, - Security -> = z.object({ - bearerAuth: z.string().optional(), -}).transform((v) => { - return remap$(v, { - bearerAuth: "BearerAuth", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace Security$ { - /** @deprecated use `Security$inboundSchema` instead. */ - export const inboundSchema = Security$inboundSchema; - /** @deprecated use `Security$outboundSchema` instead. */ - export const outboundSchema = Security$outboundSchema; - /** @deprecated use `Security$Outbound` instead. */ - export type Outbound = Security$Outbound; -} - -export function securityToJSON(security: Security): string { - return JSON.stringify(Security$outboundSchema.parse(security)); -} - -export function securityFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => Security$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'Security' from JSON`, - ); -} diff --git a/src/models/components/team.ts b/src/models/components/team.ts deleted file mode 100644 index ec0c011..0000000 --- a/src/models/components/team.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type Team = { - uid: string; - name: string; - imageUri?: string | undefined; - slug: string; - theme: string; -}; - -/** @internal */ -export const Team$inboundSchema: z.ZodType = z - .object({ - uid: z.string(), - name: z.string(), - imageUri: z.string().optional(), - slug: z.string(), - theme: z.string(), - }); - -/** @internal */ -export type Team$Outbound = { - uid: string; - name: string; - imageUri?: string | undefined; - slug: string; - theme: string; -}; - -/** @internal */ -export const Team$outboundSchema: z.ZodType = - z.object({ - uid: z.string(), - name: z.string(), - imageUri: z.string().optional(), - slug: z.string(), - theme: z.string(), - }); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace Team$ { - /** @deprecated use `Team$inboundSchema` instead. */ - export const inboundSchema = Team$inboundSchema; - /** @deprecated use `Team$outboundSchema` instead. */ - export const outboundSchema = Team$outboundSchema; - /** @deprecated use `Team$Outbound` instead. */ - export type Outbound = Team$Outbound; -} - -export function teamToJSON(team: Team): string { - return JSON.stringify(Team$outboundSchema.parse(team)); -} - -export function teamFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => Team$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'Team' from JSON`, - ); -} diff --git a/src/models/components/teamsummary.ts b/src/models/components/teamsummary.ts deleted file mode 100644 index aa67cc0..0000000 --- a/src/models/components/teamsummary.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type TeamSummary = { - uid: string; - name: string; - imageUri?: string | undefined; -}; - -/** @internal */ -export const TeamSummary$inboundSchema: z.ZodType< - TeamSummary, - z.ZodTypeDef, - unknown -> = z.object({ - uid: z.string(), - name: z.string(), - imageUri: z.string().optional(), -}); - -/** @internal */ -export type TeamSummary$Outbound = { - uid: string; - name: string; - imageUri?: string | undefined; -}; - -/** @internal */ -export const TeamSummary$outboundSchema: z.ZodType< - TeamSummary$Outbound, - z.ZodTypeDef, - TeamSummary -> = z.object({ - uid: z.string(), - name: z.string(), - imageUri: z.string().optional(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace TeamSummary$ { - /** @deprecated use `TeamSummary$inboundSchema` instead. */ - export const inboundSchema = TeamSummary$inboundSchema; - /** @deprecated use `TeamSummary$outboundSchema` instead. */ - export const outboundSchema = TeamSummary$outboundSchema; - /** @deprecated use `TeamSummary$Outbound` instead. */ - export type Outbound = TeamSummary$Outbound; -} - -export function teamSummaryToJSON(teamSummary: TeamSummary): string { - return JSON.stringify(TeamSummary$outboundSchema.parse(teamSummary)); -} - -export function teamSummaryFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => TeamSummary$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'TeamSummary' from JSON`, - ); -} diff --git a/src/models/components/theme.ts b/src/models/components/theme.ts deleted file mode 100644 index e9688c5..0000000 --- a/src/models/components/theme.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type Theme = { - uid: string; - name: string; - description: string; - slug: string; -}; - -/** @internal */ -export const Theme$inboundSchema: z.ZodType = z - .object({ - uid: z.string(), - name: z.string(), - description: z.string(), - slug: z.string(), - }); - -/** @internal */ -export type Theme$Outbound = { - uid: string; - name: string; - description: string; - slug: string; -}; - -/** @internal */ -export const Theme$outboundSchema: z.ZodType< - Theme$Outbound, - z.ZodTypeDef, - Theme -> = z.object({ - uid: z.string(), - name: z.string(), - description: z.string(), - slug: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace Theme$ { - /** @deprecated use `Theme$inboundSchema` instead. */ - export const inboundSchema = Theme$inboundSchema; - /** @deprecated use `Theme$outboundSchema` instead. */ - export const outboundSchema = Theme$outboundSchema; - /** @deprecated use `Theme$Outbound` instead. */ - export type Outbound = Theme$Outbound; -} - -export function themeToJSON(theme: Theme): string { - return JSON.stringify(Theme$outboundSchema.parse(theme)); -} - -export function themeFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => Theme$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'Theme' from JSON`, - ); -} diff --git a/src/models/components/uid.ts b/src/models/components/uid.ts deleted file mode 100644 index e182eff..0000000 --- a/src/models/components/uid.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type Uid = { - uid: string; -}; - -/** @internal */ -export const Uid$inboundSchema: z.ZodType = z - .object({ - uid: z.string(), - }); - -/** @internal */ -export type Uid$Outbound = { - uid: string; -}; - -/** @internal */ -export const Uid$outboundSchema: z.ZodType = z - .object({ - uid: z.string(), - }); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace Uid$ { - /** @deprecated use `Uid$inboundSchema` instead. */ - export const inboundSchema = Uid$inboundSchema; - /** @deprecated use `Uid$outboundSchema` instead. */ - export const outboundSchema = Uid$outboundSchema; - /** @deprecated use `Uid$Outbound` instead. */ - export type Outbound = Uid$Outbound; -} - -export function uidToJSON(uid: Uid): string { - return JSON.stringify(Uid$outboundSchema.parse(uid)); -} - -export function uidFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => Uid$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'Uid' from JSON`, - ); -} diff --git a/src/models/components/user.ts b/src/models/components/user.ts deleted file mode 100644 index a0bb69d..0000000 --- a/src/models/components/user.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; -import { - TeamSummary, - TeamSummary$inboundSchema, - TeamSummary$Outbound, - TeamSummary$outboundSchema, -} from "./teamsummary.js"; - -export type User = { - uid: string; - createdAt: number; - updatedAt: number; - email: string; - theme?: string | undefined; - activeTeamId: string | null; - hasGithub?: boolean | undefined; - teams: Array; -}; - -/** @internal */ -export const User$inboundSchema: z.ZodType = z - .object({ - uid: z.string(), - createdAt: z.number().int(), - updatedAt: z.number().int(), - email: z.string(), - theme: z.string().optional(), - activeTeamId: z.nullable(z.string()), - hasGithub: z.boolean().default(false), - teams: z.array(TeamSummary$inboundSchema), - }); - -/** @internal */ -export type User$Outbound = { - uid: string; - createdAt: number; - updatedAt: number; - email: string; - theme?: string | undefined; - activeTeamId: string | null; - hasGithub: boolean; - teams: Array; -}; - -/** @internal */ -export const User$outboundSchema: z.ZodType = - z.object({ - uid: z.string(), - createdAt: z.number().int(), - updatedAt: z.number().int(), - email: z.string(), - theme: z.string().optional(), - activeTeamId: z.nullable(z.string()), - hasGithub: z.boolean().default(false), - teams: z.array(TeamSummary$outboundSchema), - }); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace User$ { - /** @deprecated use `User$inboundSchema` instead. */ - export const inboundSchema = User$inboundSchema; - /** @deprecated use `User$outboundSchema` instead. */ - export const outboundSchema = User$outboundSchema; - /** @deprecated use `User$Outbound` instead. */ - export type Outbound = User$Outbound; -} - -export function userToJSON(user: User): string { - return JSON.stringify(User$outboundSchema.parse(user)); -} - -export function userFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => User$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'User' from JSON`, - ); -} diff --git a/src/models/errors/apierror.ts b/src/models/errors/apierror.ts deleted file mode 100644 index 8d3d0e8..0000000 --- a/src/models/errors/apierror.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ScalarError } from "./scalarerror.js"; - -/** The fallback error class if no more specific error class is matched */ -export class APIError extends ScalarError { - constructor( - message: string, - httpMeta: { - response: Response; - request: Request; - body: string; - }, - ) { - if (message) { - message += `: `; - } - message += `Status ${httpMeta.response.status}`; - const contentType = httpMeta.response.headers.get("content-type") || `""`; - if (contentType !== "application/json") { - message += ` Content-Type ${ - contentType.includes(" ") ? `"${contentType}"` : contentType - }`; - } - const body = httpMeta.body || `""`; - message += body.length > 100 ? "\n" : " "; - message += `Body ${body}`; - message = message.trim(); - super(message, httpMeta); - this.name = "APIError"; - } -} diff --git a/src/models/errors/fivehundred.ts b/src/models/errors/fivehundred.ts deleted file mode 100644 index 93e249b..0000000 --- a/src/models/errors/fivehundred.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ScalarError } from "./scalarerror.js"; - -export type FiveHundredData = { - message: string; - code: string; -}; - -export class FiveHundred extends ScalarError { - code: string; - - /** The original data that was passed to this error instance. */ - data$: FiveHundredData; - - constructor( - err: FiveHundredData, - httpMeta: { response: Response; request: Request; body: string }, - ) { - const message = "message" in err && typeof err.message === "string" - ? err.message - : `API error occurred: ${JSON.stringify(err)}`; - super(message, httpMeta); - this.data$ = err; - this.code = err.code; - - this.name = "FiveHundred"; - } -} - -/** @internal */ -export const FiveHundred$inboundSchema: z.ZodType< - FiveHundred, - z.ZodTypeDef, - unknown -> = z.object({ - message: z.string(), - code: z.string(), - request$: z.instanceof(Request), - response$: z.instanceof(Response), - body$: z.string(), -}) - .transform((v) => { - return new FiveHundred(v, { - request: v.request$, - response: v.response$, - body: v.body$, - }); - }); - -/** @internal */ -export type FiveHundred$Outbound = { - message: string; - code: string; -}; - -/** @internal */ -export const FiveHundred$outboundSchema: z.ZodType< - FiveHundred$Outbound, - z.ZodTypeDef, - FiveHundred -> = z.instanceof(FiveHundred) - .transform(v => v.data$) - .pipe(z.object({ - message: z.string(), - code: z.string(), - })); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace FiveHundred$ { - /** @deprecated use `FiveHundred$inboundSchema` instead. */ - export const inboundSchema = FiveHundred$inboundSchema; - /** @deprecated use `FiveHundred$outboundSchema` instead. */ - export const outboundSchema = FiveHundred$outboundSchema; - /** @deprecated use `FiveHundred$Outbound` instead. */ - export type Outbound = FiveHundred$Outbound; -} diff --git a/src/models/errors/fourhundred.ts b/src/models/errors/fourhundred.ts deleted file mode 100644 index b39b338..0000000 --- a/src/models/errors/fourhundred.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ScalarError } from "./scalarerror.js"; - -export type FourHundredData = { - message: string; - code: string; -}; - -export class FourHundred extends ScalarError { - code: string; - - /** The original data that was passed to this error instance. */ - data$: FourHundredData; - - constructor( - err: FourHundredData, - httpMeta: { response: Response; request: Request; body: string }, - ) { - const message = "message" in err && typeof err.message === "string" - ? err.message - : `API error occurred: ${JSON.stringify(err)}`; - super(message, httpMeta); - this.data$ = err; - this.code = err.code; - - this.name = "FourHundred"; - } -} - -/** @internal */ -export const FourHundred$inboundSchema: z.ZodType< - FourHundred, - z.ZodTypeDef, - unknown -> = z.object({ - message: z.string(), - code: z.string(), - request$: z.instanceof(Request), - response$: z.instanceof(Response), - body$: z.string(), -}) - .transform((v) => { - return new FourHundred(v, { - request: v.request$, - response: v.response$, - body: v.body$, - }); - }); - -/** @internal */ -export type FourHundred$Outbound = { - message: string; - code: string; -}; - -/** @internal */ -export const FourHundred$outboundSchema: z.ZodType< - FourHundred$Outbound, - z.ZodTypeDef, - FourHundred -> = z.instanceof(FourHundred) - .transform(v => v.data$) - .pipe(z.object({ - message: z.string(), - code: z.string(), - })); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace FourHundred$ { - /** @deprecated use `FourHundred$inboundSchema` instead. */ - export const inboundSchema = FourHundred$inboundSchema; - /** @deprecated use `FourHundred$outboundSchema` instead. */ - export const outboundSchema = FourHundred$outboundSchema; - /** @deprecated use `FourHundred$Outbound` instead. */ - export type Outbound = FourHundred$Outbound; -} diff --git a/src/models/errors/fourhundredandfour.ts b/src/models/errors/fourhundredandfour.ts deleted file mode 100644 index cda8b06..0000000 --- a/src/models/errors/fourhundredandfour.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ScalarError } from "./scalarerror.js"; - -export type FourHundredAndFourData = { - message: string; - code: string; -}; - -export class FourHundredAndFour extends ScalarError { - code: string; - - /** The original data that was passed to this error instance. */ - data$: FourHundredAndFourData; - - constructor( - err: FourHundredAndFourData, - httpMeta: { response: Response; request: Request; body: string }, - ) { - const message = "message" in err && typeof err.message === "string" - ? err.message - : `API error occurred: ${JSON.stringify(err)}`; - super(message, httpMeta); - this.data$ = err; - this.code = err.code; - - this.name = "FourHundredAndFour"; - } -} - -/** @internal */ -export const FourHundredAndFour$inboundSchema: z.ZodType< - FourHundredAndFour, - z.ZodTypeDef, - unknown -> = z.object({ - message: z.string(), - code: z.string(), - request$: z.instanceof(Request), - response$: z.instanceof(Response), - body$: z.string(), -}) - .transform((v) => { - return new FourHundredAndFour(v, { - request: v.request$, - response: v.response$, - body: v.body$, - }); - }); - -/** @internal */ -export type FourHundredAndFour$Outbound = { - message: string; - code: string; -}; - -/** @internal */ -export const FourHundredAndFour$outboundSchema: z.ZodType< - FourHundredAndFour$Outbound, - z.ZodTypeDef, - FourHundredAndFour -> = z.instanceof(FourHundredAndFour) - .transform(v => v.data$) - .pipe(z.object({ - message: z.string(), - code: z.string(), - })); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace FourHundredAndFour$ { - /** @deprecated use `FourHundredAndFour$inboundSchema` instead. */ - export const inboundSchema = FourHundredAndFour$inboundSchema; - /** @deprecated use `FourHundredAndFour$outboundSchema` instead. */ - export const outboundSchema = FourHundredAndFour$outboundSchema; - /** @deprecated use `FourHundredAndFour$Outbound` instead. */ - export type Outbound = FourHundredAndFour$Outbound; -} diff --git a/src/models/errors/fourhundredandone.ts b/src/models/errors/fourhundredandone.ts deleted file mode 100644 index 41980a9..0000000 --- a/src/models/errors/fourhundredandone.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ScalarError } from "./scalarerror.js"; - -export type FourHundredAndOneData = { - message: string; - code: string; -}; - -export class FourHundredAndOne extends ScalarError { - code: string; - - /** The original data that was passed to this error instance. */ - data$: FourHundredAndOneData; - - constructor( - err: FourHundredAndOneData, - httpMeta: { response: Response; request: Request; body: string }, - ) { - const message = "message" in err && typeof err.message === "string" - ? err.message - : `API error occurred: ${JSON.stringify(err)}`; - super(message, httpMeta); - this.data$ = err; - this.code = err.code; - - this.name = "FourHundredAndOne"; - } -} - -/** @internal */ -export const FourHundredAndOne$inboundSchema: z.ZodType< - FourHundredAndOne, - z.ZodTypeDef, - unknown -> = z.object({ - message: z.string(), - code: z.string(), - request$: z.instanceof(Request), - response$: z.instanceof(Response), - body$: z.string(), -}) - .transform((v) => { - return new FourHundredAndOne(v, { - request: v.request$, - response: v.response$, - body: v.body$, - }); - }); - -/** @internal */ -export type FourHundredAndOne$Outbound = { - message: string; - code: string; -}; - -/** @internal */ -export const FourHundredAndOne$outboundSchema: z.ZodType< - FourHundredAndOne$Outbound, - z.ZodTypeDef, - FourHundredAndOne -> = z.instanceof(FourHundredAndOne) - .transform(v => v.data$) - .pipe(z.object({ - message: z.string(), - code: z.string(), - })); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace FourHundredAndOne$ { - /** @deprecated use `FourHundredAndOne$inboundSchema` instead. */ - export const inboundSchema = FourHundredAndOne$inboundSchema; - /** @deprecated use `FourHundredAndOne$outboundSchema` instead. */ - export const outboundSchema = FourHundredAndOne$outboundSchema; - /** @deprecated use `FourHundredAndOne$Outbound` instead. */ - export type Outbound = FourHundredAndOne$Outbound; -} diff --git a/src/models/errors/fourhundredandthree.ts b/src/models/errors/fourhundredandthree.ts deleted file mode 100644 index 9f66293..0000000 --- a/src/models/errors/fourhundredandthree.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ScalarError } from "./scalarerror.js"; - -export type FourHundredAndThreeData = { - message: string; - code: string; -}; - -export class FourHundredAndThree extends ScalarError { - code: string; - - /** The original data that was passed to this error instance. */ - data$: FourHundredAndThreeData; - - constructor( - err: FourHundredAndThreeData, - httpMeta: { response: Response; request: Request; body: string }, - ) { - const message = "message" in err && typeof err.message === "string" - ? err.message - : `API error occurred: ${JSON.stringify(err)}`; - super(message, httpMeta); - this.data$ = err; - this.code = err.code; - - this.name = "FourHundredAndThree"; - } -} - -/** @internal */ -export const FourHundredAndThree$inboundSchema: z.ZodType< - FourHundredAndThree, - z.ZodTypeDef, - unknown -> = z.object({ - message: z.string(), - code: z.string(), - request$: z.instanceof(Request), - response$: z.instanceof(Response), - body$: z.string(), -}) - .transform((v) => { - return new FourHundredAndThree(v, { - request: v.request$, - response: v.response$, - body: v.body$, - }); - }); - -/** @internal */ -export type FourHundredAndThree$Outbound = { - message: string; - code: string; -}; - -/** @internal */ -export const FourHundredAndThree$outboundSchema: z.ZodType< - FourHundredAndThree$Outbound, - z.ZodTypeDef, - FourHundredAndThree -> = z.instanceof(FourHundredAndThree) - .transform(v => v.data$) - .pipe(z.object({ - message: z.string(), - code: z.string(), - })); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace FourHundredAndThree$ { - /** @deprecated use `FourHundredAndThree$inboundSchema` instead. */ - export const inboundSchema = FourHundredAndThree$inboundSchema; - /** @deprecated use `FourHundredAndThree$outboundSchema` instead. */ - export const outboundSchema = FourHundredAndThree$outboundSchema; - /** @deprecated use `FourHundredAndThree$Outbound` instead. */ - export type Outbound = FourHundredAndThree$Outbound; -} diff --git a/src/models/errors/fourhundredandtwentytwo.ts b/src/models/errors/fourhundredandtwentytwo.ts deleted file mode 100644 index aa80ee2..0000000 --- a/src/models/errors/fourhundredandtwentytwo.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ScalarError } from "./scalarerror.js"; - -export type FourHundredAndTwentyTwoData = { - message: string; - code: string; -}; - -export class FourHundredAndTwentyTwo extends ScalarError { - code: string; - - /** The original data that was passed to this error instance. */ - data$: FourHundredAndTwentyTwoData; - - constructor( - err: FourHundredAndTwentyTwoData, - httpMeta: { response: Response; request: Request; body: string }, - ) { - const message = "message" in err && typeof err.message === "string" - ? err.message - : `API error occurred: ${JSON.stringify(err)}`; - super(message, httpMeta); - this.data$ = err; - this.code = err.code; - - this.name = "FourHundredAndTwentyTwo"; - } -} - -/** @internal */ -export const FourHundredAndTwentyTwo$inboundSchema: z.ZodType< - FourHundredAndTwentyTwo, - z.ZodTypeDef, - unknown -> = z.object({ - message: z.string(), - code: z.string(), - request$: z.instanceof(Request), - response$: z.instanceof(Response), - body$: z.string(), -}) - .transform((v) => { - return new FourHundredAndTwentyTwo(v, { - request: v.request$, - response: v.response$, - body: v.body$, - }); - }); - -/** @internal */ -export type FourHundredAndTwentyTwo$Outbound = { - message: string; - code: string; -}; - -/** @internal */ -export const FourHundredAndTwentyTwo$outboundSchema: z.ZodType< - FourHundredAndTwentyTwo$Outbound, - z.ZodTypeDef, - FourHundredAndTwentyTwo -> = z.instanceof(FourHundredAndTwentyTwo) - .transform(v => v.data$) - .pipe(z.object({ - message: z.string(), - code: z.string(), - })); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace FourHundredAndTwentyTwo$ { - /** @deprecated use `FourHundredAndTwentyTwo$inboundSchema` instead. */ - export const inboundSchema = FourHundredAndTwentyTwo$inboundSchema; - /** @deprecated use `FourHundredAndTwentyTwo$outboundSchema` instead. */ - export const outboundSchema = FourHundredAndTwentyTwo$outboundSchema; - /** @deprecated use `FourHundredAndTwentyTwo$Outbound` instead. */ - export type Outbound = FourHundredAndTwentyTwo$Outbound; -} diff --git a/src/models/errors/httpclienterrors.ts b/src/models/errors/httpclienterrors.ts deleted file mode 100644 index b34f612..0000000 --- a/src/models/errors/httpclienterrors.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -/** - * Base class for all HTTP errors. - */ -export class HTTPClientError extends Error { - /** The underlying cause of the error. */ - override readonly cause: unknown; - override name = "HTTPClientError"; - constructor(message: string, opts?: { cause?: unknown }) { - let msg = message; - if (opts?.cause) { - msg += `: ${opts.cause}`; - } - - super(msg, opts); - // In older runtimes, the cause field would not have been assigned through - // the super() call. - if (typeof this.cause === "undefined") { - this.cause = opts?.cause; - } - } -} - -/** - * An error to capture unrecognised or unexpected errors when making HTTP calls. - */ -export class UnexpectedClientError extends HTTPClientError { - override name = "UnexpectedClientError"; -} - -/** - * An error that is raised when any inputs used to create a request are invalid. - */ -export class InvalidRequestError extends HTTPClientError { - override name = "InvalidRequestError"; -} - -/** - * An error that is raised when a HTTP request was aborted by the client error. - */ -export class RequestAbortedError extends HTTPClientError { - override readonly name = "RequestAbortedError"; -} - -/** - * An error that is raised when a HTTP request timed out due to an AbortSignal - * signal timeout. - */ -export class RequestTimeoutError extends HTTPClientError { - override readonly name = "RequestTimeoutError"; -} - -/** - * An error that is raised when a HTTP client is unable to make a request to - * a server. - */ -export class ConnectionError extends HTTPClientError { - override readonly name = "ConnectionError"; -} diff --git a/src/models/errors/index.ts b/src/models/errors/index.ts deleted file mode 100644 index b198fcc..0000000 --- a/src/models/errors/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -export * from "./apierror.js"; -export * from "./fivehundred.js"; -export * from "./fourhundred.js"; -export * from "./fourhundredandfour.js"; -export * from "./fourhundredandone.js"; -export * from "./fourhundredandthree.js"; -export * from "./fourhundredandtwentytwo.js"; -export * from "./httpclienterrors.js"; -export * from "./responsevalidationerror.js"; -export * from "./sdkvalidationerror.js"; diff --git a/src/models/errors/responsevalidationerror.ts b/src/models/errors/responsevalidationerror.ts deleted file mode 100644 index e494c36..0000000 --- a/src/models/errors/responsevalidationerror.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ScalarError } from "./scalarerror.js"; -import { formatZodError } from "./sdkvalidationerror.js"; - -export class ResponseValidationError extends ScalarError { - /** - * The raw value that failed validation. - */ - public readonly rawValue: unknown; - - /** - * The raw message that failed validation. - */ - public readonly rawMessage: unknown; - - constructor( - message: string, - extra: { - response: Response; - request: Request; - body: string; - cause: unknown; - rawValue: unknown; - rawMessage: unknown; - }, - ) { - super(message, extra); - this.name = "ResponseValidationError"; - this.cause = extra.cause; - this.rawValue = extra.rawValue; - this.rawMessage = extra.rawMessage; - } - - /** - * Return a pretty-formatted error message if the underlying validation error - * is a ZodError or some other recognized error type, otherwise return the - * default error message. - */ - public pretty(): string { - if (this.cause instanceof z.ZodError) { - return `${this.rawMessage}\n${formatZodError(this.cause)}`; - } else { - return this.toString(); - } - } -} diff --git a/src/models/errors/scalarerror.ts b/src/models/errors/scalarerror.ts deleted file mode 100644 index 78c9ebf..0000000 --- a/src/models/errors/scalarerror.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -/** The base class for all HTTP error responses */ -export class ScalarError extends Error { - /** HTTP meta data */ - public readonly httpMeta: { - response: Response; - request: Request; - body: string; - }; - - constructor( - message: string, - httpMeta: { - response: Response; - request: Request; - body: string; - }, - ) { - super(message); - this.httpMeta = httpMeta; - - this.name = "ScalarError"; - } -} diff --git a/src/models/errors/sdkvalidationerror.ts b/src/models/errors/sdkvalidationerror.ts deleted file mode 100644 index 37face8..0000000 --- a/src/models/errors/sdkvalidationerror.ts +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; - -export class SDKValidationError extends Error { - /** - * The raw value that failed validation. - */ - public readonly rawValue: unknown; - - /** - * The raw message that failed validation. - */ - public readonly rawMessage: unknown; - - // Allows for backwards compatibility for `instanceof` checks of `ResponseValidationError` - static override [Symbol.hasInstance]( - instance: unknown, - ): instance is SDKValidationError { - if (!(instance instanceof Error)) return false; - if (!("rawValue" in instance)) return false; - if (!("rawMessage" in instance)) return false; - if (!("pretty" in instance)) return false; - if (typeof instance.pretty !== "function") return false; - return true; - } - - constructor(message: string, cause: unknown, rawValue: unknown) { - super(`${message}: ${cause}`); - this.name = "SDKValidationError"; - this.cause = cause; - this.rawValue = rawValue; - this.rawMessage = message; - } - - /** - * Return a pretty-formatted error message if the underlying validation error - * is a ZodError or some other recognized error type, otherwise return the - * default error message. - */ - public pretty(): string { - if (this.cause instanceof z.ZodError) { - return `${this.rawMessage}\n${formatZodError(this.cause)}`; - } else { - return this.toString(); - } - } -} - -export function formatZodError(err: z.ZodError, level = 0): string { - let pre = " ".repeat(level); - pre = level > 0 ? `│${pre}` : pre; - pre += " ".repeat(level); - - let message = ""; - const append = (str: string) => (message += `\n${pre}${str}`); - - const len = err.issues.length; - const headline = len === 1 ? `${len} issue found` : `${len} issues found`; - - if (len) { - append(`┌ ${headline}:`); - } - - for (const issue of err.issues) { - let path = issue.path.join("."); - path = path ? `.${path}` : ""; - append(`│ • [${path}]: ${issue.message} (${issue.code})`); - switch (issue.code) { - case "invalid_literal": - case "invalid_type": { - append(`│ Want: ${issue.expected}`); - append(`│ Got: ${issue.received}`); - break; - } - case "unrecognized_keys": { - append(`│ Keys: ${issue.keys.join(", ")}`); - break; - } - case "invalid_enum_value": { - append(`│ Allowed: ${issue.options.join(", ")}`); - append(`│ Got: ${issue.received}`); - break; - } - case "invalid_union_discriminator": { - append(`│ Allowed: ${issue.options.join(", ")}`); - break; - } - case "invalid_union": { - const len = issue.unionErrors.length; - append( - `│ ✖︎ Attemped to deserialize into one of ${len} union members:`, - ); - issue.unionErrors.forEach((err, i) => { - append(`│ ✖︎ Member ${i + 1} of ${len}`); - append(`${formatZodError(err, level + 1)}`); - }); - } - } - } - - if (err.issues.length) { - append(`└─*`); - } - - return message.slice(1); -} diff --git a/src/models/operations/addapidocumentaccessgroup.ts b/src/models/operations/addapidocumentaccessgroup.ts deleted file mode 100644 index fd8e813..0000000 --- a/src/models/operations/addapidocumentaccessgroup.ts +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type AddApiDocumentAccessGroupRequest = { - namespace: string; - slug: string; - accessGroup: components.AccessGroup; -}; - -export type AddApiDocumentAccessGroupResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const AddApiDocumentAccessGroupRequest$inboundSchema: z.ZodType< - AddApiDocumentAccessGroupRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - "access-group": components.AccessGroup$inboundSchema, -}).transform((v) => { - return remap$(v, { - "access-group": "accessGroup", - }); -}); - -/** @internal */ -export type AddApiDocumentAccessGroupRequest$Outbound = { - namespace: string; - slug: string; - "access-group": components.AccessGroup$Outbound; -}; - -/** @internal */ -export const AddApiDocumentAccessGroupRequest$outboundSchema: z.ZodType< - AddApiDocumentAccessGroupRequest$Outbound, - z.ZodTypeDef, - AddApiDocumentAccessGroupRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - accessGroup: components.AccessGroup$outboundSchema, -}).transform((v) => { - return remap$(v, { - accessGroup: "access-group", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace AddApiDocumentAccessGroupRequest$ { - /** @deprecated use `AddApiDocumentAccessGroupRequest$inboundSchema` instead. */ - export const inboundSchema = AddApiDocumentAccessGroupRequest$inboundSchema; - /** @deprecated use `AddApiDocumentAccessGroupRequest$outboundSchema` instead. */ - export const outboundSchema = AddApiDocumentAccessGroupRequest$outboundSchema; - /** @deprecated use `AddApiDocumentAccessGroupRequest$Outbound` instead. */ - export type Outbound = AddApiDocumentAccessGroupRequest$Outbound; -} - -export function addApiDocumentAccessGroupRequestToJSON( - addApiDocumentAccessGroupRequest: AddApiDocumentAccessGroupRequest, -): string { - return JSON.stringify( - AddApiDocumentAccessGroupRequest$outboundSchema.parse( - addApiDocumentAccessGroupRequest, - ), - ); -} - -export function addApiDocumentAccessGroupRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => AddApiDocumentAccessGroupRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'AddApiDocumentAccessGroupRequest' from JSON`, - ); -} - -/** @internal */ -export const AddApiDocumentAccessGroupResponse$inboundSchema: z.ZodType< - AddApiDocumentAccessGroupResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type AddApiDocumentAccessGroupResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const AddApiDocumentAccessGroupResponse$outboundSchema: z.ZodType< - AddApiDocumentAccessGroupResponse$Outbound, - z.ZodTypeDef, - AddApiDocumentAccessGroupResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace AddApiDocumentAccessGroupResponse$ { - /** @deprecated use `AddApiDocumentAccessGroupResponse$inboundSchema` instead. */ - export const inboundSchema = AddApiDocumentAccessGroupResponse$inboundSchema; - /** @deprecated use `AddApiDocumentAccessGroupResponse$outboundSchema` instead. */ - export const outboundSchema = - AddApiDocumentAccessGroupResponse$outboundSchema; - /** @deprecated use `AddApiDocumentAccessGroupResponse$Outbound` instead. */ - export type Outbound = AddApiDocumentAccessGroupResponse$Outbound; -} - -export function addApiDocumentAccessGroupResponseToJSON( - addApiDocumentAccessGroupResponse: AddApiDocumentAccessGroupResponse, -): string { - return JSON.stringify( - AddApiDocumentAccessGroupResponse$outboundSchema.parse( - addApiDocumentAccessGroupResponse, - ), - ); -} - -export function addApiDocumentAccessGroupResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => AddApiDocumentAccessGroupResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'AddApiDocumentAccessGroupResponse' from JSON`, - ); -} diff --git a/src/models/operations/addrulesetaccessgroup.ts b/src/models/operations/addrulesetaccessgroup.ts deleted file mode 100644 index a2f50c3..0000000 --- a/src/models/operations/addrulesetaccessgroup.ts +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type AddRulesetAccessGroupRequest = { - namespace: string; - slug: string; - accessGroup: components.AccessGroup; -}; - -export type AddRulesetAccessGroupResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const AddRulesetAccessGroupRequest$inboundSchema: z.ZodType< - AddRulesetAccessGroupRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - "access-group": components.AccessGroup$inboundSchema, -}).transform((v) => { - return remap$(v, { - "access-group": "accessGroup", - }); -}); - -/** @internal */ -export type AddRulesetAccessGroupRequest$Outbound = { - namespace: string; - slug: string; - "access-group": components.AccessGroup$Outbound; -}; - -/** @internal */ -export const AddRulesetAccessGroupRequest$outboundSchema: z.ZodType< - AddRulesetAccessGroupRequest$Outbound, - z.ZodTypeDef, - AddRulesetAccessGroupRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - accessGroup: components.AccessGroup$outboundSchema, -}).transform((v) => { - return remap$(v, { - accessGroup: "access-group", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace AddRulesetAccessGroupRequest$ { - /** @deprecated use `AddRulesetAccessGroupRequest$inboundSchema` instead. */ - export const inboundSchema = AddRulesetAccessGroupRequest$inboundSchema; - /** @deprecated use `AddRulesetAccessGroupRequest$outboundSchema` instead. */ - export const outboundSchema = AddRulesetAccessGroupRequest$outboundSchema; - /** @deprecated use `AddRulesetAccessGroupRequest$Outbound` instead. */ - export type Outbound = AddRulesetAccessGroupRequest$Outbound; -} - -export function addRulesetAccessGroupRequestToJSON( - addRulesetAccessGroupRequest: AddRulesetAccessGroupRequest, -): string { - return JSON.stringify( - AddRulesetAccessGroupRequest$outboundSchema.parse( - addRulesetAccessGroupRequest, - ), - ); -} - -export function addRulesetAccessGroupRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => AddRulesetAccessGroupRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'AddRulesetAccessGroupRequest' from JSON`, - ); -} - -/** @internal */ -export const AddRulesetAccessGroupResponse$inboundSchema: z.ZodType< - AddRulesetAccessGroupResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type AddRulesetAccessGroupResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const AddRulesetAccessGroupResponse$outboundSchema: z.ZodType< - AddRulesetAccessGroupResponse$Outbound, - z.ZodTypeDef, - AddRulesetAccessGroupResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace AddRulesetAccessGroupResponse$ { - /** @deprecated use `AddRulesetAccessGroupResponse$inboundSchema` instead. */ - export const inboundSchema = AddRulesetAccessGroupResponse$inboundSchema; - /** @deprecated use `AddRulesetAccessGroupResponse$outboundSchema` instead. */ - export const outboundSchema = AddRulesetAccessGroupResponse$outboundSchema; - /** @deprecated use `AddRulesetAccessGroupResponse$Outbound` instead. */ - export type Outbound = AddRulesetAccessGroupResponse$Outbound; -} - -export function addRulesetAccessGroupResponseToJSON( - addRulesetAccessGroupResponse: AddRulesetAccessGroupResponse, -): string { - return JSON.stringify( - AddRulesetAccessGroupResponse$outboundSchema.parse( - addRulesetAccessGroupResponse, - ), - ); -} - -export function addRulesetAccessGroupResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => AddRulesetAccessGroupResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'AddRulesetAccessGroupResponse' from JSON`, - ); -} diff --git a/src/models/operations/addschemaaccessgroup.ts b/src/models/operations/addschemaaccessgroup.ts deleted file mode 100644 index c920583..0000000 --- a/src/models/operations/addschemaaccessgroup.ts +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type AddSchemaAccessGroupRequest = { - namespace: string; - slug: string; - accessGroup: components.AccessGroup; -}; - -export type AddSchemaAccessGroupResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const AddSchemaAccessGroupRequest$inboundSchema: z.ZodType< - AddSchemaAccessGroupRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - "access-group": components.AccessGroup$inboundSchema, -}).transform((v) => { - return remap$(v, { - "access-group": "accessGroup", - }); -}); - -/** @internal */ -export type AddSchemaAccessGroupRequest$Outbound = { - namespace: string; - slug: string; - "access-group": components.AccessGroup$Outbound; -}; - -/** @internal */ -export const AddSchemaAccessGroupRequest$outboundSchema: z.ZodType< - AddSchemaAccessGroupRequest$Outbound, - z.ZodTypeDef, - AddSchemaAccessGroupRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - accessGroup: components.AccessGroup$outboundSchema, -}).transform((v) => { - return remap$(v, { - accessGroup: "access-group", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace AddSchemaAccessGroupRequest$ { - /** @deprecated use `AddSchemaAccessGroupRequest$inboundSchema` instead. */ - export const inboundSchema = AddSchemaAccessGroupRequest$inboundSchema; - /** @deprecated use `AddSchemaAccessGroupRequest$outboundSchema` instead. */ - export const outboundSchema = AddSchemaAccessGroupRequest$outboundSchema; - /** @deprecated use `AddSchemaAccessGroupRequest$Outbound` instead. */ - export type Outbound = AddSchemaAccessGroupRequest$Outbound; -} - -export function addSchemaAccessGroupRequestToJSON( - addSchemaAccessGroupRequest: AddSchemaAccessGroupRequest, -): string { - return JSON.stringify( - AddSchemaAccessGroupRequest$outboundSchema.parse( - addSchemaAccessGroupRequest, - ), - ); -} - -export function addSchemaAccessGroupRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => AddSchemaAccessGroupRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'AddSchemaAccessGroupRequest' from JSON`, - ); -} - -/** @internal */ -export const AddSchemaAccessGroupResponse$inboundSchema: z.ZodType< - AddSchemaAccessGroupResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type AddSchemaAccessGroupResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const AddSchemaAccessGroupResponse$outboundSchema: z.ZodType< - AddSchemaAccessGroupResponse$Outbound, - z.ZodTypeDef, - AddSchemaAccessGroupResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace AddSchemaAccessGroupResponse$ { - /** @deprecated use `AddSchemaAccessGroupResponse$inboundSchema` instead. */ - export const inboundSchema = AddSchemaAccessGroupResponse$inboundSchema; - /** @deprecated use `AddSchemaAccessGroupResponse$outboundSchema` instead. */ - export const outboundSchema = AddSchemaAccessGroupResponse$outboundSchema; - /** @deprecated use `AddSchemaAccessGroupResponse$Outbound` instead. */ - export type Outbound = AddSchemaAccessGroupResponse$Outbound; -} - -export function addSchemaAccessGroupResponseToJSON( - addSchemaAccessGroupResponse: AddSchemaAccessGroupResponse, -): string { - return JSON.stringify( - AddSchemaAccessGroupResponse$outboundSchema.parse( - addSchemaAccessGroupResponse, - ), - ); -} - -export function addSchemaAccessGroupResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => AddSchemaAccessGroupResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'AddSchemaAccessGroupResponse' from JSON`, - ); -} diff --git a/src/models/operations/createapidocument.ts b/src/models/operations/createapidocument.ts deleted file mode 100644 index d2e7c1c..0000000 --- a/src/models/operations/createapidocument.ts +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type CreateApiDocumentRequestBody = { - title: string; - description?: string | undefined; - version: string; - slug: string; - ruleset?: string | undefined; - isPrivate?: boolean | undefined; - document: string; -}; - -export type CreateApiDocumentRequest = { - namespace: string; - requestBody: CreateApiDocumentRequestBody; -}; - -/** - * Default Response - */ -export type CreateApiDocumentResponseBody = { - uid: string; - versionUid: string; - title: string; - jsonSha: string; - yamlSha: string; - versionSha: string; -}; - -export type CreateApiDocumentResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - object?: CreateApiDocumentResponseBody | undefined; -}; - -/** @internal */ -export const CreateApiDocumentRequestBody$inboundSchema: z.ZodType< - CreateApiDocumentRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - title: z.string(), - description: z.string().optional(), - version: z.string(), - slug: z.string(), - ruleset: z.string().optional(), - isPrivate: z.boolean().optional(), - document: z.string(), -}); - -/** @internal */ -export type CreateApiDocumentRequestBody$Outbound = { - title: string; - description?: string | undefined; - version: string; - slug: string; - ruleset?: string | undefined; - isPrivate?: boolean | undefined; - document: string; -}; - -/** @internal */ -export const CreateApiDocumentRequestBody$outboundSchema: z.ZodType< - CreateApiDocumentRequestBody$Outbound, - z.ZodTypeDef, - CreateApiDocumentRequestBody -> = z.object({ - title: z.string(), - description: z.string().optional(), - version: z.string(), - slug: z.string(), - ruleset: z.string().optional(), - isPrivate: z.boolean().optional(), - document: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateApiDocumentRequestBody$ { - /** @deprecated use `CreateApiDocumentRequestBody$inboundSchema` instead. */ - export const inboundSchema = CreateApiDocumentRequestBody$inboundSchema; - /** @deprecated use `CreateApiDocumentRequestBody$outboundSchema` instead. */ - export const outboundSchema = CreateApiDocumentRequestBody$outboundSchema; - /** @deprecated use `CreateApiDocumentRequestBody$Outbound` instead. */ - export type Outbound = CreateApiDocumentRequestBody$Outbound; -} - -export function createApiDocumentRequestBodyToJSON( - createApiDocumentRequestBody: CreateApiDocumentRequestBody, -): string { - return JSON.stringify( - CreateApiDocumentRequestBody$outboundSchema.parse( - createApiDocumentRequestBody, - ), - ); -} - -export function createApiDocumentRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateApiDocumentRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateApiDocumentRequestBody' from JSON`, - ); -} - -/** @internal */ -export const CreateApiDocumentRequest$inboundSchema: z.ZodType< - CreateApiDocumentRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - RequestBody: z.lazy(() => CreateApiDocumentRequestBody$inboundSchema), -}).transform((v) => { - return remap$(v, { - "RequestBody": "requestBody", - }); -}); - -/** @internal */ -export type CreateApiDocumentRequest$Outbound = { - namespace: string; - RequestBody: CreateApiDocumentRequestBody$Outbound; -}; - -/** @internal */ -export const CreateApiDocumentRequest$outboundSchema: z.ZodType< - CreateApiDocumentRequest$Outbound, - z.ZodTypeDef, - CreateApiDocumentRequest -> = z.object({ - namespace: z.string(), - requestBody: z.lazy(() => CreateApiDocumentRequestBody$outboundSchema), -}).transform((v) => { - return remap$(v, { - requestBody: "RequestBody", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateApiDocumentRequest$ { - /** @deprecated use `CreateApiDocumentRequest$inboundSchema` instead. */ - export const inboundSchema = CreateApiDocumentRequest$inboundSchema; - /** @deprecated use `CreateApiDocumentRequest$outboundSchema` instead. */ - export const outboundSchema = CreateApiDocumentRequest$outboundSchema; - /** @deprecated use `CreateApiDocumentRequest$Outbound` instead. */ - export type Outbound = CreateApiDocumentRequest$Outbound; -} - -export function createApiDocumentRequestToJSON( - createApiDocumentRequest: CreateApiDocumentRequest, -): string { - return JSON.stringify( - CreateApiDocumentRequest$outboundSchema.parse(createApiDocumentRequest), - ); -} - -export function createApiDocumentRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateApiDocumentRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateApiDocumentRequest' from JSON`, - ); -} - -/** @internal */ -export const CreateApiDocumentResponseBody$inboundSchema: z.ZodType< - CreateApiDocumentResponseBody, - z.ZodTypeDef, - unknown -> = z.object({ - uid: z.string(), - versionUid: z.string(), - title: z.string(), - jsonSha: z.string(), - yamlSha: z.string(), - versionSha: z.string(), -}); - -/** @internal */ -export type CreateApiDocumentResponseBody$Outbound = { - uid: string; - versionUid: string; - title: string; - jsonSha: string; - yamlSha: string; - versionSha: string; -}; - -/** @internal */ -export const CreateApiDocumentResponseBody$outboundSchema: z.ZodType< - CreateApiDocumentResponseBody$Outbound, - z.ZodTypeDef, - CreateApiDocumentResponseBody -> = z.object({ - uid: z.string(), - versionUid: z.string(), - title: z.string(), - jsonSha: z.string(), - yamlSha: z.string(), - versionSha: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateApiDocumentResponseBody$ { - /** @deprecated use `CreateApiDocumentResponseBody$inboundSchema` instead. */ - export const inboundSchema = CreateApiDocumentResponseBody$inboundSchema; - /** @deprecated use `CreateApiDocumentResponseBody$outboundSchema` instead. */ - export const outboundSchema = CreateApiDocumentResponseBody$outboundSchema; - /** @deprecated use `CreateApiDocumentResponseBody$Outbound` instead. */ - export type Outbound = CreateApiDocumentResponseBody$Outbound; -} - -export function createApiDocumentResponseBodyToJSON( - createApiDocumentResponseBody: CreateApiDocumentResponseBody, -): string { - return JSON.stringify( - CreateApiDocumentResponseBody$outboundSchema.parse( - createApiDocumentResponseBody, - ), - ); -} - -export function createApiDocumentResponseBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateApiDocumentResponseBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateApiDocumentResponseBody' from JSON`, - ); -} - -/** @internal */ -export const CreateApiDocumentResponse$inboundSchema: z.ZodType< - CreateApiDocumentResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - object: z.lazy(() => CreateApiDocumentResponseBody$inboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type CreateApiDocumentResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - object?: CreateApiDocumentResponseBody$Outbound | undefined; -}; - -/** @internal */ -export const CreateApiDocumentResponse$outboundSchema: z.ZodType< - CreateApiDocumentResponse$Outbound, - z.ZodTypeDef, - CreateApiDocumentResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - object: z.lazy(() => CreateApiDocumentResponseBody$outboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateApiDocumentResponse$ { - /** @deprecated use `CreateApiDocumentResponse$inboundSchema` instead. */ - export const inboundSchema = CreateApiDocumentResponse$inboundSchema; - /** @deprecated use `CreateApiDocumentResponse$outboundSchema` instead. */ - export const outboundSchema = CreateApiDocumentResponse$outboundSchema; - /** @deprecated use `CreateApiDocumentResponse$Outbound` instead. */ - export type Outbound = CreateApiDocumentResponse$Outbound; -} - -export function createApiDocumentResponseToJSON( - createApiDocumentResponse: CreateApiDocumentResponse, -): string { - return JSON.stringify( - CreateApiDocumentResponse$outboundSchema.parse(createApiDocumentResponse), - ); -} - -export function createApiDocumentResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateApiDocumentResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateApiDocumentResponse' from JSON`, - ); -} diff --git a/src/models/operations/createapidocumentversion.ts b/src/models/operations/createapidocumentversion.ts deleted file mode 100644 index 78e2757..0000000 --- a/src/models/operations/createapidocumentversion.ts +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type CreateApiDocumentVersionRequestBody = { - version: string; - document: string; - force?: boolean | undefined; - lastKnownVersionSha?: string | undefined; -}; - -export type CreateApiDocumentVersionRequest = { - namespace: string; - slug: string; - requestBody: CreateApiDocumentVersionRequestBody; -}; - -export type CreateApiDocumentVersionResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - managedDocVersion?: components.ManagedDocVersion | undefined; -}; - -/** @internal */ -export const CreateApiDocumentVersionRequestBody$inboundSchema: z.ZodType< - CreateApiDocumentVersionRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - version: z.string(), - document: z.string(), - force: z.boolean().optional(), - lastKnownVersionSha: z.string().optional(), -}); - -/** @internal */ -export type CreateApiDocumentVersionRequestBody$Outbound = { - version: string; - document: string; - force?: boolean | undefined; - lastKnownVersionSha?: string | undefined; -}; - -/** @internal */ -export const CreateApiDocumentVersionRequestBody$outboundSchema: z.ZodType< - CreateApiDocumentVersionRequestBody$Outbound, - z.ZodTypeDef, - CreateApiDocumentVersionRequestBody -> = z.object({ - version: z.string(), - document: z.string(), - force: z.boolean().optional(), - lastKnownVersionSha: z.string().optional(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateApiDocumentVersionRequestBody$ { - /** @deprecated use `CreateApiDocumentVersionRequestBody$inboundSchema` instead. */ - export const inboundSchema = - CreateApiDocumentVersionRequestBody$inboundSchema; - /** @deprecated use `CreateApiDocumentVersionRequestBody$outboundSchema` instead. */ - export const outboundSchema = - CreateApiDocumentVersionRequestBody$outboundSchema; - /** @deprecated use `CreateApiDocumentVersionRequestBody$Outbound` instead. */ - export type Outbound = CreateApiDocumentVersionRequestBody$Outbound; -} - -export function createApiDocumentVersionRequestBodyToJSON( - createApiDocumentVersionRequestBody: CreateApiDocumentVersionRequestBody, -): string { - return JSON.stringify( - CreateApiDocumentVersionRequestBody$outboundSchema.parse( - createApiDocumentVersionRequestBody, - ), - ); -} - -export function createApiDocumentVersionRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => - CreateApiDocumentVersionRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateApiDocumentVersionRequestBody' from JSON`, - ); -} - -/** @internal */ -export const CreateApiDocumentVersionRequest$inboundSchema: z.ZodType< - CreateApiDocumentVersionRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - RequestBody: z.lazy(() => CreateApiDocumentVersionRequestBody$inboundSchema), -}).transform((v) => { - return remap$(v, { - "RequestBody": "requestBody", - }); -}); - -/** @internal */ -export type CreateApiDocumentVersionRequest$Outbound = { - namespace: string; - slug: string; - RequestBody: CreateApiDocumentVersionRequestBody$Outbound; -}; - -/** @internal */ -export const CreateApiDocumentVersionRequest$outboundSchema: z.ZodType< - CreateApiDocumentVersionRequest$Outbound, - z.ZodTypeDef, - CreateApiDocumentVersionRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - requestBody: z.lazy(() => CreateApiDocumentVersionRequestBody$outboundSchema), -}).transform((v) => { - return remap$(v, { - requestBody: "RequestBody", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateApiDocumentVersionRequest$ { - /** @deprecated use `CreateApiDocumentVersionRequest$inboundSchema` instead. */ - export const inboundSchema = CreateApiDocumentVersionRequest$inboundSchema; - /** @deprecated use `CreateApiDocumentVersionRequest$outboundSchema` instead. */ - export const outboundSchema = CreateApiDocumentVersionRequest$outboundSchema; - /** @deprecated use `CreateApiDocumentVersionRequest$Outbound` instead. */ - export type Outbound = CreateApiDocumentVersionRequest$Outbound; -} - -export function createApiDocumentVersionRequestToJSON( - createApiDocumentVersionRequest: CreateApiDocumentVersionRequest, -): string { - return JSON.stringify( - CreateApiDocumentVersionRequest$outboundSchema.parse( - createApiDocumentVersionRequest, - ), - ); -} - -export function createApiDocumentVersionRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateApiDocumentVersionRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateApiDocumentVersionRequest' from JSON`, - ); -} - -/** @internal */ -export const CreateApiDocumentVersionResponse$inboundSchema: z.ZodType< - CreateApiDocumentVersionResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - "managed-doc-version": components.ManagedDocVersion$inboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - "managed-doc-version": "managedDocVersion", - }); -}); - -/** @internal */ -export type CreateApiDocumentVersionResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - "managed-doc-version"?: components.ManagedDocVersion$Outbound | undefined; -}; - -/** @internal */ -export const CreateApiDocumentVersionResponse$outboundSchema: z.ZodType< - CreateApiDocumentVersionResponse$Outbound, - z.ZodTypeDef, - CreateApiDocumentVersionResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - managedDocVersion: components.ManagedDocVersion$outboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - managedDocVersion: "managed-doc-version", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateApiDocumentVersionResponse$ { - /** @deprecated use `CreateApiDocumentVersionResponse$inboundSchema` instead. */ - export const inboundSchema = CreateApiDocumentVersionResponse$inboundSchema; - /** @deprecated use `CreateApiDocumentVersionResponse$outboundSchema` instead. */ - export const outboundSchema = CreateApiDocumentVersionResponse$outboundSchema; - /** @deprecated use `CreateApiDocumentVersionResponse$Outbound` instead. */ - export type Outbound = CreateApiDocumentVersionResponse$Outbound; -} - -export function createApiDocumentVersionResponseToJSON( - createApiDocumentVersionResponse: CreateApiDocumentVersionResponse, -): string { - return JSON.stringify( - CreateApiDocumentVersionResponse$outboundSchema.parse( - createApiDocumentVersionResponse, - ), - ); -} - -export function createApiDocumentVersionResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateApiDocumentVersionResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateApiDocumentVersionResponse' from JSON`, - ); -} diff --git a/src/models/operations/createguide.ts b/src/models/operations/createguide.ts deleted file mode 100644 index 61afe08..0000000 --- a/src/models/operations/createguide.ts +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type CreateGuideRequestBody = { - name: string; - slug?: string | undefined; - isPrivate?: boolean | undefined; - allowedUsers: Array; - allowedDomains: Array; -}; - -/** - * Default Response - */ -export type CreateGuideResponseBody = { - uid: string; - slug: string; -}; - -export type CreateGuideResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - object?: CreateGuideResponseBody | undefined; -}; - -/** @internal */ -export const CreateGuideRequestBody$inboundSchema: z.ZodType< - CreateGuideRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - name: z.string(), - slug: z.string().optional(), - isPrivate: z.boolean().default(false), - allowedUsers: z.array(z.string()), - allowedDomains: z.array(z.string()), -}); - -/** @internal */ -export type CreateGuideRequestBody$Outbound = { - name: string; - slug?: string | undefined; - isPrivate: boolean; - allowedUsers: Array; - allowedDomains: Array; -}; - -/** @internal */ -export const CreateGuideRequestBody$outboundSchema: z.ZodType< - CreateGuideRequestBody$Outbound, - z.ZodTypeDef, - CreateGuideRequestBody -> = z.object({ - name: z.string(), - slug: z.string().optional(), - isPrivate: z.boolean().default(false), - allowedUsers: z.array(z.string()), - allowedDomains: z.array(z.string()), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateGuideRequestBody$ { - /** @deprecated use `CreateGuideRequestBody$inboundSchema` instead. */ - export const inboundSchema = CreateGuideRequestBody$inboundSchema; - /** @deprecated use `CreateGuideRequestBody$outboundSchema` instead. */ - export const outboundSchema = CreateGuideRequestBody$outboundSchema; - /** @deprecated use `CreateGuideRequestBody$Outbound` instead. */ - export type Outbound = CreateGuideRequestBody$Outbound; -} - -export function createGuideRequestBodyToJSON( - createGuideRequestBody: CreateGuideRequestBody, -): string { - return JSON.stringify( - CreateGuideRequestBody$outboundSchema.parse(createGuideRequestBody), - ); -} - -export function createGuideRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateGuideRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateGuideRequestBody' from JSON`, - ); -} - -/** @internal */ -export const CreateGuideResponseBody$inboundSchema: z.ZodType< - CreateGuideResponseBody, - z.ZodTypeDef, - unknown -> = z.object({ - uid: z.string(), - slug: z.string(), -}); - -/** @internal */ -export type CreateGuideResponseBody$Outbound = { - uid: string; - slug: string; -}; - -/** @internal */ -export const CreateGuideResponseBody$outboundSchema: z.ZodType< - CreateGuideResponseBody$Outbound, - z.ZodTypeDef, - CreateGuideResponseBody -> = z.object({ - uid: z.string(), - slug: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateGuideResponseBody$ { - /** @deprecated use `CreateGuideResponseBody$inboundSchema` instead. */ - export const inboundSchema = CreateGuideResponseBody$inboundSchema; - /** @deprecated use `CreateGuideResponseBody$outboundSchema` instead. */ - export const outboundSchema = CreateGuideResponseBody$outboundSchema; - /** @deprecated use `CreateGuideResponseBody$Outbound` instead. */ - export type Outbound = CreateGuideResponseBody$Outbound; -} - -export function createGuideResponseBodyToJSON( - createGuideResponseBody: CreateGuideResponseBody, -): string { - return JSON.stringify( - CreateGuideResponseBody$outboundSchema.parse(createGuideResponseBody), - ); -} - -export function createGuideResponseBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateGuideResponseBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateGuideResponseBody' from JSON`, - ); -} - -/** @internal */ -export const CreateGuideResponse$inboundSchema: z.ZodType< - CreateGuideResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - object: z.lazy(() => CreateGuideResponseBody$inboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type CreateGuideResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - object?: CreateGuideResponseBody$Outbound | undefined; -}; - -/** @internal */ -export const CreateGuideResponse$outboundSchema: z.ZodType< - CreateGuideResponse$Outbound, - z.ZodTypeDef, - CreateGuideResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - object: z.lazy(() => CreateGuideResponseBody$outboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateGuideResponse$ { - /** @deprecated use `CreateGuideResponse$inboundSchema` instead. */ - export const inboundSchema = CreateGuideResponse$inboundSchema; - /** @deprecated use `CreateGuideResponse$outboundSchema` instead. */ - export const outboundSchema = CreateGuideResponse$outboundSchema; - /** @deprecated use `CreateGuideResponse$Outbound` instead. */ - export type Outbound = CreateGuideResponse$Outbound; -} - -export function createGuideResponseToJSON( - createGuideResponse: CreateGuideResponse, -): string { - return JSON.stringify( - CreateGuideResponse$outboundSchema.parse(createGuideResponse), - ); -} - -export function createGuideResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateGuideResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateGuideResponse' from JSON`, - ); -} diff --git a/src/models/operations/createloginportal.ts b/src/models/operations/createloginportal.ts deleted file mode 100644 index e1a0b93..0000000 --- a/src/models/operations/createloginportal.ts +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type CreateLoginPortalRequestBody = { - title: string; - slug: string; - email: components.LoginPortalEmail; - page: components.LoginPortalPage; -}; - -export type CreateLoginPortalResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - uid?: components.Uid | undefined; -}; - -/** @internal */ -export const CreateLoginPortalRequestBody$inboundSchema: z.ZodType< - CreateLoginPortalRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - title: z.string(), - slug: z.string(), - email: components.LoginPortalEmail$inboundSchema, - page: components.LoginPortalPage$inboundSchema, -}); - -/** @internal */ -export type CreateLoginPortalRequestBody$Outbound = { - title: string; - slug: string; - email: components.LoginPortalEmail$Outbound; - page: components.LoginPortalPage$Outbound; -}; - -/** @internal */ -export const CreateLoginPortalRequestBody$outboundSchema: z.ZodType< - CreateLoginPortalRequestBody$Outbound, - z.ZodTypeDef, - CreateLoginPortalRequestBody -> = z.object({ - title: z.string(), - slug: z.string(), - email: components.LoginPortalEmail$outboundSchema, - page: components.LoginPortalPage$outboundSchema, -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateLoginPortalRequestBody$ { - /** @deprecated use `CreateLoginPortalRequestBody$inboundSchema` instead. */ - export const inboundSchema = CreateLoginPortalRequestBody$inboundSchema; - /** @deprecated use `CreateLoginPortalRequestBody$outboundSchema` instead. */ - export const outboundSchema = CreateLoginPortalRequestBody$outboundSchema; - /** @deprecated use `CreateLoginPortalRequestBody$Outbound` instead. */ - export type Outbound = CreateLoginPortalRequestBody$Outbound; -} - -export function createLoginPortalRequestBodyToJSON( - createLoginPortalRequestBody: CreateLoginPortalRequestBody, -): string { - return JSON.stringify( - CreateLoginPortalRequestBody$outboundSchema.parse( - createLoginPortalRequestBody, - ), - ); -} - -export function createLoginPortalRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateLoginPortalRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateLoginPortalRequestBody' from JSON`, - ); -} - -/** @internal */ -export const CreateLoginPortalResponse$inboundSchema: z.ZodType< - CreateLoginPortalResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - uid: components.Uid$inboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type CreateLoginPortalResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - uid?: components.Uid$Outbound | undefined; -}; - -/** @internal */ -export const CreateLoginPortalResponse$outboundSchema: z.ZodType< - CreateLoginPortalResponse$Outbound, - z.ZodTypeDef, - CreateLoginPortalResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - uid: components.Uid$outboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateLoginPortalResponse$ { - /** @deprecated use `CreateLoginPortalResponse$inboundSchema` instead. */ - export const inboundSchema = CreateLoginPortalResponse$inboundSchema; - /** @deprecated use `CreateLoginPortalResponse$outboundSchema` instead. */ - export const outboundSchema = CreateLoginPortalResponse$outboundSchema; - /** @deprecated use `CreateLoginPortalResponse$Outbound` instead. */ - export type Outbound = CreateLoginPortalResponse$Outbound; -} - -export function createLoginPortalResponseToJSON( - createLoginPortalResponse: CreateLoginPortalResponse, -): string { - return JSON.stringify( - CreateLoginPortalResponse$outboundSchema.parse(createLoginPortalResponse), - ); -} - -export function createLoginPortalResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateLoginPortalResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateLoginPortalResponse' from JSON`, - ); -} diff --git a/src/models/operations/createruleset.ts b/src/models/operations/createruleset.ts deleted file mode 100644 index 7243663..0000000 --- a/src/models/operations/createruleset.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type CreateRulesetRequestBody = { - title: string; - description?: string | undefined; - slug: string; - isPrivate?: boolean | undefined; - document: string; -}; - -export type CreateRulesetRequest = { - namespace: string; - requestBody: CreateRulesetRequestBody; -}; - -export type CreateRulesetResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - uid?: components.Uid | undefined; -}; - -/** @internal */ -export const CreateRulesetRequestBody$inboundSchema: z.ZodType< - CreateRulesetRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - title: z.string(), - description: z.string().optional(), - slug: z.string(), - isPrivate: z.boolean().optional(), - document: z.string(), -}); - -/** @internal */ -export type CreateRulesetRequestBody$Outbound = { - title: string; - description?: string | undefined; - slug: string; - isPrivate?: boolean | undefined; - document: string; -}; - -/** @internal */ -export const CreateRulesetRequestBody$outboundSchema: z.ZodType< - CreateRulesetRequestBody$Outbound, - z.ZodTypeDef, - CreateRulesetRequestBody -> = z.object({ - title: z.string(), - description: z.string().optional(), - slug: z.string(), - isPrivate: z.boolean().optional(), - document: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateRulesetRequestBody$ { - /** @deprecated use `CreateRulesetRequestBody$inboundSchema` instead. */ - export const inboundSchema = CreateRulesetRequestBody$inboundSchema; - /** @deprecated use `CreateRulesetRequestBody$outboundSchema` instead. */ - export const outboundSchema = CreateRulesetRequestBody$outboundSchema; - /** @deprecated use `CreateRulesetRequestBody$Outbound` instead. */ - export type Outbound = CreateRulesetRequestBody$Outbound; -} - -export function createRulesetRequestBodyToJSON( - createRulesetRequestBody: CreateRulesetRequestBody, -): string { - return JSON.stringify( - CreateRulesetRequestBody$outboundSchema.parse(createRulesetRequestBody), - ); -} - -export function createRulesetRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateRulesetRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateRulesetRequestBody' from JSON`, - ); -} - -/** @internal */ -export const CreateRulesetRequest$inboundSchema: z.ZodType< - CreateRulesetRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - RequestBody: z.lazy(() => CreateRulesetRequestBody$inboundSchema), -}).transform((v) => { - return remap$(v, { - "RequestBody": "requestBody", - }); -}); - -/** @internal */ -export type CreateRulesetRequest$Outbound = { - namespace: string; - RequestBody: CreateRulesetRequestBody$Outbound; -}; - -/** @internal */ -export const CreateRulesetRequest$outboundSchema: z.ZodType< - CreateRulesetRequest$Outbound, - z.ZodTypeDef, - CreateRulesetRequest -> = z.object({ - namespace: z.string(), - requestBody: z.lazy(() => CreateRulesetRequestBody$outboundSchema), -}).transform((v) => { - return remap$(v, { - requestBody: "RequestBody", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateRulesetRequest$ { - /** @deprecated use `CreateRulesetRequest$inboundSchema` instead. */ - export const inboundSchema = CreateRulesetRequest$inboundSchema; - /** @deprecated use `CreateRulesetRequest$outboundSchema` instead. */ - export const outboundSchema = CreateRulesetRequest$outboundSchema; - /** @deprecated use `CreateRulesetRequest$Outbound` instead. */ - export type Outbound = CreateRulesetRequest$Outbound; -} - -export function createRulesetRequestToJSON( - createRulesetRequest: CreateRulesetRequest, -): string { - return JSON.stringify( - CreateRulesetRequest$outboundSchema.parse(createRulesetRequest), - ); -} - -export function createRulesetRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateRulesetRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateRulesetRequest' from JSON`, - ); -} - -/** @internal */ -export const CreateRulesetResponse$inboundSchema: z.ZodType< - CreateRulesetResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - uid: components.Uid$inboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type CreateRulesetResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - uid?: components.Uid$Outbound | undefined; -}; - -/** @internal */ -export const CreateRulesetResponse$outboundSchema: z.ZodType< - CreateRulesetResponse$Outbound, - z.ZodTypeDef, - CreateRulesetResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - uid: components.Uid$outboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateRulesetResponse$ { - /** @deprecated use `CreateRulesetResponse$inboundSchema` instead. */ - export const inboundSchema = CreateRulesetResponse$inboundSchema; - /** @deprecated use `CreateRulesetResponse$outboundSchema` instead. */ - export const outboundSchema = CreateRulesetResponse$outboundSchema; - /** @deprecated use `CreateRulesetResponse$Outbound` instead. */ - export type Outbound = CreateRulesetResponse$Outbound; -} - -export function createRulesetResponseToJSON( - createRulesetResponse: CreateRulesetResponse, -): string { - return JSON.stringify( - CreateRulesetResponse$outboundSchema.parse(createRulesetResponse), - ); -} - -export function createRulesetResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateRulesetResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateRulesetResponse' from JSON`, - ); -} diff --git a/src/models/operations/createschema.ts b/src/models/operations/createschema.ts deleted file mode 100644 index 1a79159..0000000 --- a/src/models/operations/createschema.ts +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type CreateSchemaRequestBody = { - title: string; - description?: string | undefined; - version: string; - slug: string; - isPrivate?: boolean | undefined; - document: string; -}; - -export type CreateSchemaRequest = { - namespace: string; - requestBody: CreateSchemaRequestBody; -}; - -export type CreateSchemaResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - uid?: components.Uid | undefined; -}; - -/** @internal */ -export const CreateSchemaRequestBody$inboundSchema: z.ZodType< - CreateSchemaRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - title: z.string(), - description: z.string().optional(), - version: z.string(), - slug: z.string(), - isPrivate: z.boolean().optional(), - document: z.string(), -}); - -/** @internal */ -export type CreateSchemaRequestBody$Outbound = { - title: string; - description?: string | undefined; - version: string; - slug: string; - isPrivate?: boolean | undefined; - document: string; -}; - -/** @internal */ -export const CreateSchemaRequestBody$outboundSchema: z.ZodType< - CreateSchemaRequestBody$Outbound, - z.ZodTypeDef, - CreateSchemaRequestBody -> = z.object({ - title: z.string(), - description: z.string().optional(), - version: z.string(), - slug: z.string(), - isPrivate: z.boolean().optional(), - document: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateSchemaRequestBody$ { - /** @deprecated use `CreateSchemaRequestBody$inboundSchema` instead. */ - export const inboundSchema = CreateSchemaRequestBody$inboundSchema; - /** @deprecated use `CreateSchemaRequestBody$outboundSchema` instead. */ - export const outboundSchema = CreateSchemaRequestBody$outboundSchema; - /** @deprecated use `CreateSchemaRequestBody$Outbound` instead. */ - export type Outbound = CreateSchemaRequestBody$Outbound; -} - -export function createSchemaRequestBodyToJSON( - createSchemaRequestBody: CreateSchemaRequestBody, -): string { - return JSON.stringify( - CreateSchemaRequestBody$outboundSchema.parse(createSchemaRequestBody), - ); -} - -export function createSchemaRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateSchemaRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateSchemaRequestBody' from JSON`, - ); -} - -/** @internal */ -export const CreateSchemaRequest$inboundSchema: z.ZodType< - CreateSchemaRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - RequestBody: z.lazy(() => CreateSchemaRequestBody$inboundSchema), -}).transform((v) => { - return remap$(v, { - "RequestBody": "requestBody", - }); -}); - -/** @internal */ -export type CreateSchemaRequest$Outbound = { - namespace: string; - RequestBody: CreateSchemaRequestBody$Outbound; -}; - -/** @internal */ -export const CreateSchemaRequest$outboundSchema: z.ZodType< - CreateSchemaRequest$Outbound, - z.ZodTypeDef, - CreateSchemaRequest -> = z.object({ - namespace: z.string(), - requestBody: z.lazy(() => CreateSchemaRequestBody$outboundSchema), -}).transform((v) => { - return remap$(v, { - requestBody: "RequestBody", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateSchemaRequest$ { - /** @deprecated use `CreateSchemaRequest$inboundSchema` instead. */ - export const inboundSchema = CreateSchemaRequest$inboundSchema; - /** @deprecated use `CreateSchemaRequest$outboundSchema` instead. */ - export const outboundSchema = CreateSchemaRequest$outboundSchema; - /** @deprecated use `CreateSchemaRequest$Outbound` instead. */ - export type Outbound = CreateSchemaRequest$Outbound; -} - -export function createSchemaRequestToJSON( - createSchemaRequest: CreateSchemaRequest, -): string { - return JSON.stringify( - CreateSchemaRequest$outboundSchema.parse(createSchemaRequest), - ); -} - -export function createSchemaRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateSchemaRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateSchemaRequest' from JSON`, - ); -} - -/** @internal */ -export const CreateSchemaResponse$inboundSchema: z.ZodType< - CreateSchemaResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - uid: components.Uid$inboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type CreateSchemaResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - uid?: components.Uid$Outbound | undefined; -}; - -/** @internal */ -export const CreateSchemaResponse$outboundSchema: z.ZodType< - CreateSchemaResponse$Outbound, - z.ZodTypeDef, - CreateSchemaResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - uid: components.Uid$outboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateSchemaResponse$ { - /** @deprecated use `CreateSchemaResponse$inboundSchema` instead. */ - export const inboundSchema = CreateSchemaResponse$inboundSchema; - /** @deprecated use `CreateSchemaResponse$outboundSchema` instead. */ - export const outboundSchema = CreateSchemaResponse$outboundSchema; - /** @deprecated use `CreateSchemaResponse$Outbound` instead. */ - export type Outbound = CreateSchemaResponse$Outbound; -} - -export function createSchemaResponseToJSON( - createSchemaResponse: CreateSchemaResponse, -): string { - return JSON.stringify( - CreateSchemaResponse$outboundSchema.parse(createSchemaResponse), - ); -} - -export function createSchemaResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateSchemaResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateSchemaResponse' from JSON`, - ); -} diff --git a/src/models/operations/createschemaversion.ts b/src/models/operations/createschemaversion.ts deleted file mode 100644 index b4df998..0000000 --- a/src/models/operations/createschemaversion.ts +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type CreateSchemaVersionRequestBody = { - version: string; - document: string; -}; - -export type CreateSchemaVersionRequest = { - namespace: string; - slug: string; - requestBody: CreateSchemaVersionRequestBody; -}; - -export type CreateSchemaVersionResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - uid?: components.Uid | undefined; -}; - -/** @internal */ -export const CreateSchemaVersionRequestBody$inboundSchema: z.ZodType< - CreateSchemaVersionRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - version: z.string(), - document: z.string(), -}); - -/** @internal */ -export type CreateSchemaVersionRequestBody$Outbound = { - version: string; - document: string; -}; - -/** @internal */ -export const CreateSchemaVersionRequestBody$outboundSchema: z.ZodType< - CreateSchemaVersionRequestBody$Outbound, - z.ZodTypeDef, - CreateSchemaVersionRequestBody -> = z.object({ - version: z.string(), - document: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateSchemaVersionRequestBody$ { - /** @deprecated use `CreateSchemaVersionRequestBody$inboundSchema` instead. */ - export const inboundSchema = CreateSchemaVersionRequestBody$inboundSchema; - /** @deprecated use `CreateSchemaVersionRequestBody$outboundSchema` instead. */ - export const outboundSchema = CreateSchemaVersionRequestBody$outboundSchema; - /** @deprecated use `CreateSchemaVersionRequestBody$Outbound` instead. */ - export type Outbound = CreateSchemaVersionRequestBody$Outbound; -} - -export function createSchemaVersionRequestBodyToJSON( - createSchemaVersionRequestBody: CreateSchemaVersionRequestBody, -): string { - return JSON.stringify( - CreateSchemaVersionRequestBody$outboundSchema.parse( - createSchemaVersionRequestBody, - ), - ); -} - -export function createSchemaVersionRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateSchemaVersionRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateSchemaVersionRequestBody' from JSON`, - ); -} - -/** @internal */ -export const CreateSchemaVersionRequest$inboundSchema: z.ZodType< - CreateSchemaVersionRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - RequestBody: z.lazy(() => CreateSchemaVersionRequestBody$inboundSchema), -}).transform((v) => { - return remap$(v, { - "RequestBody": "requestBody", - }); -}); - -/** @internal */ -export type CreateSchemaVersionRequest$Outbound = { - namespace: string; - slug: string; - RequestBody: CreateSchemaVersionRequestBody$Outbound; -}; - -/** @internal */ -export const CreateSchemaVersionRequest$outboundSchema: z.ZodType< - CreateSchemaVersionRequest$Outbound, - z.ZodTypeDef, - CreateSchemaVersionRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - requestBody: z.lazy(() => CreateSchemaVersionRequestBody$outboundSchema), -}).transform((v) => { - return remap$(v, { - requestBody: "RequestBody", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateSchemaVersionRequest$ { - /** @deprecated use `CreateSchemaVersionRequest$inboundSchema` instead. */ - export const inboundSchema = CreateSchemaVersionRequest$inboundSchema; - /** @deprecated use `CreateSchemaVersionRequest$outboundSchema` instead. */ - export const outboundSchema = CreateSchemaVersionRequest$outboundSchema; - /** @deprecated use `CreateSchemaVersionRequest$Outbound` instead. */ - export type Outbound = CreateSchemaVersionRequest$Outbound; -} - -export function createSchemaVersionRequestToJSON( - createSchemaVersionRequest: CreateSchemaVersionRequest, -): string { - return JSON.stringify( - CreateSchemaVersionRequest$outboundSchema.parse(createSchemaVersionRequest), - ); -} - -export function createSchemaVersionRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateSchemaVersionRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateSchemaVersionRequest' from JSON`, - ); -} - -/** @internal */ -export const CreateSchemaVersionResponse$inboundSchema: z.ZodType< - CreateSchemaVersionResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - uid: components.Uid$inboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type CreateSchemaVersionResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - uid?: components.Uid$Outbound | undefined; -}; - -/** @internal */ -export const CreateSchemaVersionResponse$outboundSchema: z.ZodType< - CreateSchemaVersionResponse$Outbound, - z.ZodTypeDef, - CreateSchemaVersionResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - uid: components.Uid$outboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateSchemaVersionResponse$ { - /** @deprecated use `CreateSchemaVersionResponse$inboundSchema` instead. */ - export const inboundSchema = CreateSchemaVersionResponse$inboundSchema; - /** @deprecated use `CreateSchemaVersionResponse$outboundSchema` instead. */ - export const outboundSchema = CreateSchemaVersionResponse$outboundSchema; - /** @deprecated use `CreateSchemaVersionResponse$Outbound` instead. */ - export type Outbound = CreateSchemaVersionResponse$Outbound; -} - -export function createSchemaVersionResponseToJSON( - createSchemaVersionResponse: CreateSchemaVersionResponse, -): string { - return JSON.stringify( - CreateSchemaVersionResponse$outboundSchema.parse( - createSchemaVersionResponse, - ), - ); -} - -export function createSchemaVersionResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateSchemaVersionResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateSchemaVersionResponse' from JSON`, - ); -} diff --git a/src/models/operations/createtheme.ts b/src/models/operations/createtheme.ts deleted file mode 100644 index 26afe77..0000000 --- a/src/models/operations/createtheme.ts +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type CreateThemeRequestBody = { - name: string; - description?: string | undefined; - slug: string; - document: string; -}; - -export type CreateThemeResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - uid?: components.Uid | undefined; -}; - -/** @internal */ -export const CreateThemeRequestBody$inboundSchema: z.ZodType< - CreateThemeRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - name: z.string(), - description: z.string().optional(), - slug: z.string(), - document: z.string(), -}); - -/** @internal */ -export type CreateThemeRequestBody$Outbound = { - name: string; - description?: string | undefined; - slug: string; - document: string; -}; - -/** @internal */ -export const CreateThemeRequestBody$outboundSchema: z.ZodType< - CreateThemeRequestBody$Outbound, - z.ZodTypeDef, - CreateThemeRequestBody -> = z.object({ - name: z.string(), - description: z.string().optional(), - slug: z.string(), - document: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateThemeRequestBody$ { - /** @deprecated use `CreateThemeRequestBody$inboundSchema` instead. */ - export const inboundSchema = CreateThemeRequestBody$inboundSchema; - /** @deprecated use `CreateThemeRequestBody$outboundSchema` instead. */ - export const outboundSchema = CreateThemeRequestBody$outboundSchema; - /** @deprecated use `CreateThemeRequestBody$Outbound` instead. */ - export type Outbound = CreateThemeRequestBody$Outbound; -} - -export function createThemeRequestBodyToJSON( - createThemeRequestBody: CreateThemeRequestBody, -): string { - return JSON.stringify( - CreateThemeRequestBody$outboundSchema.parse(createThemeRequestBody), - ); -} - -export function createThemeRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateThemeRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateThemeRequestBody' from JSON`, - ); -} - -/** @internal */ -export const CreateThemeResponse$inboundSchema: z.ZodType< - CreateThemeResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - uid: components.Uid$inboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type CreateThemeResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - uid?: components.Uid$Outbound | undefined; -}; - -/** @internal */ -export const CreateThemeResponse$outboundSchema: z.ZodType< - CreateThemeResponse$Outbound, - z.ZodTypeDef, - CreateThemeResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - uid: components.Uid$outboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace CreateThemeResponse$ { - /** @deprecated use `CreateThemeResponse$inboundSchema` instead. */ - export const inboundSchema = CreateThemeResponse$inboundSchema; - /** @deprecated use `CreateThemeResponse$outboundSchema` instead. */ - export const outboundSchema = CreateThemeResponse$outboundSchema; - /** @deprecated use `CreateThemeResponse$Outbound` instead. */ - export type Outbound = CreateThemeResponse$Outbound; -} - -export function createThemeResponseToJSON( - createThemeResponse: CreateThemeResponse, -): string { - return JSON.stringify( - CreateThemeResponse$outboundSchema.parse(createThemeResponse), - ); -} - -export function createThemeResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CreateThemeResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CreateThemeResponse' from JSON`, - ); -} diff --git a/src/models/operations/deleteapidocument.ts b/src/models/operations/deleteapidocument.ts deleted file mode 100644 index 1a872c7..0000000 --- a/src/models/operations/deleteapidocument.ts +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type DeleteApiDocumentRequest = { - namespace: string; - slug: string; -}; - -export type DeleteApiDocumentResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const DeleteApiDocumentRequest$inboundSchema: z.ZodType< - DeleteApiDocumentRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), -}); - -/** @internal */ -export type DeleteApiDocumentRequest$Outbound = { - namespace: string; - slug: string; -}; - -/** @internal */ -export const DeleteApiDocumentRequest$outboundSchema: z.ZodType< - DeleteApiDocumentRequest$Outbound, - z.ZodTypeDef, - DeleteApiDocumentRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace DeleteApiDocumentRequest$ { - /** @deprecated use `DeleteApiDocumentRequest$inboundSchema` instead. */ - export const inboundSchema = DeleteApiDocumentRequest$inboundSchema; - /** @deprecated use `DeleteApiDocumentRequest$outboundSchema` instead. */ - export const outboundSchema = DeleteApiDocumentRequest$outboundSchema; - /** @deprecated use `DeleteApiDocumentRequest$Outbound` instead. */ - export type Outbound = DeleteApiDocumentRequest$Outbound; -} - -export function deleteApiDocumentRequestToJSON( - deleteApiDocumentRequest: DeleteApiDocumentRequest, -): string { - return JSON.stringify( - DeleteApiDocumentRequest$outboundSchema.parse(deleteApiDocumentRequest), - ); -} - -export function deleteApiDocumentRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => DeleteApiDocumentRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'DeleteApiDocumentRequest' from JSON`, - ); -} - -/** @internal */ -export const DeleteApiDocumentResponse$inboundSchema: z.ZodType< - DeleteApiDocumentResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type DeleteApiDocumentResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const DeleteApiDocumentResponse$outboundSchema: z.ZodType< - DeleteApiDocumentResponse$Outbound, - z.ZodTypeDef, - DeleteApiDocumentResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace DeleteApiDocumentResponse$ { - /** @deprecated use `DeleteApiDocumentResponse$inboundSchema` instead. */ - export const inboundSchema = DeleteApiDocumentResponse$inboundSchema; - /** @deprecated use `DeleteApiDocumentResponse$outboundSchema` instead. */ - export const outboundSchema = DeleteApiDocumentResponse$outboundSchema; - /** @deprecated use `DeleteApiDocumentResponse$Outbound` instead. */ - export type Outbound = DeleteApiDocumentResponse$Outbound; -} - -export function deleteApiDocumentResponseToJSON( - deleteApiDocumentResponse: DeleteApiDocumentResponse, -): string { - return JSON.stringify( - DeleteApiDocumentResponse$outboundSchema.parse(deleteApiDocumentResponse), - ); -} - -export function deleteApiDocumentResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => DeleteApiDocumentResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'DeleteApiDocumentResponse' from JSON`, - ); -} diff --git a/src/models/operations/deleteapidocumentversion.ts b/src/models/operations/deleteapidocumentversion.ts deleted file mode 100644 index e7a67ad..0000000 --- a/src/models/operations/deleteapidocumentversion.ts +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type DeleteApiDocumentVersionRequest = { - namespace: string; - slug: string; - semver: string; -}; - -export type DeleteApiDocumentVersionResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const DeleteApiDocumentVersionRequest$inboundSchema: z.ZodType< - DeleteApiDocumentVersionRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - semver: z.string(), -}); - -/** @internal */ -export type DeleteApiDocumentVersionRequest$Outbound = { - namespace: string; - slug: string; - semver: string; -}; - -/** @internal */ -export const DeleteApiDocumentVersionRequest$outboundSchema: z.ZodType< - DeleteApiDocumentVersionRequest$Outbound, - z.ZodTypeDef, - DeleteApiDocumentVersionRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - semver: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace DeleteApiDocumentVersionRequest$ { - /** @deprecated use `DeleteApiDocumentVersionRequest$inboundSchema` instead. */ - export const inboundSchema = DeleteApiDocumentVersionRequest$inboundSchema; - /** @deprecated use `DeleteApiDocumentVersionRequest$outboundSchema` instead. */ - export const outboundSchema = DeleteApiDocumentVersionRequest$outboundSchema; - /** @deprecated use `DeleteApiDocumentVersionRequest$Outbound` instead. */ - export type Outbound = DeleteApiDocumentVersionRequest$Outbound; -} - -export function deleteApiDocumentVersionRequestToJSON( - deleteApiDocumentVersionRequest: DeleteApiDocumentVersionRequest, -): string { - return JSON.stringify( - DeleteApiDocumentVersionRequest$outboundSchema.parse( - deleteApiDocumentVersionRequest, - ), - ); -} - -export function deleteApiDocumentVersionRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => DeleteApiDocumentVersionRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'DeleteApiDocumentVersionRequest' from JSON`, - ); -} - -/** @internal */ -export const DeleteApiDocumentVersionResponse$inboundSchema: z.ZodType< - DeleteApiDocumentVersionResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type DeleteApiDocumentVersionResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const DeleteApiDocumentVersionResponse$outboundSchema: z.ZodType< - DeleteApiDocumentVersionResponse$Outbound, - z.ZodTypeDef, - DeleteApiDocumentVersionResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace DeleteApiDocumentVersionResponse$ { - /** @deprecated use `DeleteApiDocumentVersionResponse$inboundSchema` instead. */ - export const inboundSchema = DeleteApiDocumentVersionResponse$inboundSchema; - /** @deprecated use `DeleteApiDocumentVersionResponse$outboundSchema` instead. */ - export const outboundSchema = DeleteApiDocumentVersionResponse$outboundSchema; - /** @deprecated use `DeleteApiDocumentVersionResponse$Outbound` instead. */ - export type Outbound = DeleteApiDocumentVersionResponse$Outbound; -} - -export function deleteApiDocumentVersionResponseToJSON( - deleteApiDocumentVersionResponse: DeleteApiDocumentVersionResponse, -): string { - return JSON.stringify( - DeleteApiDocumentVersionResponse$outboundSchema.parse( - deleteApiDocumentVersionResponse, - ), - ); -} - -export function deleteApiDocumentVersionResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => DeleteApiDocumentVersionResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'DeleteApiDocumentVersionResponse' from JSON`, - ); -} diff --git a/src/models/operations/deleteloginportal.ts b/src/models/operations/deleteloginportal.ts deleted file mode 100644 index 166c7e1..0000000 --- a/src/models/operations/deleteloginportal.ts +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type DeleteLoginPortalRequest = { - slug: string; -}; - -export type DeleteLoginPortalResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const DeleteLoginPortalRequest$inboundSchema: z.ZodType< - DeleteLoginPortalRequest, - z.ZodTypeDef, - unknown -> = z.object({ - slug: z.string(), -}); - -/** @internal */ -export type DeleteLoginPortalRequest$Outbound = { - slug: string; -}; - -/** @internal */ -export const DeleteLoginPortalRequest$outboundSchema: z.ZodType< - DeleteLoginPortalRequest$Outbound, - z.ZodTypeDef, - DeleteLoginPortalRequest -> = z.object({ - slug: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace DeleteLoginPortalRequest$ { - /** @deprecated use `DeleteLoginPortalRequest$inboundSchema` instead. */ - export const inboundSchema = DeleteLoginPortalRequest$inboundSchema; - /** @deprecated use `DeleteLoginPortalRequest$outboundSchema` instead. */ - export const outboundSchema = DeleteLoginPortalRequest$outboundSchema; - /** @deprecated use `DeleteLoginPortalRequest$Outbound` instead. */ - export type Outbound = DeleteLoginPortalRequest$Outbound; -} - -export function deleteLoginPortalRequestToJSON( - deleteLoginPortalRequest: DeleteLoginPortalRequest, -): string { - return JSON.stringify( - DeleteLoginPortalRequest$outboundSchema.parse(deleteLoginPortalRequest), - ); -} - -export function deleteLoginPortalRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => DeleteLoginPortalRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'DeleteLoginPortalRequest' from JSON`, - ); -} - -/** @internal */ -export const DeleteLoginPortalResponse$inboundSchema: z.ZodType< - DeleteLoginPortalResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type DeleteLoginPortalResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const DeleteLoginPortalResponse$outboundSchema: z.ZodType< - DeleteLoginPortalResponse$Outbound, - z.ZodTypeDef, - DeleteLoginPortalResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace DeleteLoginPortalResponse$ { - /** @deprecated use `DeleteLoginPortalResponse$inboundSchema` instead. */ - export const inboundSchema = DeleteLoginPortalResponse$inboundSchema; - /** @deprecated use `DeleteLoginPortalResponse$outboundSchema` instead. */ - export const outboundSchema = DeleteLoginPortalResponse$outboundSchema; - /** @deprecated use `DeleteLoginPortalResponse$Outbound` instead. */ - export type Outbound = DeleteLoginPortalResponse$Outbound; -} - -export function deleteLoginPortalResponseToJSON( - deleteLoginPortalResponse: DeleteLoginPortalResponse, -): string { - return JSON.stringify( - DeleteLoginPortalResponse$outboundSchema.parse(deleteLoginPortalResponse), - ); -} - -export function deleteLoginPortalResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => DeleteLoginPortalResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'DeleteLoginPortalResponse' from JSON`, - ); -} diff --git a/src/models/operations/deleteruleset.ts b/src/models/operations/deleteruleset.ts deleted file mode 100644 index d3551fe..0000000 --- a/src/models/operations/deleteruleset.ts +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type DeleteRulesetRequest = { - namespace: string; - slug: string; -}; - -export type DeleteRulesetResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const DeleteRulesetRequest$inboundSchema: z.ZodType< - DeleteRulesetRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), -}); - -/** @internal */ -export type DeleteRulesetRequest$Outbound = { - namespace: string; - slug: string; -}; - -/** @internal */ -export const DeleteRulesetRequest$outboundSchema: z.ZodType< - DeleteRulesetRequest$Outbound, - z.ZodTypeDef, - DeleteRulesetRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace DeleteRulesetRequest$ { - /** @deprecated use `DeleteRulesetRequest$inboundSchema` instead. */ - export const inboundSchema = DeleteRulesetRequest$inboundSchema; - /** @deprecated use `DeleteRulesetRequest$outboundSchema` instead. */ - export const outboundSchema = DeleteRulesetRequest$outboundSchema; - /** @deprecated use `DeleteRulesetRequest$Outbound` instead. */ - export type Outbound = DeleteRulesetRequest$Outbound; -} - -export function deleteRulesetRequestToJSON( - deleteRulesetRequest: DeleteRulesetRequest, -): string { - return JSON.stringify( - DeleteRulesetRequest$outboundSchema.parse(deleteRulesetRequest), - ); -} - -export function deleteRulesetRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => DeleteRulesetRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'DeleteRulesetRequest' from JSON`, - ); -} - -/** @internal */ -export const DeleteRulesetResponse$inboundSchema: z.ZodType< - DeleteRulesetResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type DeleteRulesetResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const DeleteRulesetResponse$outboundSchema: z.ZodType< - DeleteRulesetResponse$Outbound, - z.ZodTypeDef, - DeleteRulesetResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace DeleteRulesetResponse$ { - /** @deprecated use `DeleteRulesetResponse$inboundSchema` instead. */ - export const inboundSchema = DeleteRulesetResponse$inboundSchema; - /** @deprecated use `DeleteRulesetResponse$outboundSchema` instead. */ - export const outboundSchema = DeleteRulesetResponse$outboundSchema; - /** @deprecated use `DeleteRulesetResponse$Outbound` instead. */ - export type Outbound = DeleteRulesetResponse$Outbound; -} - -export function deleteRulesetResponseToJSON( - deleteRulesetResponse: DeleteRulesetResponse, -): string { - return JSON.stringify( - DeleteRulesetResponse$outboundSchema.parse(deleteRulesetResponse), - ); -} - -export function deleteRulesetResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => DeleteRulesetResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'DeleteRulesetResponse' from JSON`, - ); -} diff --git a/src/models/operations/deleteschema.ts b/src/models/operations/deleteschema.ts deleted file mode 100644 index 5bf4b1d..0000000 --- a/src/models/operations/deleteschema.ts +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type DeleteSchemaRequest = { - namespace: string; - slug: string; -}; - -export type DeleteSchemaResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const DeleteSchemaRequest$inboundSchema: z.ZodType< - DeleteSchemaRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), -}); - -/** @internal */ -export type DeleteSchemaRequest$Outbound = { - namespace: string; - slug: string; -}; - -/** @internal */ -export const DeleteSchemaRequest$outboundSchema: z.ZodType< - DeleteSchemaRequest$Outbound, - z.ZodTypeDef, - DeleteSchemaRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace DeleteSchemaRequest$ { - /** @deprecated use `DeleteSchemaRequest$inboundSchema` instead. */ - export const inboundSchema = DeleteSchemaRequest$inboundSchema; - /** @deprecated use `DeleteSchemaRequest$outboundSchema` instead. */ - export const outboundSchema = DeleteSchemaRequest$outboundSchema; - /** @deprecated use `DeleteSchemaRequest$Outbound` instead. */ - export type Outbound = DeleteSchemaRequest$Outbound; -} - -export function deleteSchemaRequestToJSON( - deleteSchemaRequest: DeleteSchemaRequest, -): string { - return JSON.stringify( - DeleteSchemaRequest$outboundSchema.parse(deleteSchemaRequest), - ); -} - -export function deleteSchemaRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => DeleteSchemaRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'DeleteSchemaRequest' from JSON`, - ); -} - -/** @internal */ -export const DeleteSchemaResponse$inboundSchema: z.ZodType< - DeleteSchemaResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type DeleteSchemaResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const DeleteSchemaResponse$outboundSchema: z.ZodType< - DeleteSchemaResponse$Outbound, - z.ZodTypeDef, - DeleteSchemaResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace DeleteSchemaResponse$ { - /** @deprecated use `DeleteSchemaResponse$inboundSchema` instead. */ - export const inboundSchema = DeleteSchemaResponse$inboundSchema; - /** @deprecated use `DeleteSchemaResponse$outboundSchema` instead. */ - export const outboundSchema = DeleteSchemaResponse$outboundSchema; - /** @deprecated use `DeleteSchemaResponse$Outbound` instead. */ - export type Outbound = DeleteSchemaResponse$Outbound; -} - -export function deleteSchemaResponseToJSON( - deleteSchemaResponse: DeleteSchemaResponse, -): string { - return JSON.stringify( - DeleteSchemaResponse$outboundSchema.parse(deleteSchemaResponse), - ); -} - -export function deleteSchemaResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => DeleteSchemaResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'DeleteSchemaResponse' from JSON`, - ); -} diff --git a/src/models/operations/deleteschemaversion.ts b/src/models/operations/deleteschemaversion.ts deleted file mode 100644 index 3204d73..0000000 --- a/src/models/operations/deleteschemaversion.ts +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type DeleteSchemaVersionRequest = { - namespace: string; - slug: string; - semver: string; -}; - -export type DeleteSchemaVersionResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const DeleteSchemaVersionRequest$inboundSchema: z.ZodType< - DeleteSchemaVersionRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - semver: z.string(), -}); - -/** @internal */ -export type DeleteSchemaVersionRequest$Outbound = { - namespace: string; - slug: string; - semver: string; -}; - -/** @internal */ -export const DeleteSchemaVersionRequest$outboundSchema: z.ZodType< - DeleteSchemaVersionRequest$Outbound, - z.ZodTypeDef, - DeleteSchemaVersionRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - semver: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace DeleteSchemaVersionRequest$ { - /** @deprecated use `DeleteSchemaVersionRequest$inboundSchema` instead. */ - export const inboundSchema = DeleteSchemaVersionRequest$inboundSchema; - /** @deprecated use `DeleteSchemaVersionRequest$outboundSchema` instead. */ - export const outboundSchema = DeleteSchemaVersionRequest$outboundSchema; - /** @deprecated use `DeleteSchemaVersionRequest$Outbound` instead. */ - export type Outbound = DeleteSchemaVersionRequest$Outbound; -} - -export function deleteSchemaVersionRequestToJSON( - deleteSchemaVersionRequest: DeleteSchemaVersionRequest, -): string { - return JSON.stringify( - DeleteSchemaVersionRequest$outboundSchema.parse(deleteSchemaVersionRequest), - ); -} - -export function deleteSchemaVersionRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => DeleteSchemaVersionRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'DeleteSchemaVersionRequest' from JSON`, - ); -} - -/** @internal */ -export const DeleteSchemaVersionResponse$inboundSchema: z.ZodType< - DeleteSchemaVersionResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type DeleteSchemaVersionResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const DeleteSchemaVersionResponse$outboundSchema: z.ZodType< - DeleteSchemaVersionResponse$Outbound, - z.ZodTypeDef, - DeleteSchemaVersionResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace DeleteSchemaVersionResponse$ { - /** @deprecated use `DeleteSchemaVersionResponse$inboundSchema` instead. */ - export const inboundSchema = DeleteSchemaVersionResponse$inboundSchema; - /** @deprecated use `DeleteSchemaVersionResponse$outboundSchema` instead. */ - export const outboundSchema = DeleteSchemaVersionResponse$outboundSchema; - /** @deprecated use `DeleteSchemaVersionResponse$Outbound` instead. */ - export type Outbound = DeleteSchemaVersionResponse$Outbound; -} - -export function deleteSchemaVersionResponseToJSON( - deleteSchemaVersionResponse: DeleteSchemaVersionResponse, -): string { - return JSON.stringify( - DeleteSchemaVersionResponse$outboundSchema.parse( - deleteSchemaVersionResponse, - ), - ); -} - -export function deleteSchemaVersionResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => DeleteSchemaVersionResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'DeleteSchemaVersionResponse' from JSON`, - ); -} diff --git a/src/models/operations/deletetheme.ts b/src/models/operations/deletetheme.ts deleted file mode 100644 index a0ba3a1..0000000 --- a/src/models/operations/deletetheme.ts +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type DeleteThemeRequest = { - slug: string; -}; - -export type DeleteThemeResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const DeleteThemeRequest$inboundSchema: z.ZodType< - DeleteThemeRequest, - z.ZodTypeDef, - unknown -> = z.object({ - slug: z.string(), -}); - -/** @internal */ -export type DeleteThemeRequest$Outbound = { - slug: string; -}; - -/** @internal */ -export const DeleteThemeRequest$outboundSchema: z.ZodType< - DeleteThemeRequest$Outbound, - z.ZodTypeDef, - DeleteThemeRequest -> = z.object({ - slug: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace DeleteThemeRequest$ { - /** @deprecated use `DeleteThemeRequest$inboundSchema` instead. */ - export const inboundSchema = DeleteThemeRequest$inboundSchema; - /** @deprecated use `DeleteThemeRequest$outboundSchema` instead. */ - export const outboundSchema = DeleteThemeRequest$outboundSchema; - /** @deprecated use `DeleteThemeRequest$Outbound` instead. */ - export type Outbound = DeleteThemeRequest$Outbound; -} - -export function deleteThemeRequestToJSON( - deleteThemeRequest: DeleteThemeRequest, -): string { - return JSON.stringify( - DeleteThemeRequest$outboundSchema.parse(deleteThemeRequest), - ); -} - -export function deleteThemeRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => DeleteThemeRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'DeleteThemeRequest' from JSON`, - ); -} - -/** @internal */ -export const DeleteThemeResponse$inboundSchema: z.ZodType< - DeleteThemeResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type DeleteThemeResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const DeleteThemeResponse$outboundSchema: z.ZodType< - DeleteThemeResponse$Outbound, - z.ZodTypeDef, - DeleteThemeResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace DeleteThemeResponse$ { - /** @deprecated use `DeleteThemeResponse$inboundSchema` instead. */ - export const inboundSchema = DeleteThemeResponse$inboundSchema; - /** @deprecated use `DeleteThemeResponse$outboundSchema` instead. */ - export const outboundSchema = DeleteThemeResponse$outboundSchema; - /** @deprecated use `DeleteThemeResponse$Outbound` instead. */ - export type Outbound = DeleteThemeResponse$Outbound; -} - -export function deleteThemeResponseToJSON( - deleteThemeResponse: DeleteThemeResponse, -): string { - return JSON.stringify( - DeleteThemeResponse$outboundSchema.parse(deleteThemeResponse), - ); -} - -export function deleteThemeResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => DeleteThemeResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'DeleteThemeResponse' from JSON`, - ); -} diff --git a/src/models/operations/exchangepersonaltoken.ts b/src/models/operations/exchangepersonaltoken.ts deleted file mode 100644 index ce978f8..0000000 --- a/src/models/operations/exchangepersonaltoken.ts +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type ExchangePersonalTokenRequestBody = { - personalToken: string; -}; - -/** - * Default Response - */ -export type ExchangePersonalTokenResponseBody = { - accessToken: string; -}; - -export type ExchangePersonalTokenResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - object?: ExchangePersonalTokenResponseBody | undefined; -}; - -/** @internal */ -export const ExchangePersonalTokenRequestBody$inboundSchema: z.ZodType< - ExchangePersonalTokenRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - personalToken: z.string(), -}); - -/** @internal */ -export type ExchangePersonalTokenRequestBody$Outbound = { - personalToken: string; -}; - -/** @internal */ -export const ExchangePersonalTokenRequestBody$outboundSchema: z.ZodType< - ExchangePersonalTokenRequestBody$Outbound, - z.ZodTypeDef, - ExchangePersonalTokenRequestBody -> = z.object({ - personalToken: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ExchangePersonalTokenRequestBody$ { - /** @deprecated use `ExchangePersonalTokenRequestBody$inboundSchema` instead. */ - export const inboundSchema = ExchangePersonalTokenRequestBody$inboundSchema; - /** @deprecated use `ExchangePersonalTokenRequestBody$outboundSchema` instead. */ - export const outboundSchema = ExchangePersonalTokenRequestBody$outboundSchema; - /** @deprecated use `ExchangePersonalTokenRequestBody$Outbound` instead. */ - export type Outbound = ExchangePersonalTokenRequestBody$Outbound; -} - -export function exchangePersonalTokenRequestBodyToJSON( - exchangePersonalTokenRequestBody: ExchangePersonalTokenRequestBody, -): string { - return JSON.stringify( - ExchangePersonalTokenRequestBody$outboundSchema.parse( - exchangePersonalTokenRequestBody, - ), - ); -} - -export function exchangePersonalTokenRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ExchangePersonalTokenRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ExchangePersonalTokenRequestBody' from JSON`, - ); -} - -/** @internal */ -export const ExchangePersonalTokenResponseBody$inboundSchema: z.ZodType< - ExchangePersonalTokenResponseBody, - z.ZodTypeDef, - unknown -> = z.object({ - accessToken: z.string(), -}); - -/** @internal */ -export type ExchangePersonalTokenResponseBody$Outbound = { - accessToken: string; -}; - -/** @internal */ -export const ExchangePersonalTokenResponseBody$outboundSchema: z.ZodType< - ExchangePersonalTokenResponseBody$Outbound, - z.ZodTypeDef, - ExchangePersonalTokenResponseBody -> = z.object({ - accessToken: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ExchangePersonalTokenResponseBody$ { - /** @deprecated use `ExchangePersonalTokenResponseBody$inboundSchema` instead. */ - export const inboundSchema = ExchangePersonalTokenResponseBody$inboundSchema; - /** @deprecated use `ExchangePersonalTokenResponseBody$outboundSchema` instead. */ - export const outboundSchema = - ExchangePersonalTokenResponseBody$outboundSchema; - /** @deprecated use `ExchangePersonalTokenResponseBody$Outbound` instead. */ - export type Outbound = ExchangePersonalTokenResponseBody$Outbound; -} - -export function exchangePersonalTokenResponseBodyToJSON( - exchangePersonalTokenResponseBody: ExchangePersonalTokenResponseBody, -): string { - return JSON.stringify( - ExchangePersonalTokenResponseBody$outboundSchema.parse( - exchangePersonalTokenResponseBody, - ), - ); -} - -export function exchangePersonalTokenResponseBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ExchangePersonalTokenResponseBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ExchangePersonalTokenResponseBody' from JSON`, - ); -} - -/** @internal */ -export const ExchangePersonalTokenResponse$inboundSchema: z.ZodType< - ExchangePersonalTokenResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - object: z.lazy(() => ExchangePersonalTokenResponseBody$inboundSchema) - .optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type ExchangePersonalTokenResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - object?: ExchangePersonalTokenResponseBody$Outbound | undefined; -}; - -/** @internal */ -export const ExchangePersonalTokenResponse$outboundSchema: z.ZodType< - ExchangePersonalTokenResponse$Outbound, - z.ZodTypeDef, - ExchangePersonalTokenResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - object: z.lazy(() => ExchangePersonalTokenResponseBody$outboundSchema) - .optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ExchangePersonalTokenResponse$ { - /** @deprecated use `ExchangePersonalTokenResponse$inboundSchema` instead. */ - export const inboundSchema = ExchangePersonalTokenResponse$inboundSchema; - /** @deprecated use `ExchangePersonalTokenResponse$outboundSchema` instead. */ - export const outboundSchema = ExchangePersonalTokenResponse$outboundSchema; - /** @deprecated use `ExchangePersonalTokenResponse$Outbound` instead. */ - export type Outbound = ExchangePersonalTokenResponse$Outbound; -} - -export function exchangePersonalTokenResponseToJSON( - exchangePersonalTokenResponse: ExchangePersonalTokenResponse, -): string { - return JSON.stringify( - ExchangePersonalTokenResponse$outboundSchema.parse( - exchangePersonalTokenResponse, - ), - ); -} - -export function exchangePersonalTokenResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ExchangePersonalTokenResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ExchangePersonalTokenResponse' from JSON`, - ); -} diff --git a/src/models/operations/getapidocumentversion.ts b/src/models/operations/getapidocumentversion.ts deleted file mode 100644 index 05722ae..0000000 --- a/src/models/operations/getapidocumentversion.ts +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type GetApiDocumentVersionRequest = { - namespace: string; - slug: string; - semver: string; -}; - -export type GetApiDocumentVersionResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - res?: string | undefined; -}; - -/** @internal */ -export const GetApiDocumentVersionRequest$inboundSchema: z.ZodType< - GetApiDocumentVersionRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - semver: z.string(), -}); - -/** @internal */ -export type GetApiDocumentVersionRequest$Outbound = { - namespace: string; - slug: string; - semver: string; -}; - -/** @internal */ -export const GetApiDocumentVersionRequest$outboundSchema: z.ZodType< - GetApiDocumentVersionRequest$Outbound, - z.ZodTypeDef, - GetApiDocumentVersionRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - semver: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GetApiDocumentVersionRequest$ { - /** @deprecated use `GetApiDocumentVersionRequest$inboundSchema` instead. */ - export const inboundSchema = GetApiDocumentVersionRequest$inboundSchema; - /** @deprecated use `GetApiDocumentVersionRequest$outboundSchema` instead. */ - export const outboundSchema = GetApiDocumentVersionRequest$outboundSchema; - /** @deprecated use `GetApiDocumentVersionRequest$Outbound` instead. */ - export type Outbound = GetApiDocumentVersionRequest$Outbound; -} - -export function getApiDocumentVersionRequestToJSON( - getApiDocumentVersionRequest: GetApiDocumentVersionRequest, -): string { - return JSON.stringify( - GetApiDocumentVersionRequest$outboundSchema.parse( - getApiDocumentVersionRequest, - ), - ); -} - -export function getApiDocumentVersionRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => GetApiDocumentVersionRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GetApiDocumentVersionRequest' from JSON`, - ); -} - -/** @internal */ -export const GetApiDocumentVersionResponse$inboundSchema: z.ZodType< - GetApiDocumentVersionResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - res: z.string().optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type GetApiDocumentVersionResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - res?: string | undefined; -}; - -/** @internal */ -export const GetApiDocumentVersionResponse$outboundSchema: z.ZodType< - GetApiDocumentVersionResponse$Outbound, - z.ZodTypeDef, - GetApiDocumentVersionResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - res: z.string().optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GetApiDocumentVersionResponse$ { - /** @deprecated use `GetApiDocumentVersionResponse$inboundSchema` instead. */ - export const inboundSchema = GetApiDocumentVersionResponse$inboundSchema; - /** @deprecated use `GetApiDocumentVersionResponse$outboundSchema` instead. */ - export const outboundSchema = GetApiDocumentVersionResponse$outboundSchema; - /** @deprecated use `GetApiDocumentVersionResponse$Outbound` instead. */ - export type Outbound = GetApiDocumentVersionResponse$Outbound; -} - -export function getApiDocumentVersionResponseToJSON( - getApiDocumentVersionResponse: GetApiDocumentVersionResponse, -): string { - return JSON.stringify( - GetApiDocumentVersionResponse$outboundSchema.parse( - getApiDocumentVersionResponse, - ), - ); -} - -export function getApiDocumentVersionResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => GetApiDocumentVersionResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GetApiDocumentVersionResponse' from JSON`, - ); -} diff --git a/src/models/operations/getapidocumentversionmetadata.ts b/src/models/operations/getapidocumentversionmetadata.ts deleted file mode 100644 index 4807933..0000000 --- a/src/models/operations/getapidocumentversionmetadata.ts +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type GetApiDocumentVersionMetadataRequest = { - namespace: string; - slug: string; - semver: string; -}; - -export type GetApiDocumentVersionMetadataResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - managedDocVersion?: components.ManagedDocVersion | undefined; -}; - -/** @internal */ -export const GetApiDocumentVersionMetadataRequest$inboundSchema: z.ZodType< - GetApiDocumentVersionMetadataRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - semver: z.string(), -}); - -/** @internal */ -export type GetApiDocumentVersionMetadataRequest$Outbound = { - namespace: string; - slug: string; - semver: string; -}; - -/** @internal */ -export const GetApiDocumentVersionMetadataRequest$outboundSchema: z.ZodType< - GetApiDocumentVersionMetadataRequest$Outbound, - z.ZodTypeDef, - GetApiDocumentVersionMetadataRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - semver: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GetApiDocumentVersionMetadataRequest$ { - /** @deprecated use `GetApiDocumentVersionMetadataRequest$inboundSchema` instead. */ - export const inboundSchema = - GetApiDocumentVersionMetadataRequest$inboundSchema; - /** @deprecated use `GetApiDocumentVersionMetadataRequest$outboundSchema` instead. */ - export const outboundSchema = - GetApiDocumentVersionMetadataRequest$outboundSchema; - /** @deprecated use `GetApiDocumentVersionMetadataRequest$Outbound` instead. */ - export type Outbound = GetApiDocumentVersionMetadataRequest$Outbound; -} - -export function getApiDocumentVersionMetadataRequestToJSON( - getApiDocumentVersionMetadataRequest: GetApiDocumentVersionMetadataRequest, -): string { - return JSON.stringify( - GetApiDocumentVersionMetadataRequest$outboundSchema.parse( - getApiDocumentVersionMetadataRequest, - ), - ); -} - -export function getApiDocumentVersionMetadataRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => - GetApiDocumentVersionMetadataRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GetApiDocumentVersionMetadataRequest' from JSON`, - ); -} - -/** @internal */ -export const GetApiDocumentVersionMetadataResponse$inboundSchema: z.ZodType< - GetApiDocumentVersionMetadataResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - "managed-doc-version": components.ManagedDocVersion$inboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - "managed-doc-version": "managedDocVersion", - }); -}); - -/** @internal */ -export type GetApiDocumentVersionMetadataResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - "managed-doc-version"?: components.ManagedDocVersion$Outbound | undefined; -}; - -/** @internal */ -export const GetApiDocumentVersionMetadataResponse$outboundSchema: z.ZodType< - GetApiDocumentVersionMetadataResponse$Outbound, - z.ZodTypeDef, - GetApiDocumentVersionMetadataResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - managedDocVersion: components.ManagedDocVersion$outboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - managedDocVersion: "managed-doc-version", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GetApiDocumentVersionMetadataResponse$ { - /** @deprecated use `GetApiDocumentVersionMetadataResponse$inboundSchema` instead. */ - export const inboundSchema = - GetApiDocumentVersionMetadataResponse$inboundSchema; - /** @deprecated use `GetApiDocumentVersionMetadataResponse$outboundSchema` instead. */ - export const outboundSchema = - GetApiDocumentVersionMetadataResponse$outboundSchema; - /** @deprecated use `GetApiDocumentVersionMetadataResponse$Outbound` instead. */ - export type Outbound = GetApiDocumentVersionMetadataResponse$Outbound; -} - -export function getApiDocumentVersionMetadataResponseToJSON( - getApiDocumentVersionMetadataResponse: GetApiDocumentVersionMetadataResponse, -): string { - return JSON.stringify( - GetApiDocumentVersionMetadataResponse$outboundSchema.parse( - getApiDocumentVersionMetadataResponse, - ), - ); -} - -export function getApiDocumentVersionMetadataResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => - GetApiDocumentVersionMetadataResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GetApiDocumentVersionMetadataResponse' from JSON`, - ); -} diff --git a/src/models/operations/getcurrentuser.ts b/src/models/operations/getcurrentuser.ts deleted file mode 100644 index 3034c32..0000000 --- a/src/models/operations/getcurrentuser.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type GetCurrentUserResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - user?: components.User | undefined; -}; - -/** @internal */ -export const GetCurrentUserResponse$inboundSchema: z.ZodType< - GetCurrentUserResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - user: components.User$inboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type GetCurrentUserResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - user?: components.User$Outbound | undefined; -}; - -/** @internal */ -export const GetCurrentUserResponse$outboundSchema: z.ZodType< - GetCurrentUserResponse$Outbound, - z.ZodTypeDef, - GetCurrentUserResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - user: components.User$outboundSchema.optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GetCurrentUserResponse$ { - /** @deprecated use `GetCurrentUserResponse$inboundSchema` instead. */ - export const inboundSchema = GetCurrentUserResponse$inboundSchema; - /** @deprecated use `GetCurrentUserResponse$outboundSchema` instead. */ - export const outboundSchema = GetCurrentUserResponse$outboundSchema; - /** @deprecated use `GetCurrentUserResponse$Outbound` instead. */ - export type Outbound = GetCurrentUserResponse$Outbound; -} - -export function getCurrentUserResponseToJSON( - getCurrentUserResponse: GetCurrentUserResponse, -): string { - return JSON.stringify( - GetCurrentUserResponse$outboundSchema.parse(getCurrentUserResponse), - ); -} - -export function getCurrentUserResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => GetCurrentUserResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GetCurrentUserResponse' from JSON`, - ); -} diff --git a/src/models/operations/getloginportal.ts b/src/models/operations/getloginportal.ts deleted file mode 100644 index bbc4fcf..0000000 --- a/src/models/operations/getloginportal.ts +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type GetLoginPortalRequest = { - slug: string; -}; - -/** - * Default Response - */ -export type GetLoginPortalResponseBody = { - uid: string; - title: string; - slug: string; - email: components.LoginPortalEmail; - page: components.LoginPortalPage; -}; - -export type GetLoginPortalResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - object?: GetLoginPortalResponseBody | undefined; -}; - -/** @internal */ -export const GetLoginPortalRequest$inboundSchema: z.ZodType< - GetLoginPortalRequest, - z.ZodTypeDef, - unknown -> = z.object({ - slug: z.string(), -}); - -/** @internal */ -export type GetLoginPortalRequest$Outbound = { - slug: string; -}; - -/** @internal */ -export const GetLoginPortalRequest$outboundSchema: z.ZodType< - GetLoginPortalRequest$Outbound, - z.ZodTypeDef, - GetLoginPortalRequest -> = z.object({ - slug: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GetLoginPortalRequest$ { - /** @deprecated use `GetLoginPortalRequest$inboundSchema` instead. */ - export const inboundSchema = GetLoginPortalRequest$inboundSchema; - /** @deprecated use `GetLoginPortalRequest$outboundSchema` instead. */ - export const outboundSchema = GetLoginPortalRequest$outboundSchema; - /** @deprecated use `GetLoginPortalRequest$Outbound` instead. */ - export type Outbound = GetLoginPortalRequest$Outbound; -} - -export function getLoginPortalRequestToJSON( - getLoginPortalRequest: GetLoginPortalRequest, -): string { - return JSON.stringify( - GetLoginPortalRequest$outboundSchema.parse(getLoginPortalRequest), - ); -} - -export function getLoginPortalRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => GetLoginPortalRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GetLoginPortalRequest' from JSON`, - ); -} - -/** @internal */ -export const GetLoginPortalResponseBody$inboundSchema: z.ZodType< - GetLoginPortalResponseBody, - z.ZodTypeDef, - unknown -> = z.object({ - uid: z.string(), - title: z.string(), - slug: z.string(), - email: components.LoginPortalEmail$inboundSchema, - page: components.LoginPortalPage$inboundSchema, -}); - -/** @internal */ -export type GetLoginPortalResponseBody$Outbound = { - uid: string; - title: string; - slug: string; - email: components.LoginPortalEmail$Outbound; - page: components.LoginPortalPage$Outbound; -}; - -/** @internal */ -export const GetLoginPortalResponseBody$outboundSchema: z.ZodType< - GetLoginPortalResponseBody$Outbound, - z.ZodTypeDef, - GetLoginPortalResponseBody -> = z.object({ - uid: z.string(), - title: z.string(), - slug: z.string(), - email: components.LoginPortalEmail$outboundSchema, - page: components.LoginPortalPage$outboundSchema, -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GetLoginPortalResponseBody$ { - /** @deprecated use `GetLoginPortalResponseBody$inboundSchema` instead. */ - export const inboundSchema = GetLoginPortalResponseBody$inboundSchema; - /** @deprecated use `GetLoginPortalResponseBody$outboundSchema` instead. */ - export const outboundSchema = GetLoginPortalResponseBody$outboundSchema; - /** @deprecated use `GetLoginPortalResponseBody$Outbound` instead. */ - export type Outbound = GetLoginPortalResponseBody$Outbound; -} - -export function getLoginPortalResponseBodyToJSON( - getLoginPortalResponseBody: GetLoginPortalResponseBody, -): string { - return JSON.stringify( - GetLoginPortalResponseBody$outboundSchema.parse(getLoginPortalResponseBody), - ); -} - -export function getLoginPortalResponseBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => GetLoginPortalResponseBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GetLoginPortalResponseBody' from JSON`, - ); -} - -/** @internal */ -export const GetLoginPortalResponse$inboundSchema: z.ZodType< - GetLoginPortalResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - object: z.lazy(() => GetLoginPortalResponseBody$inboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type GetLoginPortalResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - object?: GetLoginPortalResponseBody$Outbound | undefined; -}; - -/** @internal */ -export const GetLoginPortalResponse$outboundSchema: z.ZodType< - GetLoginPortalResponse$Outbound, - z.ZodTypeDef, - GetLoginPortalResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - object: z.lazy(() => GetLoginPortalResponseBody$outboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GetLoginPortalResponse$ { - /** @deprecated use `GetLoginPortalResponse$inboundSchema` instead. */ - export const inboundSchema = GetLoginPortalResponse$inboundSchema; - /** @deprecated use `GetLoginPortalResponse$outboundSchema` instead. */ - export const outboundSchema = GetLoginPortalResponse$outboundSchema; - /** @deprecated use `GetLoginPortalResponse$Outbound` instead. */ - export type Outbound = GetLoginPortalResponse$Outbound; -} - -export function getLoginPortalResponseToJSON( - getLoginPortalResponse: GetLoginPortalResponse, -): string { - return JSON.stringify( - GetLoginPortalResponse$outboundSchema.parse(getLoginPortalResponse), - ); -} - -export function getLoginPortalResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => GetLoginPortalResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GetLoginPortalResponse' from JSON`, - ); -} diff --git a/src/models/operations/getrulesetdocument.ts b/src/models/operations/getrulesetdocument.ts deleted file mode 100644 index 9aa6984..0000000 --- a/src/models/operations/getrulesetdocument.ts +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type GetRulesetDocumentRequest = { - namespace: string; - slug: string; -}; - -export type GetRulesetDocumentResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - res?: string | undefined; -}; - -/** @internal */ -export const GetRulesetDocumentRequest$inboundSchema: z.ZodType< - GetRulesetDocumentRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), -}); - -/** @internal */ -export type GetRulesetDocumentRequest$Outbound = { - namespace: string; - slug: string; -}; - -/** @internal */ -export const GetRulesetDocumentRequest$outboundSchema: z.ZodType< - GetRulesetDocumentRequest$Outbound, - z.ZodTypeDef, - GetRulesetDocumentRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GetRulesetDocumentRequest$ { - /** @deprecated use `GetRulesetDocumentRequest$inboundSchema` instead. */ - export const inboundSchema = GetRulesetDocumentRequest$inboundSchema; - /** @deprecated use `GetRulesetDocumentRequest$outboundSchema` instead. */ - export const outboundSchema = GetRulesetDocumentRequest$outboundSchema; - /** @deprecated use `GetRulesetDocumentRequest$Outbound` instead. */ - export type Outbound = GetRulesetDocumentRequest$Outbound; -} - -export function getRulesetDocumentRequestToJSON( - getRulesetDocumentRequest: GetRulesetDocumentRequest, -): string { - return JSON.stringify( - GetRulesetDocumentRequest$outboundSchema.parse(getRulesetDocumentRequest), - ); -} - -export function getRulesetDocumentRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => GetRulesetDocumentRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GetRulesetDocumentRequest' from JSON`, - ); -} - -/** @internal */ -export const GetRulesetDocumentResponse$inboundSchema: z.ZodType< - GetRulesetDocumentResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - res: z.string().optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type GetRulesetDocumentResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - res?: string | undefined; -}; - -/** @internal */ -export const GetRulesetDocumentResponse$outboundSchema: z.ZodType< - GetRulesetDocumentResponse$Outbound, - z.ZodTypeDef, - GetRulesetDocumentResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - res: z.string().optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GetRulesetDocumentResponse$ { - /** @deprecated use `GetRulesetDocumentResponse$inboundSchema` instead. */ - export const inboundSchema = GetRulesetDocumentResponse$inboundSchema; - /** @deprecated use `GetRulesetDocumentResponse$outboundSchema` instead. */ - export const outboundSchema = GetRulesetDocumentResponse$outboundSchema; - /** @deprecated use `GetRulesetDocumentResponse$Outbound` instead. */ - export type Outbound = GetRulesetDocumentResponse$Outbound; -} - -export function getRulesetDocumentResponseToJSON( - getRulesetDocumentResponse: GetRulesetDocumentResponse, -): string { - return JSON.stringify( - GetRulesetDocumentResponse$outboundSchema.parse(getRulesetDocumentResponse), - ); -} - -export function getRulesetDocumentResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => GetRulesetDocumentResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GetRulesetDocumentResponse' from JSON`, - ); -} diff --git a/src/models/operations/getschemaversion.ts b/src/models/operations/getschemaversion.ts deleted file mode 100644 index 1cacc17..0000000 --- a/src/models/operations/getschemaversion.ts +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type GetSchemaVersionRequest = { - namespace: string; - slug: string; - semver: string; -}; - -export type GetSchemaVersionResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - res?: string | undefined; -}; - -/** @internal */ -export const GetSchemaVersionRequest$inboundSchema: z.ZodType< - GetSchemaVersionRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - semver: z.string(), -}); - -/** @internal */ -export type GetSchemaVersionRequest$Outbound = { - namespace: string; - slug: string; - semver: string; -}; - -/** @internal */ -export const GetSchemaVersionRequest$outboundSchema: z.ZodType< - GetSchemaVersionRequest$Outbound, - z.ZodTypeDef, - GetSchemaVersionRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - semver: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GetSchemaVersionRequest$ { - /** @deprecated use `GetSchemaVersionRequest$inboundSchema` instead. */ - export const inboundSchema = GetSchemaVersionRequest$inboundSchema; - /** @deprecated use `GetSchemaVersionRequest$outboundSchema` instead. */ - export const outboundSchema = GetSchemaVersionRequest$outboundSchema; - /** @deprecated use `GetSchemaVersionRequest$Outbound` instead. */ - export type Outbound = GetSchemaVersionRequest$Outbound; -} - -export function getSchemaVersionRequestToJSON( - getSchemaVersionRequest: GetSchemaVersionRequest, -): string { - return JSON.stringify( - GetSchemaVersionRequest$outboundSchema.parse(getSchemaVersionRequest), - ); -} - -export function getSchemaVersionRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => GetSchemaVersionRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GetSchemaVersionRequest' from JSON`, - ); -} - -/** @internal */ -export const GetSchemaVersionResponse$inboundSchema: z.ZodType< - GetSchemaVersionResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - res: z.string().optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type GetSchemaVersionResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - res?: string | undefined; -}; - -/** @internal */ -export const GetSchemaVersionResponse$outboundSchema: z.ZodType< - GetSchemaVersionResponse$Outbound, - z.ZodTypeDef, - GetSchemaVersionResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - res: z.string().optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GetSchemaVersionResponse$ { - /** @deprecated use `GetSchemaVersionResponse$inboundSchema` instead. */ - export const inboundSchema = GetSchemaVersionResponse$inboundSchema; - /** @deprecated use `GetSchemaVersionResponse$outboundSchema` instead. */ - export const outboundSchema = GetSchemaVersionResponse$outboundSchema; - /** @deprecated use `GetSchemaVersionResponse$Outbound` instead. */ - export type Outbound = GetSchemaVersionResponse$Outbound; -} - -export function getSchemaVersionResponseToJSON( - getSchemaVersionResponse: GetSchemaVersionResponse, -): string { - return JSON.stringify( - GetSchemaVersionResponse$outboundSchema.parse(getSchemaVersionResponse), - ); -} - -export function getSchemaVersionResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => GetSchemaVersionResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GetSchemaVersionResponse' from JSON`, - ); -} diff --git a/src/models/operations/gettheme.ts b/src/models/operations/gettheme.ts deleted file mode 100644 index 8a83f39..0000000 --- a/src/models/operations/gettheme.ts +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type GetThemeRequest = { - slug: string; -}; - -export type GetThemeResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - res?: string | undefined; -}; - -/** @internal */ -export const GetThemeRequest$inboundSchema: z.ZodType< - GetThemeRequest, - z.ZodTypeDef, - unknown -> = z.object({ - slug: z.string(), -}); - -/** @internal */ -export type GetThemeRequest$Outbound = { - slug: string; -}; - -/** @internal */ -export const GetThemeRequest$outboundSchema: z.ZodType< - GetThemeRequest$Outbound, - z.ZodTypeDef, - GetThemeRequest -> = z.object({ - slug: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GetThemeRequest$ { - /** @deprecated use `GetThemeRequest$inboundSchema` instead. */ - export const inboundSchema = GetThemeRequest$inboundSchema; - /** @deprecated use `GetThemeRequest$outboundSchema` instead. */ - export const outboundSchema = GetThemeRequest$outboundSchema; - /** @deprecated use `GetThemeRequest$Outbound` instead. */ - export type Outbound = GetThemeRequest$Outbound; -} - -export function getThemeRequestToJSON( - getThemeRequest: GetThemeRequest, -): string { - return JSON.stringify(GetThemeRequest$outboundSchema.parse(getThemeRequest)); -} - -export function getThemeRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => GetThemeRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GetThemeRequest' from JSON`, - ); -} - -/** @internal */ -export const GetThemeResponse$inboundSchema: z.ZodType< - GetThemeResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - res: z.string().optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type GetThemeResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - res?: string | undefined; -}; - -/** @internal */ -export const GetThemeResponse$outboundSchema: z.ZodType< - GetThemeResponse$Outbound, - z.ZodTypeDef, - GetThemeResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - res: z.string().optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace GetThemeResponse$ { - /** @deprecated use `GetThemeResponse$inboundSchema` instead. */ - export const inboundSchema = GetThemeResponse$inboundSchema; - /** @deprecated use `GetThemeResponse$outboundSchema` instead. */ - export const outboundSchema = GetThemeResponse$outboundSchema; - /** @deprecated use `GetThemeResponse$Outbound` instead. */ - export type Outbound = GetThemeResponse$Outbound; -} - -export function getThemeResponseToJSON( - getThemeResponse: GetThemeResponse, -): string { - return JSON.stringify( - GetThemeResponse$outboundSchema.parse(getThemeResponse), - ); -} - -export function getThemeResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => GetThemeResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'GetThemeResponse' from JSON`, - ); -} diff --git a/src/models/operations/index.ts b/src/models/operations/index.ts deleted file mode 100644 index 4e038ff..0000000 --- a/src/models/operations/index.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -export * from "./addapidocumentaccessgroup.js"; -export * from "./addrulesetaccessgroup.js"; -export * from "./addschemaaccessgroup.js"; -export * from "./createapidocument.js"; -export * from "./createapidocumentversion.js"; -export * from "./createguide.js"; -export * from "./createloginportal.js"; -export * from "./createruleset.js"; -export * from "./createschema.js"; -export * from "./createschemaversion.js"; -export * from "./createtheme.js"; -export * from "./deleteapidocument.js"; -export * from "./deleteapidocumentversion.js"; -export * from "./deleteloginportal.js"; -export * from "./deleteruleset.js"; -export * from "./deleteschema.js"; -export * from "./deleteschemaversion.js"; -export * from "./deletetheme.js"; -export * from "./exchangepersonaltoken.js"; -export * from "./getapidocumentversion.js"; -export * from "./getapidocumentversionmetadata.js"; -export * from "./getcurrentuser.js"; -export * from "./getloginportal.js"; -export * from "./getrulesetdocument.js"; -export * from "./getschemaversion.js"; -export * from "./gettheme.js"; -export * from "./listallapidocuments.js"; -export * from "./listapidocuments.js"; -export * from "./listguides.js"; -export * from "./listloginportals.js"; -export * from "./listnamespaces.js"; -export * from "./listrulesets.js"; -export * from "./listschemas.js"; -export * from "./listteams.js"; -export * from "./listthemes.js"; -export * from "./publishguide.js"; -export * from "./removeapidocumentaccessgroup.js"; -export * from "./removerulesetaccessgroup.js"; -export * from "./removeschemaaccessgroup.js"; -export * from "./replacethemedocument.js"; -export * from "./updateapidocument.js"; -export * from "./updateapidocumentversion.js"; -export * from "./updateloginportal.js"; -export * from "./updateruleset.js"; -export * from "./updateschema.js"; -export * from "./updatetheme.js"; diff --git a/src/models/operations/listallapidocuments.ts b/src/models/operations/listallapidocuments.ts deleted file mode 100644 index c0a2cc7..0000000 --- a/src/models/operations/listallapidocuments.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type ListAllApiDocumentsResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - apiDocuments?: Array | undefined; -}; - -/** @internal */ -export const ListAllApiDocumentsResponse$inboundSchema: z.ZodType< - ListAllApiDocumentsResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - "api-documents": z.array(components.ApiDocument$inboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - "api-documents": "apiDocuments", - }); -}); - -/** @internal */ -export type ListAllApiDocumentsResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - "api-documents"?: Array | undefined; -}; - -/** @internal */ -export const ListAllApiDocumentsResponse$outboundSchema: z.ZodType< - ListAllApiDocumentsResponse$Outbound, - z.ZodTypeDef, - ListAllApiDocumentsResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - apiDocuments: z.array(components.ApiDocument$outboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - apiDocuments: "api-documents", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ListAllApiDocumentsResponse$ { - /** @deprecated use `ListAllApiDocumentsResponse$inboundSchema` instead. */ - export const inboundSchema = ListAllApiDocumentsResponse$inboundSchema; - /** @deprecated use `ListAllApiDocumentsResponse$outboundSchema` instead. */ - export const outboundSchema = ListAllApiDocumentsResponse$outboundSchema; - /** @deprecated use `ListAllApiDocumentsResponse$Outbound` instead. */ - export type Outbound = ListAllApiDocumentsResponse$Outbound; -} - -export function listAllApiDocumentsResponseToJSON( - listAllApiDocumentsResponse: ListAllApiDocumentsResponse, -): string { - return JSON.stringify( - ListAllApiDocumentsResponse$outboundSchema.parse( - listAllApiDocumentsResponse, - ), - ); -} - -export function listAllApiDocumentsResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ListAllApiDocumentsResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ListAllApiDocumentsResponse' from JSON`, - ); -} diff --git a/src/models/operations/listapidocuments.ts b/src/models/operations/listapidocuments.ts deleted file mode 100644 index 70bea5d..0000000 --- a/src/models/operations/listapidocuments.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type ListApiDocumentsRequest = { - namespace: string; -}; - -export type ListApiDocumentsResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - apiDocuments?: Array | undefined; -}; - -/** @internal */ -export const ListApiDocumentsRequest$inboundSchema: z.ZodType< - ListApiDocumentsRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), -}); - -/** @internal */ -export type ListApiDocumentsRequest$Outbound = { - namespace: string; -}; - -/** @internal */ -export const ListApiDocumentsRequest$outboundSchema: z.ZodType< - ListApiDocumentsRequest$Outbound, - z.ZodTypeDef, - ListApiDocumentsRequest -> = z.object({ - namespace: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ListApiDocumentsRequest$ { - /** @deprecated use `ListApiDocumentsRequest$inboundSchema` instead. */ - export const inboundSchema = ListApiDocumentsRequest$inboundSchema; - /** @deprecated use `ListApiDocumentsRequest$outboundSchema` instead. */ - export const outboundSchema = ListApiDocumentsRequest$outboundSchema; - /** @deprecated use `ListApiDocumentsRequest$Outbound` instead. */ - export type Outbound = ListApiDocumentsRequest$Outbound; -} - -export function listApiDocumentsRequestToJSON( - listApiDocumentsRequest: ListApiDocumentsRequest, -): string { - return JSON.stringify( - ListApiDocumentsRequest$outboundSchema.parse(listApiDocumentsRequest), - ); -} - -export function listApiDocumentsRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ListApiDocumentsRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ListApiDocumentsRequest' from JSON`, - ); -} - -/** @internal */ -export const ListApiDocumentsResponse$inboundSchema: z.ZodType< - ListApiDocumentsResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - "api-documents": z.array(components.ApiDocument$inboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - "api-documents": "apiDocuments", - }); -}); - -/** @internal */ -export type ListApiDocumentsResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - "api-documents"?: Array | undefined; -}; - -/** @internal */ -export const ListApiDocumentsResponse$outboundSchema: z.ZodType< - ListApiDocumentsResponse$Outbound, - z.ZodTypeDef, - ListApiDocumentsResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - apiDocuments: z.array(components.ApiDocument$outboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - apiDocuments: "api-documents", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ListApiDocumentsResponse$ { - /** @deprecated use `ListApiDocumentsResponse$inboundSchema` instead. */ - export const inboundSchema = ListApiDocumentsResponse$inboundSchema; - /** @deprecated use `ListApiDocumentsResponse$outboundSchema` instead. */ - export const outboundSchema = ListApiDocumentsResponse$outboundSchema; - /** @deprecated use `ListApiDocumentsResponse$Outbound` instead. */ - export type Outbound = ListApiDocumentsResponse$Outbound; -} - -export function listApiDocumentsResponseToJSON( - listApiDocumentsResponse: ListApiDocumentsResponse, -): string { - return JSON.stringify( - ListApiDocumentsResponse$outboundSchema.parse(listApiDocumentsResponse), - ); -} - -export function listApiDocumentsResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ListApiDocumentsResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ListApiDocumentsResponse' from JSON`, - ); -} diff --git a/src/models/operations/listguides.ts b/src/models/operations/listguides.ts deleted file mode 100644 index a09fcb8..0000000 --- a/src/models/operations/listguides.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type ListGuidesResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - githubProjects?: Array | undefined; -}; - -/** @internal */ -export const ListGuidesResponse$inboundSchema: z.ZodType< - ListGuidesResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - "github-projects": z.array(components.GithubProject$inboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - "github-projects": "githubProjects", - }); -}); - -/** @internal */ -export type ListGuidesResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - "github-projects"?: Array | undefined; -}; - -/** @internal */ -export const ListGuidesResponse$outboundSchema: z.ZodType< - ListGuidesResponse$Outbound, - z.ZodTypeDef, - ListGuidesResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - githubProjects: z.array(components.GithubProject$outboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - githubProjects: "github-projects", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ListGuidesResponse$ { - /** @deprecated use `ListGuidesResponse$inboundSchema` instead. */ - export const inboundSchema = ListGuidesResponse$inboundSchema; - /** @deprecated use `ListGuidesResponse$outboundSchema` instead. */ - export const outboundSchema = ListGuidesResponse$outboundSchema; - /** @deprecated use `ListGuidesResponse$Outbound` instead. */ - export type Outbound = ListGuidesResponse$Outbound; -} - -export function listGuidesResponseToJSON( - listGuidesResponse: ListGuidesResponse, -): string { - return JSON.stringify( - ListGuidesResponse$outboundSchema.parse(listGuidesResponse), - ); -} - -export function listGuidesResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ListGuidesResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ListGuidesResponse' from JSON`, - ); -} diff --git a/src/models/operations/listloginportals.ts b/src/models/operations/listloginportals.ts deleted file mode 100644 index e3ad38c..0000000 --- a/src/models/operations/listloginportals.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type ListLoginPortalsResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - loginPortals?: Array | undefined; -}; - -/** @internal */ -export const ListLoginPortalsResponse$inboundSchema: z.ZodType< - ListLoginPortalsResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - "login-portals": z.array(components.LoginPortal$inboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - "login-portals": "loginPortals", - }); -}); - -/** @internal */ -export type ListLoginPortalsResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - "login-portals"?: Array | undefined; -}; - -/** @internal */ -export const ListLoginPortalsResponse$outboundSchema: z.ZodType< - ListLoginPortalsResponse$Outbound, - z.ZodTypeDef, - ListLoginPortalsResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - loginPortals: z.array(components.LoginPortal$outboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - loginPortals: "login-portals", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ListLoginPortalsResponse$ { - /** @deprecated use `ListLoginPortalsResponse$inboundSchema` instead. */ - export const inboundSchema = ListLoginPortalsResponse$inboundSchema; - /** @deprecated use `ListLoginPortalsResponse$outboundSchema` instead. */ - export const outboundSchema = ListLoginPortalsResponse$outboundSchema; - /** @deprecated use `ListLoginPortalsResponse$Outbound` instead. */ - export type Outbound = ListLoginPortalsResponse$Outbound; -} - -export function listLoginPortalsResponseToJSON( - listLoginPortalsResponse: ListLoginPortalsResponse, -): string { - return JSON.stringify( - ListLoginPortalsResponse$outboundSchema.parse(listLoginPortalsResponse), - ); -} - -export function listLoginPortalsResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ListLoginPortalsResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ListLoginPortalsResponse' from JSON`, - ); -} diff --git a/src/models/operations/listnamespaces.ts b/src/models/operations/listnamespaces.ts deleted file mode 100644 index 8ec7a5c..0000000 --- a/src/models/operations/listnamespaces.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type ListNamespacesResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - strings?: Array | undefined; -}; - -/** @internal */ -export const ListNamespacesResponse$inboundSchema: z.ZodType< - ListNamespacesResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - strings: z.array(z.string()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type ListNamespacesResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - strings?: Array | undefined; -}; - -/** @internal */ -export const ListNamespacesResponse$outboundSchema: z.ZodType< - ListNamespacesResponse$Outbound, - z.ZodTypeDef, - ListNamespacesResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - strings: z.array(z.string()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ListNamespacesResponse$ { - /** @deprecated use `ListNamespacesResponse$inboundSchema` instead. */ - export const inboundSchema = ListNamespacesResponse$inboundSchema; - /** @deprecated use `ListNamespacesResponse$outboundSchema` instead. */ - export const outboundSchema = ListNamespacesResponse$outboundSchema; - /** @deprecated use `ListNamespacesResponse$Outbound` instead. */ - export type Outbound = ListNamespacesResponse$Outbound; -} - -export function listNamespacesResponseToJSON( - listNamespacesResponse: ListNamespacesResponse, -): string { - return JSON.stringify( - ListNamespacesResponse$outboundSchema.parse(listNamespacesResponse), - ); -} - -export function listNamespacesResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ListNamespacesResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ListNamespacesResponse' from JSON`, - ); -} diff --git a/src/models/operations/listrulesets.ts b/src/models/operations/listrulesets.ts deleted file mode 100644 index a3e6709..0000000 --- a/src/models/operations/listrulesets.ts +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type ListRulesetsRequest = { - namespace: string; -}; - -export type ListRulesetsResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - rules?: Array | undefined; -}; - -/** @internal */ -export const ListRulesetsRequest$inboundSchema: z.ZodType< - ListRulesetsRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), -}); - -/** @internal */ -export type ListRulesetsRequest$Outbound = { - namespace: string; -}; - -/** @internal */ -export const ListRulesetsRequest$outboundSchema: z.ZodType< - ListRulesetsRequest$Outbound, - z.ZodTypeDef, - ListRulesetsRequest -> = z.object({ - namespace: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ListRulesetsRequest$ { - /** @deprecated use `ListRulesetsRequest$inboundSchema` instead. */ - export const inboundSchema = ListRulesetsRequest$inboundSchema; - /** @deprecated use `ListRulesetsRequest$outboundSchema` instead. */ - export const outboundSchema = ListRulesetsRequest$outboundSchema; - /** @deprecated use `ListRulesetsRequest$Outbound` instead. */ - export type Outbound = ListRulesetsRequest$Outbound; -} - -export function listRulesetsRequestToJSON( - listRulesetsRequest: ListRulesetsRequest, -): string { - return JSON.stringify( - ListRulesetsRequest$outboundSchema.parse(listRulesetsRequest), - ); -} - -export function listRulesetsRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ListRulesetsRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ListRulesetsRequest' from JSON`, - ); -} - -/** @internal */ -export const ListRulesetsResponse$inboundSchema: z.ZodType< - ListRulesetsResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - rules: z.array(components.Rule$inboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type ListRulesetsResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - rules?: Array | undefined; -}; - -/** @internal */ -export const ListRulesetsResponse$outboundSchema: z.ZodType< - ListRulesetsResponse$Outbound, - z.ZodTypeDef, - ListRulesetsResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - rules: z.array(components.Rule$outboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ListRulesetsResponse$ { - /** @deprecated use `ListRulesetsResponse$inboundSchema` instead. */ - export const inboundSchema = ListRulesetsResponse$inboundSchema; - /** @deprecated use `ListRulesetsResponse$outboundSchema` instead. */ - export const outboundSchema = ListRulesetsResponse$outboundSchema; - /** @deprecated use `ListRulesetsResponse$Outbound` instead. */ - export type Outbound = ListRulesetsResponse$Outbound; -} - -export function listRulesetsResponseToJSON( - listRulesetsResponse: ListRulesetsResponse, -): string { - return JSON.stringify( - ListRulesetsResponse$outboundSchema.parse(listRulesetsResponse), - ); -} - -export function listRulesetsResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ListRulesetsResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ListRulesetsResponse' from JSON`, - ); -} diff --git a/src/models/operations/listschemas.ts b/src/models/operations/listschemas.ts deleted file mode 100644 index c0346c4..0000000 --- a/src/models/operations/listschemas.ts +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type ListSchemasRequest = { - namespace: string; -}; - -export type ListSchemasResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - schemata?: Array | undefined; -}; - -/** @internal */ -export const ListSchemasRequest$inboundSchema: z.ZodType< - ListSchemasRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), -}); - -/** @internal */ -export type ListSchemasRequest$Outbound = { - namespace: string; -}; - -/** @internal */ -export const ListSchemasRequest$outboundSchema: z.ZodType< - ListSchemasRequest$Outbound, - z.ZodTypeDef, - ListSchemasRequest -> = z.object({ - namespace: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ListSchemasRequest$ { - /** @deprecated use `ListSchemasRequest$inboundSchema` instead. */ - export const inboundSchema = ListSchemasRequest$inboundSchema; - /** @deprecated use `ListSchemasRequest$outboundSchema` instead. */ - export const outboundSchema = ListSchemasRequest$outboundSchema; - /** @deprecated use `ListSchemasRequest$Outbound` instead. */ - export type Outbound = ListSchemasRequest$Outbound; -} - -export function listSchemasRequestToJSON( - listSchemasRequest: ListSchemasRequest, -): string { - return JSON.stringify( - ListSchemasRequest$outboundSchema.parse(listSchemasRequest), - ); -} - -export function listSchemasRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ListSchemasRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ListSchemasRequest' from JSON`, - ); -} - -/** @internal */ -export const ListSchemasResponse$inboundSchema: z.ZodType< - ListSchemasResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - schemata: z.array(components.Schema$inboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type ListSchemasResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - schemata?: Array | undefined; -}; - -/** @internal */ -export const ListSchemasResponse$outboundSchema: z.ZodType< - ListSchemasResponse$Outbound, - z.ZodTypeDef, - ListSchemasResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - schemata: z.array(components.Schema$outboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ListSchemasResponse$ { - /** @deprecated use `ListSchemasResponse$inboundSchema` instead. */ - export const inboundSchema = ListSchemasResponse$inboundSchema; - /** @deprecated use `ListSchemasResponse$outboundSchema` instead. */ - export const outboundSchema = ListSchemasResponse$outboundSchema; - /** @deprecated use `ListSchemasResponse$Outbound` instead. */ - export type Outbound = ListSchemasResponse$Outbound; -} - -export function listSchemasResponseToJSON( - listSchemasResponse: ListSchemasResponse, -): string { - return JSON.stringify( - ListSchemasResponse$outboundSchema.parse(listSchemasResponse), - ); -} - -export function listSchemasResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ListSchemasResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ListSchemasResponse' from JSON`, - ); -} diff --git a/src/models/operations/listteams.ts b/src/models/operations/listteams.ts deleted file mode 100644 index 9ab86ce..0000000 --- a/src/models/operations/listteams.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type ListTeamsResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - teams?: Array | undefined; -}; - -/** @internal */ -export const ListTeamsResponse$inboundSchema: z.ZodType< - ListTeamsResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - teams: z.array(components.Team$inboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type ListTeamsResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - teams?: Array | undefined; -}; - -/** @internal */ -export const ListTeamsResponse$outboundSchema: z.ZodType< - ListTeamsResponse$Outbound, - z.ZodTypeDef, - ListTeamsResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - teams: z.array(components.Team$outboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ListTeamsResponse$ { - /** @deprecated use `ListTeamsResponse$inboundSchema` instead. */ - export const inboundSchema = ListTeamsResponse$inboundSchema; - /** @deprecated use `ListTeamsResponse$outboundSchema` instead. */ - export const outboundSchema = ListTeamsResponse$outboundSchema; - /** @deprecated use `ListTeamsResponse$Outbound` instead. */ - export type Outbound = ListTeamsResponse$Outbound; -} - -export function listTeamsResponseToJSON( - listTeamsResponse: ListTeamsResponse, -): string { - return JSON.stringify( - ListTeamsResponse$outboundSchema.parse(listTeamsResponse), - ); -} - -export function listTeamsResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ListTeamsResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ListTeamsResponse' from JSON`, - ); -} diff --git a/src/models/operations/listthemes.ts b/src/models/operations/listthemes.ts deleted file mode 100644 index 88497bb..0000000 --- a/src/models/operations/listthemes.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type ListThemesResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - themes?: Array | undefined; -}; - -/** @internal */ -export const ListThemesResponse$inboundSchema: z.ZodType< - ListThemesResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - themes: z.array(components.Theme$inboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type ListThemesResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - themes?: Array | undefined; -}; - -/** @internal */ -export const ListThemesResponse$outboundSchema: z.ZodType< - ListThemesResponse$Outbound, - z.ZodTypeDef, - ListThemesResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - themes: z.array(components.Theme$outboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ListThemesResponse$ { - /** @deprecated use `ListThemesResponse$inboundSchema` instead. */ - export const inboundSchema = ListThemesResponse$inboundSchema; - /** @deprecated use `ListThemesResponse$outboundSchema` instead. */ - export const outboundSchema = ListThemesResponse$outboundSchema; - /** @deprecated use `ListThemesResponse$Outbound` instead. */ - export type Outbound = ListThemesResponse$Outbound; -} - -export function listThemesResponseToJSON( - listThemesResponse: ListThemesResponse, -): string { - return JSON.stringify( - ListThemesResponse$outboundSchema.parse(listThemesResponse), - ); -} - -export function listThemesResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ListThemesResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ListThemesResponse' from JSON`, - ); -} diff --git a/src/models/operations/publishguide.ts b/src/models/operations/publishguide.ts deleted file mode 100644 index c2e3405..0000000 --- a/src/models/operations/publishguide.ts +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type PublishGuideRequest = { - slug: string; -}; - -/** - * Default Response - */ -export type PublishGuideResponseBody = { - publishUid: string; -}; - -export type PublishGuideResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - object?: PublishGuideResponseBody | undefined; -}; - -/** @internal */ -export const PublishGuideRequest$inboundSchema: z.ZodType< - PublishGuideRequest, - z.ZodTypeDef, - unknown -> = z.object({ - slug: z.string(), -}); - -/** @internal */ -export type PublishGuideRequest$Outbound = { - slug: string; -}; - -/** @internal */ -export const PublishGuideRequest$outboundSchema: z.ZodType< - PublishGuideRequest$Outbound, - z.ZodTypeDef, - PublishGuideRequest -> = z.object({ - slug: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace PublishGuideRequest$ { - /** @deprecated use `PublishGuideRequest$inboundSchema` instead. */ - export const inboundSchema = PublishGuideRequest$inboundSchema; - /** @deprecated use `PublishGuideRequest$outboundSchema` instead. */ - export const outboundSchema = PublishGuideRequest$outboundSchema; - /** @deprecated use `PublishGuideRequest$Outbound` instead. */ - export type Outbound = PublishGuideRequest$Outbound; -} - -export function publishGuideRequestToJSON( - publishGuideRequest: PublishGuideRequest, -): string { - return JSON.stringify( - PublishGuideRequest$outboundSchema.parse(publishGuideRequest), - ); -} - -export function publishGuideRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => PublishGuideRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'PublishGuideRequest' from JSON`, - ); -} - -/** @internal */ -export const PublishGuideResponseBody$inboundSchema: z.ZodType< - PublishGuideResponseBody, - z.ZodTypeDef, - unknown -> = z.object({ - publishUid: z.string(), -}); - -/** @internal */ -export type PublishGuideResponseBody$Outbound = { - publishUid: string; -}; - -/** @internal */ -export const PublishGuideResponseBody$outboundSchema: z.ZodType< - PublishGuideResponseBody$Outbound, - z.ZodTypeDef, - PublishGuideResponseBody -> = z.object({ - publishUid: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace PublishGuideResponseBody$ { - /** @deprecated use `PublishGuideResponseBody$inboundSchema` instead. */ - export const inboundSchema = PublishGuideResponseBody$inboundSchema; - /** @deprecated use `PublishGuideResponseBody$outboundSchema` instead. */ - export const outboundSchema = PublishGuideResponseBody$outboundSchema; - /** @deprecated use `PublishGuideResponseBody$Outbound` instead. */ - export type Outbound = PublishGuideResponseBody$Outbound; -} - -export function publishGuideResponseBodyToJSON( - publishGuideResponseBody: PublishGuideResponseBody, -): string { - return JSON.stringify( - PublishGuideResponseBody$outboundSchema.parse(publishGuideResponseBody), - ); -} - -export function publishGuideResponseBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => PublishGuideResponseBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'PublishGuideResponseBody' from JSON`, - ); -} - -/** @internal */ -export const PublishGuideResponse$inboundSchema: z.ZodType< - PublishGuideResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - object: z.lazy(() => PublishGuideResponseBody$inboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type PublishGuideResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - object?: PublishGuideResponseBody$Outbound | undefined; -}; - -/** @internal */ -export const PublishGuideResponse$outboundSchema: z.ZodType< - PublishGuideResponse$Outbound, - z.ZodTypeDef, - PublishGuideResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - object: z.lazy(() => PublishGuideResponseBody$outboundSchema).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace PublishGuideResponse$ { - /** @deprecated use `PublishGuideResponse$inboundSchema` instead. */ - export const inboundSchema = PublishGuideResponse$inboundSchema; - /** @deprecated use `PublishGuideResponse$outboundSchema` instead. */ - export const outboundSchema = PublishGuideResponse$outboundSchema; - /** @deprecated use `PublishGuideResponse$Outbound` instead. */ - export type Outbound = PublishGuideResponse$Outbound; -} - -export function publishGuideResponseToJSON( - publishGuideResponse: PublishGuideResponse, -): string { - return JSON.stringify( - PublishGuideResponse$outboundSchema.parse(publishGuideResponse), - ); -} - -export function publishGuideResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => PublishGuideResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'PublishGuideResponse' from JSON`, - ); -} diff --git a/src/models/operations/removeapidocumentaccessgroup.ts b/src/models/operations/removeapidocumentaccessgroup.ts deleted file mode 100644 index b68f044..0000000 --- a/src/models/operations/removeapidocumentaccessgroup.ts +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type RemoveApiDocumentAccessGroupRequest = { - namespace: string; - slug: string; - accessGroup: components.AccessGroup; -}; - -export type RemoveApiDocumentAccessGroupResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const RemoveApiDocumentAccessGroupRequest$inboundSchema: z.ZodType< - RemoveApiDocumentAccessGroupRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - "access-group": components.AccessGroup$inboundSchema, -}).transform((v) => { - return remap$(v, { - "access-group": "accessGroup", - }); -}); - -/** @internal */ -export type RemoveApiDocumentAccessGroupRequest$Outbound = { - namespace: string; - slug: string; - "access-group": components.AccessGroup$Outbound; -}; - -/** @internal */ -export const RemoveApiDocumentAccessGroupRequest$outboundSchema: z.ZodType< - RemoveApiDocumentAccessGroupRequest$Outbound, - z.ZodTypeDef, - RemoveApiDocumentAccessGroupRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - accessGroup: components.AccessGroup$outboundSchema, -}).transform((v) => { - return remap$(v, { - accessGroup: "access-group", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace RemoveApiDocumentAccessGroupRequest$ { - /** @deprecated use `RemoveApiDocumentAccessGroupRequest$inboundSchema` instead. */ - export const inboundSchema = - RemoveApiDocumentAccessGroupRequest$inboundSchema; - /** @deprecated use `RemoveApiDocumentAccessGroupRequest$outboundSchema` instead. */ - export const outboundSchema = - RemoveApiDocumentAccessGroupRequest$outboundSchema; - /** @deprecated use `RemoveApiDocumentAccessGroupRequest$Outbound` instead. */ - export type Outbound = RemoveApiDocumentAccessGroupRequest$Outbound; -} - -export function removeApiDocumentAccessGroupRequestToJSON( - removeApiDocumentAccessGroupRequest: RemoveApiDocumentAccessGroupRequest, -): string { - return JSON.stringify( - RemoveApiDocumentAccessGroupRequest$outboundSchema.parse( - removeApiDocumentAccessGroupRequest, - ), - ); -} - -export function removeApiDocumentAccessGroupRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => - RemoveApiDocumentAccessGroupRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'RemoveApiDocumentAccessGroupRequest' from JSON`, - ); -} - -/** @internal */ -export const RemoveApiDocumentAccessGroupResponse$inboundSchema: z.ZodType< - RemoveApiDocumentAccessGroupResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type RemoveApiDocumentAccessGroupResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const RemoveApiDocumentAccessGroupResponse$outboundSchema: z.ZodType< - RemoveApiDocumentAccessGroupResponse$Outbound, - z.ZodTypeDef, - RemoveApiDocumentAccessGroupResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace RemoveApiDocumentAccessGroupResponse$ { - /** @deprecated use `RemoveApiDocumentAccessGroupResponse$inboundSchema` instead. */ - export const inboundSchema = - RemoveApiDocumentAccessGroupResponse$inboundSchema; - /** @deprecated use `RemoveApiDocumentAccessGroupResponse$outboundSchema` instead. */ - export const outboundSchema = - RemoveApiDocumentAccessGroupResponse$outboundSchema; - /** @deprecated use `RemoveApiDocumentAccessGroupResponse$Outbound` instead. */ - export type Outbound = RemoveApiDocumentAccessGroupResponse$Outbound; -} - -export function removeApiDocumentAccessGroupResponseToJSON( - removeApiDocumentAccessGroupResponse: RemoveApiDocumentAccessGroupResponse, -): string { - return JSON.stringify( - RemoveApiDocumentAccessGroupResponse$outboundSchema.parse( - removeApiDocumentAccessGroupResponse, - ), - ); -} - -export function removeApiDocumentAccessGroupResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => - RemoveApiDocumentAccessGroupResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'RemoveApiDocumentAccessGroupResponse' from JSON`, - ); -} diff --git a/src/models/operations/removerulesetaccessgroup.ts b/src/models/operations/removerulesetaccessgroup.ts deleted file mode 100644 index 85a22c5..0000000 --- a/src/models/operations/removerulesetaccessgroup.ts +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type RemoveRulesetAccessGroupRequest = { - namespace: string; - slug: string; - accessGroup: components.AccessGroup; -}; - -export type RemoveRulesetAccessGroupResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const RemoveRulesetAccessGroupRequest$inboundSchema: z.ZodType< - RemoveRulesetAccessGroupRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - "access-group": components.AccessGroup$inboundSchema, -}).transform((v) => { - return remap$(v, { - "access-group": "accessGroup", - }); -}); - -/** @internal */ -export type RemoveRulesetAccessGroupRequest$Outbound = { - namespace: string; - slug: string; - "access-group": components.AccessGroup$Outbound; -}; - -/** @internal */ -export const RemoveRulesetAccessGroupRequest$outboundSchema: z.ZodType< - RemoveRulesetAccessGroupRequest$Outbound, - z.ZodTypeDef, - RemoveRulesetAccessGroupRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - accessGroup: components.AccessGroup$outboundSchema, -}).transform((v) => { - return remap$(v, { - accessGroup: "access-group", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace RemoveRulesetAccessGroupRequest$ { - /** @deprecated use `RemoveRulesetAccessGroupRequest$inboundSchema` instead. */ - export const inboundSchema = RemoveRulesetAccessGroupRequest$inboundSchema; - /** @deprecated use `RemoveRulesetAccessGroupRequest$outboundSchema` instead. */ - export const outboundSchema = RemoveRulesetAccessGroupRequest$outboundSchema; - /** @deprecated use `RemoveRulesetAccessGroupRequest$Outbound` instead. */ - export type Outbound = RemoveRulesetAccessGroupRequest$Outbound; -} - -export function removeRulesetAccessGroupRequestToJSON( - removeRulesetAccessGroupRequest: RemoveRulesetAccessGroupRequest, -): string { - return JSON.stringify( - RemoveRulesetAccessGroupRequest$outboundSchema.parse( - removeRulesetAccessGroupRequest, - ), - ); -} - -export function removeRulesetAccessGroupRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => RemoveRulesetAccessGroupRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'RemoveRulesetAccessGroupRequest' from JSON`, - ); -} - -/** @internal */ -export const RemoveRulesetAccessGroupResponse$inboundSchema: z.ZodType< - RemoveRulesetAccessGroupResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type RemoveRulesetAccessGroupResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const RemoveRulesetAccessGroupResponse$outboundSchema: z.ZodType< - RemoveRulesetAccessGroupResponse$Outbound, - z.ZodTypeDef, - RemoveRulesetAccessGroupResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace RemoveRulesetAccessGroupResponse$ { - /** @deprecated use `RemoveRulesetAccessGroupResponse$inboundSchema` instead. */ - export const inboundSchema = RemoveRulesetAccessGroupResponse$inboundSchema; - /** @deprecated use `RemoveRulesetAccessGroupResponse$outboundSchema` instead. */ - export const outboundSchema = RemoveRulesetAccessGroupResponse$outboundSchema; - /** @deprecated use `RemoveRulesetAccessGroupResponse$Outbound` instead. */ - export type Outbound = RemoveRulesetAccessGroupResponse$Outbound; -} - -export function removeRulesetAccessGroupResponseToJSON( - removeRulesetAccessGroupResponse: RemoveRulesetAccessGroupResponse, -): string { - return JSON.stringify( - RemoveRulesetAccessGroupResponse$outboundSchema.parse( - removeRulesetAccessGroupResponse, - ), - ); -} - -export function removeRulesetAccessGroupResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => RemoveRulesetAccessGroupResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'RemoveRulesetAccessGroupResponse' from JSON`, - ); -} diff --git a/src/models/operations/removeschemaaccessgroup.ts b/src/models/operations/removeschemaaccessgroup.ts deleted file mode 100644 index 8f82bc3..0000000 --- a/src/models/operations/removeschemaaccessgroup.ts +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type RemoveSchemaAccessGroupRequest = { - namespace: string; - slug: string; - accessGroup: components.AccessGroup; -}; - -export type RemoveSchemaAccessGroupResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const RemoveSchemaAccessGroupRequest$inboundSchema: z.ZodType< - RemoveSchemaAccessGroupRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - "access-group": components.AccessGroup$inboundSchema, -}).transform((v) => { - return remap$(v, { - "access-group": "accessGroup", - }); -}); - -/** @internal */ -export type RemoveSchemaAccessGroupRequest$Outbound = { - namespace: string; - slug: string; - "access-group": components.AccessGroup$Outbound; -}; - -/** @internal */ -export const RemoveSchemaAccessGroupRequest$outboundSchema: z.ZodType< - RemoveSchemaAccessGroupRequest$Outbound, - z.ZodTypeDef, - RemoveSchemaAccessGroupRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - accessGroup: components.AccessGroup$outboundSchema, -}).transform((v) => { - return remap$(v, { - accessGroup: "access-group", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace RemoveSchemaAccessGroupRequest$ { - /** @deprecated use `RemoveSchemaAccessGroupRequest$inboundSchema` instead. */ - export const inboundSchema = RemoveSchemaAccessGroupRequest$inboundSchema; - /** @deprecated use `RemoveSchemaAccessGroupRequest$outboundSchema` instead. */ - export const outboundSchema = RemoveSchemaAccessGroupRequest$outboundSchema; - /** @deprecated use `RemoveSchemaAccessGroupRequest$Outbound` instead. */ - export type Outbound = RemoveSchemaAccessGroupRequest$Outbound; -} - -export function removeSchemaAccessGroupRequestToJSON( - removeSchemaAccessGroupRequest: RemoveSchemaAccessGroupRequest, -): string { - return JSON.stringify( - RemoveSchemaAccessGroupRequest$outboundSchema.parse( - removeSchemaAccessGroupRequest, - ), - ); -} - -export function removeSchemaAccessGroupRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => RemoveSchemaAccessGroupRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'RemoveSchemaAccessGroupRequest' from JSON`, - ); -} - -/** @internal */ -export const RemoveSchemaAccessGroupResponse$inboundSchema: z.ZodType< - RemoveSchemaAccessGroupResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type RemoveSchemaAccessGroupResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const RemoveSchemaAccessGroupResponse$outboundSchema: z.ZodType< - RemoveSchemaAccessGroupResponse$Outbound, - z.ZodTypeDef, - RemoveSchemaAccessGroupResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace RemoveSchemaAccessGroupResponse$ { - /** @deprecated use `RemoveSchemaAccessGroupResponse$inboundSchema` instead. */ - export const inboundSchema = RemoveSchemaAccessGroupResponse$inboundSchema; - /** @deprecated use `RemoveSchemaAccessGroupResponse$outboundSchema` instead. */ - export const outboundSchema = RemoveSchemaAccessGroupResponse$outboundSchema; - /** @deprecated use `RemoveSchemaAccessGroupResponse$Outbound` instead. */ - export type Outbound = RemoveSchemaAccessGroupResponse$Outbound; -} - -export function removeSchemaAccessGroupResponseToJSON( - removeSchemaAccessGroupResponse: RemoveSchemaAccessGroupResponse, -): string { - return JSON.stringify( - RemoveSchemaAccessGroupResponse$outboundSchema.parse( - removeSchemaAccessGroupResponse, - ), - ); -} - -export function removeSchemaAccessGroupResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => RemoveSchemaAccessGroupResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'RemoveSchemaAccessGroupResponse' from JSON`, - ); -} diff --git a/src/models/operations/replacethemedocument.ts b/src/models/operations/replacethemedocument.ts deleted file mode 100644 index 86b88c9..0000000 --- a/src/models/operations/replacethemedocument.ts +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type ReplaceThemeDocumentRequestBody = { - document: string; -}; - -export type ReplaceThemeDocumentRequest = { - slug: string; - requestBody: ReplaceThemeDocumentRequestBody; -}; - -export type ReplaceThemeDocumentResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const ReplaceThemeDocumentRequestBody$inboundSchema: z.ZodType< - ReplaceThemeDocumentRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - document: z.string(), -}); - -/** @internal */ -export type ReplaceThemeDocumentRequestBody$Outbound = { - document: string; -}; - -/** @internal */ -export const ReplaceThemeDocumentRequestBody$outboundSchema: z.ZodType< - ReplaceThemeDocumentRequestBody$Outbound, - z.ZodTypeDef, - ReplaceThemeDocumentRequestBody -> = z.object({ - document: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ReplaceThemeDocumentRequestBody$ { - /** @deprecated use `ReplaceThemeDocumentRequestBody$inboundSchema` instead. */ - export const inboundSchema = ReplaceThemeDocumentRequestBody$inboundSchema; - /** @deprecated use `ReplaceThemeDocumentRequestBody$outboundSchema` instead. */ - export const outboundSchema = ReplaceThemeDocumentRequestBody$outboundSchema; - /** @deprecated use `ReplaceThemeDocumentRequestBody$Outbound` instead. */ - export type Outbound = ReplaceThemeDocumentRequestBody$Outbound; -} - -export function replaceThemeDocumentRequestBodyToJSON( - replaceThemeDocumentRequestBody: ReplaceThemeDocumentRequestBody, -): string { - return JSON.stringify( - ReplaceThemeDocumentRequestBody$outboundSchema.parse( - replaceThemeDocumentRequestBody, - ), - ); -} - -export function replaceThemeDocumentRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ReplaceThemeDocumentRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ReplaceThemeDocumentRequestBody' from JSON`, - ); -} - -/** @internal */ -export const ReplaceThemeDocumentRequest$inboundSchema: z.ZodType< - ReplaceThemeDocumentRequest, - z.ZodTypeDef, - unknown -> = z.object({ - slug: z.string(), - RequestBody: z.lazy(() => ReplaceThemeDocumentRequestBody$inboundSchema), -}).transform((v) => { - return remap$(v, { - "RequestBody": "requestBody", - }); -}); - -/** @internal */ -export type ReplaceThemeDocumentRequest$Outbound = { - slug: string; - RequestBody: ReplaceThemeDocumentRequestBody$Outbound; -}; - -/** @internal */ -export const ReplaceThemeDocumentRequest$outboundSchema: z.ZodType< - ReplaceThemeDocumentRequest$Outbound, - z.ZodTypeDef, - ReplaceThemeDocumentRequest -> = z.object({ - slug: z.string(), - requestBody: z.lazy(() => ReplaceThemeDocumentRequestBody$outboundSchema), -}).transform((v) => { - return remap$(v, { - requestBody: "RequestBody", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ReplaceThemeDocumentRequest$ { - /** @deprecated use `ReplaceThemeDocumentRequest$inboundSchema` instead. */ - export const inboundSchema = ReplaceThemeDocumentRequest$inboundSchema; - /** @deprecated use `ReplaceThemeDocumentRequest$outboundSchema` instead. */ - export const outboundSchema = ReplaceThemeDocumentRequest$outboundSchema; - /** @deprecated use `ReplaceThemeDocumentRequest$Outbound` instead. */ - export type Outbound = ReplaceThemeDocumentRequest$Outbound; -} - -export function replaceThemeDocumentRequestToJSON( - replaceThemeDocumentRequest: ReplaceThemeDocumentRequest, -): string { - return JSON.stringify( - ReplaceThemeDocumentRequest$outboundSchema.parse( - replaceThemeDocumentRequest, - ), - ); -} - -export function replaceThemeDocumentRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ReplaceThemeDocumentRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ReplaceThemeDocumentRequest' from JSON`, - ); -} - -/** @internal */ -export const ReplaceThemeDocumentResponse$inboundSchema: z.ZodType< - ReplaceThemeDocumentResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type ReplaceThemeDocumentResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const ReplaceThemeDocumentResponse$outboundSchema: z.ZodType< - ReplaceThemeDocumentResponse$Outbound, - z.ZodTypeDef, - ReplaceThemeDocumentResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ReplaceThemeDocumentResponse$ { - /** @deprecated use `ReplaceThemeDocumentResponse$inboundSchema` instead. */ - export const inboundSchema = ReplaceThemeDocumentResponse$inboundSchema; - /** @deprecated use `ReplaceThemeDocumentResponse$outboundSchema` instead. */ - export const outboundSchema = ReplaceThemeDocumentResponse$outboundSchema; - /** @deprecated use `ReplaceThemeDocumentResponse$Outbound` instead. */ - export type Outbound = ReplaceThemeDocumentResponse$Outbound; -} - -export function replaceThemeDocumentResponseToJSON( - replaceThemeDocumentResponse: ReplaceThemeDocumentResponse, -): string { - return JSON.stringify( - ReplaceThemeDocumentResponse$outboundSchema.parse( - replaceThemeDocumentResponse, - ), - ); -} - -export function replaceThemeDocumentResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => ReplaceThemeDocumentResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'ReplaceThemeDocumentResponse' from JSON`, - ); -} diff --git a/src/models/operations/updateapidocument.ts b/src/models/operations/updateapidocument.ts deleted file mode 100644 index 5ea5d4b..0000000 --- a/src/models/operations/updateapidocument.ts +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type UpdateApiDocumentRequestBody = { - title?: string | undefined; - description?: string | undefined; - isPrivate?: boolean | undefined; - ruleset?: string | undefined; -}; - -export type UpdateApiDocumentRequest = { - namespace: string; - slug: string; - requestBody: UpdateApiDocumentRequestBody; -}; - -export type UpdateApiDocumentResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const UpdateApiDocumentRequestBody$inboundSchema: z.ZodType< - UpdateApiDocumentRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - title: z.string().optional(), - description: z.string().optional(), - isPrivate: z.boolean().optional(), - ruleset: z.string().optional(), -}); - -/** @internal */ -export type UpdateApiDocumentRequestBody$Outbound = { - title?: string | undefined; - description?: string | undefined; - isPrivate?: boolean | undefined; - ruleset?: string | undefined; -}; - -/** @internal */ -export const UpdateApiDocumentRequestBody$outboundSchema: z.ZodType< - UpdateApiDocumentRequestBody$Outbound, - z.ZodTypeDef, - UpdateApiDocumentRequestBody -> = z.object({ - title: z.string().optional(), - description: z.string().optional(), - isPrivate: z.boolean().optional(), - ruleset: z.string().optional(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateApiDocumentRequestBody$ { - /** @deprecated use `UpdateApiDocumentRequestBody$inboundSchema` instead. */ - export const inboundSchema = UpdateApiDocumentRequestBody$inboundSchema; - /** @deprecated use `UpdateApiDocumentRequestBody$outboundSchema` instead. */ - export const outboundSchema = UpdateApiDocumentRequestBody$outboundSchema; - /** @deprecated use `UpdateApiDocumentRequestBody$Outbound` instead. */ - export type Outbound = UpdateApiDocumentRequestBody$Outbound; -} - -export function updateApiDocumentRequestBodyToJSON( - updateApiDocumentRequestBody: UpdateApiDocumentRequestBody, -): string { - return JSON.stringify( - UpdateApiDocumentRequestBody$outboundSchema.parse( - updateApiDocumentRequestBody, - ), - ); -} - -export function updateApiDocumentRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateApiDocumentRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateApiDocumentRequestBody' from JSON`, - ); -} - -/** @internal */ -export const UpdateApiDocumentRequest$inboundSchema: z.ZodType< - UpdateApiDocumentRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - RequestBody: z.lazy(() => UpdateApiDocumentRequestBody$inboundSchema), -}).transform((v) => { - return remap$(v, { - "RequestBody": "requestBody", - }); -}); - -/** @internal */ -export type UpdateApiDocumentRequest$Outbound = { - namespace: string; - slug: string; - RequestBody: UpdateApiDocumentRequestBody$Outbound; -}; - -/** @internal */ -export const UpdateApiDocumentRequest$outboundSchema: z.ZodType< - UpdateApiDocumentRequest$Outbound, - z.ZodTypeDef, - UpdateApiDocumentRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - requestBody: z.lazy(() => UpdateApiDocumentRequestBody$outboundSchema), -}).transform((v) => { - return remap$(v, { - requestBody: "RequestBody", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateApiDocumentRequest$ { - /** @deprecated use `UpdateApiDocumentRequest$inboundSchema` instead. */ - export const inboundSchema = UpdateApiDocumentRequest$inboundSchema; - /** @deprecated use `UpdateApiDocumentRequest$outboundSchema` instead. */ - export const outboundSchema = UpdateApiDocumentRequest$outboundSchema; - /** @deprecated use `UpdateApiDocumentRequest$Outbound` instead. */ - export type Outbound = UpdateApiDocumentRequest$Outbound; -} - -export function updateApiDocumentRequestToJSON( - updateApiDocumentRequest: UpdateApiDocumentRequest, -): string { - return JSON.stringify( - UpdateApiDocumentRequest$outboundSchema.parse(updateApiDocumentRequest), - ); -} - -export function updateApiDocumentRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateApiDocumentRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateApiDocumentRequest' from JSON`, - ); -} - -/** @internal */ -export const UpdateApiDocumentResponse$inboundSchema: z.ZodType< - UpdateApiDocumentResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type UpdateApiDocumentResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const UpdateApiDocumentResponse$outboundSchema: z.ZodType< - UpdateApiDocumentResponse$Outbound, - z.ZodTypeDef, - UpdateApiDocumentResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateApiDocumentResponse$ { - /** @deprecated use `UpdateApiDocumentResponse$inboundSchema` instead. */ - export const inboundSchema = UpdateApiDocumentResponse$inboundSchema; - /** @deprecated use `UpdateApiDocumentResponse$outboundSchema` instead. */ - export const outboundSchema = UpdateApiDocumentResponse$outboundSchema; - /** @deprecated use `UpdateApiDocumentResponse$Outbound` instead. */ - export type Outbound = UpdateApiDocumentResponse$Outbound; -} - -export function updateApiDocumentResponseToJSON( - updateApiDocumentResponse: UpdateApiDocumentResponse, -): string { - return JSON.stringify( - UpdateApiDocumentResponse$outboundSchema.parse(updateApiDocumentResponse), - ); -} - -export function updateApiDocumentResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateApiDocumentResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateApiDocumentResponse' from JSON`, - ); -} diff --git a/src/models/operations/updateapidocumentversion.ts b/src/models/operations/updateapidocumentversion.ts deleted file mode 100644 index c3ce3a3..0000000 --- a/src/models/operations/updateapidocumentversion.ts +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type UpdateApiDocumentVersionRequestBody = { - document: string; - lastKnownVersionSha?: string | undefined; -}; - -export type UpdateApiDocumentVersionRequest = { - namespace: string; - slug: string; - semver: string; - requestBody: UpdateApiDocumentVersionRequestBody; -}; - -/** - * Default Response - */ -export type UpdateApiDocumentVersionResponseBody = { - jsonSha: string; - yamlSha: string; - versionSha: string; -}; - -export type UpdateApiDocumentVersionResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - object?: UpdateApiDocumentVersionResponseBody | undefined; -}; - -/** @internal */ -export const UpdateApiDocumentVersionRequestBody$inboundSchema: z.ZodType< - UpdateApiDocumentVersionRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - document: z.string(), - lastKnownVersionSha: z.string().optional(), -}); - -/** @internal */ -export type UpdateApiDocumentVersionRequestBody$Outbound = { - document: string; - lastKnownVersionSha?: string | undefined; -}; - -/** @internal */ -export const UpdateApiDocumentVersionRequestBody$outboundSchema: z.ZodType< - UpdateApiDocumentVersionRequestBody$Outbound, - z.ZodTypeDef, - UpdateApiDocumentVersionRequestBody -> = z.object({ - document: z.string(), - lastKnownVersionSha: z.string().optional(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateApiDocumentVersionRequestBody$ { - /** @deprecated use `UpdateApiDocumentVersionRequestBody$inboundSchema` instead. */ - export const inboundSchema = - UpdateApiDocumentVersionRequestBody$inboundSchema; - /** @deprecated use `UpdateApiDocumentVersionRequestBody$outboundSchema` instead. */ - export const outboundSchema = - UpdateApiDocumentVersionRequestBody$outboundSchema; - /** @deprecated use `UpdateApiDocumentVersionRequestBody$Outbound` instead. */ - export type Outbound = UpdateApiDocumentVersionRequestBody$Outbound; -} - -export function updateApiDocumentVersionRequestBodyToJSON( - updateApiDocumentVersionRequestBody: UpdateApiDocumentVersionRequestBody, -): string { - return JSON.stringify( - UpdateApiDocumentVersionRequestBody$outboundSchema.parse( - updateApiDocumentVersionRequestBody, - ), - ); -} - -export function updateApiDocumentVersionRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => - UpdateApiDocumentVersionRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateApiDocumentVersionRequestBody' from JSON`, - ); -} - -/** @internal */ -export const UpdateApiDocumentVersionRequest$inboundSchema: z.ZodType< - UpdateApiDocumentVersionRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - semver: z.string(), - RequestBody: z.lazy(() => UpdateApiDocumentVersionRequestBody$inboundSchema), -}).transform((v) => { - return remap$(v, { - "RequestBody": "requestBody", - }); -}); - -/** @internal */ -export type UpdateApiDocumentVersionRequest$Outbound = { - namespace: string; - slug: string; - semver: string; - RequestBody: UpdateApiDocumentVersionRequestBody$Outbound; -}; - -/** @internal */ -export const UpdateApiDocumentVersionRequest$outboundSchema: z.ZodType< - UpdateApiDocumentVersionRequest$Outbound, - z.ZodTypeDef, - UpdateApiDocumentVersionRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - semver: z.string(), - requestBody: z.lazy(() => UpdateApiDocumentVersionRequestBody$outboundSchema), -}).transform((v) => { - return remap$(v, { - requestBody: "RequestBody", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateApiDocumentVersionRequest$ { - /** @deprecated use `UpdateApiDocumentVersionRequest$inboundSchema` instead. */ - export const inboundSchema = UpdateApiDocumentVersionRequest$inboundSchema; - /** @deprecated use `UpdateApiDocumentVersionRequest$outboundSchema` instead. */ - export const outboundSchema = UpdateApiDocumentVersionRequest$outboundSchema; - /** @deprecated use `UpdateApiDocumentVersionRequest$Outbound` instead. */ - export type Outbound = UpdateApiDocumentVersionRequest$Outbound; -} - -export function updateApiDocumentVersionRequestToJSON( - updateApiDocumentVersionRequest: UpdateApiDocumentVersionRequest, -): string { - return JSON.stringify( - UpdateApiDocumentVersionRequest$outboundSchema.parse( - updateApiDocumentVersionRequest, - ), - ); -} - -export function updateApiDocumentVersionRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateApiDocumentVersionRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateApiDocumentVersionRequest' from JSON`, - ); -} - -/** @internal */ -export const UpdateApiDocumentVersionResponseBody$inboundSchema: z.ZodType< - UpdateApiDocumentVersionResponseBody, - z.ZodTypeDef, - unknown -> = z.object({ - jsonSha: z.string(), - yamlSha: z.string(), - versionSha: z.string(), -}); - -/** @internal */ -export type UpdateApiDocumentVersionResponseBody$Outbound = { - jsonSha: string; - yamlSha: string; - versionSha: string; -}; - -/** @internal */ -export const UpdateApiDocumentVersionResponseBody$outboundSchema: z.ZodType< - UpdateApiDocumentVersionResponseBody$Outbound, - z.ZodTypeDef, - UpdateApiDocumentVersionResponseBody -> = z.object({ - jsonSha: z.string(), - yamlSha: z.string(), - versionSha: z.string(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateApiDocumentVersionResponseBody$ { - /** @deprecated use `UpdateApiDocumentVersionResponseBody$inboundSchema` instead. */ - export const inboundSchema = - UpdateApiDocumentVersionResponseBody$inboundSchema; - /** @deprecated use `UpdateApiDocumentVersionResponseBody$outboundSchema` instead. */ - export const outboundSchema = - UpdateApiDocumentVersionResponseBody$outboundSchema; - /** @deprecated use `UpdateApiDocumentVersionResponseBody$Outbound` instead. */ - export type Outbound = UpdateApiDocumentVersionResponseBody$Outbound; -} - -export function updateApiDocumentVersionResponseBodyToJSON( - updateApiDocumentVersionResponseBody: UpdateApiDocumentVersionResponseBody, -): string { - return JSON.stringify( - UpdateApiDocumentVersionResponseBody$outboundSchema.parse( - updateApiDocumentVersionResponseBody, - ), - ); -} - -export function updateApiDocumentVersionResponseBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => - UpdateApiDocumentVersionResponseBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateApiDocumentVersionResponseBody' from JSON`, - ); -} - -/** @internal */ -export const UpdateApiDocumentVersionResponse$inboundSchema: z.ZodType< - UpdateApiDocumentVersionResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - object: z.lazy(() => UpdateApiDocumentVersionResponseBody$inboundSchema) - .optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type UpdateApiDocumentVersionResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - object?: UpdateApiDocumentVersionResponseBody$Outbound | undefined; -}; - -/** @internal */ -export const UpdateApiDocumentVersionResponse$outboundSchema: z.ZodType< - UpdateApiDocumentVersionResponse$Outbound, - z.ZodTypeDef, - UpdateApiDocumentVersionResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - object: z.lazy(() => UpdateApiDocumentVersionResponseBody$outboundSchema) - .optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateApiDocumentVersionResponse$ { - /** @deprecated use `UpdateApiDocumentVersionResponse$inboundSchema` instead. */ - export const inboundSchema = UpdateApiDocumentVersionResponse$inboundSchema; - /** @deprecated use `UpdateApiDocumentVersionResponse$outboundSchema` instead. */ - export const outboundSchema = UpdateApiDocumentVersionResponse$outboundSchema; - /** @deprecated use `UpdateApiDocumentVersionResponse$Outbound` instead. */ - export type Outbound = UpdateApiDocumentVersionResponse$Outbound; -} - -export function updateApiDocumentVersionResponseToJSON( - updateApiDocumentVersionResponse: UpdateApiDocumentVersionResponse, -): string { - return JSON.stringify( - UpdateApiDocumentVersionResponse$outboundSchema.parse( - updateApiDocumentVersionResponse, - ), - ); -} - -export function updateApiDocumentVersionResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateApiDocumentVersionResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateApiDocumentVersionResponse' from JSON`, - ); -} diff --git a/src/models/operations/updateloginportal.ts b/src/models/operations/updateloginportal.ts deleted file mode 100644 index 92f9e99..0000000 --- a/src/models/operations/updateloginportal.ts +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type UpdateLoginPortalRequestBody = { - title?: string | undefined; -}; - -export type UpdateLoginPortalRequest = { - slug: string; - requestBody: UpdateLoginPortalRequestBody; -}; - -export type UpdateLoginPortalResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const UpdateLoginPortalRequestBody$inboundSchema: z.ZodType< - UpdateLoginPortalRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - title: z.string().optional(), -}); - -/** @internal */ -export type UpdateLoginPortalRequestBody$Outbound = { - title?: string | undefined; -}; - -/** @internal */ -export const UpdateLoginPortalRequestBody$outboundSchema: z.ZodType< - UpdateLoginPortalRequestBody$Outbound, - z.ZodTypeDef, - UpdateLoginPortalRequestBody -> = z.object({ - title: z.string().optional(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateLoginPortalRequestBody$ { - /** @deprecated use `UpdateLoginPortalRequestBody$inboundSchema` instead. */ - export const inboundSchema = UpdateLoginPortalRequestBody$inboundSchema; - /** @deprecated use `UpdateLoginPortalRequestBody$outboundSchema` instead. */ - export const outboundSchema = UpdateLoginPortalRequestBody$outboundSchema; - /** @deprecated use `UpdateLoginPortalRequestBody$Outbound` instead. */ - export type Outbound = UpdateLoginPortalRequestBody$Outbound; -} - -export function updateLoginPortalRequestBodyToJSON( - updateLoginPortalRequestBody: UpdateLoginPortalRequestBody, -): string { - return JSON.stringify( - UpdateLoginPortalRequestBody$outboundSchema.parse( - updateLoginPortalRequestBody, - ), - ); -} - -export function updateLoginPortalRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateLoginPortalRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateLoginPortalRequestBody' from JSON`, - ); -} - -/** @internal */ -export const UpdateLoginPortalRequest$inboundSchema: z.ZodType< - UpdateLoginPortalRequest, - z.ZodTypeDef, - unknown -> = z.object({ - slug: z.string(), - RequestBody: z.lazy(() => UpdateLoginPortalRequestBody$inboundSchema), -}).transform((v) => { - return remap$(v, { - "RequestBody": "requestBody", - }); -}); - -/** @internal */ -export type UpdateLoginPortalRequest$Outbound = { - slug: string; - RequestBody: UpdateLoginPortalRequestBody$Outbound; -}; - -/** @internal */ -export const UpdateLoginPortalRequest$outboundSchema: z.ZodType< - UpdateLoginPortalRequest$Outbound, - z.ZodTypeDef, - UpdateLoginPortalRequest -> = z.object({ - slug: z.string(), - requestBody: z.lazy(() => UpdateLoginPortalRequestBody$outboundSchema), -}).transform((v) => { - return remap$(v, { - requestBody: "RequestBody", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateLoginPortalRequest$ { - /** @deprecated use `UpdateLoginPortalRequest$inboundSchema` instead. */ - export const inboundSchema = UpdateLoginPortalRequest$inboundSchema; - /** @deprecated use `UpdateLoginPortalRequest$outboundSchema` instead. */ - export const outboundSchema = UpdateLoginPortalRequest$outboundSchema; - /** @deprecated use `UpdateLoginPortalRequest$Outbound` instead. */ - export type Outbound = UpdateLoginPortalRequest$Outbound; -} - -export function updateLoginPortalRequestToJSON( - updateLoginPortalRequest: UpdateLoginPortalRequest, -): string { - return JSON.stringify( - UpdateLoginPortalRequest$outboundSchema.parse(updateLoginPortalRequest), - ); -} - -export function updateLoginPortalRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateLoginPortalRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateLoginPortalRequest' from JSON`, - ); -} - -/** @internal */ -export const UpdateLoginPortalResponse$inboundSchema: z.ZodType< - UpdateLoginPortalResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type UpdateLoginPortalResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const UpdateLoginPortalResponse$outboundSchema: z.ZodType< - UpdateLoginPortalResponse$Outbound, - z.ZodTypeDef, - UpdateLoginPortalResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateLoginPortalResponse$ { - /** @deprecated use `UpdateLoginPortalResponse$inboundSchema` instead. */ - export const inboundSchema = UpdateLoginPortalResponse$inboundSchema; - /** @deprecated use `UpdateLoginPortalResponse$outboundSchema` instead. */ - export const outboundSchema = UpdateLoginPortalResponse$outboundSchema; - /** @deprecated use `UpdateLoginPortalResponse$Outbound` instead. */ - export type Outbound = UpdateLoginPortalResponse$Outbound; -} - -export function updateLoginPortalResponseToJSON( - updateLoginPortalResponse: UpdateLoginPortalResponse, -): string { - return JSON.stringify( - UpdateLoginPortalResponse$outboundSchema.parse(updateLoginPortalResponse), - ); -} - -export function updateLoginPortalResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateLoginPortalResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateLoginPortalResponse' from JSON`, - ); -} diff --git a/src/models/operations/updateruleset.ts b/src/models/operations/updateruleset.ts deleted file mode 100644 index cca700e..0000000 --- a/src/models/operations/updateruleset.ts +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type UpdateRulesetRequestBody = { - namespace?: string | undefined; - slug?: string | undefined; - title?: string | undefined; - description?: string | undefined; - isPrivate?: boolean | undefined; -}; - -export type UpdateRulesetRequest = { - namespace: string; - slug: string; - requestBody: UpdateRulesetRequestBody; -}; - -export type UpdateRulesetResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const UpdateRulesetRequestBody$inboundSchema: z.ZodType< - UpdateRulesetRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string().optional(), - slug: z.string().optional(), - title: z.string().optional(), - description: z.string().optional(), - isPrivate: z.boolean().optional(), -}); - -/** @internal */ -export type UpdateRulesetRequestBody$Outbound = { - namespace?: string | undefined; - slug?: string | undefined; - title?: string | undefined; - description?: string | undefined; - isPrivate?: boolean | undefined; -}; - -/** @internal */ -export const UpdateRulesetRequestBody$outboundSchema: z.ZodType< - UpdateRulesetRequestBody$Outbound, - z.ZodTypeDef, - UpdateRulesetRequestBody -> = z.object({ - namespace: z.string().optional(), - slug: z.string().optional(), - title: z.string().optional(), - description: z.string().optional(), - isPrivate: z.boolean().optional(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateRulesetRequestBody$ { - /** @deprecated use `UpdateRulesetRequestBody$inboundSchema` instead. */ - export const inboundSchema = UpdateRulesetRequestBody$inboundSchema; - /** @deprecated use `UpdateRulesetRequestBody$outboundSchema` instead. */ - export const outboundSchema = UpdateRulesetRequestBody$outboundSchema; - /** @deprecated use `UpdateRulesetRequestBody$Outbound` instead. */ - export type Outbound = UpdateRulesetRequestBody$Outbound; -} - -export function updateRulesetRequestBodyToJSON( - updateRulesetRequestBody: UpdateRulesetRequestBody, -): string { - return JSON.stringify( - UpdateRulesetRequestBody$outboundSchema.parse(updateRulesetRequestBody), - ); -} - -export function updateRulesetRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateRulesetRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateRulesetRequestBody' from JSON`, - ); -} - -/** @internal */ -export const UpdateRulesetRequest$inboundSchema: z.ZodType< - UpdateRulesetRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - RequestBody: z.lazy(() => UpdateRulesetRequestBody$inboundSchema), -}).transform((v) => { - return remap$(v, { - "RequestBody": "requestBody", - }); -}); - -/** @internal */ -export type UpdateRulesetRequest$Outbound = { - namespace: string; - slug: string; - RequestBody: UpdateRulesetRequestBody$Outbound; -}; - -/** @internal */ -export const UpdateRulesetRequest$outboundSchema: z.ZodType< - UpdateRulesetRequest$Outbound, - z.ZodTypeDef, - UpdateRulesetRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - requestBody: z.lazy(() => UpdateRulesetRequestBody$outboundSchema), -}).transform((v) => { - return remap$(v, { - requestBody: "RequestBody", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateRulesetRequest$ { - /** @deprecated use `UpdateRulesetRequest$inboundSchema` instead. */ - export const inboundSchema = UpdateRulesetRequest$inboundSchema; - /** @deprecated use `UpdateRulesetRequest$outboundSchema` instead. */ - export const outboundSchema = UpdateRulesetRequest$outboundSchema; - /** @deprecated use `UpdateRulesetRequest$Outbound` instead. */ - export type Outbound = UpdateRulesetRequest$Outbound; -} - -export function updateRulesetRequestToJSON( - updateRulesetRequest: UpdateRulesetRequest, -): string { - return JSON.stringify( - UpdateRulesetRequest$outboundSchema.parse(updateRulesetRequest), - ); -} - -export function updateRulesetRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateRulesetRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateRulesetRequest' from JSON`, - ); -} - -/** @internal */ -export const UpdateRulesetResponse$inboundSchema: z.ZodType< - UpdateRulesetResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type UpdateRulesetResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const UpdateRulesetResponse$outboundSchema: z.ZodType< - UpdateRulesetResponse$Outbound, - z.ZodTypeDef, - UpdateRulesetResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateRulesetResponse$ { - /** @deprecated use `UpdateRulesetResponse$inboundSchema` instead. */ - export const inboundSchema = UpdateRulesetResponse$inboundSchema; - /** @deprecated use `UpdateRulesetResponse$outboundSchema` instead. */ - export const outboundSchema = UpdateRulesetResponse$outboundSchema; - /** @deprecated use `UpdateRulesetResponse$Outbound` instead. */ - export type Outbound = UpdateRulesetResponse$Outbound; -} - -export function updateRulesetResponseToJSON( - updateRulesetResponse: UpdateRulesetResponse, -): string { - return JSON.stringify( - UpdateRulesetResponse$outboundSchema.parse(updateRulesetResponse), - ); -} - -export function updateRulesetResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateRulesetResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateRulesetResponse' from JSON`, - ); -} diff --git a/src/models/operations/updateschema.ts b/src/models/operations/updateschema.ts deleted file mode 100644 index 9e7ab80..0000000 --- a/src/models/operations/updateschema.ts +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type UpdateSchemaRequestBody = { - title?: string | undefined; - description?: string | undefined; - isPrivate?: boolean | undefined; -}; - -export type UpdateSchemaRequest = { - namespace: string; - slug: string; - requestBody: UpdateSchemaRequestBody; -}; - -export type UpdateSchemaResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const UpdateSchemaRequestBody$inboundSchema: z.ZodType< - UpdateSchemaRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - title: z.string().optional(), - description: z.string().optional(), - isPrivate: z.boolean().optional(), -}); - -/** @internal */ -export type UpdateSchemaRequestBody$Outbound = { - title?: string | undefined; - description?: string | undefined; - isPrivate?: boolean | undefined; -}; - -/** @internal */ -export const UpdateSchemaRequestBody$outboundSchema: z.ZodType< - UpdateSchemaRequestBody$Outbound, - z.ZodTypeDef, - UpdateSchemaRequestBody -> = z.object({ - title: z.string().optional(), - description: z.string().optional(), - isPrivate: z.boolean().optional(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateSchemaRequestBody$ { - /** @deprecated use `UpdateSchemaRequestBody$inboundSchema` instead. */ - export const inboundSchema = UpdateSchemaRequestBody$inboundSchema; - /** @deprecated use `UpdateSchemaRequestBody$outboundSchema` instead. */ - export const outboundSchema = UpdateSchemaRequestBody$outboundSchema; - /** @deprecated use `UpdateSchemaRequestBody$Outbound` instead. */ - export type Outbound = UpdateSchemaRequestBody$Outbound; -} - -export function updateSchemaRequestBodyToJSON( - updateSchemaRequestBody: UpdateSchemaRequestBody, -): string { - return JSON.stringify( - UpdateSchemaRequestBody$outboundSchema.parse(updateSchemaRequestBody), - ); -} - -export function updateSchemaRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateSchemaRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateSchemaRequestBody' from JSON`, - ); -} - -/** @internal */ -export const UpdateSchemaRequest$inboundSchema: z.ZodType< - UpdateSchemaRequest, - z.ZodTypeDef, - unknown -> = z.object({ - namespace: z.string(), - slug: z.string(), - RequestBody: z.lazy(() => UpdateSchemaRequestBody$inboundSchema), -}).transform((v) => { - return remap$(v, { - "RequestBody": "requestBody", - }); -}); - -/** @internal */ -export type UpdateSchemaRequest$Outbound = { - namespace: string; - slug: string; - RequestBody: UpdateSchemaRequestBody$Outbound; -}; - -/** @internal */ -export const UpdateSchemaRequest$outboundSchema: z.ZodType< - UpdateSchemaRequest$Outbound, - z.ZodTypeDef, - UpdateSchemaRequest -> = z.object({ - namespace: z.string(), - slug: z.string(), - requestBody: z.lazy(() => UpdateSchemaRequestBody$outboundSchema), -}).transform((v) => { - return remap$(v, { - requestBody: "RequestBody", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateSchemaRequest$ { - /** @deprecated use `UpdateSchemaRequest$inboundSchema` instead. */ - export const inboundSchema = UpdateSchemaRequest$inboundSchema; - /** @deprecated use `UpdateSchemaRequest$outboundSchema` instead. */ - export const outboundSchema = UpdateSchemaRequest$outboundSchema; - /** @deprecated use `UpdateSchemaRequest$Outbound` instead. */ - export type Outbound = UpdateSchemaRequest$Outbound; -} - -export function updateSchemaRequestToJSON( - updateSchemaRequest: UpdateSchemaRequest, -): string { - return JSON.stringify( - UpdateSchemaRequest$outboundSchema.parse(updateSchemaRequest), - ); -} - -export function updateSchemaRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateSchemaRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateSchemaRequest' from JSON`, - ); -} - -/** @internal */ -export const UpdateSchemaResponse$inboundSchema: z.ZodType< - UpdateSchemaResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type UpdateSchemaResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const UpdateSchemaResponse$outboundSchema: z.ZodType< - UpdateSchemaResponse$Outbound, - z.ZodTypeDef, - UpdateSchemaResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateSchemaResponse$ { - /** @deprecated use `UpdateSchemaResponse$inboundSchema` instead. */ - export const inboundSchema = UpdateSchemaResponse$inboundSchema; - /** @deprecated use `UpdateSchemaResponse$outboundSchema` instead. */ - export const outboundSchema = UpdateSchemaResponse$outboundSchema; - /** @deprecated use `UpdateSchemaResponse$Outbound` instead. */ - export type Outbound = UpdateSchemaResponse$Outbound; -} - -export function updateSchemaResponseToJSON( - updateSchemaResponse: UpdateSchemaResponse, -): string { - return JSON.stringify( - UpdateSchemaResponse$outboundSchema.parse(updateSchemaResponse), - ); -} - -export function updateSchemaResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateSchemaResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateSchemaResponse' from JSON`, - ); -} diff --git a/src/models/operations/updatetheme.ts b/src/models/operations/updatetheme.ts deleted file mode 100644 index 50aca87..0000000 --- a/src/models/operations/updatetheme.ts +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { remap as remap$ } from "../../lib/primitives.js"; -import { safeParse } from "../../lib/schemas.js"; -import { Result as SafeParseResult } from "../../types/fp.js"; -import * as components from "../components/index.js"; -import { SDKValidationError } from "../errors/sdkvalidationerror.js"; - -export type UpdateThemeRequestBody = { - name?: string | undefined; - description?: string | undefined; -}; - -export type UpdateThemeRequest = { - slug: string; - requestBody: UpdateThemeRequestBody; -}; - -export type UpdateThemeResponse = { - httpMeta: components.HTTPMetadata; - /** - * Default Response - */ - any?: any | null | undefined; -}; - -/** @internal */ -export const UpdateThemeRequestBody$inboundSchema: z.ZodType< - UpdateThemeRequestBody, - z.ZodTypeDef, - unknown -> = z.object({ - name: z.string().optional(), - description: z.string().optional(), -}); - -/** @internal */ -export type UpdateThemeRequestBody$Outbound = { - name?: string | undefined; - description?: string | undefined; -}; - -/** @internal */ -export const UpdateThemeRequestBody$outboundSchema: z.ZodType< - UpdateThemeRequestBody$Outbound, - z.ZodTypeDef, - UpdateThemeRequestBody -> = z.object({ - name: z.string().optional(), - description: z.string().optional(), -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateThemeRequestBody$ { - /** @deprecated use `UpdateThemeRequestBody$inboundSchema` instead. */ - export const inboundSchema = UpdateThemeRequestBody$inboundSchema; - /** @deprecated use `UpdateThemeRequestBody$outboundSchema` instead. */ - export const outboundSchema = UpdateThemeRequestBody$outboundSchema; - /** @deprecated use `UpdateThemeRequestBody$Outbound` instead. */ - export type Outbound = UpdateThemeRequestBody$Outbound; -} - -export function updateThemeRequestBodyToJSON( - updateThemeRequestBody: UpdateThemeRequestBody, -): string { - return JSON.stringify( - UpdateThemeRequestBody$outboundSchema.parse(updateThemeRequestBody), - ); -} - -export function updateThemeRequestBodyFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateThemeRequestBody$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateThemeRequestBody' from JSON`, - ); -} - -/** @internal */ -export const UpdateThemeRequest$inboundSchema: z.ZodType< - UpdateThemeRequest, - z.ZodTypeDef, - unknown -> = z.object({ - slug: z.string(), - RequestBody: z.lazy(() => UpdateThemeRequestBody$inboundSchema), -}).transform((v) => { - return remap$(v, { - "RequestBody": "requestBody", - }); -}); - -/** @internal */ -export type UpdateThemeRequest$Outbound = { - slug: string; - RequestBody: UpdateThemeRequestBody$Outbound; -}; - -/** @internal */ -export const UpdateThemeRequest$outboundSchema: z.ZodType< - UpdateThemeRequest$Outbound, - z.ZodTypeDef, - UpdateThemeRequest -> = z.object({ - slug: z.string(), - requestBody: z.lazy(() => UpdateThemeRequestBody$outboundSchema), -}).transform((v) => { - return remap$(v, { - requestBody: "RequestBody", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateThemeRequest$ { - /** @deprecated use `UpdateThemeRequest$inboundSchema` instead. */ - export const inboundSchema = UpdateThemeRequest$inboundSchema; - /** @deprecated use `UpdateThemeRequest$outboundSchema` instead. */ - export const outboundSchema = UpdateThemeRequest$outboundSchema; - /** @deprecated use `UpdateThemeRequest$Outbound` instead. */ - export type Outbound = UpdateThemeRequest$Outbound; -} - -export function updateThemeRequestToJSON( - updateThemeRequest: UpdateThemeRequest, -): string { - return JSON.stringify( - UpdateThemeRequest$outboundSchema.parse(updateThemeRequest), - ); -} - -export function updateThemeRequestFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateThemeRequest$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateThemeRequest' from JSON`, - ); -} - -/** @internal */ -export const UpdateThemeResponse$inboundSchema: z.ZodType< - UpdateThemeResponse, - z.ZodTypeDef, - unknown -> = z.object({ - HttpMeta: components.HTTPMetadata$inboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - "HttpMeta": "httpMeta", - }); -}); - -/** @internal */ -export type UpdateThemeResponse$Outbound = { - HttpMeta: components.HTTPMetadata$Outbound; - any?: any | null | undefined; -}; - -/** @internal */ -export const UpdateThemeResponse$outboundSchema: z.ZodType< - UpdateThemeResponse$Outbound, - z.ZodTypeDef, - UpdateThemeResponse -> = z.object({ - httpMeta: components.HTTPMetadata$outboundSchema, - any: z.nullable(z.any()).optional(), -}).transform((v) => { - return remap$(v, { - httpMeta: "HttpMeta", - }); -}); - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace UpdateThemeResponse$ { - /** @deprecated use `UpdateThemeResponse$inboundSchema` instead. */ - export const inboundSchema = UpdateThemeResponse$inboundSchema; - /** @deprecated use `UpdateThemeResponse$outboundSchema` instead. */ - export const outboundSchema = UpdateThemeResponse$outboundSchema; - /** @deprecated use `UpdateThemeResponse$Outbound` instead. */ - export type Outbound = UpdateThemeResponse$Outbound; -} - -export function updateThemeResponseToJSON( - updateThemeResponse: UpdateThemeResponse, -): string { - return JSON.stringify( - UpdateThemeResponse$outboundSchema.parse(updateThemeResponse), - ); -} - -export function updateThemeResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => UpdateThemeResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'UpdateThemeResponse' from JSON`, - ); -} diff --git a/src/resource.ts b/src/resource.ts new file mode 100644 index 0000000..eafe430 --- /dev/null +++ b/src/resource.ts @@ -0,0 +1,11 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import type { ScalarAPI } from './client'; + +export class APIResource { + protected _client: ScalarAPI; + + constructor(client: ScalarAPI) { + this._client = client; + } +} diff --git a/src/resources/authentication.ts b/src/resources/authentication.ts new file mode 100644 index 0000000..782509c --- /dev/null +++ b/src/resources/authentication.ts @@ -0,0 +1,111 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { APIResource } from "../resource"; +import { APIPromise } from "../api-promise"; +import type { RequestOptions } from "../internal/request-options"; + +export class Authentication extends APIResource { + /** + * Exchange an API key for an access token. + * + * @param {AuthenticationExchangePersonalTokenParams} body - The request body to send. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const exchangePersonalToken = await client.authentication.exchangePersonalToken({ + * personalToken: "", + * }); + * ``` + */ + exchangePersonalToken(body: AuthenticationExchangePersonalTokenParams, options?: RequestOptions): APIPromise { + return this._client.post("/v1/auth/exchange", { body: body, ...options }); + } + + /** + * Get the authenticated user, including their available teams and theme. + * + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const user = await client.authentication.listCurrentUser(); + * ``` + */ + listCurrentUser(options?: RequestOptions): APIPromise { + return this._client.get("/v1/auth/me", options); + } +} + +export interface Value400 { + message: string; + code: string; +} + +export interface Value401 { + message: string; + code: string; +} + +export interface Value403 { + message: string; + code: string; +} + +export interface Value404 { + message: string; + code: string; +} + +export interface Value422 { + message: string; + code: string; +} + +export interface Value500 { + message: string; + code: string; +} + +export interface User { + uid: Nanoid; + createdAt: Timestamp; + updatedAt: Timestamp; + email: Email; + activeTeamId: string | null; + hasGithub: boolean; + teams: Array; + theme?: string; +} + +export type Nanoid = string; + +export type Timestamp = number; + +export type Email = string; + +export interface TeamSummary { + uid: Nanoid; + name: TeamName; + imageUri?: TeamImage; +} + +export type TeamName = string; + +export type TeamImage = string; + +export interface AuthenticationExchangePersonalTokenParams { + personalToken: string; +} + +export type AuthenticationExchangePersonalTokenResponse = { accessToken: string }; +export declare namespace Authentication { + export { + type AuthenticationExchangePersonalTokenResponse as AuthenticationExchangePersonalTokenResponse, + type User as User, + type AuthenticationExchangePersonalTokenParams as AuthenticationExchangePersonalTokenParams, + }; +} +export { Authentication as AuthenticationResource }; diff --git a/src/resources/index.ts b/src/resources/index.ts new file mode 100644 index 0000000..d391dce --- /dev/null +++ b/src/resources/index.ts @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +export { Registry } from "./registry"; +export type { Version, AccessGroup, APIDocument, Nanoid, Slug, Namespace, ManagedDocVersion, Method, Value400, Value401, Value403, Value404, Value422, Value500, RegistryListAllAPIDocumentsResponse, RegistryListAPIDocumentsResponse, RegistryCreateAPIDocumentParams, RegistryCreateAPIDocumentResponse, RegistryUpdateAPIDocumentParams, RegistryDeleteAPIDocumentParams, RegistryRetrieveAPIDocumentVersionParams, RegistryUpdateAPIDocumentVersionParams, RegistryUpdateAPIDocumentVersionResponse, RegistryDeleteAPIDocumentVersionParams, RegistryListAPIDocumentVersionMetadataParams, RegistryCreateAPIDocumentVersionParams, RegistryCreateAPIDocumentAccessGroupParams, RegistryDeleteAPIDocumentAccessGroupParams } from "./registry"; +export { Registry as RegistryResource } from "./registry"; +export { Schemas } from "./schemas/schemas"; +export type { Schema, ManagedSchemaVersion, Timestamp, Version2 as SchemaVersion, UID, SchemaListResponse, SchemaCreateParams, SchemaUpdateParams, SchemaDeleteParams } from "./schemas/schemas"; +export { Schemas as SchemaResource } from "./schemas/schemas"; +export { LoginPortals } from "./login-portals"; +export type { LoginPortalEmail, LoginPortalPage, LoginPortal, LoginPortalRetrieveResponse, LoginPortalUpdateParams, LoginPortalCreateParams, LoginPortalListResponse } from "./login-portals"; +export { LoginPortals as LoginPortalResource } from "./login-portals"; +export { Rules } from "./rules"; +export type { Rule, RuleListRulesetsResponse, RuleCreateRulesetParams, RuleUpdateRulesetParams, RuleDeleteRulesetParams, RuleRetrieveRulesetDocumentParams, RuleCreateRulesetAccessGroupParams, RuleDeleteRulesetAccessGroupParams } from "./rules"; +export { Rules as RuleResource } from "./rules"; +export { Themes } from "./themes"; +export type { Theme, ThemeListResponse, ThemeCreateParams, ThemeUpdateParams, ThemeReplaceDocumentParams } from "./themes"; +export { Themes as ThemeResource } from "./themes"; +export { Teams } from "./teams"; +export type { Team, TeamName, TeamImage, TeamListResponse } from "./teams"; +export { Teams as TeamResource } from "./teams"; +export { ScalarDocs } from "./scalar-docs"; +export type { GithubProject, ActiveDeployment, GithubProjectRepository, ScalarDocListGuidesResponse, ScalarDocCreateGuideParams, ScalarDocCreateGuideResponse, ScalarDocPublishGuideResponse } from "./scalar-docs"; +export { ScalarDocs as ScalarDocResource } from "./scalar-docs"; +export { Namespaces } from "./namespaces"; +export type { NamespaceListResponse } from "./namespaces"; +export { Namespaces as NamespaceResource } from "./namespaces"; +export { Authentication } from "./authentication"; +export type { User, Email, TeamSummary, AuthenticationExchangePersonalTokenParams, AuthenticationExchangePersonalTokenResponse } from "./authentication"; +export { Authentication as AuthenticationResource } from "./authentication"; diff --git a/src/resources/login-portals.ts b/src/resources/login-portals.ts new file mode 100644 index 0000000..a13798c --- /dev/null +++ b/src/resources/login-portals.ts @@ -0,0 +1,222 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { APIResource } from "../resource"; +import { APIPromise } from "../api-promise"; +import type { RequestOptions } from "../internal/request-options"; +import { path as __scalarPath } from "../internal/utils/path"; + +export class LoginPortals extends APIResource { + /** + * Get a login portal by slug. + * + * @param {string} slug + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const retrieve = await client.loginPortals.retrieve("slug"); + * ``` + */ + retrieve(slug: string, options?: RequestOptions): APIPromise { + return this._client.get(__scalarPath`/v1/login-portals/${slug}`, options); + } + + /** + * Update metadata for a login portal. + * + * @param {string} slug + * @param {LoginPortalUpdateParams} body - The request body to send. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.loginPortals.update("slug", {}); + * ``` + */ + update(slug: string, body: LoginPortalUpdateParams, options?: RequestOptions): APIPromise { + return this._client.patch(__scalarPath`/v1/login-portals/${slug}`, { body: body, ...options }); + } + + /** + * Delete a login portal. + * + * @param {string} slug + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.loginPortals.delete("slug"); + * ``` + */ + delete(slug: string, options?: RequestOptions): APIPromise { + return this._client.delete(__scalarPath`/v1/login-portals/${slug}`, options); + } + + /** + * Create a login portal for the current team. + * + * @param {LoginPortalCreateParams} body - The request body to send. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const uID = await client.loginPortals.create({ + * title: "", + * slug: "", + * email: { + * logo: "", + * logoSize: "100", + * buttonText: "Login", + * message: "Click to access private documentation hosted by scalar.com", + * title: "Private Docs", + * mainColor: "#2a2f45", + * mainBackground: "#f6f6f6", + * cardColor: "2a2f45", + * cardBackground: "#fff", + * buttonColor: "#fff", + * buttonBackground: "#0f0f0f", + * }, + * page: { + * title: "Scalar Private Docs", + * description: "Login to access your documentation", + * head: "", + * script: "", + * theme: "", + * companyName: "", + * logo: "", + * logoUrl: "", + * favicon: "", + * termsLink: "", + * privacyLink: "", + * formTitle: "Scalar Private Docs", + * formDescription: "Login to access your documentation", + * formImage: "", + * }, + * }); + * ``` + */ + create(body: LoginPortalCreateParams, options?: RequestOptions): APIPromise { + return this._client.post("/v1/login-portals", { body: body, ...options }); + } + + /** + * List all login portals for the current team. + * + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const list = await client.loginPortals.list(); + * ``` + */ + list(options?: RequestOptions): APIPromise { + return this._client.get("/v1/login-portals", options); + } +} + +export interface LoginPortalEmail { + logo: string; + logoSize: string; + buttonText: string; + message: string; + title: string; + mainColor: string; + mainBackground: string; + cardColor: string; + cardBackground: string; + buttonColor: string; + buttonBackground: string; +} + +export interface LoginPortalPage { + title: string; + description: string; + head: string; + script: string; + theme: string; + companyName: string; + logo: string; + logoURL: string; + favicon: string; + termsLink: string; + privacyLink: string; + formTitle: string; + formDescription: string; + formImage: string; +} + +export interface Value400 { + message: string; + code: string; +} + +export interface Value401 { + message: string; + code: string; +} + +export interface Value403 { + message: string; + code: string; +} + +export interface Value404 { + message: string; + code: string; +} + +export interface Value422 { + message: string; + code: string; +} + +export interface Value500 { + message: string; + code: string; +} + +export interface UID { + uid: Nanoid; +} + +export type Nanoid = string; + +export interface LoginPortal { + uid: Nanoid; + title: string; + slug: Slug; +} + +export type Slug = string; + +export type LoginPortalRetrieveResponse = { uid: string; title: string; slug: string; email: LoginPortalEmail; page: LoginPortalPage }; + +export interface LoginPortalUpdateParams { + title?: string; +} + +export interface LoginPortalCreateParams { + title: string; + slug: string; + email: LoginPortalEmail; + page: LoginPortalPage; +} + +export type LoginPortalListResponse = Array; +export declare namespace LoginPortals { + export { + type LoginPortalEmail as LoginPortalEmail, + type LoginPortalPage as LoginPortalPage, + type LoginPortalRetrieveResponse as LoginPortalRetrieveResponse, + type UID as UID, + type LoginPortalListResponse as LoginPortalListResponse, + type LoginPortalUpdateParams as LoginPortalUpdateParams, + type LoginPortalCreateParams as LoginPortalCreateParams, + }; +} +export { LoginPortals as LoginPortalResource }; diff --git a/src/resources/namespaces.ts b/src/resources/namespaces.ts new file mode 100644 index 0000000..9487f26 --- /dev/null +++ b/src/resources/namespaces.ts @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { APIResource } from "../resource"; +import { APIPromise } from "../api-promise"; +import type { RequestOptions } from "../internal/request-options"; + +export class Namespaces extends APIResource { + /** + * Get all namespaces for the current team + * + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const list = await client.namespaces.list(); + * ``` + */ + list(options?: RequestOptions): APIPromise { + return this._client.get("/v1/namespaces", options); + } +} + +export interface Value400 { + message: string; + code: string; +} + +export interface Value401 { + message: string; + code: string; +} + +export interface Value403 { + message: string; + code: string; +} + +export interface Value404 { + message: string; + code: string; +} + +export interface Value422 { + message: string; + code: string; +} + +export interface Value500 { + message: string; + code: string; +} + +export type NamespaceListResponse = Array; +export declare namespace Namespaces { + export { + type NamespaceListResponse as NamespaceListResponse, + }; +} +export { Namespaces as NamespaceResource }; diff --git a/src/resources/registry.ts b/src/resources/registry.ts new file mode 100644 index 0000000..6867c00 --- /dev/null +++ b/src/resources/registry.ts @@ -0,0 +1,411 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { APIResource } from "../resource"; +import { APIPromise } from "../api-promise"; +import type { RequestOptions } from "../internal/request-options"; +import { path as __scalarPath } from "../internal/utils/path"; + +export class Registry extends APIResource { + /** + * List all API documents across every namespace the caller can access. + * + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const listAllAPIDocuments = await client.registry.listAllAPIDocuments(); + * ``` + */ + listAllAPIDocuments(options?: RequestOptions): APIPromise { + return this._client.get("/v1/apis", options); + } + + /** + * List API documents in a namespace. + * + * @param {string} namespace + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const listAPIDocuments = await client.registry.listAPIDocuments("namespace"); + * ``` + */ + listAPIDocuments(namespace: string, options?: RequestOptions): APIPromise { + return this._client.get(__scalarPath`/v1/apis/${namespace}`, options); + } + + /** + * Create an API document. + * + * @param {string} namespace + * @param {RegistryCreateAPIDocumentParams} body - The request body to send. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const createAPIDocument = await client.registry.createAPIDocument("namespace", { + * title: "", + * version: "", + * slug: "", + * document: "", + * }); + * ``` + */ + createAPIDocument(namespace: string, body: RegistryCreateAPIDocumentParams, options?: RequestOptions): APIPromise { + return this._client.post(__scalarPath`/v1/apis/${namespace}`, { body: body, ...options }); + } + + /** + * Update metadata for an API document. + * + * @param {string} slug + * @param {RegistryUpdateAPIDocumentParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.registry.updateAPIDocument("slug", { + * namespace: "namespace", + * }); + * ``` + */ + updateAPIDocument(slug: string, params: RegistryUpdateAPIDocumentParams, options?: RequestOptions): APIPromise { + const { namespace, ...body } = params ?? {}; + return this._client.patch(__scalarPath`/v1/apis/${namespace}/${slug}`, { body: body, ...options }); + } + + /** + * Delete an API document and all versions. + * + * @param {string} slug + * @param {RegistryDeleteAPIDocumentParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.registry.deleteAPIDocument("slug", { + * namespace: "namespace", + * }); + * ``` + */ + deleteAPIDocument(slug: string, params: RegistryDeleteAPIDocumentParams, options?: RequestOptions): APIPromise { + const { namespace } = params ?? {}; + return this._client.delete(__scalarPath`/v1/apis/${namespace}/${slug}`, options); + } + + /** + * Get a specific API document version. + * + * @param {string} semver + * @param {RegistryRetrieveAPIDocumentVersionParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const string_ = await client.registry.retrieveAPIDocumentVersion("semver", { + * namespace: "namespace", + * slug: "slug", + * }); + * ``` + */ + retrieveAPIDocumentVersion(semver: string, params: RegistryRetrieveAPIDocumentVersionParams, options?: RequestOptions): APIPromise { + const { namespace, slug } = params ?? {}; + return this._client.get(__scalarPath`/v1/apis/${namespace}/${slug}/version/${semver}`, options); + } + + /** + * Update the registry file content for an API document version. + * + * @param {string} semver + * @param {RegistryUpdateAPIDocumentVersionParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const updateAPIDocumentVersion = await client.registry.updateAPIDocumentVersion("semver", { + * namespace: "namespace", + * slug: "slug", + * document: "", + * }); + * ``` + */ + updateAPIDocumentVersion(semver: string, params: RegistryUpdateAPIDocumentVersionParams, options?: RequestOptions): APIPromise { + const { namespace, slug, ...body } = params ?? {}; + return this._client.patch(__scalarPath`/v1/apis/${namespace}/${slug}/version/${semver}`, { body: body, ...options }); + } + + /** + * Delete a specific API document version. + * + * @param {string} semver + * @param {RegistryDeleteAPIDocumentVersionParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.registry.deleteAPIDocumentVersion("semver", { + * namespace: "namespace", + * slug: "slug", + * }); + * ``` + */ + deleteAPIDocumentVersion(semver: string, params: RegistryDeleteAPIDocumentVersionParams, options?: RequestOptions): APIPromise { + const { namespace, slug } = params ?? {}; + return this._client.delete(__scalarPath`/v1/apis/${namespace}/${slug}/version/${semver}`, options); + } + + /** + * Get metadata (uid, content shas, version sha, tags) for a specific API document version. + * + * @param {string} semver + * @param {RegistryListAPIDocumentVersionMetadataParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const managedDocVersion = await client.registry.listAPIDocumentVersionMetadata("semver", { + * namespace: "namespace", + * slug: "slug", + * }); + * ``` + */ + listAPIDocumentVersionMetadata(semver: string, params: RegistryListAPIDocumentVersionMetadataParams, options?: RequestOptions): APIPromise { + const { namespace, slug } = params ?? {}; + return this._client.get(__scalarPath`/v1/apis/${namespace}/${slug}/version/${semver}/metadata`, options); + } + + /** + * Create a new API document version. + * + * @param {string} slug + * @param {RegistryCreateAPIDocumentVersionParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const managedDocVersion = await client.registry.createAPIDocumentVersion("slug", { + * namespace: "namespace", + * version: "", + * document: "", + * }); + * ``` + */ + createAPIDocumentVersion(slug: string, params: RegistryCreateAPIDocumentVersionParams, options?: RequestOptions): APIPromise { + const { namespace, ...body } = params ?? {}; + return this._client.post(__scalarPath`/v1/apis/${namespace}/${slug}/version`, { body: body, ...options }); + } + + /** + * Add an access group to an API document. + * + * @param {string} slug + * @param {RegistryCreateAPIDocumentAccessGroupParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.registry.createAPIDocumentAccessGroup("slug", { + * namespace: "namespace", + * accessGroupSlug: "", + * }); + * ``` + */ + createAPIDocumentAccessGroup(slug: string, params: RegistryCreateAPIDocumentAccessGroupParams, options?: RequestOptions): APIPromise { + const { namespace, ...body } = params ?? {}; + return this._client.post(__scalarPath`/v1/apis/${namespace}/${slug}/access-group`, { body: body, ...options }); + } + + /** + * Remove an access group from an API document. + * + * @param {string} slug + * @param {RegistryDeleteAPIDocumentAccessGroupParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.registry.deleteAPIDocumentAccessGroup("slug", { + * namespace: "namespace", + * accessGroupSlug: "", + * }); + * ``` + */ + deleteAPIDocumentAccessGroup(slug: string, params: RegistryDeleteAPIDocumentAccessGroupParams, options?: RequestOptions): APIPromise { + const { namespace, ...body } = params ?? {}; + return this._client.delete(__scalarPath`/v1/apis/${namespace}/${slug}/access-group`, { body: body, ...options }); + } +} + +export type Version = string; + +export interface AccessGroup { + accessGroupSlug: Slug; +} + +export interface APIDocument { + uid: Nanoid; + version: Version; + title: string; + slug: Slug; + description: string; + namespace: Namespace; + isPrivate: boolean; + tags: string; + versions: Array; +} + +export type Nanoid = string; + +export type Slug = string; + +export type Namespace = string; + +export interface ManagedDocVersion { + uid: Nanoid; + createdAt: number; + version: Version; + upgraded: boolean; + embedStatus: "complete" | "failed" | null; + tags: Array; + tools?: Array<{ path: string; method: Method; enabledTools: Array<"execute-request" | "get-mini-openapi-spec"> }>; + yamlSha?: string; + jsonSha?: string; + versionSha?: string; +} + +export type Method = "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace"; + +export interface Value400 { + message: string; + code: string; +} + +export interface Value401 { + message: string; + code: string; +} + +export interface Value403 { + message: string; + code: string; +} + +export interface Value404 { + message: string; + code: string; +} + +export interface Value422 { + message: string; + code: string; +} + +export interface Value500 { + message: string; + code: string; +} + +export type RegistryListAllAPIDocumentsResponse = Array; + +export type RegistryListAPIDocumentsResponse = Array; + +export interface RegistryCreateAPIDocumentParams { + title: string; + version: Version; + slug: string; + document: string; + description?: string; + ruleset?: string; + isPrivate?: boolean; +} + +export type RegistryCreateAPIDocumentResponse = { uid: string; versionUid: string; title: string; jsonSha: string; yamlSha: string; versionSha: string }; + +export interface RegistryUpdateAPIDocumentParams { + namespace: string; + title?: string; + description?: string; + isPrivate?: boolean; + ruleset?: string; +} + +export interface RegistryDeleteAPIDocumentParams { + namespace: string; +} + +export interface RegistryRetrieveAPIDocumentVersionParams { + namespace: string; + slug: string; +} + +export interface RegistryUpdateAPIDocumentVersionParams { + namespace: string; + slug: string; + document: string; + lastKnownVersionSha?: string; +} + +export type RegistryUpdateAPIDocumentVersionResponse = { jsonSha: string; yamlSha: string; versionSha: string }; + +export interface RegistryDeleteAPIDocumentVersionParams { + namespace: string; + slug: string; +} + +export interface RegistryListAPIDocumentVersionMetadataParams { + namespace: string; + slug: string; +} + +export interface RegistryCreateAPIDocumentVersionParams { + namespace: string; + version: Version; + document: string; + force?: boolean; + lastKnownVersionSha?: string; +} + +export interface RegistryCreateAPIDocumentAccessGroupParams { + namespace: string; + accessGroupSlug: Slug; +} + +export interface RegistryDeleteAPIDocumentAccessGroupParams { + namespace: string; + accessGroupSlug: Slug; +} +export declare namespace Registry { + export { + type Version as Version, + type AccessGroup as AccessGroup, + type RegistryListAllAPIDocumentsResponse as RegistryListAllAPIDocumentsResponse, + type RegistryListAPIDocumentsResponse as RegistryListAPIDocumentsResponse, + type RegistryCreateAPIDocumentResponse as RegistryCreateAPIDocumentResponse, + type RegistryUpdateAPIDocumentVersionResponse as RegistryUpdateAPIDocumentVersionResponse, + type ManagedDocVersion as ManagedDocVersion, + type RegistryCreateAPIDocumentParams as RegistryCreateAPIDocumentParams, + type RegistryUpdateAPIDocumentParams as RegistryUpdateAPIDocumentParams, + type RegistryDeleteAPIDocumentParams as RegistryDeleteAPIDocumentParams, + type RegistryRetrieveAPIDocumentVersionParams as RegistryRetrieveAPIDocumentVersionParams, + type RegistryUpdateAPIDocumentVersionParams as RegistryUpdateAPIDocumentVersionParams, + type RegistryDeleteAPIDocumentVersionParams as RegistryDeleteAPIDocumentVersionParams, + type RegistryListAPIDocumentVersionMetadataParams as RegistryListAPIDocumentVersionMetadataParams, + type RegistryCreateAPIDocumentVersionParams as RegistryCreateAPIDocumentVersionParams, + type RegistryCreateAPIDocumentAccessGroupParams as RegistryCreateAPIDocumentAccessGroupParams, + type RegistryDeleteAPIDocumentAccessGroupParams as RegistryDeleteAPIDocumentAccessGroupParams, + }; +} +export { Registry as RegistryResource }; diff --git a/src/resources/rules.ts b/src/resources/rules.ts new file mode 100644 index 0000000..5b275b8 --- /dev/null +++ b/src/resources/rules.ts @@ -0,0 +1,249 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { APIResource } from "../resource"; +import { APIPromise } from "../api-promise"; +import type { RequestOptions } from "../internal/request-options"; +import { path as __scalarPath } from "../internal/utils/path"; + +export class Rules extends APIResource { + /** + * List all rulesets in a namespace. + * + * @param {string} namespace + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const listRulesets = await client.rules.listRulesets("namespace"); + * ``` + */ + listRulesets(namespace: string, options?: RequestOptions): APIPromise { + return this._client.get(__scalarPath`/v1/rulesets/${namespace}`, options); + } + + /** + * Create a rule in a namespace. + * + * @param {string} namespace + * @param {RuleCreateRulesetParams} body - The request body to send. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const uID = await client.rules.createRuleset("namespace", { + * title: "", + * slug: "", + * document: "", + * }); + * ``` + */ + createRuleset(namespace: string, body: RuleCreateRulesetParams, options?: RequestOptions): APIPromise { + return this._client.post(__scalarPath`/v1/rulesets/${namespace}`, { body: body, ...options }); + } + + /** + * Update rule metadata by slug. + * + * @param {string} slug + * @param {RuleUpdateRulesetParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.rules.updateRuleset("slug", { + * namespace: "namespace", + * }); + * ``` + */ + updateRuleset(slug: string, params: RuleUpdateRulesetParams, options?: RequestOptions): APIPromise { + const { namespace, ...body } = params ?? {}; + return this._client.patch(__scalarPath`/v1/rulesets/${namespace}/${slug}`, { body: body, ...options }); + } + + /** + * Delete a rule by slug. + * + * @param {string} slug + * @param {RuleDeleteRulesetParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.rules.deleteRuleset("slug", { + * namespace: "namespace", + * }); + * ``` + */ + deleteRuleset(slug: string, params: RuleDeleteRulesetParams, options?: RequestOptions): APIPromise { + const { namespace } = params ?? {}; + return this._client.delete(__scalarPath`/v1/rulesets/${namespace}/${slug}`, options); + } + + /** + * Get a rule document by slug. + * + * @param {string} slug + * @param {RuleRetrieveRulesetDocumentParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const string_ = await client.rules.retrieveRulesetDocument("slug", { + * namespace: "namespace", + * }); + * ``` + */ + retrieveRulesetDocument(slug: string, params: RuleRetrieveRulesetDocumentParams, options?: RequestOptions): APIPromise { + const { namespace } = params ?? {}; + return this._client.get(__scalarPath`/v1/rulesets/${namespace}/${slug}`, options); + } + + /** + * Grant an access group to a rule. + * + * @param {string} slug + * @param {RuleCreateRulesetAccessGroupParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.rules.createRulesetAccessGroup("slug", { + * namespace: "namespace", + * accessGroupSlug: "", + * }); + * ``` + */ + createRulesetAccessGroup(slug: string, params: RuleCreateRulesetAccessGroupParams, options?: RequestOptions): APIPromise { + const { namespace, ...body } = params ?? {}; + return this._client.post(__scalarPath`/v1/rulesets/${namespace}/${slug}/access-group`, { body: body, ...options }); + } + + /** + * Remove an access group from a rule. + * + * @param {string} slug + * @param {RuleDeleteRulesetAccessGroupParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.rules.deleteRulesetAccessGroup("slug", { + * namespace: "namespace", + * accessGroupSlug: "", + * }); + * ``` + */ + deleteRulesetAccessGroup(slug: string, params: RuleDeleteRulesetAccessGroupParams, options?: RequestOptions): APIPromise { + const { namespace, ...body } = params ?? {}; + return this._client.delete(__scalarPath`/v1/rulesets/${namespace}/${slug}/access-group`, { body: body, ...options }); + } +} + +export interface Rule { + uid: Nanoid; + title: string; + description: string; + slug: Slug; + namespace: Namespace; + isPrivate: boolean; +} + +export type Nanoid = string; + +export type Slug = string; + +export type Namespace = string; + +export interface Value400 { + message: string; + code: string; +} + +export interface Value401 { + message: string; + code: string; +} + +export interface Value403 { + message: string; + code: string; +} + +export interface Value404 { + message: string; + code: string; +} + +export interface Value422 { + message: string; + code: string; +} + +export interface Value500 { + message: string; + code: string; +} + +export interface UID { + uid: Nanoid; +} + +export interface AccessGroup { + accessGroupSlug: Slug; +} + +export type RuleListRulesetsResponse = Array; + +export interface RuleCreateRulesetParams { + title: string; + slug: string; + document: string; + description?: string; + isPrivate?: boolean; +} + +export interface RuleUpdateRulesetParams { + namespace: string; + slug?: string; + title?: string; + description?: string; + isPrivate?: boolean; +} + +export interface RuleDeleteRulesetParams { + namespace: string; +} + +export interface RuleRetrieveRulesetDocumentParams { + namespace: string; +} + +export interface RuleCreateRulesetAccessGroupParams { + namespace: string; + accessGroupSlug: Slug; +} + +export interface RuleDeleteRulesetAccessGroupParams { + namespace: string; + accessGroupSlug: Slug; +} +export declare namespace Rules { + export { + type RuleListRulesetsResponse as RuleListRulesetsResponse, + type UID as UID, + type RuleCreateRulesetParams as RuleCreateRulesetParams, + type RuleUpdateRulesetParams as RuleUpdateRulesetParams, + type RuleDeleteRulesetParams as RuleDeleteRulesetParams, + type RuleRetrieveRulesetDocumentParams as RuleRetrieveRulesetDocumentParams, + type RuleCreateRulesetAccessGroupParams as RuleCreateRulesetAccessGroupParams, + type RuleDeleteRulesetAccessGroupParams as RuleDeleteRulesetAccessGroupParams, + }; +} +export { Rules as RuleResource }; diff --git a/src/resources/scalar-docs.ts b/src/resources/scalar-docs.ts new file mode 100644 index 0000000..a21d1c3 --- /dev/null +++ b/src/resources/scalar-docs.ts @@ -0,0 +1,158 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { APIResource } from "../resource"; +import { APIPromise } from "../api-promise"; +import type { RequestOptions } from "../internal/request-options"; +import { path as __scalarPath } from "../internal/utils/path"; + +export class ScalarDocs extends APIResource { + /** + * List all guide projects. + * + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const listGuides = await client.scalarDocs.listGuides(); + * ``` + */ + listGuides(options?: RequestOptions): APIPromise { + return this._client.get("/v1/guides", options); + } + + /** + * Create a guide project. + * + * @param {ScalarDocCreateGuideParams} body - The request body to send. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const createGuide = await client.scalarDocs.createGuide({ + * name: "", + * isPrivate: false, + * allowedUsers: [], + * allowedDomains: [], + * }); + * ``` + */ + createGuide(body: ScalarDocCreateGuideParams, options?: RequestOptions): APIPromise { + return this._client.post("/v1/guides", { body: body, ...options }); + } + + /** + * Start a new publish process. + * + * @param {string} slug + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const publishGuide = await client.scalarDocs.publishGuide("slug"); + * ``` + */ + publishGuide(slug: string, options?: RequestOptions): APIPromise { + return this._client.post(__scalarPath`/v1/guides/${slug}/publish`, options); + } +} + +export type Slug = string; + +export interface GithubProject { + uid: Nanoid; + createdAt: Timestamp; + updatedAt: Timestamp; + name: string; + activeDeployment: ActiveDeployment | null; + lastPublished: Timestamp | null; + lastPublishedUid: string | null; + loginPortalUid: string; + activeThemeId: string; + isPrivate: boolean; + agentEnabled: boolean; + accessGroups: string; + slug: Slug; + publishStatus: string; + publishMessage: string; + typesenseId?: number; + repository?: GithubProjectRepository | null; +} + +export type Nanoid = string; + +export type Timestamp = number; + +export interface ActiveDeployment { + uid: string; + domain: string; + publishedAt: Timestamp; +} + +export interface GithubProjectRepository { + linkedBy: string; + id: number; + name: string; + configPath: string; + branch: string; + publishOnMerge: boolean; + publishPreviews: boolean; + prComments: boolean; + expired: boolean; +} + +export interface Value400 { + message: string; + code: string; +} + +export interface Value401 { + message: string; + code: string; +} + +export interface Value403 { + message: string; + code: string; +} + +export interface Value404 { + message: string; + code: string; +} + +export interface Value422 { + message: string; + code: string; +} + +export interface Value500 { + message: string; + code: string; +} + +export type ScalarDocListGuidesResponse = Array; + +export interface ScalarDocCreateGuideParams { + name: string; + isPrivate: boolean; + allowedUsers: Array; + allowedDomains: Array; + slug?: Slug; +} + +export type ScalarDocCreateGuideResponse = { uid: string; slug: string }; + +export type ScalarDocPublishGuideResponse = { publishUid: string }; +export declare namespace ScalarDocs { + export { + type Slug as Slug, + type ScalarDocListGuidesResponse as ScalarDocListGuidesResponse, + type ScalarDocCreateGuideResponse as ScalarDocCreateGuideResponse, + type ScalarDocPublishGuideResponse as ScalarDocPublishGuideResponse, + type ScalarDocCreateGuideParams as ScalarDocCreateGuideParams, + }; +} +export { ScalarDocs as ScalarDocResource }; diff --git a/src/resources/schemas.ts b/src/resources/schemas.ts new file mode 100644 index 0000000..4bf8c86 --- /dev/null +++ b/src/resources/schemas.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +export * from "./schemas/index"; diff --git a/src/resources/schemas/access-group.ts b/src/resources/schemas/access-group.ts new file mode 100644 index 0000000..a7eae7a --- /dev/null +++ b/src/resources/schemas/access-group.ts @@ -0,0 +1,103 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { APIResource } from "../../resource"; +import { APIPromise } from "../../api-promise"; +import type { RequestOptions } from "../../internal/request-options"; +import { path as __scalarPath } from "../../internal/utils/path"; + +export class AccessGroup extends APIResource { + /** + * Add an access group to a schema. + * + * @param {string} slug + * @param {AccessGroupCreateSchemaParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.schemas.accessGroup.createSchema("slug", { + * namespace: "namespace", + * accessGroupSlug: "", + * }); + * ``` + */ + createSchema(slug: string, params: AccessGroupCreateSchemaParams, options?: RequestOptions): APIPromise { + const { namespace, ...body } = params ?? {}; + return this._client.post(__scalarPath`/v1/schemas/${namespace}/${slug}/access-group`, { body: body, ...options }); + } + + /** + * Remove an access group from a schema. + * + * @param {string} slug + * @param {AccessGroupDeleteSchemaParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.schemas.accessGroup.deleteSchema("slug", { + * namespace: "namespace", + * accessGroupSlug: "", + * }); + * ``` + */ + deleteSchema(slug: string, params: AccessGroupDeleteSchemaParams, options?: RequestOptions): APIPromise { + const { namespace, ...body } = params ?? {}; + return this._client.delete(__scalarPath`/v1/schemas/${namespace}/${slug}/access-group`, { body: body, ...options }); + } +} + +export interface AccessGroup2 { + accessGroupSlug: Slug; +} + +export type Slug = string; + +export interface Value400 { + message: string; + code: string; +} + +export interface Value401 { + message: string; + code: string; +} + +export interface Value403 { + message: string; + code: string; +} + +export interface Value404 { + message: string; + code: string; +} + +export interface Value422 { + message: string; + code: string; +} + +export interface Value500 { + message: string; + code: string; +} + +export interface AccessGroupCreateSchemaParams { + namespace: string; + accessGroupSlug: Slug; +} + +export interface AccessGroupDeleteSchemaParams { + namespace: string; + accessGroupSlug: Slug; +} +export declare namespace AccessGroup { + export { + type AccessGroupCreateSchemaParams as AccessGroupCreateSchemaParams, + type AccessGroupDeleteSchemaParams as AccessGroupDeleteSchemaParams, + }; +} +export { AccessGroup as AccessGroupResource }; diff --git a/src/resources/schemas/index.ts b/src/resources/schemas/index.ts new file mode 100644 index 0000000..b997460 --- /dev/null +++ b/src/resources/schemas/index.ts @@ -0,0 +1,8 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +export { Schemas } from "./schemas"; +export type { Schema, Nanoid, Slug, Namespace, ManagedSchemaVersion, Timestamp, Version2 as SchemaVersion, Value400, Value401, Value403, Value404, Value422, Value500, UID, SchemaListResponse, SchemaCreateParams, SchemaUpdateParams, SchemaDeleteParams } from "./schemas"; +export { Version } from "./version"; +export type { VersionRetrieveSchemaParams, VersionDeleteSchemaParams, VersionCreateSchemaParams } from "./version"; +export { AccessGroup } from "./access-group"; +export type { AccessGroup2 as AccessGroupAccessGroup, AccessGroupCreateSchemaParams, AccessGroupDeleteSchemaParams } from "./access-group"; diff --git a/src/resources/schemas/schemas.ts b/src/resources/schemas/schemas.ts new file mode 100644 index 0000000..b25314a --- /dev/null +++ b/src/resources/schemas/schemas.ts @@ -0,0 +1,200 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { APIResource } from "../../resource"; +import { APIPromise } from "../../api-promise"; +import type { RequestOptions } from "../../internal/request-options"; +import { path as __scalarPath } from "../../internal/utils/path"; +import { Version, type VersionRetrieveSchemaParams, type VersionDeleteSchemaParams, type VersionCreateSchemaParams } from "./version"; +import { AccessGroup, type AccessGroupCreateSchemaParams, type AccessGroupDeleteSchemaParams } from "./access-group"; + +export class Schemas extends APIResource { + version: Version = new Version(this._client); + accessGroup: AccessGroup = new AccessGroup(this._client); + + /** + * List schemas in a namespace. + * + * @param {string} namespace + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const list = await client.schemas.list("namespace"); + * ``` + */ + list(namespace: string, options?: RequestOptions): APIPromise { + return this._client.get(__scalarPath`/v1/schemas/${namespace}`, options); + } + + /** + * Create a schema in a namespace. + * + * @param {string} namespace + * @param {SchemaCreateParams} body - The request body to send. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const uID = await client.schemas.create("namespace", { + * title: "", + * version: "", + * slug: "", + * document: "", + * }); + * ``` + */ + create(namespace: string, body: SchemaCreateParams, options?: RequestOptions): APIPromise { + return this._client.post(__scalarPath`/v1/schemas/${namespace}`, { body: body, ...options }); + } + + /** + * Update schema metadata. + * + * @param {string} slug + * @param {SchemaUpdateParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.schemas.update("slug", { + * namespace: "namespace", + * }); + * ``` + */ + update(slug: string, params: SchemaUpdateParams, options?: RequestOptions): APIPromise { + const { namespace, ...body } = params ?? {}; + return this._client.patch(__scalarPath`/v1/schemas/${namespace}/${slug}`, { body: body, ...options }); + } + + /** + * Delete a schema and all related versions. + * + * @param {string} slug + * @param {SchemaDeleteParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.schemas.delete("slug", { + * namespace: "namespace", + * }); + * ``` + */ + delete(slug: string, params: SchemaDeleteParams, options?: RequestOptions): APIPromise { + const { namespace } = params ?? {}; + return this._client.delete(__scalarPath`/v1/schemas/${namespace}/${slug}`, options); + } +} + +export interface Schema { + uid: Nanoid; + title: string; + description: string; + slug: Slug; + namespace: Namespace; + isPrivate: boolean; + versions: Array; +} + +export type Nanoid = string; + +export type Slug = string; + +export type Namespace = string; + +export interface ManagedSchemaVersion { + uid: Nanoid; + createdAt: Timestamp; + updatedAt: Timestamp; + version: Version2; +} + +export type Timestamp = number; + +export type Version2 = string; + +export interface Value400 { + message: string; + code: string; +} + +export interface Value401 { + message: string; + code: string; +} + +export interface Value403 { + message: string; + code: string; +} + +export interface Value404 { + message: string; + code: string; +} + +export interface Value422 { + message: string; + code: string; +} + +export interface Value500 { + message: string; + code: string; +} + +export interface UID { + uid: Nanoid; +} + +export type SchemaListResponse = Array; + +export interface SchemaCreateParams { + title: string; + version: Version; + slug: string; + document: string; + description?: string; + isPrivate?: boolean; +} + +export interface SchemaUpdateParams { + namespace: string; + title?: string; + description?: string; + isPrivate?: boolean; +} + +export interface SchemaDeleteParams { + namespace: string; +} +Schemas.Version = Version; +Schemas.AccessGroup = AccessGroup; + +export declare namespace Schemas { + export { + type SchemaListResponse as SchemaListResponse, + type UID as UID, + type SchemaCreateParams as SchemaCreateParams, + type SchemaUpdateParams as SchemaUpdateParams, + type SchemaDeleteParams as SchemaDeleteParams, + }; + + export { + Version as Version, + type VersionRetrieveSchemaParams as VersionRetrieveSchemaParams, + type VersionDeleteSchemaParams as VersionDeleteSchemaParams, + type VersionCreateSchemaParams as VersionCreateSchemaParams, + }; + + export { + AccessGroup as AccessGroup, + type AccessGroupCreateSchemaParams as AccessGroupCreateSchemaParams, + type AccessGroupDeleteSchemaParams as AccessGroupDeleteSchemaParams, + }; +} +export { Schemas as SchemaResource }; diff --git a/src/resources/schemas/version.ts b/src/resources/schemas/version.ts new file mode 100644 index 0000000..af8e7a4 --- /dev/null +++ b/src/resources/schemas/version.ts @@ -0,0 +1,135 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { APIResource } from "../../resource"; +import { APIPromise } from "../../api-promise"; +import type { RequestOptions } from "../../internal/request-options"; +import { path as __scalarPath } from "../../internal/utils/path"; + +export class Version extends APIResource { + /** + * Get a specific schema version document. + * + * @param {string} semver + * @param {VersionRetrieveSchemaParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const string_ = await client.schemas.version.retrieveSchema("semver", { + * namespace: "namespace", + * slug: "slug", + * }); + * ``` + */ + retrieveSchema(semver: string, params: VersionRetrieveSchemaParams, options?: RequestOptions): APIPromise { + const { namespace, slug } = params ?? {}; + return this._client.get(__scalarPath`/v1/schemas/${namespace}/${slug}/version/${semver}`, options); + } + + /** + * Delete a schema version. + * + * @param {string} semver + * @param {VersionDeleteSchemaParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.schemas.version.deleteSchema("semver", { + * namespace: "namespace", + * slug: "slug", + * }); + * ``` + */ + deleteSchema(semver: string, params: VersionDeleteSchemaParams, options?: RequestOptions): APIPromise { + const { namespace, slug } = params ?? {}; + return this._client.delete(__scalarPath`/v1/schemas/${namespace}/${slug}/version/${semver}`, options); + } + + /** + * Create a schema version. + * + * @param {string} slug + * @param {VersionCreateSchemaParams} params - The parameters to send with the request. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const uID = await client.schemas.version.createSchema("slug", { + * namespace: "namespace", + * version: "", + * document: "", + * }); + * ``` + */ + createSchema(slug: string, params: VersionCreateSchemaParams, options?: RequestOptions): APIPromise { + const { namespace, ...body } = params ?? {}; + return this._client.post(__scalarPath`/v1/schemas/${namespace}/${slug}/version`, { body: body, ...options }); + } +} + +export interface Value400 { + message: string; + code: string; +} + +export interface Value401 { + message: string; + code: string; +} + +export interface Value403 { + message: string; + code: string; +} + +export interface Value404 { + message: string; + code: string; +} + +export interface Value422 { + message: string; + code: string; +} + +export interface Value500 { + message: string; + code: string; +} + +export interface UID { + uid: Nanoid; +} + +export type Nanoid = string; + +export type Version2 = string; + +export interface VersionRetrieveSchemaParams { + namespace: string; + slug: string; +} + +export interface VersionDeleteSchemaParams { + namespace: string; + slug: string; +} + +export interface VersionCreateSchemaParams { + namespace: string; + version: Version2; + document: string; +} +export declare namespace Version { + export { + type UID as UID, + type VersionRetrieveSchemaParams as VersionRetrieveSchemaParams, + type VersionDeleteSchemaParams as VersionDeleteSchemaParams, + type VersionCreateSchemaParams as VersionCreateSchemaParams, + }; +} +export { Version as VersionResource }; diff --git a/src/resources/teams.ts b/src/resources/teams.ts new file mode 100644 index 0000000..2daaf27 --- /dev/null +++ b/src/resources/teams.ts @@ -0,0 +1,76 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { APIResource } from "../resource"; +import { APIPromise } from "../api-promise"; +import type { RequestOptions } from "../internal/request-options"; + +export class Teams extends APIResource { + /** + * List all available teams + * + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const list = await client.teams.list(); + * ``` + */ + list(options?: RequestOptions): APIPromise { + return this._client.get("/v1/teams", options); + } +} + +export interface Team { + uid: Nanoid; + name: TeamName; + slug: Slug; + theme: string; + imageUri?: TeamImage; +} + +export type Nanoid = string; + +export type TeamName = string; + +export type TeamImage = string; + +export type Slug = string; + +export interface Value400 { + message: string; + code: string; +} + +export interface Value401 { + message: string; + code: string; +} + +export interface Value403 { + message: string; + code: string; +} + +export interface Value404 { + message: string; + code: string; +} + +export interface Value422 { + message: string; + code: string; +} + +export interface Value500 { + message: string; + code: string; +} + +export type TeamListResponse = Array; +export declare namespace Teams { + export { + type TeamListResponse as TeamListResponse, + }; +} +export { Teams as TeamResource }; diff --git a/src/resources/themes.ts b/src/resources/themes.ts new file mode 100644 index 0000000..3e0f781 --- /dev/null +++ b/src/resources/themes.ts @@ -0,0 +1,184 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +import { APIResource } from "../resource"; +import { APIPromise } from "../api-promise"; +import type { RequestOptions } from "../internal/request-options"; +import { path as __scalarPath } from "../internal/utils/path"; + +export class Themes extends APIResource { + /** + * List all team themes. + * + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const list = await client.themes.list(); + * ``` + */ + list(options?: RequestOptions): APIPromise { + return this._client.get("/v1/themes", options); + } + + /** + * Create a team theme. + * + * @param {ThemeCreateParams} body - The request body to send. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const uID = await client.themes.create({ + * name: "", + * slug: "", + * document: "", + * }); + * ``` + */ + create(body: ThemeCreateParams, options?: RequestOptions): APIPromise { + return this._client.post("/v1/themes", { body: body, ...options }); + } + + /** + * Update theme metadata. + * + * @param {string} slug + * @param {ThemeUpdateParams} body - The request body to send. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.themes.update("slug", {}); + * ``` + */ + update(slug: string, body: ThemeUpdateParams, options?: RequestOptions): APIPromise { + return this._client.patch(__scalarPath`/v1/themes/${slug}`, { body: body, ...options }); + } + + /** + * Replace the theme document. + * + * @param {string} slug + * @param {ThemeReplaceDocumentParams} body - The request body to send. + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.themes.replaceDocument("slug", { + * document: "", + * }); + * ``` + */ + replaceDocument(slug: string, body: ThemeReplaceDocumentParams, options?: RequestOptions): APIPromise { + return this._client.put(__scalarPath`/v1/themes/${slug}`, { body: body, ...options }); + } + + /** + * Delete a theme by slug. + * + * @param {string} slug + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * await client.themes.delete("slug"); + * ``` + */ + delete(slug: string, options?: RequestOptions): APIPromise { + return this._client.delete(__scalarPath`/v1/themes/${slug}`, options); + } + + /** + * Get the theme document by slug. + * + * @param {string} slug + * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. + * @returns {APIPromise} Default Response + * + * @example + * ```ts + * const string_ = await client.themes.retrieve("slug"); + * ``` + */ + retrieve(slug: string, options?: RequestOptions): APIPromise { + return this._client.get(__scalarPath`/v1/themes/${slug}`, options); + } +} + +export interface Theme { + uid: Nanoid; + name: string; + description: string; + slug: Slug; +} + +export type Nanoid = string; + +export type Slug = string; + +export interface Value400 { + message: string; + code: string; +} + +export interface Value401 { + message: string; + code: string; +} + +export interface Value403 { + message: string; + code: string; +} + +export interface Value404 { + message: string; + code: string; +} + +export interface Value422 { + message: string; + code: string; +} + +export interface Value500 { + message: string; + code: string; +} + +export interface UID { + uid: Nanoid; +} + +export type ThemeListResponse = Array; + +export interface ThemeCreateParams { + name: string; + slug: string; + document: string; + description?: string; +} + +export interface ThemeUpdateParams { + name?: string; + description?: string; +} + +export interface ThemeReplaceDocumentParams { + document: string; +} +export declare namespace Themes { + export { + type ThemeListResponse as ThemeListResponse, + type UID as UID, + type ThemeCreateParams as ThemeCreateParams, + type ThemeUpdateParams as ThemeUpdateParams, + type ThemeReplaceDocumentParams as ThemeReplaceDocumentParams, + }; +} +export { Themes as ThemeResource }; diff --git a/src/sdk/authentication.ts b/src/sdk/authentication.ts deleted file mode 100644 index 0fac97f..0000000 --- a/src/sdk/authentication.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { authenticationExchangePersonalToken } from "../funcs/authenticationExchangePersonalToken.js"; -import { authenticationGetCurrentUser } from "../funcs/authenticationGetCurrentUser.js"; -import { ClientSDK, RequestOptions } from "../lib/sdks.js"; -import * as operations from "../models/operations/index.js"; -import { unwrapAsync } from "../types/fp.js"; - -export class Authentication extends ClientSDK { - /** - * Exchange token - * - * @remarks - * Exchange an API key for an access token. - */ - async exchangePersonalToken( - request: operations.ExchangePersonalTokenRequestBody, - options?: RequestOptions, - ): Promise { - return unwrapAsync(authenticationExchangePersonalToken( - this, - request, - options, - )); - } - - /** - * Get current user - * - * @remarks - * Get the authenticated user, including their available teams and theme. - */ - async getCurrentUser( - options?: RequestOptions, - ): Promise { - return unwrapAsync(authenticationGetCurrentUser( - this, - options, - )); - } -} diff --git a/src/sdk/index.ts b/src/sdk/index.ts deleted file mode 100644 index ecac226..0000000 --- a/src/sdk/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -export * from "./sdk.js"; diff --git a/src/sdk/loginportals.ts b/src/sdk/loginportals.ts deleted file mode 100644 index 4ae96e3..0000000 --- a/src/sdk/loginportals.ts +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { loginPortalsCreateLoginPortal } from "../funcs/loginPortalsCreateLoginPortal.js"; -import { loginPortalsDeleteLoginPortal } from "../funcs/loginPortalsDeleteLoginPortal.js"; -import { loginPortalsGetLoginPortal } from "../funcs/loginPortalsGetLoginPortal.js"; -import { loginPortalsListLoginPortals } from "../funcs/loginPortalsListLoginPortals.js"; -import { loginPortalsUpdateLoginPortal } from "../funcs/loginPortalsUpdateLoginPortal.js"; -import { ClientSDK, RequestOptions } from "../lib/sdks.js"; -import * as operations from "../models/operations/index.js"; -import { unwrapAsync } from "../types/fp.js"; - -export class LoginPortals extends ClientSDK { - /** - * Get a login portal - * - * @remarks - * Get a login portal by slug. - */ - async getLoginPortal( - request: operations.GetLoginPortalRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(loginPortalsGetLoginPortal( - this, - request, - options, - )); - } - - /** - * Update portal metadata - * - * @remarks - * Update metadata for a login portal. - */ - async updateLoginPortal( - request: operations.UpdateLoginPortalRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(loginPortalsUpdateLoginPortal( - this, - request, - options, - )); - } - - /** - * Delete a login portal - * - * @remarks - * Delete a login portal. - */ - async deleteLoginPortal( - request: operations.DeleteLoginPortalRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(loginPortalsDeleteLoginPortal( - this, - request, - options, - )); - } - - /** - * Create a portal - * - * @remarks - * Create a login portal for the current team. - */ - async createLoginPortal( - request: operations.CreateLoginPortalRequestBody, - options?: RequestOptions, - ): Promise { - return unwrapAsync(loginPortalsCreateLoginPortal( - this, - request, - options, - )); - } - - /** - * List all portals - * - * @remarks - * List all login portals for the current team. - */ - async listLoginPortals( - options?: RequestOptions, - ): Promise { - return unwrapAsync(loginPortalsListLoginPortals( - this, - options, - )); - } -} diff --git a/src/sdk/namespaces.ts b/src/sdk/namespaces.ts deleted file mode 100644 index 61d6217..0000000 --- a/src/sdk/namespaces.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { namespacesListNamespaces } from "../funcs/namespacesListNamespaces.js"; -import { ClientSDK, RequestOptions } from "../lib/sdks.js"; -import * as operations from "../models/operations/index.js"; -import { unwrapAsync } from "../types/fp.js"; - -export class Namespaces extends ClientSDK { - /** - * List namespaces - * - * @remarks - * Get all namespaces for the current team - */ - async listNamespaces( - options?: RequestOptions, - ): Promise { - return unwrapAsync(namespacesListNamespaces( - this, - options, - )); - } -} diff --git a/src/sdk/registry.ts b/src/sdk/registry.ts deleted file mode 100644 index 1ec2cc9..0000000 --- a/src/sdk/registry.ts +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { registryAddApiDocumentAccessGroup } from "../funcs/registryAddApiDocumentAccessGroup.js"; -import { registryCreateApiDocument } from "../funcs/registryCreateApiDocument.js"; -import { registryCreateApiDocumentVersion } from "../funcs/registryCreateApiDocumentVersion.js"; -import { registryDeleteApiDocument } from "../funcs/registryDeleteApiDocument.js"; -import { registryDeleteApiDocumentVersion } from "../funcs/registryDeleteApiDocumentVersion.js"; -import { registryGetApiDocumentVersion } from "../funcs/registryGetApiDocumentVersion.js"; -import { registryGetApiDocumentVersionMetadata } from "../funcs/registryGetApiDocumentVersionMetadata.js"; -import { registryListAllApiDocuments } from "../funcs/registryListAllApiDocuments.js"; -import { registryListApiDocuments } from "../funcs/registryListApiDocuments.js"; -import { registryRemoveApiDocumentAccessGroup } from "../funcs/registryRemoveApiDocumentAccessGroup.js"; -import { registryUpdateApiDocument } from "../funcs/registryUpdateApiDocument.js"; -import { registryUpdateApiDocumentVersion } from "../funcs/registryUpdateApiDocumentVersion.js"; -import { ClientSDK, RequestOptions } from "../lib/sdks.js"; -import * as operations from "../models/operations/index.js"; -import { unwrapAsync } from "../types/fp.js"; - -export class Registry extends ClientSDK { - /** - * List all API Documents - * - * @remarks - * List all API documents across every namespace the caller can access. - */ - async listAllApiDocuments( - options?: RequestOptions, - ): Promise { - return unwrapAsync(registryListAllApiDocuments( - this, - options, - )); - } - - /** - * List API Documents in a namespace - * - * @remarks - * List API documents in a namespace. - */ - async listApiDocuments( - request: operations.ListApiDocumentsRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(registryListApiDocuments( - this, - request, - options, - )); - } - - /** - * Create API Document - * - * @remarks - * Create an API document. - */ - async createApiDocument( - request: operations.CreateApiDocumentRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(registryCreateApiDocument( - this, - request, - options, - )); - } - - /** - * Update API Document metadata - * - * @remarks - * Update metadata for an API document. - */ - async updateApiDocument( - request: operations.UpdateApiDocumentRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(registryUpdateApiDocument( - this, - request, - options, - )); - } - - /** - * Delete API Document - * - * @remarks - * Delete an API document and all versions. - */ - async deleteApiDocument( - request: operations.DeleteApiDocumentRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(registryDeleteApiDocument( - this, - request, - options, - )); - } - - /** - * Get API Document - * - * @remarks - * Get a specific API document version. - */ - async getApiDocumentVersion( - request: operations.GetApiDocumentVersionRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(registryGetApiDocumentVersion( - this, - request, - options, - )); - } - - /** - * Update API Document version - * - * @remarks - * Update the registry file content for an API document version. - */ - async updateApiDocumentVersion( - request: operations.UpdateApiDocumentVersionRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(registryUpdateApiDocumentVersion( - this, - request, - options, - )); - } - - /** - * Delete API Document version - * - * @remarks - * Delete a specific API document version. - */ - async deleteApiDocumentVersion( - request: operations.DeleteApiDocumentVersionRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(registryDeleteApiDocumentVersion( - this, - request, - options, - )); - } - - /** - * Get API Document version metadata - * - * @remarks - * Get metadata (uid, content shas, version sha, tags) for a specific API document version. - */ - async getApiDocumentVersionMetadata( - request: operations.GetApiDocumentVersionMetadataRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(registryGetApiDocumentVersionMetadata( - this, - request, - options, - )); - } - - /** - * Create API Document version - * - * @remarks - * Create a new API document version. - */ - async createApiDocumentVersion( - request: operations.CreateApiDocumentVersionRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(registryCreateApiDocumentVersion( - this, - request, - options, - )); - } - - /** - * Add access group - * - * @remarks - * Add an access group to an API document. - */ - async addApiDocumentAccessGroup( - request: operations.AddApiDocumentAccessGroupRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(registryAddApiDocumentAccessGroup( - this, - request, - options, - )); - } - - /** - * Remove access group - * - * @remarks - * Remove an access group from an API document. - */ - async removeApiDocumentAccessGroup( - request: operations.RemoveApiDocumentAccessGroupRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(registryRemoveApiDocumentAccessGroup( - this, - request, - options, - )); - } -} diff --git a/src/sdk/rules.ts b/src/sdk/rules.ts deleted file mode 100644 index 5a5bee4..0000000 --- a/src/sdk/rules.ts +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { rulesAddRulesetAccessGroup } from "../funcs/rulesAddRulesetAccessGroup.js"; -import { rulesCreateRuleset } from "../funcs/rulesCreateRuleset.js"; -import { rulesDeleteRuleset } from "../funcs/rulesDeleteRuleset.js"; -import { rulesGetRulesetDocument } from "../funcs/rulesGetRulesetDocument.js"; -import { rulesListRulesets } from "../funcs/rulesListRulesets.js"; -import { rulesRemoveRulesetAccessGroup } from "../funcs/rulesRemoveRulesetAccessGroup.js"; -import { rulesUpdateRuleset } from "../funcs/rulesUpdateRuleset.js"; -import { ClientSDK, RequestOptions } from "../lib/sdks.js"; -import * as operations from "../models/operations/index.js"; -import { unwrapAsync } from "../types/fp.js"; - -export class Rules extends ClientSDK { - /** - * List all rules - * - * @remarks - * List all rulesets in a namespace. - */ - async listRulesets( - request: operations.ListRulesetsRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(rulesListRulesets( - this, - request, - options, - )); - } - - /** - * Create a rule - * - * @remarks - * Create a rule in a namespace. - */ - async createRuleset( - request: operations.CreateRulesetRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(rulesCreateRuleset( - this, - request, - options, - )); - } - - /** - * Update rule metadata - * - * @remarks - * Update rule metadata by slug. - */ - async updateRuleset( - request: operations.UpdateRulesetRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(rulesUpdateRuleset( - this, - request, - options, - )); - } - - /** - * Delete a rule - * - * @remarks - * Delete a rule by slug. - */ - async deleteRuleset( - request: operations.DeleteRulesetRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(rulesDeleteRuleset( - this, - request, - options, - )); - } - - /** - * Get a rule - * - * @remarks - * Get a rule document by slug. - */ - async getRulesetDocument( - request: operations.GetRulesetDocumentRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(rulesGetRulesetDocument( - this, - request, - options, - )); - } - - /** - * Add rule access group - * - * @remarks - * Grant an access group to a rule. - */ - async addRulesetAccessGroup( - request: operations.AddRulesetAccessGroupRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(rulesAddRulesetAccessGroup( - this, - request, - options, - )); - } - - /** - * Remove rule access group - * - * @remarks - * Remove an access group from a rule. - */ - async removeRulesetAccessGroup( - request: operations.RemoveRulesetAccessGroupRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(rulesRemoveRulesetAccessGroup( - this, - request, - options, - )); - } -} diff --git a/src/sdk/scalardocs.ts b/src/sdk/scalardocs.ts deleted file mode 100644 index 905d22a..0000000 --- a/src/sdk/scalardocs.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { scalarDocsCreateGuide } from "../funcs/scalarDocsCreateGuide.js"; -import { scalarDocsListGuides } from "../funcs/scalarDocsListGuides.js"; -import { scalarDocsPublishGuide } from "../funcs/scalarDocsPublishGuide.js"; -import { ClientSDK, RequestOptions } from "../lib/sdks.js"; -import * as operations from "../models/operations/index.js"; -import { unwrapAsync } from "../types/fp.js"; - -export class ScalarDocs extends ClientSDK { - /** - * List all projects - * - * @remarks - * List all guide projects. - */ - async listGuides( - options?: RequestOptions, - ): Promise { - return unwrapAsync(scalarDocsListGuides( - this, - options, - )); - } - - /** - * Create a project - * - * @remarks - * Create a guide project. - */ - async createGuide( - request: operations.CreateGuideRequestBody, - options?: RequestOptions, - ): Promise { - return unwrapAsync(scalarDocsCreateGuide( - this, - request, - options, - )); - } - - /** - * Publish a project - * - * @remarks - * Start a new publish process. - */ - async publishGuide( - request: operations.PublishGuideRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(scalarDocsPublishGuide( - this, - request, - options, - )); - } -} diff --git a/src/sdk/schemas.ts b/src/sdk/schemas.ts deleted file mode 100644 index e180381..0000000 --- a/src/sdk/schemas.ts +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { schemasAddSchemaAccessGroup } from "../funcs/schemasAddSchemaAccessGroup.js"; -import { schemasCreateSchema } from "../funcs/schemasCreateSchema.js"; -import { schemasCreateSchemaVersion } from "../funcs/schemasCreateSchemaVersion.js"; -import { schemasDeleteSchema } from "../funcs/schemasDeleteSchema.js"; -import { schemasDeleteSchemaVersion } from "../funcs/schemasDeleteSchemaVersion.js"; -import { schemasGetSchemaVersion } from "../funcs/schemasGetSchemaVersion.js"; -import { schemasListSchemas } from "../funcs/schemasListSchemas.js"; -import { schemasRemoveSchemaAccessGroup } from "../funcs/schemasRemoveSchemaAccessGroup.js"; -import { schemasUpdateSchema } from "../funcs/schemasUpdateSchema.js"; -import { ClientSDK, RequestOptions } from "../lib/sdks.js"; -import * as operations from "../models/operations/index.js"; -import { unwrapAsync } from "../types/fp.js"; - -export class Schemas extends ClientSDK { - /** - * List all shared components - * - * @remarks - * List schemas in a namespace. - */ - async listSchemas( - request: operations.ListSchemasRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(schemasListSchemas( - this, - request, - options, - )); - } - - /** - * Create a shared component - * - * @remarks - * Create a schema in a namespace. - */ - async createSchema( - request: operations.CreateSchemaRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(schemasCreateSchema( - this, - request, - options, - )); - } - - /** - * Update shared component metadata - * - * @remarks - * Update schema metadata. - */ - async updateSchema( - request: operations.UpdateSchemaRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(schemasUpdateSchema( - this, - request, - options, - )); - } - - /** - * Delete a shared component - * - * @remarks - * Delete a schema and all related versions. - */ - async deleteSchema( - request: operations.DeleteSchemaRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(schemasDeleteSchema( - this, - request, - options, - )); - } - - /** - * Get a shared component document - * - * @remarks - * Get a specific schema version document. - */ - async getSchemaVersion( - request: operations.GetSchemaVersionRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(schemasGetSchemaVersion( - this, - request, - options, - )); - } - - /** - * Delete a shared component version - * - * @remarks - * Delete a schema version. - */ - async deleteSchemaVersion( - request: operations.DeleteSchemaVersionRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(schemasDeleteSchemaVersion( - this, - request, - options, - )); - } - - /** - * Create a shared component version - * - * @remarks - * Create a schema version. - */ - async createSchemaVersion( - request: operations.CreateSchemaVersionRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(schemasCreateSchemaVersion( - this, - request, - options, - )); - } - - /** - * Add shared component access group - * - * @remarks - * Add an access group to a schema. - */ - async addSchemaAccessGroup( - request: operations.AddSchemaAccessGroupRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(schemasAddSchemaAccessGroup( - this, - request, - options, - )); - } - - /** - * Remove shared component access group - * - * @remarks - * Remove an access group from a schema. - */ - async removeSchemaAccessGroup( - request: operations.RemoveSchemaAccessGroupRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(schemasRemoveSchemaAccessGroup( - this, - request, - options, - )); - } -} diff --git a/src/sdk/sdk.ts b/src/sdk/sdk.ts deleted file mode 100644 index fafce7d..0000000 --- a/src/sdk/sdk.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { ClientSDK } from "../lib/sdks.js"; -import { Authentication } from "./authentication.js"; -import { LoginPortals } from "./loginportals.js"; -import { Namespaces } from "./namespaces.js"; -import { Registry } from "./registry.js"; -import { Rules } from "./rules.js"; -import { ScalarDocs } from "./scalardocs.js"; -import { Schemas } from "./schemas.js"; -import { Teams } from "./teams.js"; -import { Themes } from "./themes.js"; - -export class Scalar extends ClientSDK { - private _registry?: Registry; - get registry(): Registry { - return (this._registry ??= new Registry(this._options)); - } - - private _schemas?: Schemas; - get schemas(): Schemas { - return (this._schemas ??= new Schemas(this._options)); - } - - private _loginPortals?: LoginPortals; - get loginPortals(): LoginPortals { - return (this._loginPortals ??= new LoginPortals(this._options)); - } - - private _rules?: Rules; - get rules(): Rules { - return (this._rules ??= new Rules(this._options)); - } - - private _themes?: Themes; - get themes(): Themes { - return (this._themes ??= new Themes(this._options)); - } - - private _teams?: Teams; - get teams(): Teams { - return (this._teams ??= new Teams(this._options)); - } - - private _scalarDocs?: ScalarDocs; - get scalarDocs(): ScalarDocs { - return (this._scalarDocs ??= new ScalarDocs(this._options)); - } - - private _namespaces?: Namespaces; - get namespaces(): Namespaces { - return (this._namespaces ??= new Namespaces(this._options)); - } - - private _authentication?: Authentication; - get authentication(): Authentication { - return (this._authentication ??= new Authentication(this._options)); - } -} diff --git a/src/sdk/teams.ts b/src/sdk/teams.ts deleted file mode 100644 index de51e8b..0000000 --- a/src/sdk/teams.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { teamsListTeams } from "../funcs/teamsListTeams.js"; -import { ClientSDK, RequestOptions } from "../lib/sdks.js"; -import * as operations from "../models/operations/index.js"; -import { unwrapAsync } from "../types/fp.js"; - -export class Teams extends ClientSDK { - /** - * List teams - * - * @remarks - * List all available teams - */ - async listTeams( - options?: RequestOptions, - ): Promise { - return unwrapAsync(teamsListTeams( - this, - options, - )); - } -} diff --git a/src/sdk/themes.ts b/src/sdk/themes.ts deleted file mode 100644 index a1062da..0000000 --- a/src/sdk/themes.ts +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { themesCreateTheme } from "../funcs/themesCreateTheme.js"; -import { themesDeleteTheme } from "../funcs/themesDeleteTheme.js"; -import { themesGetTheme } from "../funcs/themesGetTheme.js"; -import { themesListThemes } from "../funcs/themesListThemes.js"; -import { themesReplaceThemeDocument } from "../funcs/themesReplaceThemeDocument.js"; -import { themesUpdateTheme } from "../funcs/themesUpdateTheme.js"; -import { ClientSDK, RequestOptions } from "../lib/sdks.js"; -import * as operations from "../models/operations/index.js"; -import { unwrapAsync } from "../types/fp.js"; - -export class Themes extends ClientSDK { - /** - * List all themes - * - * @remarks - * List all team themes. - */ - async listThemes( - options?: RequestOptions, - ): Promise { - return unwrapAsync(themesListThemes( - this, - options, - )); - } - - /** - * Create a theme - * - * @remarks - * Create a team theme. - */ - async createTheme( - request: operations.CreateThemeRequestBody, - options?: RequestOptions, - ): Promise { - return unwrapAsync(themesCreateTheme( - this, - request, - options, - )); - } - - /** - * Update theme metadata - * - * @remarks - * Update theme metadata. - */ - async updateTheme( - request: operations.UpdateThemeRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(themesUpdateTheme( - this, - request, - options, - )); - } - - /** - * Update theme document - * - * @remarks - * Replace the theme document. - */ - async replaceThemeDocument( - request: operations.ReplaceThemeDocumentRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(themesReplaceThemeDocument( - this, - request, - options, - )); - } - - /** - * Delete a theme - * - * @remarks - * Delete a theme by slug. - */ - async deleteTheme( - request: operations.DeleteThemeRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(themesDeleteTheme( - this, - request, - options, - )); - } - - /** - * Get a theme - * - * @remarks - * Get the theme document by slug. - */ - async getTheme( - request: operations.GetThemeRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(themesGetTheme( - this, - request, - options, - )); - } -} diff --git a/src/types/async.ts b/src/types/async.ts deleted file mode 100644 index 689dba5..0000000 --- a/src/types/async.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -export type APICall = - | { - status: "complete"; - request: Request; - response: Response; - } - | { - status: "request-error"; - request: Request; - response?: undefined; - } - | { - status: "invalid"; - request?: undefined; - response?: undefined; - }; - -export class APIPromise implements Promise { - readonly #promise: Promise<[T, APICall]>; - readonly #unwrapped: Promise; - - readonly [Symbol.toStringTag] = "APIPromise"; - - constructor(p: [T, APICall] | Promise<[T, APICall]>) { - this.#promise = p instanceof Promise ? p : Promise.resolve(p); - this.#unwrapped = - p instanceof Promise - ? this.#promise.then(([value]) => value) - : Promise.resolve(p[0]); - } - - then( - onfulfilled?: - | ((value: T) => TResult1 | PromiseLike) - | null - | undefined, - onrejected?: - | ((reason: any) => TResult2 | PromiseLike) - | null - | undefined, - ): Promise { - return this.#promise.then( - onfulfilled ? ([value]) => onfulfilled(value) : void 0, - onrejected, - ); - } - - catch( - onrejected?: - | ((reason: any) => TResult | PromiseLike) - | null - | undefined, - ): Promise { - return this.#unwrapped.catch(onrejected); - } - - finally(onfinally?: (() => void) | null | undefined): Promise { - return this.#unwrapped.finally(onfinally); - } - - $inspect(): Promise<[T, APICall]> { - return this.#promise; - } -} diff --git a/src/types/blobs.ts b/src/types/blobs.ts deleted file mode 100644 index 4ce8460..0000000 --- a/src/types/blobs.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; - -export const blobLikeSchema: z.ZodType = - z.custom(isBlobLike, { - message: "expected a Blob, File or Blob-like object", - fatal: true, - }); - -export function isBlobLike(val: unknown): val is Blob { - if (val instanceof Blob) { - return true; - } - - if (typeof val !== "object" || val == null || !(Symbol.toStringTag in val)) { - return false; - } - - const name = val[Symbol.toStringTag]; - if (typeof name !== "string") { - return false; - } - if (name !== "Blob" && name !== "File") { - return false; - } - - return "stream" in val && typeof val.stream === "function"; -} diff --git a/src/types/constdatetime.ts b/src/types/constdatetime.ts deleted file mode 100644 index eeff4dd..0000000 --- a/src/types/constdatetime.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; - -export function constDateTime( - val: string, -): z.ZodType { - return z.custom((v) => { - return ( - typeof v === "string" && new Date(v).getTime() === new Date(val).getTime() - ); - }, `Value must be equivalent to ${val}`); -} diff --git a/src/types/enums.ts b/src/types/enums.ts deleted file mode 100644 index 6fb6d91..0000000 --- a/src/types/enums.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -declare const __brand: unique symbol; -export type Unrecognized = T & { [__brand]: "unrecognized" }; - -export function catchUnrecognizedEnum(value: T): Unrecognized { - return value as Unrecognized; -} - -type Prettify = { [K in keyof T]: T[K] } & {}; -export type ClosedEnum = T[keyof T]; -export type OpenEnum = - | Prettify - | Unrecognized; diff --git a/src/types/fp.ts b/src/types/fp.ts deleted file mode 100644 index ccbe51e..0000000 --- a/src/types/fp.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -/** - * A monad that captures the result of a function call or an error if it was not - * successful. Railway programming, enabled by this type, can be a nicer - * alternative to traditional exception throwing because it allows functions to - * declare all _known_ errors with static types and then check for them - * exhaustively in application code. Thrown exception have a type of `unknown` - * and break out of regular control flow of programs making them harder to - * inspect and more verbose work with due to try-catch blocks. - */ -export type Result = - | { ok: true; value: T; error?: never } - | { ok: false; value?: never; error: E }; - -export function OK(value: V): Result { - return { ok: true, value }; -} - -export function ERR(error: E): Result { - return { ok: false, error }; -} - -/** - * unwrap is a convenience function for extracting a value from a result or - * throwing if there was an error. - */ -export function unwrap(r: Result): T { - if (!r.ok) { - throw r.error; - } - return r.value; -} - -/** - * unwrapAsync is a convenience function for resolving a value from a Promise - * of a result or rejecting if an error occurred. - */ -export async function unwrapAsync( - pr: Promise>, -): Promise { - const r = await pr; - if (!r.ok) { - throw r.error; - } - - return r.value; -} diff --git a/src/types/index.ts b/src/types/index.ts deleted file mode 100644 index e124e81..0000000 --- a/src/types/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -export { blobLikeSchema, isBlobLike } from "./blobs.js"; -export { catchUnrecognizedEnum } from "./enums.js"; -export type { ClosedEnum, OpenEnum, Unrecognized } from "./enums.js"; -export type { Result } from "./fp.js"; -export type { PageIterator, Paginator } from "./operations.js"; -export { createPageIterator } from "./operations.js"; -export { RFCDate } from "./rfcdate.js"; diff --git a/src/types/operations.ts b/src/types/operations.ts deleted file mode 100644 index beb81e1..0000000 --- a/src/types/operations.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { Result } from "./fp.js"; - -export type Paginator = () => Promise }> | null; - -export type PageIterator = V & { - next: Paginator; - [Symbol.asyncIterator]: () => AsyncIterableIterator; - "~next"?: PageState | undefined; -}; - -export function createPageIterator( - page: V & { next: Paginator }, - halt: (v: V) => boolean, -): { - [Symbol.asyncIterator]: () => AsyncIterableIterator; -} { - return { - [Symbol.asyncIterator]: async function* paginator() { - yield page; - if (halt(page)) { - return; - } - - let p: typeof page | null = page; - for (p = await p.next(); p != null; p = await p.next()) { - yield p; - if (halt(p)) { - return; - } - } - }, - }; -} - -/** - * This utility create a special iterator that yields a single value and - * terminates. It is useful in paginated SDK functions that have early return - * paths when things go wrong. - */ -export function haltIterator( - v: V, -): PageIterator { - return { - ...v, - next: () => null, - [Symbol.asyncIterator]: async function* paginator() { - yield v; - }, - }; -} - -/** - * Converts an async iterator of `Result` into an async iterator of `V`. - * When error results occur, the underlying error value is thrown. - */ -export async function unwrapResultIterator( - iteratorPromise: Promise, PageState>>, -): Promise> { - const resultIter = await iteratorPromise; - - if (!resultIter.ok) { - throw resultIter.error; - } - - return { - ...resultIter.value, - next: unwrapPaginator(resultIter.next), - "~next": resultIter["~next"], - [Symbol.asyncIterator]: async function* paginator() { - for await (const page of resultIter) { - if (!page.ok) { - throw page.error; - } - yield page.value; - } - }, - }; -} - -function unwrapPaginator( - paginator: Paginator>, -): Paginator { - return () => { - const nextResult = paginator(); - if (nextResult == null) { - return null; - } - return nextResult.then((res) => { - if (!res.ok) { - throw res.error; - } - const out = { - ...res.value, - next: unwrapPaginator(res.next), - }; - return out; - }); - }; -} - -export const URL_OVERRIDE = Symbol("URL_OVERRIDE"); diff --git a/src/types/rfcdate.ts b/src/types/rfcdate.ts deleted file mode 100644 index c79b3f5..0000000 --- a/src/types/rfcdate.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -const dateRE = /^\d{4}-\d{2}-\d{2}$/; - -export class RFCDate { - private serialized: string; - - /** - * Creates a new RFCDate instance using today's date. - */ - static today(): RFCDate { - return new RFCDate(new Date()); - } - - /** - * Creates a new RFCDate instance using the provided input. - * If a string is used then in must be in the format YYYY-MM-DD. - * - * @param date A Date object or a date string in YYYY-MM-DD format - * @example - * new RFCDate("2022-01-01") - * @example - * new RFCDate(new Date()) - */ - constructor(date: Date | string) { - if (typeof date === "string" && !dateRE.test(date)) { - throw new RangeError( - "RFCDate: date strings must be in the format YYYY-MM-DD: " + date, - ); - } - - const value = new Date(date); - if (isNaN(+value)) { - throw new RangeError("RFCDate: invalid date provided: " + date); - } - - this.serialized = value.toISOString().slice(0, "YYYY-MM-DD".length); - if (!dateRE.test(this.serialized)) { - throw new TypeError( - `RFCDate: failed to build valid date with given value: ${date} serialized to ${this.serialized}`, - ); - } - } - - toJSON(): string { - return this.toString(); - } - - toString(): string { - return this.serialized; - } -} diff --git a/src/types/streams.ts b/src/types/streams.ts deleted file mode 100644 index a0163e7..0000000 --- a/src/types/streams.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -export function isReadableStream( - val: unknown, -): val is ReadableStream { - if (typeof val !== "object" || val === null) { - return false; - } - - // Check for the presence of methods specific to ReadableStream - const stream = val as ReadableStream; - - // ReadableStream has methods like getReader, cancel, and tee - return ( - typeof stream.getReader === "function" && - typeof stream.cancel === "function" && - typeof stream.tee === "function" - ); -} diff --git a/src/uploads.ts b/src/uploads.ts new file mode 100644 index 0000000..86a228e --- /dev/null +++ b/src/uploads.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +export { type Uploadable, toFile, type ToFileInput } from './core/uploads'; diff --git a/src/version.ts b/src/version.ts new file mode 100644 index 0000000..1bee298 --- /dev/null +++ b/src/version.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +export const VERSION = "0.0.1"; diff --git a/tests/smoke-test.ts b/tests/smoke-test.ts new file mode 100644 index 0000000..0d62ffb --- /dev/null +++ b/tests/smoke-test.ts @@ -0,0 +1,616 @@ +// File generated from our OpenAPI spec by Scalar. See README.md for details. + +// Smoke test: calls every generated operation once to confirm the SDK can reach each endpoint. +// Run it from this repo with `bun tests/smoke-test.ts`. Each case below calls one SDK method +// exactly the way the SDK exposes it (positional params, request body, pagination, streaming). +// +// Two environment variables tune a run: +// - SCALAR_SMOKE_FILTER: comma-separated needles; only operations whose name or path contains +// one of them run, so you can smoke-test a subset without editing this file. +// - SCALAR_SMOKE_REPORT: a file path; when set, the run writes a JSON report there instead of +// printing a table. The generator uses this to collect per-operation results. +import { writeFileSync } from 'node:fs' + +// The default export is the client class. The client reads auth and the base URL from the +// environment, so it needs no constructor options to point at a server. +import ScalarAPI from "@scalar/sdk" + +// One shared client runs every case. +const client = new ScalarAPI() + +// The result of running one case, collected for the JSON report or the printed table. +type SmokeResult = { + operation: string + method: string + path: string + status: 'passed' | 'failed' + durationMs: number + error?: string +} + +// One entry per generated operation. `run` performs the real SDK call; the other fields are +// metadata used for filtering and reporting. This list is generated, so it stays in sync with +// the SDK surface. +const cases: { operation: string; method: string; path: string; run: () => Promise }[] = [ + { + operation: "listAllApiDocuments", + method: "GET", + path: "/v1/apis", + run: async () => { + const listAllAPIDocuments = await client.registry.listAllAPIDocuments(); + }, + }, + + { + operation: "listApiDocuments", + method: "GET", + path: "/v1/apis/{namespace}", + run: async () => { + const listAPIDocuments = await client.registry.listAPIDocuments("namespace"); + }, + }, + + { + operation: "createApiDocument", + method: "POST", + path: "/v1/apis/{namespace}", + run: async () => { + const createAPIDocument = await client.registry.createAPIDocument("namespace", { + title: "", + version: "", + slug: "", + document: "", + }); + }, + }, + + { + operation: "updateApiDocument", + method: "PATCH", + path: "/v1/apis/{namespace}/{slug}", + run: async () => { + await client.registry.updateAPIDocument("slug", { + namespace: "namespace", + }); + }, + }, + + { + operation: "deleteApiDocument", + method: "DELETE", + path: "/v1/apis/{namespace}/{slug}", + run: async () => { + await client.registry.deleteAPIDocument("slug", { + namespace: "namespace", + }); + }, + }, + + { + operation: "retrieveApiDocumentVersion", + method: "GET", + path: "/v1/apis/{namespace}/{slug}/version/{semver}", + run: async () => { + const string_ = await client.registry.retrieveAPIDocumentVersion("semver", { + namespace: "namespace", + slug: "slug", + }); + }, + }, + + { + operation: "updateApiDocumentVersion", + method: "PATCH", + path: "/v1/apis/{namespace}/{slug}/version/{semver}", + run: async () => { + const updateAPIDocumentVersion = await client.registry.updateAPIDocumentVersion("semver", { + namespace: "namespace", + slug: "slug", + document: "", + }); + }, + }, + + { + operation: "deleteApiDocumentVersion", + method: "DELETE", + path: "/v1/apis/{namespace}/{slug}/version/{semver}", + run: async () => { + await client.registry.deleteAPIDocumentVersion("semver", { + namespace: "namespace", + slug: "slug", + }); + }, + }, + + { + operation: "listApiDocumentVersionMetadata", + method: "GET", + path: "/v1/apis/{namespace}/{slug}/version/{semver}/metadata", + run: async () => { + const managedDocVersion = await client.registry.listAPIDocumentVersionMetadata("semver", { + namespace: "namespace", + slug: "slug", + }); + }, + }, + + { + operation: "createApiDocumentVersion", + method: "POST", + path: "/v1/apis/{namespace}/{slug}/version", + run: async () => { + const managedDocVersion = await client.registry.createAPIDocumentVersion("slug", { + namespace: "namespace", + version: "", + document: "", + }); + }, + }, + + { + operation: "createApiDocumentAccessGroup", + method: "POST", + path: "/v1/apis/{namespace}/{slug}/access-group", + run: async () => { + await client.registry.createAPIDocumentAccessGroup("slug", { + namespace: "namespace", + accessGroupSlug: "", + }); + }, + }, + + { + operation: "deleteApiDocumentAccessGroup", + method: "DELETE", + path: "/v1/apis/{namespace}/{slug}/access-group", + run: async () => { + await client.registry.deleteAPIDocumentAccessGroup("slug", { + namespace: "namespace", + accessGroupSlug: "", + }); + }, + }, + + { + operation: "list", + method: "GET", + path: "/v1/schemas/{namespace}", + run: async () => { + const list = await client.schemas.list("namespace"); + }, + }, + + { + operation: "create", + method: "POST", + path: "/v1/schemas/{namespace}", + run: async () => { + const uID = await client.schemas.create("namespace", { + title: "", + version: "", + slug: "", + document: "", + }); + }, + }, + + { + operation: "update", + method: "PATCH", + path: "/v1/schemas/{namespace}/{slug}", + run: async () => { + await client.schemas.update("slug", { + namespace: "namespace", + }); + }, + }, + + { + operation: "delete", + method: "DELETE", + path: "/v1/schemas/{namespace}/{slug}", + run: async () => { + await client.schemas.delete("slug", { + namespace: "namespace", + }); + }, + }, + + { + operation: "retrieveSchema", + method: "GET", + path: "/v1/schemas/{namespace}/{slug}/version/{semver}", + run: async () => { + const string_ = await client.schemas.version.retrieveSchema("semver", { + namespace: "namespace", + slug: "slug", + }); + }, + }, + + { + operation: "deleteSchema", + method: "DELETE", + path: "/v1/schemas/{namespace}/{slug}/version/{semver}", + run: async () => { + await client.schemas.version.deleteSchema("semver", { + namespace: "namespace", + slug: "slug", + }); + }, + }, + + { + operation: "createSchema", + method: "POST", + path: "/v1/schemas/{namespace}/{slug}/version", + run: async () => { + const uID = await client.schemas.version.createSchema("slug", { + namespace: "namespace", + version: "", + document: "", + }); + }, + }, + + { + operation: "createSchema", + method: "POST", + path: "/v1/schemas/{namespace}/{slug}/access-group", + run: async () => { + await client.schemas.accessGroup.createSchema("slug", { + namespace: "namespace", + accessGroupSlug: "", + }); + }, + }, + + { + operation: "deleteSchema", + method: "DELETE", + path: "/v1/schemas/{namespace}/{slug}/access-group", + run: async () => { + await client.schemas.accessGroup.deleteSchema("slug", { + namespace: "namespace", + accessGroupSlug: "", + }); + }, + }, + + { + operation: "retrieve", + method: "GET", + path: "/v1/login-portals/{slug}", + run: async () => { + const retrieve = await client.loginPortals.retrieve("slug"); + }, + }, + + { + operation: "update", + method: "PATCH", + path: "/v1/login-portals/{slug}", + run: async () => { + await client.loginPortals.update("slug", {}); + }, + }, + + { + operation: "delete", + method: "DELETE", + path: "/v1/login-portals/{slug}", + run: async () => { + await client.loginPortals.delete("slug"); + }, + }, + + { + operation: "create", + method: "POST", + path: "/v1/login-portals", + run: async () => { + const uID = await client.loginPortals.create({ + title: "", + slug: "", + email: { + logo: "", + logoSize: "100", + buttonText: "Login", + message: "Click to access private documentation hosted by scalar.com", + title: "Private Docs", + mainColor: "#2a2f45", + mainBackground: "#f6f6f6", + cardColor: "2a2f45", + cardBackground: "#fff", + buttonColor: "#fff", + buttonBackground: "#0f0f0f", + }, + page: { + title: "Scalar Private Docs", + description: "Login to access your documentation", + head: "", + script: "", + theme: "", + companyName: "", + logo: "", + logoUrl: "", + favicon: "", + termsLink: "", + privacyLink: "", + formTitle: "Scalar Private Docs", + formDescription: "Login to access your documentation", + formImage: "", + }, + }); + }, + }, + + { + operation: "list", + method: "GET", + path: "/v1/login-portals", + run: async () => { + const list = await client.loginPortals.list(); + }, + }, + + { + operation: "listRulesets", + method: "GET", + path: "/v1/rulesets/{namespace}", + run: async () => { + const listRulesets = await client.rules.listRulesets("namespace"); + }, + }, + + { + operation: "createRuleset", + method: "POST", + path: "/v1/rulesets/{namespace}", + run: async () => { + const uID = await client.rules.createRuleset("namespace", { + title: "", + slug: "", + document: "", + }); + }, + }, + + { + operation: "updateRuleset", + method: "PATCH", + path: "/v1/rulesets/{namespace}/{slug}", + run: async () => { + await client.rules.updateRuleset("slug", { + namespace: "namespace", + }); + }, + }, + + { + operation: "deleteRuleset", + method: "DELETE", + path: "/v1/rulesets/{namespace}/{slug}", + run: async () => { + await client.rules.deleteRuleset("slug", { + namespace: "namespace", + }); + }, + }, + + { + operation: "retrieveRulesetDocument", + method: "GET", + path: "/v1/rulesets/{namespace}/{slug}", + run: async () => { + const string_ = await client.rules.retrieveRulesetDocument("slug", { + namespace: "namespace", + }); + }, + }, + + { + operation: "createRulesetAccessGroup", + method: "POST", + path: "/v1/rulesets/{namespace}/{slug}/access-group", + run: async () => { + await client.rules.createRulesetAccessGroup("slug", { + namespace: "namespace", + accessGroupSlug: "", + }); + }, + }, + + { + operation: "deleteRulesetAccessGroup", + method: "DELETE", + path: "/v1/rulesets/{namespace}/{slug}/access-group", + run: async () => { + await client.rules.deleteRulesetAccessGroup("slug", { + namespace: "namespace", + accessGroupSlug: "", + }); + }, + }, + + { + operation: "list", + method: "GET", + path: "/v1/themes", + run: async () => { + const list = await client.themes.list(); + }, + }, + + { + operation: "create", + method: "POST", + path: "/v1/themes", + run: async () => { + const uID = await client.themes.create({ + name: "", + slug: "", + document: "", + }); + }, + }, + + { + operation: "update", + method: "PATCH", + path: "/v1/themes/{slug}", + run: async () => { + await client.themes.update("slug", {}); + }, + }, + + { + operation: "replaceDocument", + method: "PUT", + path: "/v1/themes/{slug}", + run: async () => { + await client.themes.replaceDocument("slug", { + document: "", + }); + }, + }, + + { + operation: "delete", + method: "DELETE", + path: "/v1/themes/{slug}", + run: async () => { + await client.themes.delete("slug"); + }, + }, + + { + operation: "retrieve", + method: "GET", + path: "/v1/themes/{slug}", + run: async () => { + const string_ = await client.themes.retrieve("slug"); + }, + }, + + { + operation: "list", + method: "GET", + path: "/v1/teams", + run: async () => { + const list = await client.teams.list(); + }, + }, + + { + operation: "listGuides", + method: "GET", + path: "/v1/guides", + run: async () => { + const listGuides = await client.scalarDocs.listGuides(); + }, + }, + + { + operation: "createGuide", + method: "POST", + path: "/v1/guides", + run: async () => { + const createGuide = await client.scalarDocs.createGuide({ + name: "", + isPrivate: false, + allowedUsers: [], + allowedDomains: [], + }); + }, + }, + + { + operation: "publishGuide", + method: "POST", + path: "/v1/guides/{slug}/publish", + run: async () => { + const publishGuide = await client.scalarDocs.publishGuide("slug"); + }, + }, + + { + operation: "list", + method: "GET", + path: "/v1/namespaces", + run: async () => { + const list = await client.namespaces.list(); + }, + }, + + { + operation: "exchangePersonalToken", + method: "POST", + path: "/v1/auth/exchange", + run: async () => { + const exchangePersonalToken = await client.authentication.exchangePersonalToken({ + personalToken: "", + }); + }, + }, + + { + operation: "listCurrentUser", + method: "GET", + path: "/v1/auth/me", + run: async () => { + const user = await client.authentication.listCurrentUser(); + }, + }, + +] + +const main = async (): Promise => { + // SCALAR_SMOKE_FILTER (comma-separated) keeps only cases whose operation name or path matches + // one of the needles, so a caller can smoke-test a subset. With no filter, every case runs. + const filter = process.env['SCALAR_SMOKE_FILTER'] + const needles = filter ? filter.split(',').map((needle) => needle.trim()).filter(Boolean) : [] + const selected = needles.length > 0 ? cases.filter((testCase) => needles.some((needle) => testCase.operation.includes(needle) || testCase.path.includes(needle))) : cases + + // Run every selected case concurrently. Promise.allSettled means one failing operation never + // blocks the others, so a single run reports the status of every endpoint. + const settled = await Promise.allSettled( + selected.map(async (testCase): Promise => { + const startedAt = Date.now() + try { + await testCase.run() + return { operation: testCase.operation, method: testCase.method, path: testCase.path, status: 'passed', durationMs: Date.now() - startedAt } + } catch (error) { + // Prefer the stack so a failure points at the failing SDK call; fall back to the message. + const message = error instanceof Error ? (error.stack ?? error.message) : String(error) + return { operation: testCase.operation, method: testCase.method, path: testCase.path, status: 'failed', durationMs: Date.now() - startedAt, error: message } + } + }), + ) + + // allSettled never rejects, but defensively map any rejected slot to a failed result. + const results: SmokeResult[] = settled.map((result) => (result.status === 'fulfilled' ? result.value : { operation: 'unknown', method: '', path: '', status: 'failed', durationMs: 0, error: String(result.reason) })) + const failed = results.filter((result) => result.status === 'failed') + + // With SCALAR_SMOKE_REPORT set, write a machine-readable report; otherwise print a table. + const reportPath = process.env['SCALAR_SMOKE_REPORT'] + if (reportPath) { + writeFileSync(reportPath, JSON.stringify({ total: results.length, failed: failed.length, results })) + } else { + for (const result of results) { + if (result.status === 'passed') console.log(`\u2714 ${result.operation} (${result.method} ${result.path}) ${result.durationMs}ms`) + else console.error(`\u2718 ${result.operation} (${result.method} ${result.path})\n${result.error ?? ''}`) + } + if (results.length === 0) { + console.error('No code samples ran (empty SDK or a SCALAR_SMOKE_FILTER that matched nothing).') + } else { + console.log(`\n${results.length - failed.length}/${results.length} samples passed`) + } + } + + // An empty run (no operations, or a filter that matched nothing) is a failure, not a vacuous pass. + if (failed.length > 0 || results.length === 0) process.exitCode = 1 +} + +void main() diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json new file mode 100644 index 0000000..ace7601 --- /dev/null +++ b/tsconfig.cjs.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "target": "ES2023", + "module": "CommonJS", + "lib": [ + "ES2023", + "DOM" + ], + "rootDir": "src", + "outDir": "./dist/cjs", + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "strict": true, + "noUncheckedIndexedAccess": true, + "exactOptionalPropertyTypes": true, + "forceConsistentCasingInFileNames": true, + "skipLibCheck": true + }, + "include": [ + "src/**/*.ts" + ] +} diff --git a/tsconfig.json b/tsconfig.json index 94d81a3..a30b112 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,41 +1,24 @@ { "compilerOptions": { - "incremental": true, - "tsBuildInfoFile": ".tsbuildinfo", - "target": "ES2020", - "lib": ["ES2022", "DOM", "DOM.Iterable"], - "jsx": "react-jsx", - - "module": "Node16", - "moduleResolution": "Node16", - - "allowJs": true, - + "target": "ES2023", + "module": "ES2022", + "moduleResolution": "Bundler", + "lib": [ + "ES2023", + "DOM" + ], + "rootDir": "src", + "outDir": "./dist/esm", "declaration": true, "declarationMap": true, "sourceMap": true, - "outDir": ".", - - - // https://github.com/tsconfig/bases/blob/a1bf7c0fa2e094b068ca3e1448ca2ece4157977e/bases/strictest.json "strict": true, - "allowUnusedLabels": false, - "allowUnreachableCode": false, - "exactOptionalPropertyTypes": true, - "useUnknownInCatchVariables": true, - "noFallthroughCasesInSwitch": true, - "noImplicitOverride": true, - "noImplicitReturns": true, - "noPropertyAccessFromIndexSignature": true, "noUncheckedIndexedAccess": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "isolatedModules": true, - "checkJs": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true + "exactOptionalPropertyTypes": true, + "forceConsistentCasingInFileNames": true, + "skipLibCheck": true }, - "include": ["src"], - "exclude": ["node_modules"] + "include": [ + "src/**/*.ts" + ] }