From 0f788afc500f8b980c3c70b191793828b7b5ad96 Mon Sep 17 00:00:00 2001 From: scalarbot Date: Fri, 19 Jun 2026 18:03:47 +0000 Subject: [PATCH] feat: scalar-typescript-sdk-rust@0.2.0 --- Cargo.toml | 30 + README.md | 69 +- api.md | 259 + openapi.augmented.json | 7841 ++++++++++++++++++++ reference.md | 428 ++ rustfmt.toml | 2 + scalar-sdk.manifest.json | 9519 +++++++++++++++++++++++++ src/client.rs | 257 + src/error.rs | 475 ++ src/lib.rs | 28 + src/models.rs | 472 ++ src/prelude.rs | 18 + src/request.rs | 561 ++ src/resources/authentication.rs | 92 + src/resources/login_portals.rs | 196 + src/resources/mod.rs | 11 + src/resources/namespaces.rs | 53 + src/resources/registry.rs | 481 ++ src/resources/rules.rs | 301 + src/resources/scalar_docs.rs | 133 + src/resources/schemas.rs | 193 + src/resources/schemas_access_group.rs | 104 + src/resources/schemas_version.rs | 122 + src/resources/teams.rs | 53 + src/resources/themes.rs | 242 + src/webhooks.rs | 133 + 26 files changed, 22072 insertions(+), 1 deletion(-) create mode 100644 Cargo.toml create mode 100644 api.md create mode 100644 openapi.augmented.json create mode 100644 reference.md create mode 100644 rustfmt.toml create mode 100644 scalar-sdk.manifest.json create mode 100644 src/client.rs create mode 100644 src/error.rs create mode 100644 src/lib.rs create mode 100644 src/models.rs create mode 100644 src/prelude.rs create mode 100644 src/request.rs create mode 100644 src/resources/authentication.rs create mode 100644 src/resources/login_portals.rs create mode 100644 src/resources/mod.rs create mode 100644 src/resources/namespaces.rs create mode 100644 src/resources/registry.rs create mode 100644 src/resources/rules.rs create mode 100644 src/resources/scalar_docs.rs create mode 100644 src/resources/schemas.rs create mode 100644 src/resources/schemas_access_group.rs create mode 100644 src/resources/schemas_version.rs create mode 100644 src/resources/teams.rs create mode 100644 src/resources/themes.rs create mode 100644 src/webhooks.rs diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..c406614 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "scalar-scalar-typescript-sdk" +version = "0.2.1" +edition = "2021" +rust-version = "1.75" +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)" + +[features] +default = [] +blocking = [] + +[dependencies] +base64 = "0.22" +bytes = "1.5" +chrono = { version = "0.4", default-features = false, features = ["clock", "serde"] } +futures-core = "0.3" +futures-util = "0.3" +hex = "0.4" +hmac = "0.12" +indexmap = "=2.2.6" +percent-encoding = "2" +reqwest = { version = "=0.11.23", default-features = false, features = ["json", "multipart", "stream", "rustls-tls"] } +ring = "0.17" +serde = { version = "1", features = ["derive"] } +serde_json = "1" +serde_urlencoded = "0.7" +sha2 = "0.10" +tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] } +url = "=2.5.8" +uuid = { version = "=1.6.1", features = ["serde", "v4"] } diff --git a/README.md b/README.md index 2cc763f..be4403b 100644 --- a/README.md +++ b/README.md @@ -1 +1,68 @@ -# scalar-rust \ No newline at end of file +# ScalarApi Rust API Library + +This crate provides convenient access to the ScalarApi REST API from Rust applications. +It is generated from your OpenAPI document with typed models, async resource methods, pagination helpers, and raw response affordances. + +The full generated API reference is available in `api.md` and the operation inventory is available in `reference.md`. + +## Installation + +```toml +[dependencies] +scalar-scalar-typescript-sdk = "0.2.1" +``` + +## Usage + +```rust +use scalar_scalar_typescript_sdk::prelude::*; + +#[tokio::main] +async fn main() -> Result<(), Error> { + let _client = ScalarApiClient::new(); + Ok(()) +} +``` + +## Request and Response Types + +Request params and response bodies are generated as typed Rust structs and enums with `serde` support. +Methods return `Result` and use owned data so generated models are straightforward to pass around. + +## Handling Errors + +Non-success responses return generated errors that expose status code, headers, raw response body, and request id metadata when available. +Transport failures are represented separately from HTTP status failures. + +## Retries and Timeouts + +The runtime supports client-level and per-request timeout, retry, header, query, base URL, and idempotency options. +Retryable responses honor `Retry-After` before exponential backoff. + +## Pagination + +Paginated operations expose page helpers with data and next-page metadata when pagination is described by the OpenAPI document. + +## Raw Responses and Custom Requests + +Raw response helpers are available when callers need status, headers, or unparsed response bytes. +Per-request options provide an escape hatch for extra headers and query params. + +## Runtime Features + +- Async `reqwest` transport with typed request/response models. +- Per-request headers, query params, timeouts, retries, idempotency keys, and auth overrides. +- Raw response helpers with status, headers, and body bytes. +- Cursor/page metadata helpers, byte-stream descriptors, SSE descriptors, and WebSocket request descriptors. + +## Requirements + +Requires Rust 1.75+ with edition 2021. + + +## Contributions + +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-rust&utm_campaign=sdk) diff --git a/api.md b/api.md new file mode 100644 index 0000000..e8d827d --- /dev/null +++ b/api.md @@ -0,0 +1,259 @@ +# ScalarApi Rust API + +## Types + +- _400 +- _401 +- _403 +- _404 +- _422 +- _500 +- AccessGroup +- ActiveDeployment +- ApiDocument +- Email +- GithubProject +- GithubProjectRepository +- LoginPortal +- LoginPortalEmail +- LoginPortalPage +- ManagedDocVersion +- ManagedSchemaVersion +- Method +- Namespace +- Nanoid +- Rule +- Schema +- Slug +- Team +- TeamImage +- TeamName +- TeamSummary +- Theme +- Timestamp +- Uid +- User +- Version + +## Registry + +Types: + +- _400 +- _401 +- _403 +- _404 +- _422 +- _500 +- AccessGroup +- ApiDocument +- ManagedDocVersion +- Version + +Methods: + +- client.registry.listAllApiDocuments(...) +- client.registry.listApiDocuments(...) +- client.registry.createApiDocument(...) +- client.registry.updateApiDocument(...) +- client.registry.deleteApiDocument(...) +- client.registry.retrieveApiDocumentVersion(...) +- client.registry.updateApiDocumentVersion(...) +- client.registry.deleteApiDocumentVersion(...) +- client.registry.listApiDocumentVersionMetadata(...) -> ManagedDocVersion +- client.registry.createApiDocumentVersion(...) -> ManagedDocVersion +- client.registry.createApiDocumentAccessGroup(...) +- client.registry.deleteApiDocumentAccessGroup(...) + +## Schemas + +Types: + +- _400 +- _401 +- _403 +- _404 +- _422 +- _500 +- Schema +- Uid +- Version + +Methods: + +- client.schemas.list(...) +- client.schemas.create(...) -> Uid +- client.schemas.update(...) +- client.schemas.delete(...) + +### Version + +Types: + +- _400 +- _401 +- _403 +- _404 +- _422 +- _500 +- Uid +- Version + +Methods: + +- client.schemas.version.retrieveSchema(...) +- client.schemas.version.deleteSchema(...) +- client.schemas.version.createSchema(...) -> Uid + +### AccessGroup + +Types: + +- _400 +- _401 +- _403 +- _404 +- _422 +- _500 +- AccessGroup + +Methods: + +- client.schemas.accessGroup.createSchema(...) +- client.schemas.accessGroup.deleteSchema(...) + +## LoginPortals + +Types: + +- _400 +- _401 +- _403 +- _404 +- _422 +- _500 +- LoginPortal +- LoginPortalEmail +- LoginPortalPage +- Uid + +Methods: + +- client.loginPortals.retrieve(...) +- client.loginPortals.update(...) +- client.loginPortals.delete(...) +- client.loginPortals.create(...) -> Uid +- client.loginPortals.list(...) + +## Rules + +Types: + +- _400 +- _401 +- _403 +- _404 +- _422 +- _500 +- AccessGroup +- Rule +- Uid + +Methods: + +- client.rules.listRulesets(...) +- client.rules.createRuleset(...) -> Uid +- client.rules.updateRuleset(...) +- client.rules.deleteRuleset(...) +- client.rules.retrieveRulesetDocument(...) +- client.rules.createRulesetAccessGroup(...) +- client.rules.deleteRulesetAccessGroup(...) + +## Themes + +Types: + +- _400 +- _401 +- _403 +- _404 +- _422 +- _500 +- Theme +- Uid + +Methods: + +- client.themes.list(...) +- client.themes.create(...) -> Uid +- client.themes.update(...) +- client.themes.replaceDocument(...) +- client.themes.delete(...) +- client.themes.retrieve(...) + +## Teams + +Types: + +- _400 +- _401 +- _403 +- _404 +- _422 +- _500 +- Team + +Methods: + +- client.teams.list(...) + +## ScalarDocs + +Types: + +- _400 +- _401 +- _403 +- _404 +- _422 +- _500 +- GithubProject +- Slug + +Methods: + +- client.scalarDocs.listGuides(...) +- client.scalarDocs.createGuide(...) +- client.scalarDocs.publishGuide(...) + +## Namespaces + +Types: + +- _400 +- _401 +- _403 +- _404 +- _422 +- _500 + +Methods: + +- client.namespaces.list(...) + +## Authentication + +Types: + +- _400 +- _401 +- _403 +- _404 +- _422 +- _500 +- User + +Methods: + +- client.authentication.exchangePersonalToken(...) +- client.authentication.listCurrentUser(...) -> User diff --git a/openapi.augmented.json b/openapi.augmented.json new file mode 100644 index 0000000..2a73adf --- /dev/null +++ b/openapi.augmented.json @@ -0,0 +1,7841 @@ +{ + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi registry list-all-api-documents --bearer-auth \"$BEARER_AUTH\"" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi registry list-api-documents 'namespace' --bearer-auth \"$BEARER_AUTH\"" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi registry create-api-document 'namespace' --bearer-auth \"$BEARER_AUTH\" --title 'title' --version-command 'version' --slug 'slug' --document 'document'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi registry update-api-document 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace'" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi registry delete-api-document 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi registry retrieve-api-document-version 'semver' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --slug 'slug'" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi registry update-api-document-version 'semver' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --slug 'slug' --document 'document'" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi registry delete-api-document-version 'semver' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --slug 'slug'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi registry list-api-document-version-metadata 'semver' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --slug 'slug'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi registry create-api-document-version 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --version-command 'version' --document 'document'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi registry create-api-document-access-group 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --access-group-slug 'accessGroupSlug'" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi registry delete-api-document-access-group 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --access-group-slug 'accessGroupSlug'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi schemas list 'namespace' --bearer-auth \"$BEARER_AUTH\"" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi schemas create 'namespace' --bearer-auth \"$BEARER_AUTH\" --title 'title' --version-command 'version' --slug 'slug' --document 'document'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi schemas update 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace'" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi schemas delete 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi schemas:version-command retrieve-schema 'semver' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --slug 'slug'" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi schemas:version-command delete-schema 'semver' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --slug 'slug'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi schemas:version-command create-schema 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --version-command 'version' --document 'document'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi schemas:access-group create-schema 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --access-group-slug 'accessGroupSlug'" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi schemas:access-group delete-schema 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --access-group-slug 'accessGroupSlug'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi login-portals retrieve 'slug' --bearer-auth \"$BEARER_AUTH\"" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi login-portals update 'slug' --bearer-auth \"$BEARER_AUTH\"" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi login-portals delete 'slug' --bearer-auth \"$BEARER_AUTH\"" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "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\":\"\"}'" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi login-portals list --bearer-auth \"$BEARER_AUTH\"" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi rules list-rulesets 'namespace' --bearer-auth \"$BEARER_AUTH\"" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi rules create-ruleset 'namespace' --bearer-auth \"$BEARER_AUTH\" --title 'title' --slug 'slug' --document 'document'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi rules update-ruleset 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace'" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi rules delete-ruleset 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace'" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi rules retrieve-ruleset-document 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi rules create-ruleset-access-group 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --access-group-slug 'accessGroupSlug'" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi rules delete-ruleset-access-group 'slug' --bearer-auth \"$BEARER_AUTH\" --namespace 'namespace' --access-group-slug 'accessGroupSlug'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi themes list --bearer-auth \"$BEARER_AUTH\"" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi themes create --bearer-auth \"$BEARER_AUTH\" --name 'name' --slug 'slug' --document 'document'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi themes update 'slug' --bearer-auth \"$BEARER_AUTH\"" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi themes replace-document 'slug' --bearer-auth \"$BEARER_AUTH\" --document 'document'" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi themes delete 'slug' --bearer-auth \"$BEARER_AUTH\"" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi themes retrieve 'slug' --bearer-auth \"$BEARER_AUTH\"" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi teams list --bearer-auth \"$BEARER_AUTH\"" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi scalar-docs list-guides --bearer-auth \"$BEARER_AUTH\"" + } + ] + }, + "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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi scalar-docs create-guide --bearer-auth \"$BEARER_AUTH\" --name 'name' --is-private" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi scalar-docs publish-guide 'slug' --bearer-auth \"$BEARER_AUTH\"" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi namespaces list --bearer-auth \"$BEARER_AUTH\"" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi authentication exchange-personal-token --bearer-auth \"$BEARER_AUTH\" --personal-token 'personalToken'" + } + ] + } + }, + "/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);" + }, + { + "lang": "Shell", + "label": "CLI", + "source": "scalarapi authentication list-current-user --bearer-auth \"$BEARER_AUTH\"" + } + ] + } + } + } +} diff --git a/reference.md b/reference.md new file mode 100644 index 0000000..22f858d --- /dev/null +++ b/reference.md @@ -0,0 +1,428 @@ +# ScalarApi Rust SDK Reference + +## Operations + +### registry.listAllApiDocuments + +List all API Documents + +- HTTP: `GET /v1/apis` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### registry.listApiDocuments + +List API Documents in a namespace + +- HTTP: `GET /v1/apis/{namespace}` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### registry.createApiDocument + +Create API Document + +- HTTP: `POST /v1/apis/{namespace}` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### registry.updateApiDocument + +Update API Document metadata + +- HTTP: `PATCH /v1/apis/{namespace}/{slug}` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### registry.deleteApiDocument + +Delete API Document + +- HTTP: `DELETE /v1/apis/{namespace}/{slug}` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### registry.retrieveApiDocumentVersion + +Get API Document + +- HTTP: `GET /v1/apis/{namespace}/{slug}/version/{semver}` +- Response body: `text/plain` +- Errors: `400, 401, 403, 404, 422, 500` + +### registry.updateApiDocumentVersion + +Update API Document version + +- HTTP: `PATCH /v1/apis/{namespace}/{slug}/version/{semver}` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### registry.deleteApiDocumentVersion + +Delete API Document version + +- HTTP: `DELETE /v1/apis/{namespace}/{slug}/version/{semver}` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### registry.listApiDocumentVersionMetadata + +Get API Document version metadata + +- HTTP: `GET /v1/apis/{namespace}/{slug}/version/{semver}/metadata` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### registry.createApiDocumentVersion + +Create API Document version + +- HTTP: `POST /v1/apis/{namespace}/{slug}/version` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### registry.createApiDocumentAccessGroup + +Add access group + +- HTTP: `POST /v1/apis/{namespace}/{slug}/access-group` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### registry.deleteApiDocumentAccessGroup + +Remove access group + +- HTTP: `DELETE /v1/apis/{namespace}/{slug}/access-group` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### schemas.list + +List all shared components + +- HTTP: `GET /v1/schemas/{namespace}` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### schemas.create + +Create a shared component + +- HTTP: `POST /v1/schemas/{namespace}` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### schemas.update + +Update shared component metadata + +- HTTP: `PATCH /v1/schemas/{namespace}/{slug}` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### schemas.delete + +Delete a shared component + +- HTTP: `DELETE /v1/schemas/{namespace}/{slug}` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### schemas.version.retrieveSchema + +Get a shared component document + +- HTTP: `GET /v1/schemas/{namespace}/{slug}/version/{semver}` +- Response body: `text/plain` +- Errors: `400, 401, 403, 404, 422, 500` + +### schemas.version.deleteSchema + +Delete a shared component version + +- HTTP: `DELETE /v1/schemas/{namespace}/{slug}/version/{semver}` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### schemas.version.createSchema + +Create a shared component version + +- HTTP: `POST /v1/schemas/{namespace}/{slug}/version` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### schemas.accessGroup.createSchema + +Add shared component access group + +- HTTP: `POST /v1/schemas/{namespace}/{slug}/access-group` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### schemas.accessGroup.deleteSchema + +Remove shared component access group + +- HTTP: `DELETE /v1/schemas/{namespace}/{slug}/access-group` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### loginPortals.retrieve + +Get a login portal + +- HTTP: `GET /v1/login-portals/{slug}` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### loginPortals.update + +Update portal metadata + +- HTTP: `PATCH /v1/login-portals/{slug}` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### loginPortals.delete + +Delete a login portal + +- HTTP: `DELETE /v1/login-portals/{slug}` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### loginPortals.create + +Create a portal + +- HTTP: `POST /v1/login-portals` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### loginPortals.list + +List all portals + +- HTTP: `GET /v1/login-portals` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### rules.listRulesets + +List all rules + +- HTTP: `GET /v1/rulesets/{namespace}` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### rules.createRuleset + +Create a rule + +- HTTP: `POST /v1/rulesets/{namespace}` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### rules.updateRuleset + +Update rule metadata + +- HTTP: `PATCH /v1/rulesets/{namespace}/{slug}` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### rules.deleteRuleset + +Delete a rule + +- HTTP: `DELETE /v1/rulesets/{namespace}/{slug}` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### rules.retrieveRulesetDocument + +Get a rule + +- HTTP: `GET /v1/rulesets/{namespace}/{slug}` +- Response body: `text/plain` +- Errors: `400, 401, 403, 404, 422, 500` + +### rules.createRulesetAccessGroup + +Add rule access group + +- HTTP: `POST /v1/rulesets/{namespace}/{slug}/access-group` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### rules.deleteRulesetAccessGroup + +Remove rule access group + +- HTTP: `DELETE /v1/rulesets/{namespace}/{slug}/access-group` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### themes.list + +List all themes + +- HTTP: `GET /v1/themes` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### themes.create + +Create a theme + +- HTTP: `POST /v1/themes` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### themes.update + +Update theme metadata + +- HTTP: `PATCH /v1/themes/{slug}` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### themes.replaceDocument + +Update theme document + +- HTTP: `PUT /v1/themes/{slug}` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### themes.delete + +Delete a theme + +- HTTP: `DELETE /v1/themes/{slug}` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### themes.retrieve + +Get a theme + +- HTTP: `GET /v1/themes/{slug}` +- Response body: `text/plain` +- Errors: `400, 401, 403, 404, 422, 500` + +### teams.list + +List teams + +- HTTP: `GET /v1/teams` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### scalarDocs.listGuides + +List all projects + +- HTTP: `GET /v1/guides` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### scalarDocs.createGuide + +Create a project + +- HTTP: `POST /v1/guides` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### scalarDocs.publishGuide + +Publish a project + +- HTTP: `POST /v1/guides/{slug}/publish` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### namespaces.list + +List namespaces + +- HTTP: `GET /v1/namespaces` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### authentication.exchangePersonalToken + +Exchange token + +- HTTP: `POST /v1/auth/exchange` +- Request body: `application/json` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +### authentication.listCurrentUser + +Get current user + +- HTTP: `GET /v1/auth/me` +- Response body: `application/json` +- Errors: `400, 401, 403, 404, 422, 500` + +## Models + +- `_400` +- `_401` +- `_403` +- `_404` +- `_422` +- `_500` +- `ApiDocument` +- `Nanoid` +- `Version` +- `Slug` +- `Namespace` +- `ManagedDocVersion` +- `Method` +- `AccessGroup` +- `Schema` +- `ManagedSchemaVersion` +- `Timestamp` +- `Uid` +- `LoginPortalEmail` +- `LoginPortalPage` +- `LoginPortal` +- `Rule` +- `Theme` +- `Team` +- `TeamName` +- `TeamImage` +- `GithubProject` +- `ActiveDeployment` +- `GithubProjectRepository` +- `Email` +- `TeamSummary` +- `User` diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..b9a537d --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,2 @@ +edition = "2021" +max_width = 120 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/src/client.rs b/src/client.rs new file mode 100644 index 0000000..d90f1ac --- /dev/null +++ b/src/client.rs @@ -0,0 +1,257 @@ +use std::collections::HashMap; +use std::sync::Arc; +use std::time::Duration; + +use reqwest::header::{HeaderMap, HeaderName, HeaderValue}; + +use crate::error::Error; +use crate::models::*; +use crate::request::{self, RawResponse, RequestOptions, RequestSpec}; + +/// Named API environments configured for this SDK. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Environment { + Production, + Local, +} + +impl Environment { + /// Returns the base URL for this environment. + pub fn base_url(self) -> &'static str { + match self { + Self::Production => "https://access.scalar.com", + Self::Local => "http://127.0.0.1:4010", + } + } +} + +impl Default for Environment { + fn default() -> Self { + Self::Production + } +} + +/// Configuration used to construct a generated API client. +#[derive(Clone)] +pub struct ScalarApiClientOptions { + pub base_url: Option, + pub environment: Option, + pub http_client: Option, + pub timeout: Option, + pub max_retries: Option, + pub default_headers: HeaderMap, + pub bearer_token: Option, +} + +/// Supplies OAuth2 access tokens for generated requests. +pub trait OAuthTokenProvider: Send + Sync { + fn access_token(&self) -> Option; +} + +impl OAuthTokenProvider for F +where + F: Fn() -> Option + Send + Sync, +{ + fn access_token(&self) -> Option { + self() + } +} + +#[cfg(feature = "blocking")] +/// OAuth2 client-credentials provider backed by reqwest blocking client. +pub struct OAuth2ClientCredentialsProvider { + client: reqwest::blocking::Client, + token_url: String, + client_id: String, + client_secret: String, + scopes: Vec, + state: std::sync::Mutex>, +} + +#[cfg(feature = "blocking")] +impl OAuth2ClientCredentialsProvider { + pub fn new(token_url: impl Into, client_id: impl Into, client_secret: impl Into, scopes: Vec) -> Self { + Self { client: reqwest::blocking::Client::new(), token_url: token_url.into(), client_id: client_id.into(), client_secret: client_secret.into(), scopes, state: std::sync::Mutex::new(None) } + } +} + +#[cfg(feature = "blocking")] +impl OAuthTokenProvider for OAuth2ClientCredentialsProvider { + fn access_token(&self) -> Option { + let mut state = self.state.lock().ok()?; + if let Some((token, expires_at)) = state.as_ref() { + if std::time::Instant::now() + Duration::from_secs(30) < *expires_at { return Some(token.clone()); } + } + let mut form = vec![("grant_type", "client_credentials".to_string()), ("client_id", self.client_id.clone()), ("client_secret", self.client_secret.clone())]; + if !self.scopes.is_empty() { form.push(("scope", self.scopes.join(" "))); } + let response = self.client.post(&self.token_url).form(&form).send().ok()?; + if !response.status().is_success() { return None; } + let payload: serde_json::Value = response.json().ok()?; + let token = payload.get("access_token")?.as_str()?.to_string(); + let expires_in = payload.get("expires_in").and_then(|value| value.as_u64()).unwrap_or(3600); + *state = Some((token.clone(), std::time::Instant::now() + Duration::from_secs(expires_in))); + Some(token) + } +} + +impl Default for ScalarApiClientOptions { + fn default() -> Self { + Self { + base_url: None, + environment: None, + http_client: None, + timeout: None, + max_retries: None, + default_headers: HeaderMap::new(), + bearer_token: None, + } + } +} + +impl ScalarApiClientOptions { + /// Starts a typed options builder. + pub fn builder() -> ScalarApiClientBuilder { + ScalarApiClientBuilder::default() + } +} + +/// Builder for generated client options. +#[derive(Default)] +pub struct ScalarApiClientBuilder { + options: ScalarApiClientOptions, +} + +impl ScalarApiClientBuilder { + pub fn base_url(mut self, value: impl Into) -> Self { + self.options.base_url = Some(value.into()); + self + } + pub fn environment(mut self, value: Environment) -> Self { + self.options.environment = Some(value); + self + } + pub fn http_client(mut self, value: reqwest::Client) -> Self { + self.options.http_client = Some(value); + self + } + pub fn timeout(mut self, value: Duration) -> Self { + self.options.timeout = Some(value); + self + } + pub fn max_retries(mut self, value: usize) -> Self { + self.options.max_retries = Some(value); + self + } + pub fn default_header(mut self, name: impl TryInto, value: impl TryInto) -> Self { + if let (Ok(name), Ok(value)) = (name.try_into(), value.try_into()) { + self.options.default_headers.insert(name, value); + } + self + } + pub fn bearer_token(mut self, value: impl Into) -> Self { + self.options.bearer_token = Some(value.into()); + self + } + pub fn build(self) -> ScalarApiClientOptions { + self.options + } +} + +/// Shared immutable client state used by resource handles. +#[derive(Clone)] +pub(crate) struct ClientInner { + pub(crate) base_url: String, + pub(crate) http_client: reqwest::Client, + pub(crate) max_retries: usize, + pub(crate) default_headers: HeaderMap, + pub(crate) bearer_token: Option, +} + +/// Generated API client. +#[derive(Clone)] +pub struct ScalarApiClient { + pub(crate) inner: Arc, + pub registry: crate::resources::registry::RegistryService, + pub schemas: crate::resources::schemas::SchemasService, + pub login_portals: crate::resources::login_portals::LoginPortalsService, + pub rules: crate::resources::rules::RulesService, + pub themes: crate::resources::themes::ThemesService, + pub teams: crate::resources::teams::TeamsService, + pub scalar_docs: crate::resources::scalar_docs::ScalarDocsService, + pub namespaces: crate::resources::namespaces::NamespacesService, + pub authentication: crate::resources::authentication::AuthenticationService, +} + +impl ScalarApiClient { + /// Constructs a client with default options. + pub fn new() -> Self { + Self::with_options(Default::default()) + } + /// Constructs a client from explicit options. + pub fn with_options(options: ScalarApiClientOptions) -> Self { + let environment = options.environment.unwrap_or_default(); + let base_url = options.base_url.unwrap_or_else(|| environment.base_url().to_string()); + let timeout = options.timeout.unwrap_or_else(|| Duration::from_secs(60)); + let http_client = options.http_client.unwrap_or_else(|| { + reqwest::Client::builder() + .timeout(timeout) + .build() + .expect("generated client HTTP configuration should be valid") + }); + let inner = Arc::new(ClientInner { + base_url: base_url.trim_end_matches('/').to_string(), + http_client, + max_retries: options.max_retries.unwrap_or(3), + default_headers: options.default_headers, + bearer_token: options.bearer_token.or_else(|| std::env::var("SCALAR_BEARER_TOKEN").ok()), + }); + Self { + inner: inner.clone(), + registry: crate::resources::registry::RegistryService::from_inner(inner.clone()), + schemas: crate::resources::schemas::SchemasService::from_inner(inner.clone()), + login_portals: crate::resources::login_portals::LoginPortalsService::from_inner(inner.clone()), + rules: crate::resources::rules::RulesService::from_inner(inner.clone()), + themes: crate::resources::themes::ThemesService::from_inner(inner.clone()), + teams: crate::resources::teams::TeamsService::from_inner(inner.clone()), + scalar_docs: crate::resources::scalar_docs::ScalarDocsService::from_inner(inner.clone()), + namespaces: crate::resources::namespaces::NamespacesService::from_inner(inner.clone()), + authentication: crate::resources::authentication::AuthenticationService::from_inner(inner.clone()), + } + } + /// Returns a copy of this client with selected options changed. + pub fn with_base_url(&self, base_url: impl Into) -> ScalarApiClient { + let mut options = ScalarApiClientOptions::default(); + options.base_url = Some(base_url.into()); + options.http_client = Some(self.inner.http_client.clone()); + options.max_retries = Some(self.inner.max_retries); + options.default_headers = self.inner.default_headers.clone(); + options.bearer_token = self.inner.bearer_token.clone(); + Self::with_options(options) + } +} + +impl Default for ScalarApiClient { + fn default() -> Self { + Self::new() + } +} + +impl ClientInner { + pub(crate) fn auth_headers(&self, allowed: Option<&[&str]>) -> HeaderMap { + let _ = allowed; + let mut headers = HeaderMap::new(); + if allowed.map_or(true, |schemes| schemes.contains(&"auth.bearerAuth")) { + if let Some(value) = &self.bearer_token { + if let Ok(value) = HeaderValue::from_str(&format!("Bearer {value}")) { + headers.insert(reqwest::header::AUTHORIZATION, value); + } + } + } + headers + } + pub(crate) fn auth_query(&self, allowed: Option<&[&str]>) -> Vec<(String, String)> { + let _ = allowed; + let mut query = Vec::new(); + query + } +} diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..c2b8c00 --- /dev/null +++ b/src/error.rs @@ -0,0 +1,475 @@ +use crate::models::*; +use reqwest::header::HeaderMap; +use std::collections::BTreeMap; +use std::fmt; + +/// RFC 7807 Problem Details payload returned by an API error. +#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] +pub struct ProblemDetails { + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub detail: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub instance: Option, + #[serde(flatten)] + pub extensions: BTreeMap, +} + +/// Error returned by generated SDK requests. +#[derive(Debug)] +pub enum Error { + /// The HTTP transport failed. + Transport(reqwest::Error), + /// The server returned a non-successful status code. + Status { status: reqwest::StatusCode, headers: HeaderMap, body: bytes::Bytes }, + /// A response body could not be decoded. + Decode { source: serde_json::Error, body: bytes::Bytes }, + /// A request body could not be encoded. + Encode(serde_json::Error), + /// A required generated request parameter was missing. + MissingParameter(&'static str), + /// A URL, header, or request component could not be built. + InvalidRequest(String), +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Transport(error) => write!(f, "transport error: {error}"), + Self::Status { status, .. } => write!(f, "server returned status {status}"), + Self::Decode { source, .. } => write!(f, "decode error: {source}"), + Self::Encode(error) => write!(f, "encode error: {error}"), + Self::MissingParameter(name) => write!(f, "missing required parameter {name}"), + Self::InvalidRequest(message) => write!(f, "invalid request: {message}"), + } + } +} + +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Self::Transport(error) => Some(error), + Self::Decode { source, .. } => Some(source), + Self::Encode(error) => Some(error), + _ => None, + } + } +} + +impl From for Error { + fn from(error: reqwest::Error) -> Self { + Self::Transport(error) + } +} + +pub type APIConnectionError = Error; +pub type BadRequestError = Error; +pub type AuthenticationError = Error; +pub type PermissionDeniedError = Error; +pub type NotFoundError = Error; +pub type ConflictError = Error; +pub type UnprocessableError = Error; +pub type RateLimitError = Error; +pub type InternalServerError = Error; + +impl Error { + /// Request identifier returned by the server, when present. + pub fn request_id(&self) -> Option<&str> { + match self { + Self::Status { headers, .. } => headers + .get("x-request-id") + .or_else(|| headers.get("request-id")) + .and_then(|value| value.to_str().ok()), + _ => None, + } + } + + /// Parses the response body as an RFC 7807 Problem Details object, when possible. + pub fn problem_details(&self) -> Option { + match self { + Self::Status { body, .. } => { + let value: serde_json::Value = serde_json::from_slice(body).ok()?; + let object = value.as_object()?; + if !["type", "title", "status", "detail", "instance"].iter().any(|key| object.contains_key(*key)) { + return None; + } + serde_json::from_value(value).ok() + } + _ => None, + } + } +} + +pub type ListAllApiDocumentsBadRequestErrorBody = _400; +pub type ListAllApiDocumentsAuthenticationErrorBody = _401; +pub type ListAllApiDocumentsPermissionDeniedErrorBody = _403; +pub type ListAllApiDocumentsNotFoundErrorBody = _404; +pub type ListAllApiDocumentsUnprocessableEntityErrorBody = _422; +pub type ListAllApiDocumentsInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: ListAllApiDocumentsBadRequestErrorBody, ListAllApiDocumentsAuthenticationErrorBody, ListAllApiDocumentsPermissionDeniedErrorBody, ListAllApiDocumentsNotFoundErrorBody, ListAllApiDocumentsUnprocessableEntityErrorBody, ListAllApiDocumentsInternalServerErrorBody. +pub type ListAllApiDocumentsErrorBody = serde_json::Value; +pub type ListApiDocumentsBadRequestErrorBody = _400; +pub type ListApiDocumentsAuthenticationErrorBody = _401; +pub type ListApiDocumentsPermissionDeniedErrorBody = _403; +pub type ListApiDocumentsNotFoundErrorBody = _404; +pub type ListApiDocumentsUnprocessableEntityErrorBody = _422; +pub type ListApiDocumentsInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: ListApiDocumentsBadRequestErrorBody, ListApiDocumentsAuthenticationErrorBody, ListApiDocumentsPermissionDeniedErrorBody, ListApiDocumentsNotFoundErrorBody, ListApiDocumentsUnprocessableEntityErrorBody, ListApiDocumentsInternalServerErrorBody. +pub type ListApiDocumentsErrorBody = serde_json::Value; +pub type CreateApiDocumentBadRequestErrorBody = _400; +pub type CreateApiDocumentAuthenticationErrorBody = _401; +pub type CreateApiDocumentPermissionDeniedErrorBody = _403; +pub type CreateApiDocumentNotFoundErrorBody = _404; +pub type CreateApiDocumentUnprocessableEntityErrorBody = _422; +pub type CreateApiDocumentInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: CreateApiDocumentBadRequestErrorBody, CreateApiDocumentAuthenticationErrorBody, CreateApiDocumentPermissionDeniedErrorBody, CreateApiDocumentNotFoundErrorBody, CreateApiDocumentUnprocessableEntityErrorBody, CreateApiDocumentInternalServerErrorBody. +pub type CreateApiDocumentErrorBody = serde_json::Value; +pub type UpdateApiDocumentBadRequestErrorBody = _400; +pub type UpdateApiDocumentAuthenticationErrorBody = _401; +pub type UpdateApiDocumentPermissionDeniedErrorBody = _403; +pub type UpdateApiDocumentNotFoundErrorBody = _404; +pub type UpdateApiDocumentUnprocessableEntityErrorBody = _422; +pub type UpdateApiDocumentInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: UpdateApiDocumentBadRequestErrorBody, UpdateApiDocumentAuthenticationErrorBody, UpdateApiDocumentPermissionDeniedErrorBody, UpdateApiDocumentNotFoundErrorBody, UpdateApiDocumentUnprocessableEntityErrorBody, UpdateApiDocumentInternalServerErrorBody. +pub type UpdateApiDocumentErrorBody = serde_json::Value; +pub type DeleteApiDocumentBadRequestErrorBody = _400; +pub type DeleteApiDocumentAuthenticationErrorBody = _401; +pub type DeleteApiDocumentPermissionDeniedErrorBody = _403; +pub type DeleteApiDocumentNotFoundErrorBody = _404; +pub type DeleteApiDocumentUnprocessableEntityErrorBody = _422; +pub type DeleteApiDocumentInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: DeleteApiDocumentBadRequestErrorBody, DeleteApiDocumentAuthenticationErrorBody, DeleteApiDocumentPermissionDeniedErrorBody, DeleteApiDocumentNotFoundErrorBody, DeleteApiDocumentUnprocessableEntityErrorBody, DeleteApiDocumentInternalServerErrorBody. +pub type DeleteApiDocumentErrorBody = serde_json::Value; +pub type RetrieveApiDocumentVersionBadRequestErrorBody = _400; +pub type RetrieveApiDocumentVersionAuthenticationErrorBody = _401; +pub type RetrieveApiDocumentVersionPermissionDeniedErrorBody = _403; +pub type RetrieveApiDocumentVersionNotFoundErrorBody = _404; +pub type RetrieveApiDocumentVersionUnprocessableEntityErrorBody = _422; +pub type RetrieveApiDocumentVersionInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: RetrieveApiDocumentVersionBadRequestErrorBody, RetrieveApiDocumentVersionAuthenticationErrorBody, RetrieveApiDocumentVersionPermissionDeniedErrorBody, RetrieveApiDocumentVersionNotFoundErrorBody, RetrieveApiDocumentVersionUnprocessableEntityErrorBody, RetrieveApiDocumentVersionInternalServerErrorBody. +pub type RetrieveApiDocumentVersionErrorBody = serde_json::Value; +pub type UpdateApiDocumentVersionBadRequestErrorBody = _400; +pub type UpdateApiDocumentVersionAuthenticationErrorBody = _401; +pub type UpdateApiDocumentVersionPermissionDeniedErrorBody = _403; +pub type UpdateApiDocumentVersionNotFoundErrorBody = _404; +pub type UpdateApiDocumentVersionUnprocessableEntityErrorBody = _422; +pub type UpdateApiDocumentVersionInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: UpdateApiDocumentVersionBadRequestErrorBody, UpdateApiDocumentVersionAuthenticationErrorBody, UpdateApiDocumentVersionPermissionDeniedErrorBody, UpdateApiDocumentVersionNotFoundErrorBody, UpdateApiDocumentVersionUnprocessableEntityErrorBody, UpdateApiDocumentVersionInternalServerErrorBody. +pub type UpdateApiDocumentVersionErrorBody = serde_json::Value; +pub type DeleteApiDocumentVersionBadRequestErrorBody = _400; +pub type DeleteApiDocumentVersionAuthenticationErrorBody = _401; +pub type DeleteApiDocumentVersionPermissionDeniedErrorBody = _403; +pub type DeleteApiDocumentVersionNotFoundErrorBody = _404; +pub type DeleteApiDocumentVersionUnprocessableEntityErrorBody = _422; +pub type DeleteApiDocumentVersionInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: DeleteApiDocumentVersionBadRequestErrorBody, DeleteApiDocumentVersionAuthenticationErrorBody, DeleteApiDocumentVersionPermissionDeniedErrorBody, DeleteApiDocumentVersionNotFoundErrorBody, DeleteApiDocumentVersionUnprocessableEntityErrorBody, DeleteApiDocumentVersionInternalServerErrorBody. +pub type DeleteApiDocumentVersionErrorBody = serde_json::Value; +pub type ListApiDocumentVersionMetadataBadRequestErrorBody = _400; +pub type ListApiDocumentVersionMetadataAuthenticationErrorBody = _401; +pub type ListApiDocumentVersionMetadataPermissionDeniedErrorBody = _403; +pub type ListApiDocumentVersionMetadataNotFoundErrorBody = _404; +pub type ListApiDocumentVersionMetadataUnprocessableEntityErrorBody = _422; +pub type ListApiDocumentVersionMetadataInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: ListApiDocumentVersionMetadataBadRequestErrorBody, ListApiDocumentVersionMetadataAuthenticationErrorBody, ListApiDocumentVersionMetadataPermissionDeniedErrorBody, ListApiDocumentVersionMetadataNotFoundErrorBody, ListApiDocumentVersionMetadataUnprocessableEntityErrorBody, ListApiDocumentVersionMetadataInternalServerErrorBody. +pub type ListApiDocumentVersionMetadataErrorBody = serde_json::Value; +pub type CreateApiDocumentVersionBadRequestErrorBody = _400; +pub type CreateApiDocumentVersionAuthenticationErrorBody = _401; +pub type CreateApiDocumentVersionPermissionDeniedErrorBody = _403; +pub type CreateApiDocumentVersionNotFoundErrorBody = _404; +pub type CreateApiDocumentVersionUnprocessableEntityErrorBody = _422; +pub type CreateApiDocumentVersionInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: CreateApiDocumentVersionBadRequestErrorBody, CreateApiDocumentVersionAuthenticationErrorBody, CreateApiDocumentVersionPermissionDeniedErrorBody, CreateApiDocumentVersionNotFoundErrorBody, CreateApiDocumentVersionUnprocessableEntityErrorBody, CreateApiDocumentVersionInternalServerErrorBody. +pub type CreateApiDocumentVersionErrorBody = serde_json::Value; +pub type CreateApiDocumentAccessGroupBadRequestErrorBody = _400; +pub type CreateApiDocumentAccessGroupAuthenticationErrorBody = _401; +pub type CreateApiDocumentAccessGroupPermissionDeniedErrorBody = _403; +pub type CreateApiDocumentAccessGroupNotFoundErrorBody = _404; +pub type CreateApiDocumentAccessGroupUnprocessableEntityErrorBody = _422; +pub type CreateApiDocumentAccessGroupInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: CreateApiDocumentAccessGroupBadRequestErrorBody, CreateApiDocumentAccessGroupAuthenticationErrorBody, CreateApiDocumentAccessGroupPermissionDeniedErrorBody, CreateApiDocumentAccessGroupNotFoundErrorBody, CreateApiDocumentAccessGroupUnprocessableEntityErrorBody, CreateApiDocumentAccessGroupInternalServerErrorBody. +pub type CreateApiDocumentAccessGroupErrorBody = serde_json::Value; +pub type DeleteApiDocumentAccessGroupBadRequestErrorBody = _400; +pub type DeleteApiDocumentAccessGroupAuthenticationErrorBody = _401; +pub type DeleteApiDocumentAccessGroupPermissionDeniedErrorBody = _403; +pub type DeleteApiDocumentAccessGroupNotFoundErrorBody = _404; +pub type DeleteApiDocumentAccessGroupUnprocessableEntityErrorBody = _422; +pub type DeleteApiDocumentAccessGroupInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: DeleteApiDocumentAccessGroupBadRequestErrorBody, DeleteApiDocumentAccessGroupAuthenticationErrorBody, DeleteApiDocumentAccessGroupPermissionDeniedErrorBody, DeleteApiDocumentAccessGroupNotFoundErrorBody, DeleteApiDocumentAccessGroupUnprocessableEntityErrorBody, DeleteApiDocumentAccessGroupInternalServerErrorBody. +pub type DeleteApiDocumentAccessGroupErrorBody = serde_json::Value; +pub type ListBadRequestErrorBody = _400; +pub type ListAuthenticationErrorBody = _401; +pub type ListPermissionDeniedErrorBody = _403; +pub type ListNotFoundErrorBody = _404; +pub type ListUnprocessableEntityErrorBody = _422; +pub type ListInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: ListBadRequestErrorBody, ListAuthenticationErrorBody, ListPermissionDeniedErrorBody, ListNotFoundErrorBody, ListUnprocessableEntityErrorBody, ListInternalServerErrorBody. +pub type ListErrorBody = serde_json::Value; +pub type CreateBadRequestErrorBody = _400; +pub type CreateAuthenticationErrorBody = _401; +pub type CreatePermissionDeniedErrorBody = _403; +pub type CreateNotFoundErrorBody = _404; +pub type CreateUnprocessableEntityErrorBody = _422; +pub type CreateInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: CreateBadRequestErrorBody, CreateAuthenticationErrorBody, CreatePermissionDeniedErrorBody, CreateNotFoundErrorBody, CreateUnprocessableEntityErrorBody, CreateInternalServerErrorBody. +pub type CreateErrorBody = serde_json::Value; +pub type UpdateBadRequestErrorBody = _400; +pub type UpdateAuthenticationErrorBody = _401; +pub type UpdatePermissionDeniedErrorBody = _403; +pub type UpdateNotFoundErrorBody = _404; +pub type UpdateUnprocessableEntityErrorBody = _422; +pub type UpdateInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: UpdateBadRequestErrorBody, UpdateAuthenticationErrorBody, UpdatePermissionDeniedErrorBody, UpdateNotFoundErrorBody, UpdateUnprocessableEntityErrorBody, UpdateInternalServerErrorBody. +pub type UpdateErrorBody = serde_json::Value; +pub type DeleteBadRequestErrorBody = _400; +pub type DeleteAuthenticationErrorBody = _401; +pub type DeletePermissionDeniedErrorBody = _403; +pub type DeleteNotFoundErrorBody = _404; +pub type DeleteUnprocessableEntityErrorBody = _422; +pub type DeleteInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: DeleteBadRequestErrorBody, DeleteAuthenticationErrorBody, DeletePermissionDeniedErrorBody, DeleteNotFoundErrorBody, DeleteUnprocessableEntityErrorBody, DeleteInternalServerErrorBody. +pub type DeleteErrorBody = serde_json::Value; +pub type RetrieveSchemaBadRequestErrorBody = _400; +pub type RetrieveSchemaAuthenticationErrorBody = _401; +pub type RetrieveSchemaPermissionDeniedErrorBody = _403; +pub type RetrieveSchemaNotFoundErrorBody = _404; +pub type RetrieveSchemaUnprocessableEntityErrorBody = _422; +pub type RetrieveSchemaInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: RetrieveSchemaBadRequestErrorBody, RetrieveSchemaAuthenticationErrorBody, RetrieveSchemaPermissionDeniedErrorBody, RetrieveSchemaNotFoundErrorBody, RetrieveSchemaUnprocessableEntityErrorBody, RetrieveSchemaInternalServerErrorBody. +pub type RetrieveSchemaErrorBody = serde_json::Value; +pub type DeleteSchemaBadRequestErrorBody = _400; +pub type DeleteSchemaAuthenticationErrorBody = _401; +pub type DeleteSchemaPermissionDeniedErrorBody = _403; +pub type DeleteSchemaNotFoundErrorBody = _404; +pub type DeleteSchemaUnprocessableEntityErrorBody = _422; +pub type DeleteSchemaInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: DeleteSchemaBadRequestErrorBody, DeleteSchemaAuthenticationErrorBody, DeleteSchemaPermissionDeniedErrorBody, DeleteSchemaNotFoundErrorBody, DeleteSchemaUnprocessableEntityErrorBody, DeleteSchemaInternalServerErrorBody. +pub type DeleteSchemaErrorBody = serde_json::Value; +pub type CreateSchemaBadRequestErrorBody = _400; +pub type CreateSchemaAuthenticationErrorBody = _401; +pub type CreateSchemaPermissionDeniedErrorBody = _403; +pub type CreateSchemaNotFoundErrorBody = _404; +pub type CreateSchemaUnprocessableEntityErrorBody = _422; +pub type CreateSchemaInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: CreateSchemaBadRequestErrorBody, CreateSchemaAuthenticationErrorBody, CreateSchemaPermissionDeniedErrorBody, CreateSchemaNotFoundErrorBody, CreateSchemaUnprocessableEntityErrorBody, CreateSchemaInternalServerErrorBody. +pub type CreateSchemaErrorBody = serde_json::Value; +pub type CreateSchemaBadRequestErrorBody2 = _400; +pub type CreateSchemaAuthenticationErrorBody2 = _401; +pub type CreateSchemaPermissionDeniedErrorBody2 = _403; +pub type CreateSchemaNotFoundErrorBody2 = _404; +pub type CreateSchemaUnprocessableEntityErrorBody2 = _422; +pub type CreateSchemaInternalServerErrorBody2 = _500; +/// Error response bodies documented for this operation: CreateSchemaBadRequestErrorBody2, CreateSchemaAuthenticationErrorBody2, CreateSchemaPermissionDeniedErrorBody2, CreateSchemaNotFoundErrorBody2, CreateSchemaUnprocessableEntityErrorBody2, CreateSchemaInternalServerErrorBody2. +pub type CreateSchemaErrorBody2 = serde_json::Value; +pub type DeleteSchemaBadRequestErrorBody2 = _400; +pub type DeleteSchemaAuthenticationErrorBody2 = _401; +pub type DeleteSchemaPermissionDeniedErrorBody2 = _403; +pub type DeleteSchemaNotFoundErrorBody2 = _404; +pub type DeleteSchemaUnprocessableEntityErrorBody2 = _422; +pub type DeleteSchemaInternalServerErrorBody2 = _500; +/// Error response bodies documented for this operation: DeleteSchemaBadRequestErrorBody2, DeleteSchemaAuthenticationErrorBody2, DeleteSchemaPermissionDeniedErrorBody2, DeleteSchemaNotFoundErrorBody2, DeleteSchemaUnprocessableEntityErrorBody2, DeleteSchemaInternalServerErrorBody2. +pub type DeleteSchemaErrorBody2 = serde_json::Value; +pub type RetrieveBadRequestErrorBody = _400; +pub type RetrieveAuthenticationErrorBody = _401; +pub type RetrievePermissionDeniedErrorBody = _403; +pub type RetrieveNotFoundErrorBody = _404; +pub type RetrieveUnprocessableEntityErrorBody = _422; +pub type RetrieveInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: RetrieveBadRequestErrorBody, RetrieveAuthenticationErrorBody, RetrievePermissionDeniedErrorBody, RetrieveNotFoundErrorBody, RetrieveUnprocessableEntityErrorBody, RetrieveInternalServerErrorBody. +pub type RetrieveErrorBody = serde_json::Value; +pub type UpdateBadRequestErrorBody2 = _400; +pub type UpdateAuthenticationErrorBody2 = _401; +pub type UpdatePermissionDeniedErrorBody2 = _403; +pub type UpdateNotFoundErrorBody2 = _404; +pub type UpdateUnprocessableEntityErrorBody2 = _422; +pub type UpdateInternalServerErrorBody2 = _500; +/// Error response bodies documented for this operation: UpdateBadRequestErrorBody2, UpdateAuthenticationErrorBody2, UpdatePermissionDeniedErrorBody2, UpdateNotFoundErrorBody2, UpdateUnprocessableEntityErrorBody2, UpdateInternalServerErrorBody2. +pub type UpdateErrorBody2 = serde_json::Value; +pub type DeleteBadRequestErrorBody2 = _400; +pub type DeleteAuthenticationErrorBody2 = _401; +pub type DeletePermissionDeniedErrorBody2 = _403; +pub type DeleteNotFoundErrorBody2 = _404; +pub type DeleteUnprocessableEntityErrorBody2 = _422; +pub type DeleteInternalServerErrorBody2 = _500; +/// Error response bodies documented for this operation: DeleteBadRequestErrorBody2, DeleteAuthenticationErrorBody2, DeletePermissionDeniedErrorBody2, DeleteNotFoundErrorBody2, DeleteUnprocessableEntityErrorBody2, DeleteInternalServerErrorBody2. +pub type DeleteErrorBody2 = serde_json::Value; +pub type CreateBadRequestErrorBody2 = _400; +pub type CreateAuthenticationErrorBody2 = _401; +pub type CreatePermissionDeniedErrorBody2 = _403; +pub type CreateNotFoundErrorBody2 = _404; +pub type CreateUnprocessableEntityErrorBody2 = _422; +pub type CreateInternalServerErrorBody2 = _500; +/// Error response bodies documented for this operation: CreateBadRequestErrorBody2, CreateAuthenticationErrorBody2, CreatePermissionDeniedErrorBody2, CreateNotFoundErrorBody2, CreateUnprocessableEntityErrorBody2, CreateInternalServerErrorBody2. +pub type CreateErrorBody2 = serde_json::Value; +pub type ListBadRequestErrorBody2 = _400; +pub type ListAuthenticationErrorBody2 = _401; +pub type ListPermissionDeniedErrorBody2 = _403; +pub type ListNotFoundErrorBody2 = _404; +pub type ListUnprocessableEntityErrorBody2 = _422; +pub type ListInternalServerErrorBody2 = _500; +/// Error response bodies documented for this operation: ListBadRequestErrorBody2, ListAuthenticationErrorBody2, ListPermissionDeniedErrorBody2, ListNotFoundErrorBody2, ListUnprocessableEntityErrorBody2, ListInternalServerErrorBody2. +pub type ListErrorBody2 = serde_json::Value; +pub type ListRulesetsBadRequestErrorBody = _400; +pub type ListRulesetsAuthenticationErrorBody = _401; +pub type ListRulesetsPermissionDeniedErrorBody = _403; +pub type ListRulesetsNotFoundErrorBody = _404; +pub type ListRulesetsUnprocessableEntityErrorBody = _422; +pub type ListRulesetsInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: ListRulesetsBadRequestErrorBody, ListRulesetsAuthenticationErrorBody, ListRulesetsPermissionDeniedErrorBody, ListRulesetsNotFoundErrorBody, ListRulesetsUnprocessableEntityErrorBody, ListRulesetsInternalServerErrorBody. +pub type ListRulesetsErrorBody = serde_json::Value; +pub type CreateRulesetBadRequestErrorBody = _400; +pub type CreateRulesetAuthenticationErrorBody = _401; +pub type CreateRulesetPermissionDeniedErrorBody = _403; +pub type CreateRulesetNotFoundErrorBody = _404; +pub type CreateRulesetUnprocessableEntityErrorBody = _422; +pub type CreateRulesetInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: CreateRulesetBadRequestErrorBody, CreateRulesetAuthenticationErrorBody, CreateRulesetPermissionDeniedErrorBody, CreateRulesetNotFoundErrorBody, CreateRulesetUnprocessableEntityErrorBody, CreateRulesetInternalServerErrorBody. +pub type CreateRulesetErrorBody = serde_json::Value; +pub type UpdateRulesetBadRequestErrorBody = _400; +pub type UpdateRulesetAuthenticationErrorBody = _401; +pub type UpdateRulesetPermissionDeniedErrorBody = _403; +pub type UpdateRulesetNotFoundErrorBody = _404; +pub type UpdateRulesetUnprocessableEntityErrorBody = _422; +pub type UpdateRulesetInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: UpdateRulesetBadRequestErrorBody, UpdateRulesetAuthenticationErrorBody, UpdateRulesetPermissionDeniedErrorBody, UpdateRulesetNotFoundErrorBody, UpdateRulesetUnprocessableEntityErrorBody, UpdateRulesetInternalServerErrorBody. +pub type UpdateRulesetErrorBody = serde_json::Value; +pub type DeleteRulesetBadRequestErrorBody = _400; +pub type DeleteRulesetAuthenticationErrorBody = _401; +pub type DeleteRulesetPermissionDeniedErrorBody = _403; +pub type DeleteRulesetNotFoundErrorBody = _404; +pub type DeleteRulesetUnprocessableEntityErrorBody = _422; +pub type DeleteRulesetInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: DeleteRulesetBadRequestErrorBody, DeleteRulesetAuthenticationErrorBody, DeleteRulesetPermissionDeniedErrorBody, DeleteRulesetNotFoundErrorBody, DeleteRulesetUnprocessableEntityErrorBody, DeleteRulesetInternalServerErrorBody. +pub type DeleteRulesetErrorBody = serde_json::Value; +pub type RetrieveRulesetDocumentBadRequestErrorBody = _400; +pub type RetrieveRulesetDocumentAuthenticationErrorBody = _401; +pub type RetrieveRulesetDocumentPermissionDeniedErrorBody = _403; +pub type RetrieveRulesetDocumentNotFoundErrorBody = _404; +pub type RetrieveRulesetDocumentUnprocessableEntityErrorBody = _422; +pub type RetrieveRulesetDocumentInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: RetrieveRulesetDocumentBadRequestErrorBody, RetrieveRulesetDocumentAuthenticationErrorBody, RetrieveRulesetDocumentPermissionDeniedErrorBody, RetrieveRulesetDocumentNotFoundErrorBody, RetrieveRulesetDocumentUnprocessableEntityErrorBody, RetrieveRulesetDocumentInternalServerErrorBody. +pub type RetrieveRulesetDocumentErrorBody = serde_json::Value; +pub type CreateRulesetAccessGroupBadRequestErrorBody = _400; +pub type CreateRulesetAccessGroupAuthenticationErrorBody = _401; +pub type CreateRulesetAccessGroupPermissionDeniedErrorBody = _403; +pub type CreateRulesetAccessGroupNotFoundErrorBody = _404; +pub type CreateRulesetAccessGroupUnprocessableEntityErrorBody = _422; +pub type CreateRulesetAccessGroupInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: CreateRulesetAccessGroupBadRequestErrorBody, CreateRulesetAccessGroupAuthenticationErrorBody, CreateRulesetAccessGroupPermissionDeniedErrorBody, CreateRulesetAccessGroupNotFoundErrorBody, CreateRulesetAccessGroupUnprocessableEntityErrorBody, CreateRulesetAccessGroupInternalServerErrorBody. +pub type CreateRulesetAccessGroupErrorBody = serde_json::Value; +pub type DeleteRulesetAccessGroupBadRequestErrorBody = _400; +pub type DeleteRulesetAccessGroupAuthenticationErrorBody = _401; +pub type DeleteRulesetAccessGroupPermissionDeniedErrorBody = _403; +pub type DeleteRulesetAccessGroupNotFoundErrorBody = _404; +pub type DeleteRulesetAccessGroupUnprocessableEntityErrorBody = _422; +pub type DeleteRulesetAccessGroupInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: DeleteRulesetAccessGroupBadRequestErrorBody, DeleteRulesetAccessGroupAuthenticationErrorBody, DeleteRulesetAccessGroupPermissionDeniedErrorBody, DeleteRulesetAccessGroupNotFoundErrorBody, DeleteRulesetAccessGroupUnprocessableEntityErrorBody, DeleteRulesetAccessGroupInternalServerErrorBody. +pub type DeleteRulesetAccessGroupErrorBody = serde_json::Value; +pub type ListBadRequestErrorBody3 = _400; +pub type ListAuthenticationErrorBody3 = _401; +pub type ListPermissionDeniedErrorBody3 = _403; +pub type ListNotFoundErrorBody3 = _404; +pub type ListUnprocessableEntityErrorBody3 = _422; +pub type ListInternalServerErrorBody3 = _500; +/// Error response bodies documented for this operation: ListBadRequestErrorBody3, ListAuthenticationErrorBody3, ListPermissionDeniedErrorBody3, ListNotFoundErrorBody3, ListUnprocessableEntityErrorBody3, ListInternalServerErrorBody3. +pub type ListErrorBody3 = serde_json::Value; +pub type CreateBadRequestErrorBody3 = _400; +pub type CreateAuthenticationErrorBody3 = _401; +pub type CreatePermissionDeniedErrorBody3 = _403; +pub type CreateNotFoundErrorBody3 = _404; +pub type CreateUnprocessableEntityErrorBody3 = _422; +pub type CreateInternalServerErrorBody3 = _500; +/// Error response bodies documented for this operation: CreateBadRequestErrorBody3, CreateAuthenticationErrorBody3, CreatePermissionDeniedErrorBody3, CreateNotFoundErrorBody3, CreateUnprocessableEntityErrorBody3, CreateInternalServerErrorBody3. +pub type CreateErrorBody3 = serde_json::Value; +pub type UpdateBadRequestErrorBody3 = _400; +pub type UpdateAuthenticationErrorBody3 = _401; +pub type UpdatePermissionDeniedErrorBody3 = _403; +pub type UpdateNotFoundErrorBody3 = _404; +pub type UpdateUnprocessableEntityErrorBody3 = _422; +pub type UpdateInternalServerErrorBody3 = _500; +/// Error response bodies documented for this operation: UpdateBadRequestErrorBody3, UpdateAuthenticationErrorBody3, UpdatePermissionDeniedErrorBody3, UpdateNotFoundErrorBody3, UpdateUnprocessableEntityErrorBody3, UpdateInternalServerErrorBody3. +pub type UpdateErrorBody3 = serde_json::Value; +pub type ReplaceDocumentBadRequestErrorBody = _400; +pub type ReplaceDocumentAuthenticationErrorBody = _401; +pub type ReplaceDocumentPermissionDeniedErrorBody = _403; +pub type ReplaceDocumentNotFoundErrorBody = _404; +pub type ReplaceDocumentUnprocessableEntityErrorBody = _422; +pub type ReplaceDocumentInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: ReplaceDocumentBadRequestErrorBody, ReplaceDocumentAuthenticationErrorBody, ReplaceDocumentPermissionDeniedErrorBody, ReplaceDocumentNotFoundErrorBody, ReplaceDocumentUnprocessableEntityErrorBody, ReplaceDocumentInternalServerErrorBody. +pub type ReplaceDocumentErrorBody = serde_json::Value; +pub type DeleteBadRequestErrorBody3 = _400; +pub type DeleteAuthenticationErrorBody3 = _401; +pub type DeletePermissionDeniedErrorBody3 = _403; +pub type DeleteNotFoundErrorBody3 = _404; +pub type DeleteUnprocessableEntityErrorBody3 = _422; +pub type DeleteInternalServerErrorBody3 = _500; +/// Error response bodies documented for this operation: DeleteBadRequestErrorBody3, DeleteAuthenticationErrorBody3, DeletePermissionDeniedErrorBody3, DeleteNotFoundErrorBody3, DeleteUnprocessableEntityErrorBody3, DeleteInternalServerErrorBody3. +pub type DeleteErrorBody3 = serde_json::Value; +pub type RetrieveBadRequestErrorBody2 = _400; +pub type RetrieveAuthenticationErrorBody2 = _401; +pub type RetrievePermissionDeniedErrorBody2 = _403; +pub type RetrieveNotFoundErrorBody2 = _404; +pub type RetrieveUnprocessableEntityErrorBody2 = _422; +pub type RetrieveInternalServerErrorBody2 = _500; +/// Error response bodies documented for this operation: RetrieveBadRequestErrorBody2, RetrieveAuthenticationErrorBody2, RetrievePermissionDeniedErrorBody2, RetrieveNotFoundErrorBody2, RetrieveUnprocessableEntityErrorBody2, RetrieveInternalServerErrorBody2. +pub type RetrieveErrorBody2 = serde_json::Value; +pub type ListBadRequestErrorBody4 = _400; +pub type ListAuthenticationErrorBody4 = _401; +pub type ListPermissionDeniedErrorBody4 = _403; +pub type ListNotFoundErrorBody4 = _404; +pub type ListUnprocessableEntityErrorBody4 = _422; +pub type ListInternalServerErrorBody4 = _500; +/// Error response bodies documented for this operation: ListBadRequestErrorBody4, ListAuthenticationErrorBody4, ListPermissionDeniedErrorBody4, ListNotFoundErrorBody4, ListUnprocessableEntityErrorBody4, ListInternalServerErrorBody4. +pub type ListErrorBody4 = serde_json::Value; +pub type ListGuidesBadRequestErrorBody = _400; +pub type ListGuidesAuthenticationErrorBody = _401; +pub type ListGuidesPermissionDeniedErrorBody = _403; +pub type ListGuidesNotFoundErrorBody = _404; +pub type ListGuidesUnprocessableEntityErrorBody = _422; +pub type ListGuidesInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: ListGuidesBadRequestErrorBody, ListGuidesAuthenticationErrorBody, ListGuidesPermissionDeniedErrorBody, ListGuidesNotFoundErrorBody, ListGuidesUnprocessableEntityErrorBody, ListGuidesInternalServerErrorBody. +pub type ListGuidesErrorBody = serde_json::Value; +pub type CreateGuideBadRequestErrorBody = _400; +pub type CreateGuideAuthenticationErrorBody = _401; +pub type CreateGuidePermissionDeniedErrorBody = _403; +pub type CreateGuideNotFoundErrorBody = _404; +pub type CreateGuideUnprocessableEntityErrorBody = _422; +pub type CreateGuideInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: CreateGuideBadRequestErrorBody, CreateGuideAuthenticationErrorBody, CreateGuidePermissionDeniedErrorBody, CreateGuideNotFoundErrorBody, CreateGuideUnprocessableEntityErrorBody, CreateGuideInternalServerErrorBody. +pub type CreateGuideErrorBody = serde_json::Value; +pub type PublishGuideBadRequestErrorBody = _400; +pub type PublishGuideAuthenticationErrorBody = _401; +pub type PublishGuidePermissionDeniedErrorBody = _403; +pub type PublishGuideNotFoundErrorBody = _404; +pub type PublishGuideUnprocessableEntityErrorBody = _422; +pub type PublishGuideInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: PublishGuideBadRequestErrorBody, PublishGuideAuthenticationErrorBody, PublishGuidePermissionDeniedErrorBody, PublishGuideNotFoundErrorBody, PublishGuideUnprocessableEntityErrorBody, PublishGuideInternalServerErrorBody. +pub type PublishGuideErrorBody = serde_json::Value; +pub type ListBadRequestErrorBody5 = _400; +pub type ListAuthenticationErrorBody5 = _401; +pub type ListPermissionDeniedErrorBody5 = _403; +pub type ListNotFoundErrorBody5 = _404; +pub type ListUnprocessableEntityErrorBody5 = _422; +pub type ListInternalServerErrorBody5 = _500; +/// Error response bodies documented for this operation: ListBadRequestErrorBody5, ListAuthenticationErrorBody5, ListPermissionDeniedErrorBody5, ListNotFoundErrorBody5, ListUnprocessableEntityErrorBody5, ListInternalServerErrorBody5. +pub type ListErrorBody5 = serde_json::Value; +pub type ExchangePersonalTokenBadRequestErrorBody = _400; +pub type ExchangePersonalTokenAuthenticationErrorBody = _401; +pub type ExchangePersonalTokenPermissionDeniedErrorBody = _403; +pub type ExchangePersonalTokenNotFoundErrorBody = _404; +pub type ExchangePersonalTokenUnprocessableEntityErrorBody = _422; +pub type ExchangePersonalTokenInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: ExchangePersonalTokenBadRequestErrorBody, ExchangePersonalTokenAuthenticationErrorBody, ExchangePersonalTokenPermissionDeniedErrorBody, ExchangePersonalTokenNotFoundErrorBody, ExchangePersonalTokenUnprocessableEntityErrorBody, ExchangePersonalTokenInternalServerErrorBody. +pub type ExchangePersonalTokenErrorBody = serde_json::Value; +pub type ListCurrentUserBadRequestErrorBody = _400; +pub type ListCurrentUserAuthenticationErrorBody = _401; +pub type ListCurrentUserPermissionDeniedErrorBody = _403; +pub type ListCurrentUserNotFoundErrorBody = _404; +pub type ListCurrentUserUnprocessableEntityErrorBody = _422; +pub type ListCurrentUserInternalServerErrorBody = _500; +/// Error response bodies documented for this operation: ListCurrentUserBadRequestErrorBody, ListCurrentUserAuthenticationErrorBody, ListCurrentUserPermissionDeniedErrorBody, ListCurrentUserNotFoundErrorBody, ListCurrentUserUnprocessableEntityErrorBody, ListCurrentUserInternalServerErrorBody. +pub type ListCurrentUserErrorBody = serde_json::Value; diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..72dadd8 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,28 @@ +#![forbid(unsafe_code)] +#![allow(dead_code, missing_docs, unused_imports, unused_mut)] + +//! Generated SDK crate. + +pub mod client; +pub mod error; +pub mod models; +pub mod prelude; +pub mod request; +pub mod resources; +pub mod webhooks; + +pub use client::{ScalarApiClient, ScalarApiClientBuilder, ScalarApiClientOptions, Environment}; +pub use error::Error; +pub use request::{ByteStream, EventStream, Page, RawResponse, RequestOptions, ResultResponse, WebSocketRequest}; +pub use webhooks::*; +pub use resources::registry::*; +pub use resources::schemas::*; +pub use resources::schemas_version::*; +pub use resources::schemas_access_group::*; +pub use resources::login_portals::*; +pub use resources::rules::*; +pub use resources::themes::*; +pub use resources::teams::*; +pub use resources::scalar_docs::*; +pub use resources::namespaces::*; +pub use resources::authentication::*; diff --git a/src/models.rs b/src/models.rs new file mode 100644 index 0000000..0f98134 --- /dev/null +++ b/src/models.rs @@ -0,0 +1,472 @@ +use std::collections::HashMap; +use std::fmt; + +use serde::{Deserialize, Serialize}; + +/// _400 is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct _400 { + #[serde(rename = "message")] + pub message: String, + #[serde(rename = "code")] + pub code: String, +} + +/// _401 is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct _401 { + #[serde(rename = "message")] + pub message: String, + #[serde(rename = "code")] + pub code: String, +} + +/// _403 is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct _403 { + #[serde(rename = "message")] + pub message: String, + #[serde(rename = "code")] + pub code: String, +} + +/// _404 is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct _404 { + #[serde(rename = "message")] + pub message: String, + #[serde(rename = "code")] + pub code: String, +} + +/// _422 is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct _422 { + #[serde(rename = "message")] + pub message: String, + #[serde(rename = "code")] + pub code: String, +} + +/// _500 is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct _500 { + #[serde(rename = "message")] + pub message: String, + #[serde(rename = "code")] + pub code: String, +} + +/// AccessGroup is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct AccessGroup { +/// Schema: length=3..60; pattern=^[a-z](?:[a-z0-9-]*[a-z0-9])?$ + #[serde(rename = "accessGroupSlug")] + pub access_group_slug: Slug, +} + +/// ActiveDeployment is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ActiveDeployment { + #[serde(rename = "uid")] + pub uid: String, + #[serde(rename = "domain")] + pub domain: String, + #[serde(rename = "publishedAt")] + pub published_at: Timestamp, +} + +/// ApiDocument is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ApiDocument { +/// Schema: length>=5 + #[serde(rename = "uid")] + pub uid: Nanoid, +/// Schema: length>=1 + #[serde(rename = "version")] + pub version: Version, +/// Schema: length<=100 + #[serde(rename = "title")] + pub title: String, +/// Schema: length=3..60; pattern=^[a-z](?:[a-z0-9-]*[a-z0-9])?$ + #[serde(rename = "slug")] + pub slug: Slug, + #[serde(rename = "description")] + pub description: String, +/// Schema: length=3..50; pattern=^[a-zA-Z0-9-_]+$ + #[serde(rename = "namespace")] + pub namespace: Namespace, + #[serde(rename = "isPrivate")] + pub is_private: bool, + #[serde(rename = "tags")] + pub tags: String, + #[serde(rename = "versions")] + pub versions: Vec, +} + +pub type Email = Email; + +/// GithubProject is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct GithubProject { +/// Schema: length>=5 + #[serde(rename = "uid")] + pub uid: Nanoid, + #[serde(rename = "createdAt")] + pub created_at: Timestamp, + #[serde(rename = "updatedAt")] + pub updated_at: Timestamp, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "activeDeployment", skip_serializing_if = "Option::is_none")] + pub active_deployment: Option, + #[serde(rename = "lastPublished", skip_serializing_if = "Option::is_none")] + pub last_published: Option, + #[serde(rename = "lastPublishedUid", skip_serializing_if = "Option::is_none")] + pub last_published_uid: Option, + #[serde(rename = "loginPortalUid")] + pub login_portal_uid: String, + #[serde(rename = "activeThemeId")] + pub active_theme_id: String, + #[serde(rename = "typesenseId", skip_serializing_if = "Option::is_none")] + pub typesense_id: Option, + #[serde(rename = "isPrivate")] + pub is_private: bool, + #[serde(rename = "agentEnabled")] + pub agent_enabled: bool, + #[serde(rename = "accessGroups")] + pub access_groups: String, +/// Schema: length=3..60; pattern=^[a-z](?:[a-z0-9-]*[a-z0-9])?$ + #[serde(rename = "slug")] + pub slug: Slug, + #[serde(rename = "publishStatus")] + pub publish_status: String, + #[serde(rename = "publishMessage")] + pub publish_message: String, + #[serde(rename = "repository", skip_serializing_if = "Option::is_none")] + pub repository: Option, +} + +/// GithubProjectRepository is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct GithubProjectRepository { + #[serde(rename = "linkedBy")] + pub linked_by: String, + #[serde(rename = "id")] + pub id: f64, +/// Schema: length>=2 + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "configPath")] + pub config_path: String, + #[serde(rename = "branch")] + pub branch: String, + #[serde(rename = "publishOnMerge")] + pub publish_on_merge: bool, + #[serde(rename = "publishPreviews")] + pub publish_previews: bool, + #[serde(rename = "prComments")] + pub pr_comments: bool, + #[serde(rename = "expired")] + pub expired: bool, +} + +/// LoginPortal is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct LoginPortal { +/// Schema: length>=5 + #[serde(rename = "uid")] + pub uid: Nanoid, +/// Schema: length<=200 + #[serde(rename = "title")] + pub title: String, +/// Schema: length=3..60; pattern=^[a-z](?:[a-z0-9-]*[a-z0-9])?$ + #[serde(rename = "slug")] + pub slug: Slug, +} + +/// LoginPortalEmail is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct LoginPortalEmail { + #[serde(rename = "logo")] + pub logo: String, + #[serde(rename = "logoSize")] + pub logo_size: String, +/// Schema: length<=50 + #[serde(rename = "buttonText")] + pub button_text: String, +/// Schema: length<=1000 + #[serde(rename = "message")] + pub message: String, +/// Schema: length<=100 + #[serde(rename = "title")] + pub title: String, +/// Schema: length<=100 + #[serde(rename = "mainColor")] + pub main_color: String, +/// Schema: length<=100 + #[serde(rename = "mainBackground")] + pub main_background: String, +/// Schema: length<=100 + #[serde(rename = "cardColor")] + pub card_color: String, +/// Schema: length<=100 + #[serde(rename = "cardBackground")] + pub card_background: String, +/// Schema: length<=100 + #[serde(rename = "buttonColor")] + pub button_color: String, +/// Schema: length<=100 + #[serde(rename = "buttonBackground")] + pub button_background: String, +} + +/// LoginPortalPage is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct LoginPortalPage { +/// Schema: length<=100 + #[serde(rename = "title")] + pub title: String, +/// Schema: length<=500 + #[serde(rename = "description")] + pub description: String, + #[serde(rename = "head")] + pub head: String, + #[serde(rename = "script")] + pub script: String, + #[serde(rename = "theme")] + pub theme: String, +/// Schema: length<=100 + #[serde(rename = "companyName")] + pub company_name: String, + #[serde(rename = "logo")] + pub logo: String, + #[serde(rename = "logoURL")] + pub logo_url: String, + #[serde(rename = "favicon")] + pub favicon: String, + #[serde(rename = "termsLink")] + pub terms_link: String, + #[serde(rename = "privacyLink")] + pub privacy_link: String, +/// Schema: length<=100 + #[serde(rename = "formTitle")] + pub form_title: String, +/// Schema: length<=500 + #[serde(rename = "formDescription")] + pub form_description: String, + #[serde(rename = "formImage")] + pub form_image: String, +} + +/// ManagedDocVersion is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ManagedDocVersion { +/// Schema: length>=5 + #[serde(rename = "uid")] + pub uid: Nanoid, + #[serde(rename = "createdAt")] + pub created_at: f64, +/// Schema: length>=1 + #[serde(rename = "version")] + pub version: Version, + #[serde(rename = "upgraded")] + pub upgraded: bool, + #[serde(rename = "embedStatus", skip_serializing_if = "Option::is_none")] + pub embed_status: Option, + #[serde(rename = "tags")] + pub tags: Vec, + #[serde(rename = "tools", skip_serializing_if = "Option::is_none")] + pub tools: Option>, + #[serde(rename = "yamlSha", skip_serializing_if = "Option::is_none")] + pub yaml_sha: Option, + #[serde(rename = "jsonSha", skip_serializing_if = "Option::is_none")] + pub json_sha: Option, + #[serde(rename = "versionSha", skip_serializing_if = "Option::is_none")] + pub version_sha: Option, +} + +/// ManagedSchemaVersion is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ManagedSchemaVersion { +/// Schema: length>=5 + #[serde(rename = "uid")] + pub uid: Nanoid, + #[serde(rename = "createdAt")] + pub created_at: Timestamp, + #[serde(rename = "updatedAt")] + pub updated_at: Timestamp, +/// Schema: length>=1 + #[serde(rename = "version")] + pub version: Version, +} + +/// Method is a generated enum. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub enum Method { + #[serde(rename = "delete")] + Delete, + #[serde(rename = "get")] + Get, + #[serde(rename = "head")] + Head, + #[serde(rename = "options")] + Options, + #[serde(rename = "patch")] + Patch, + #[serde(rename = "post")] + Post, + #[serde(rename = "put")] + Put, + #[serde(rename = "trace")] + Trace, +} + +impl fmt::Display for Method { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(match self { + Self::Delete => "delete", + Self::Get => "get", + Self::Head => "head", + Self::Options => "options", + Self::Patch => "patch", + Self::Post => "post", + Self::Put => "put", + Self::Trace => "trace", + }) + } +} + +pub type Namespace = Namespace; + +pub type Nanoid = Nanoid; + +/// Rule is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Rule { +/// Schema: length>=5 + #[serde(rename = "uid")] + pub uid: Nanoid, +/// Schema: length<=100 + #[serde(rename = "title")] + pub title: String, + #[serde(rename = "description")] + pub description: String, +/// Schema: length=3..60; pattern=^[a-z](?:[a-z0-9-]*[a-z0-9])?$ + #[serde(rename = "slug")] + pub slug: Slug, +/// Schema: length=3..50; pattern=^[a-zA-Z0-9-_]+$ + #[serde(rename = "namespace")] + pub namespace: Namespace, + #[serde(rename = "isPrivate")] + pub is_private: bool, +} + +/// Schema is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Schema { +/// Schema: length>=5 + #[serde(rename = "uid")] + pub uid: Nanoid, +/// Schema: length<=100 + #[serde(rename = "title")] + pub title: String, + #[serde(rename = "description")] + pub description: String, +/// Schema: length=3..60; pattern=^[a-z](?:[a-z0-9-]*[a-z0-9])?$ + #[serde(rename = "slug")] + pub slug: Slug, +/// Schema: length=3..50; pattern=^[a-zA-Z0-9-_]+$ + #[serde(rename = "namespace")] + pub namespace: Namespace, + #[serde(rename = "isPrivate")] + pub is_private: bool, + #[serde(rename = "versions")] + pub versions: Vec, +} + +pub type Slug = Slug; + +/// Team is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Team { +/// Schema: length>=5 + #[serde(rename = "uid")] + pub uid: Nanoid, + #[serde(rename = "name")] + pub name: TeamName, + #[serde(rename = "imageUri", skip_serializing_if = "Option::is_none")] + pub image_uri: Option, +/// Schema: length=3..60; pattern=^[a-z](?:[a-z0-9-]*[a-z0-9])?$ + #[serde(rename = "slug")] + pub slug: Slug, + #[serde(rename = "theme")] + pub theme: String, +} + +pub type TeamImage = TeamImage; + +pub type TeamName = TeamName; + +/// TeamSummary is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct TeamSummary { +/// Schema: length>=5 + #[serde(rename = "uid")] + pub uid: Nanoid, + #[serde(rename = "name")] + pub name: TeamName, + #[serde(rename = "imageUri", skip_serializing_if = "Option::is_none")] + pub image_uri: Option, +} + +/// Theme is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Theme { +/// Schema: length>=5 + #[serde(rename = "uid")] + pub uid: Nanoid, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "description")] + pub description: String, +/// Schema: length=3..60; pattern=^[a-z](?:[a-z0-9-]*[a-z0-9])?$ + #[serde(rename = "slug")] + pub slug: Slug, +} + +pub type Timestamp = Timestamp; + +/// Uid is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Uid { +/// Schema: length>=5 + #[serde(rename = "uid")] + pub uid: Nanoid, +} + +/// User is a generated model. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct User { +/// Schema: length>=5 + #[serde(rename = "uid")] + pub uid: Nanoid, + #[serde(rename = "createdAt")] + pub created_at: Timestamp, + #[serde(rename = "updatedAt")] + pub updated_at: Timestamp, +/// Schema: pattern=^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$ + #[serde(rename = "email")] + pub email: Email, + #[serde(rename = "theme", skip_serializing_if = "Option::is_none")] + pub theme: Option, + #[serde(rename = "activeTeamId", skip_serializing_if = "Option::is_none")] + pub active_team_id: Option, + #[serde(rename = "hasGithub")] + pub has_github: bool, + #[serde(rename = "teams")] + pub teams: Vec, +} + +pub type Version = Version; + diff --git a/src/prelude.rs b/src/prelude.rs new file mode 100644 index 0000000..1831c25 --- /dev/null +++ b/src/prelude.rs @@ -0,0 +1,18 @@ +//! Common imports for generated SDK consumers. + +pub use crate::client::{ScalarApiClient, ScalarApiClientBuilder, ScalarApiClientOptions, Environment}; +pub use crate::error::Error; +pub use crate::models::*; +pub use crate::request::{ByteStream, EventStream, Page, RawResponse, RequestOptions, ResultResponse, WebSocketRequest}; +pub use crate::webhooks::*; +pub use crate::resources::registry::*; +pub use crate::resources::schemas::*; +pub use crate::resources::schemas_version::*; +pub use crate::resources::schemas_access_group::*; +pub use crate::resources::login_portals::*; +pub use crate::resources::rules::*; +pub use crate::resources::themes::*; +pub use crate::resources::teams::*; +pub use crate::resources::scalar_docs::*; +pub use crate::resources::namespaces::*; +pub use crate::resources::authentication::*; diff --git a/src/request.rs b/src/request.rs new file mode 100644 index 0000000..e006902 --- /dev/null +++ b/src/request.rs @@ -0,0 +1,561 @@ +use std::collections::HashMap; +use std::marker::PhantomData; +use std::pin::Pin; +use std::task::{Context, Poll}; +use std::time::Duration; + +use bytes::Bytes; +use futures_core::Stream; +use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC}; +use reqwest::header::{HeaderMap, HeaderName, HeaderValue}; +use reqwest::multipart; +use serde::de::DeserializeOwned; +use serde::Serialize; + +use crate::client::ClientInner; +use crate::error::Error; + +/// Per-request options accepted by every generated operation. +#[derive(Clone, Debug, Default)] +pub struct RequestOptions { + pub headers: HeaderMap, + pub query: Vec<(String, String)>, + pub auth_headers: HeaderMap, + pub auth_query: Vec<(String, String)>, + pub timeout: Option, + pub max_retries: Option, + pub idempotency_key: Option, +} + +impl RequestOptions { + pub fn idempotency_key(mut self, value: impl Into) -> Self { + self.idempotency_key = Some(value.into()); + self + } + pub fn header(mut self, name: impl TryInto, value: impl TryInto) -> Self { + if let (Ok(name), Ok(value)) = (name.try_into(), value.try_into()) { + self.headers.insert(name, value); + } + self + } + pub fn query(mut self, name: impl Into, value: impl Into) -> Self { + self.query.push((name.into(), value.into())); + self + } + pub fn auth_header(mut self, name: impl TryInto, value: impl TryInto) -> Self { + if let (Ok(name), Ok(value)) = (name.try_into(), value.try_into()) { + self.auth_headers.insert(name, value); + } + self + } + pub fn auth_query(mut self, name: impl Into, value: impl Into) -> Self { + self.auth_query.push((name.into(), value.into())); + self + } + pub fn timeout(mut self, value: Duration) -> Self { + self.timeout = Some(value); + self + } + pub fn max_retries(mut self, value: usize) -> Self { + self.max_retries = Some(value); + self + } +} + +/// Full response metadata plus a typed parsed body. +#[derive(Clone, Debug)] +pub struct RawResponse { + pub status: reqwest::StatusCode, + pub headers: HeaderMap, + pub body: Bytes, + pub data: T, +} + +/// Status-discriminated response metadata carrying either data or a typed error body. +#[derive(Clone, Debug)] +pub struct ResultResponse { + pub status: reqwest::StatusCode, + pub headers: HeaderMap, + pub body: Bytes, + pub data: Option, + pub error: Option, +} + +/// Cursor-page response affordance for generated paginated endpoints. +#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +pub struct Page { + pub data: Vec, + pub next_cursor: Option, + pub has_next_page: bool, +} + +/// Streaming bytes returned by binary download helpers. +pub struct ByteStream { + content_length: Option, + inner: Pin> + Send>>, +} + +impl ByteStream { + pub(crate) fn new(response: reqwest::Response) -> Self { + Self { content_length: response.content_length(), inner: Box::pin(response.bytes_stream()) } + } + pub fn content_length(&self) -> Option { + self.content_length + } + pub async fn collect(mut self) -> Result, Error> { + let mut out = Vec::new(); + while let Some(chunk) = futures_util::StreamExt::next(&mut self).await { + out.extend_from_slice(&chunk?); + } + Ok(out) + } +} + +impl Stream for ByteStream { + type Item = Result; + fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + match self.inner.as_mut().poll_next(cx) { + Poll::Ready(Some(Ok(bytes))) => Poll::Ready(Some(Ok(bytes))), + Poll::Ready(Some(Err(error))) => Poll::Ready(Some(Err(Error::Transport(error)))), + Poll::Ready(None) => Poll::Ready(None), + Poll::Pending => Poll::Pending, + } + } +} + +/// Descriptor for opening a WebSocket with an application-provided transport. +#[derive(Clone, Debug)] +pub struct WebSocketReconnectOptions { + pub max_attempts: usize, + pub min_delay_ms: u64, + pub max_delay_ms: u64, +} + +#[derive(Clone, Debug)] +pub struct WebSocketHeartbeatOptions { + pub interval_ms: u64, + pub message: Send, +} + +#[derive(Clone, Debug)] +pub struct WebSocketRequest { + pub url: String, + pub headers: HeaderMap, + pub reconnect: Option, + pub heartbeat: Option>, + _receive: PhantomData, +} + +impl WebSocketRequest { + pub fn auth_headers(&self) -> HeaderMap { + self.headers.clone() + } + + pub fn with_reconnect(mut self, options: WebSocketReconnectOptions) -> Self { + self.reconnect = Some(options); + self + } + + pub fn with_heartbeat(mut self, options: WebSocketHeartbeatOptions) -> Self { + self.heartbeat = Some(options); + self + } +} + +/// Streaming response descriptor for SSE and newline-delimited JSON responses. +#[derive(Debug)] +pub struct EventStream { + response: reqwest::Response, + format: StreamFormat, + retry_after: Option, + last_event_id: Option, + last_event_name: Option, + _marker: PhantomData, +} + +impl EventStream { + pub(crate) fn new(response: reqwest::Response, format: StreamFormat) -> Self { + Self { response, format, retry_after: None, last_event_id: None, last_event_name: None, _marker: PhantomData } + } + pub fn format(&self) -> StreamFormat { self.format } + pub fn retry_after(&self) -> Option { self.retry_after } + pub fn last_event_id(&self) -> Option<&str> { self.last_event_id.as_deref() } + pub fn last_event_name(&self) -> Option<&str> { self.last_event_name.as_deref() } + pub fn status(&self) -> reqwest::StatusCode { + self.response.status() + } + pub fn headers(&self) -> &HeaderMap { + self.response.headers() + } +} + +#[derive(Debug, Clone, Copy)] +pub enum StreamFormat { + Sse, + Jsonl, +} + +pub(crate) enum ResponseMode { Json, Text, Binary, Auto } + +#[derive(Clone, Copy, PartialEq, Eq)] +enum RequestBodyMode { Json, Form, Multipart, Binary } + +pub(crate) struct RequestSpec<'a> { + pub method: reqwest::Method, + pub path: &'a str, + pub query: Vec<(String, String)>, + pub cookies: Vec<(String, String)>, + pub headers: HeaderMap, + pub json: Option, + pub bytes: Option, + pub content_type: Option<&'a str>, + pub response_mode: ResponseMode, + pub auth: Option<&'a [&'a str]>, +} + +pub(crate) async fn send_json( + client: &ClientInner, + spec: RequestSpec<'_>, + options: Option, +) -> Result, Error> { + let response = send_bytes(client, spec, options).await?; + if std::any::TypeId::of::() == std::any::TypeId::of::<()>() { + let data = serde_json::from_value(serde_json::Value::Null).map_err(Error::Encode)?; + return Ok(RawResponse { status: response.status, headers: response.headers, body: response.body, data }); + } + let data = serde_json::from_slice(&response.body).map_err(|source| Error::Decode { source, body: response.body.clone() })?; + Ok(RawResponse { status: response.status, headers: response.headers, body: response.body, data }) +} + +pub(crate) async fn send_text( + client: &ClientInner, + spec: RequestSpec<'_>, + options: Option, +) -> Result, Error> { + let response = send_bytes(client, spec, options).await?; + let data = String::from_utf8(response.body.to_vec()).map_err(|error| Error::InvalidRequest(error.to_string()))?; + Ok(RawResponse { status: response.status, headers: response.headers, body: response.body, data }) +} + +pub(crate) async fn send_binary( + client: &ClientInner, + spec: RequestSpec<'_>, + options: Option, +) -> Result, Error> { + let response = send_bytes(client, spec, options).await?; + let data = response.body.clone(); + Ok(RawResponse { status: response.status, headers: response.headers, body: response.body, data }) +} + +async fn send_bytes( + client: &ClientInner, + mut spec: RequestSpec<'_>, + options: Option, +) -> Result, Error> { + let options = options.unwrap_or_default(); + let mut url = format!("{}{}", client.base_url, spec.path); + let mut query = client.auth_query(spec.auth); + query.append(&mut spec.query); + query.extend(options.auth_query.clone()); + query.extend(options.query); + if !query.is_empty() { + let encoded = serde_urlencoded::to_string(&query).map_err(|error| Error::InvalidRequest(error.to_string()))?; + url.push(if url.contains("?") { '&' } else { '?' }); + url.push_str(&encoded); + } + let max_retries = options.max_retries.unwrap_or(client.max_retries); + let mut attempt = 0usize; + loop { + let mut request = client.http_client.request(spec.method.clone(), &url); + if let Some(timeout) = options.timeout { + request = request.timeout(timeout); + } + let mut headers = HeaderMap::new(); + headers.extend(client.default_headers.clone()); + headers.extend(client.auth_headers(spec.auth)); + headers.extend(options.auth_headers.clone()); + headers.extend(spec.headers.clone()); + headers.extend(options.headers.clone()); + if !spec.cookies.is_empty() { + let cookie = cookie_header(&spec.cookies); + let value = HeaderValue::from_str(&cookie).map_err(|error| Error::InvalidRequest(error.to_string()))?; + headers.append(reqwest::header::COOKIE, value); + } + if let Some(idempotency_key) = &options.idempotency_key { + let value = HeaderValue::from_str(idempotency_key).map_err(|error| Error::InvalidRequest(error.to_string()))?; + headers.insert(HeaderName::from_static("idempotency-key"), value); + } + let body_mode = request_body_mode(spec.content_type); + request = request.headers(headers); + if let Some(content_type) = spec.content_type.filter(|_| body_mode != RequestBodyMode::Multipart) { + request = request.header(reqwest::header::CONTENT_TYPE, content_type); + } + if let Some(json) = &spec.json { + request = match body_mode { + RequestBodyMode::Form => request.form(&value_to_pairs(json)), + RequestBodyMode::Multipart => request.multipart(value_to_multipart(json)), + RequestBodyMode::Binary => request.body(Bytes::from(json.to_string())), + RequestBodyMode::Json => request.json(json), + }; + } else if let Some(bytes) = &spec.bytes { + request = request.body(bytes.clone()); + } + let mut retry_headers: Option = None; + match request.send().await { + Ok(response) => { + let status = response.status(); + let headers = response.headers().clone(); + let body = response.bytes().await.map_err(Error::Transport)?; + if status.is_success() { + return Ok(RawResponse { status, headers, body: body.clone(), data: body }); + } + if attempt >= max_retries || !retryable_status(status) { + return Err(Error::Status { status, headers, body }); + } + retry_headers = Some(headers); + } + Err(error) => { + if attempt >= max_retries { + return Err(Error::Transport(error)); + } + } + } + attempt += 1; + tokio::time::sleep(retry_delay(attempt, retry_headers.as_ref())).await; + } +} + +pub(crate) async fn send_byte_stream( + client: &ClientInner, + mut spec: RequestSpec<'_>, + options: Option, +) -> Result { + let options = options.unwrap_or_default(); + let mut url = format!("{}{}", client.base_url, spec.path); + let mut query = client.auth_query(spec.auth); + query.append(&mut spec.query); + query.extend(options.auth_query.clone()); + query.extend(options.query); + if !query.is_empty() { + let encoded = serde_urlencoded::to_string(&query).map_err(|error| Error::InvalidRequest(error.to_string()))?; + url.push(if url.contains("?") { '&' } else { '?' }); + url.push_str(&encoded); + } + let mut request = client.http_client.request(spec.method.clone(), &url); + let mut headers = HeaderMap::new(); + headers.extend(client.default_headers.clone()); + headers.extend(client.auth_headers(spec.auth)); + headers.extend(options.auth_headers.clone()); + headers.extend(spec.headers.clone()); + headers.extend(options.headers.clone()); + if !spec.cookies.is_empty() { + let cookie = cookie_header(&spec.cookies); + if let Ok(value) = HeaderValue::from_str(&cookie) { + headers.append(reqwest::header::COOKIE, value); + } + } + request = request.headers(headers); + let response = request.send().await.map_err(Error::Transport)?; + if !response.status().is_success() { + let status = response.status(); + let headers = response.headers().clone(); + let body = response.bytes().await.map_err(Error::Transport)?; + return Err(Error::Status { status, headers, body }); + } + Ok(ByteStream::new(response)) +} + +pub(crate) async fn send_stream( + client: &ClientInner, + mut spec: RequestSpec<'_>, + options: Option, + format: StreamFormat, +) -> Result, Error> { + let options = options.unwrap_or_default(); + let mut url = format!("{}{}", client.base_url, spec.path); + let mut query = client.auth_query(spec.auth); + query.append(&mut spec.query); + query.extend(options.auth_query.clone()); + query.extend(options.query); + if !query.is_empty() { + let encoded = serde_urlencoded::to_string(&query).map_err(|error| Error::InvalidRequest(error.to_string()))?; + url.push(if url.contains("?") { '&' } else { '?' }); + url.push_str(&encoded); + } + let mut request = client.http_client.request(spec.method.clone(), &url); + let mut headers = HeaderMap::new(); + headers.extend(client.default_headers.clone()); + headers.extend(client.auth_headers(spec.auth)); + headers.extend(options.auth_headers.clone()); + headers.extend(spec.headers.clone()); + headers.extend(options.headers.clone()); + if !spec.cookies.is_empty() { + let cookie = cookie_header(&spec.cookies); + if let Ok(value) = HeaderValue::from_str(&cookie) { + headers.append(reqwest::header::COOKIE, value); + } + } + let accept = match format { + StreamFormat::Jsonl => "application/x-ndjson", + StreamFormat::Sse => "text/event-stream", + }; + headers.insert(reqwest::header::ACCEPT, HeaderValue::from_static(accept)); + request = request.headers(headers); + let response = request.send().await.map_err(Error::Transport)?; + if !response.status().is_success() { + let status = response.status(); + let headers = response.headers().clone(); + let body = response.bytes().await.map_err(Error::Transport)?; + return Err(Error::Status { status, headers, body }); + } + Ok(EventStream::new(response, format)) +} + +pub(crate) fn websocket_request( + client: &ClientInner, + spec: RequestSpec<'_>, + options: Option, +) -> WebSocketRequest { + let options = options.unwrap_or_default(); + let mut url = format!("{}{}", client.base_url, spec.path); + if url.starts_with("https://") { + url = url.replacen("https://", "wss://", 1); + } else if url.starts_with("http://") { + url = url.replacen("http://", "ws://", 1); + } + let mut headers = HeaderMap::new(); + headers.extend(client.default_headers.clone()); + headers.extend(client.auth_headers(spec.auth)); + headers.extend(options.auth_headers.clone()); + headers.extend(spec.headers.clone()); + headers.extend(options.headers.clone()); + if !spec.cookies.is_empty() { + let cookie = cookie_header(&spec.cookies); + if let Ok(value) = HeaderValue::from_str(&cookie) { + headers.append(reqwest::header::COOKIE, value); + } + } + WebSocketRequest { url, headers, reconnect: None, heartbeat: None, _receive: PhantomData } +} + +fn cookie_header(cookies: &[(String, String)]) -> String { + cookies + .iter() + .map(|(name, value)| { + format!( + "{}={}", + utf8_percent_encode(name, NON_ALPHANUMERIC), + utf8_percent_encode(value, NON_ALPHANUMERIC), + ) + }) + .collect::>() + .join("; ") +} + +fn retryable_status(status: reqwest::StatusCode) -> bool { + matches!(status.as_u16(), 408 | 409 | 429 | 500 | 502 | 503 | 504) +} + +fn request_body_mode(content_type: Option<&str>) -> RequestBodyMode { + let value = content_type.unwrap_or("application/json").to_ascii_lowercase(); + if value.contains("multipart/") { + return RequestBodyMode::Multipart; + } + if value.contains("x-www-form-urlencoded") { + return RequestBodyMode::Form; + } + if value.contains("json") { + return RequestBodyMode::Json; + } + RequestBodyMode::Binary +} + +fn value_to_pairs(value: &serde_json::Value) -> Vec<(String, String)> { + match value { + serde_json::Value::Object(map) => map.iter().map(|(key, value)| (key.clone(), scalar_string(value.clone()))).collect(), + serde_json::Value::Null => Vec::new(), + other => vec![("body".to_string(), scalar_string(other.clone()))], + } +} + +fn value_to_multipart(value: &serde_json::Value) -> multipart::Form { + let mut form = multipart::Form::new(); + for (key, value) in value_to_pairs(value) { + form = form.text(key, value); + } + form +} + +fn retry_delay(attempt: usize, headers: Option<&HeaderMap>) -> Duration { + if let Some(delay) = headers.and_then(retry_after_delay) { + return delay; + } + let capped = attempt.min(6) as u32; + Duration::from_millis(100 * 2u64.saturating_pow(capped)) +} + +fn retry_after_delay(headers: &HeaderMap) -> Option { + let retry_after_header = headers.get("Retry-After").or_else(|| headers.get(reqwest::header::RETRY_AFTER))?; + let retry_after = retry_after_header.to_str().ok()?.trim(); // retryAfterHeader + if let Ok(seconds) = retry_after.parse::() { + if seconds.is_finite() && seconds >= 0.0 { + return Some(Duration::from_secs_f64(seconds)); + } + } + let retry_at = chrono::DateTime::parse_from_rfc2822(retry_after).ok()?; + let millis = retry_at.timestamp_millis() - chrono::Utc::now().timestamp_millis(); + Some(Duration::from_millis(millis.max(0) as u64)) +} + +pub(crate) fn path_segment(value: impl ToString) -> String { + utf8_percent_encode(&value.to_string(), NON_ALPHANUMERIC).to_string() +} + +pub(crate) fn styled_path_segment(name: &str, value: impl ToString, style: &str) -> String { + let value = path_segment(value); + match style { + "label" => format!(".{}", value), + "matrix" => format!(";{}={}", name, value), + _ => value, + } +} + +pub(crate) fn insert_header(headers: &mut HeaderMap, name: &str, value: impl ToString) -> Result<(), Error> { + let name = HeaderName::from_bytes(name.as_bytes()).map_err(|error| Error::InvalidRequest(error.to_string()))?; + let value = HeaderValue::from_str(&value.to_string()).map_err(|error| Error::InvalidRequest(error.to_string()))?; + headers.insert(name, value); + Ok(()) +} + +pub(crate) fn push_query(query: &mut Vec<(String, String)>, name: &str, value: &T) -> Result<(), Error> { + let value = serde_json::to_value(value).map_err(Error::Encode)?; + match value { + serde_json::Value::Null => {} + serde_json::Value::Array(items) => { + for item in items { + query.push((name.to_string(), scalar_string(item))); + } + } + other => query.push((name.to_string(), scalar_string(other))), + } + Ok(()) +} + +pub(crate) fn push_cookie(cookies: &mut Vec<(String, String)>, name: &str, value: &T) -> Result<(), Error> { + let value = serde_json::to_value(value).map_err(Error::Encode)?; + if !value.is_null() { cookies.push((name.to_string(), scalar_string(value))); } + Ok(()) +} + +fn scalar_string(value: serde_json::Value) -> String { + match value { + serde_json::Value::String(value) => value, + serde_json::Value::Number(value) => value.to_string(), + serde_json::Value::Bool(value) => value.to_string(), + other => other.to_string(), + } +} + +pub(crate) fn object_map() -> HashMap { + HashMap::new() +} diff --git a/src/resources/authentication.rs b/src/resources/authentication.rs new file mode 100644 index 0000000..e07c41a --- /dev/null +++ b/src/resources/authentication.rs @@ -0,0 +1,92 @@ +use std::collections::HashMap; +use std::sync::Arc; + +use bytes::Bytes; +use reqwest::header::HeaderMap; +use serde::{Deserialize, Serialize}; + +use crate::client::ClientInner; +use crate::error::Error; +use crate::models::*; +use crate::request::{self, RawResponse, RequestOptions, RequestSpec}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct AuthenticationexchangePersonalTokenParams { + #[serde(rename = "personalToken")] + pub personal_token: String, + #[serde(skip)] + pub request_options: Option, +} + +/// AuthenticationService groups related API operations. +#[derive(Clone)] +pub struct AuthenticationService { + inner: Arc, +} + +impl AuthenticationService { + pub(crate) fn from_inner(inner: Arc) -> Self { + Self { + inner: inner.clone(), + } + } +/// Exchange an API key for an access token. + pub async fn exchange_personal_token(&self, params: AuthenticationexchangePersonalTokenParams) -> Result { + let response = self.exchange_personal_token_raw(params).await?; + Ok(response.data) + } + + pub async fn exchange_personal_token_raw(&self, params: AuthenticationexchangePersonalTokenParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = "/v1/auth/exchange".to_string(); + let spec = RequestSpec { + method: reqwest::Method::POST, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("personalToken".to_string(), serde_json::to_value(¶ms.personal_token).map_err(Error::Encode)?); + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Get the authenticated user, including their available teams and theme. + pub async fn list_current_user(&self) -> Result { + let response = self.list_current_user_raw().await?; + Ok(response.data) + } + + pub async fn list_current_user_raw(&self) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = "/v1/auth/me".to_string(); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +} + diff --git a/src/resources/login_portals.rs b/src/resources/login_portals.rs new file mode 100644 index 0000000..8a24005 --- /dev/null +++ b/src/resources/login_portals.rs @@ -0,0 +1,196 @@ +use std::collections::HashMap; +use std::sync::Arc; + +use bytes::Bytes; +use reqwest::header::HeaderMap; +use serde::{Deserialize, Serialize}; + +use crate::client::ClientInner; +use crate::error::Error; +use crate::models::*; +use crate::request::{self, RawResponse, RequestOptions, RequestSpec}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct LoginPortalupdateParams { + #[serde(rename = "title", skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(skip)] + pub request_options: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct LoginPortalcreateParams { + #[serde(rename = "title")] + pub title: String, + #[serde(rename = "slug")] + pub slug: String, + #[serde(rename = "email")] + pub email: LoginPortalEmail, + #[serde(rename = "page")] + pub page: LoginPortalPage, + #[serde(skip)] + pub request_options: Option, +} + +/// LoginPortalsService groups related API operations. +#[derive(Clone)] +pub struct LoginPortalsService { + inner: Arc, +} + +impl LoginPortalsService { + pub(crate) fn from_inner(inner: Arc) -> Self { + Self { + inner: inner.clone(), + } + } +/// Get a login portal by slug. + pub async fn retrieve(&self, slug: impl ToString) -> Result { + let response = self.retrieve_raw(slug).await?; + Ok(response.data) + } + + pub async fn retrieve_raw(&self, slug: impl ToString) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/login-portals/{}", request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Update metadata for a login portal. + pub async fn update(&self, slug: impl ToString, params: LoginPortalupdateParams) -> Result { + let response = self.update_raw(slug, params).await?; + Ok(response.data) + } + + pub async fn update_raw(&self, slug: impl ToString, params: LoginPortalupdateParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/login-portals/{}", request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::PATCH, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + if let Some(value) = ¶ms.title { + body.insert("title".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Delete a login portal. + pub async fn delete(&self, slug: impl ToString) -> Result { + let response = self.delete_raw(slug).await?; + Ok(response.data) + } + + pub async fn delete_raw(&self, slug: impl ToString) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/login-portals/{}", request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::DELETE, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Create a login portal for the current team. + pub async fn create(&self, params: LoginPortalcreateParams) -> Result { + let response = self.create_raw(params).await?; + Ok(response.data) + } + + pub async fn create_raw(&self, params: LoginPortalcreateParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = "/v1/login-portals".to_string(); + let spec = RequestSpec { + method: reqwest::Method::POST, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("title".to_string(), serde_json::to_value(¶ms.title).map_err(Error::Encode)?); + body.insert("slug".to_string(), serde_json::to_value(¶ms.slug).map_err(Error::Encode)?); + body.insert("email".to_string(), serde_json::to_value(¶ms.email).map_err(Error::Encode)?); + body.insert("page".to_string(), serde_json::to_value(¶ms.page).map_err(Error::Encode)?); + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// List all login portals for the current team. + pub async fn list(&self) -> Result, Error> { + let response = self.list_raw().await?; + Ok(response.data) + } + + pub async fn list_raw(&self) -> Result>, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = "/v1/login-portals".to_string(); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +} + diff --git a/src/resources/mod.rs b/src/resources/mod.rs new file mode 100644 index 0000000..2c12253 --- /dev/null +++ b/src/resources/mod.rs @@ -0,0 +1,11 @@ +pub mod registry; +pub mod schemas; +pub mod schemas_version; +pub mod schemas_access_group; +pub mod login_portals; +pub mod rules; +pub mod themes; +pub mod teams; +pub mod scalar_docs; +pub mod namespaces; +pub mod authentication; diff --git a/src/resources/namespaces.rs b/src/resources/namespaces.rs new file mode 100644 index 0000000..311c45f --- /dev/null +++ b/src/resources/namespaces.rs @@ -0,0 +1,53 @@ +use std::collections::HashMap; +use std::sync::Arc; + +use bytes::Bytes; +use reqwest::header::HeaderMap; +use serde::{Deserialize, Serialize}; + +use crate::client::ClientInner; +use crate::error::Error; +use crate::models::*; +use crate::request::{self, RawResponse, RequestOptions, RequestSpec}; + +/// NamespacesService groups related API operations. +#[derive(Clone)] +pub struct NamespacesService { + inner: Arc, +} + +impl NamespacesService { + pub(crate) fn from_inner(inner: Arc) -> Self { + Self { + inner: inner.clone(), + } + } +/// Get all namespaces for the current team + pub async fn list(&self) -> Result, Error> { + let response = self.list_raw().await?; + Ok(response.data) + } + + pub async fn list_raw(&self) -> Result>, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = "/v1/namespaces".to_string(); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +} + diff --git a/src/resources/registry.rs b/src/resources/registry.rs new file mode 100644 index 0000000..a15857a --- /dev/null +++ b/src/resources/registry.rs @@ -0,0 +1,481 @@ +use std::collections::HashMap; +use std::sync::Arc; + +use bytes::Bytes; +use reqwest::header::HeaderMap; +use serde::{Deserialize, Serialize}; + +use crate::client::ClientInner; +use crate::error::Error; +use crate::models::*; +use crate::request::{self, RawResponse, RequestOptions, RequestSpec}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RegistrycreateApiDocumentParams { + #[serde(rename = "title")] + pub title: String, + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "version")] + pub version: Version, + #[serde(rename = "slug")] + pub slug: String, + #[serde(rename = "ruleset", skip_serializing_if = "Option::is_none")] + pub ruleset: Option, + #[serde(rename = "isPrivate", skip_serializing_if = "Option::is_none")] + pub is_private: Option, + #[serde(rename = "document")] + pub document: String, + #[serde(skip)] + pub request_options: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RegistryupdateApiDocumentParams { + #[serde(rename = "title", skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "isPrivate", skip_serializing_if = "Option::is_none")] + pub is_private: Option, + #[serde(rename = "ruleset", skip_serializing_if = "Option::is_none")] + pub ruleset: Option, + #[serde(skip)] + pub request_options: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RegistryupdateApiDocumentVersionParams { + #[serde(rename = "document")] + pub document: String, + #[serde(rename = "lastKnownVersionSha", skip_serializing_if = "Option::is_none")] + pub last_known_version_sha: Option, + #[serde(skip)] + pub request_options: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RegistrycreateApiDocumentVersionParams { + #[serde(rename = "version")] + pub version: Version, + #[serde(rename = "document")] + pub document: String, + #[serde(rename = "force", skip_serializing_if = "Option::is_none")] + pub force: Option, + #[serde(rename = "lastKnownVersionSha", skip_serializing_if = "Option::is_none")] + pub last_known_version_sha: Option, + #[serde(skip)] + pub request_options: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RegistrycreateApiDocumentAccessGroupParams { + #[serde(rename = "accessGroupSlug")] + pub access_group_slug: Slug, + #[serde(skip)] + pub request_options: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RegistrydeleteApiDocumentAccessGroupParams { + #[serde(rename = "accessGroupSlug")] + pub access_group_slug: Slug, + #[serde(skip)] + pub request_options: Option, +} + +/// RegistryService groups related API operations. +#[derive(Clone)] +pub struct RegistryService { + inner: Arc, +} + +impl RegistryService { + pub(crate) fn from_inner(inner: Arc) -> Self { + Self { + inner: inner.clone(), + } + } +/// List all API documents across every namespace the caller can access. + pub async fn list_all_api_documents(&self) -> Result, Error> { + let response = self.list_all_api_documents_raw().await?; + Ok(response.data) + } + + pub async fn list_all_api_documents_raw(&self) -> Result>, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = "/v1/apis".to_string(); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// List API documents in a namespace. + pub async fn list_api_documents(&self, namespace: impl ToString) -> Result, Error> { + let response = self.list_api_documents_raw(namespace).await?; + Ok(response.data) + } + + pub async fn list_api_documents_raw(&self, namespace: impl ToString) -> Result>, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/apis/{}", request::path_segment(namespace)); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Create an API document. + pub async fn create_api_document(&self, namespace: impl ToString, params: RegistrycreateApiDocumentParams) -> Result { + let response = self.create_api_document_raw(namespace, params).await?; + Ok(response.data) + } + + pub async fn create_api_document_raw(&self, namespace: impl ToString, params: RegistrycreateApiDocumentParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/apis/{}", request::path_segment(namespace)); + let spec = RequestSpec { + method: reqwest::Method::POST, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("title".to_string(), serde_json::to_value(¶ms.title).map_err(Error::Encode)?); + if let Some(value) = ¶ms.description { + body.insert("description".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + body.insert("version".to_string(), serde_json::to_value(¶ms.version).map_err(Error::Encode)?); + body.insert("slug".to_string(), serde_json::to_value(¶ms.slug).map_err(Error::Encode)?); + if let Some(value) = ¶ms.ruleset { + body.insert("ruleset".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + if let Some(value) = ¶ms.is_private { + body.insert("isPrivate".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + body.insert("document".to_string(), serde_json::to_value(¶ms.document).map_err(Error::Encode)?); + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Update metadata for an API document. + pub async fn update_api_document(&self, namespace: impl ToString, slug: impl ToString, params: RegistryupdateApiDocumentParams) -> Result { + let response = self.update_api_document_raw(namespace, slug, params).await?; + Ok(response.data) + } + + pub async fn update_api_document_raw(&self, namespace: impl ToString, slug: impl ToString, params: RegistryupdateApiDocumentParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/apis/{}/{}", request::path_segment(namespace), request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::PATCH, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + if let Some(value) = ¶ms.title { + body.insert("title".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + if let Some(value) = ¶ms.description { + body.insert("description".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + if let Some(value) = ¶ms.is_private { + body.insert("isPrivate".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + if let Some(value) = ¶ms.ruleset { + body.insert("ruleset".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Delete an API document and all versions. + pub async fn delete_api_document(&self, namespace: impl ToString, slug: impl ToString) -> Result { + let response = self.delete_api_document_raw(namespace, slug).await?; + Ok(response.data) + } + + pub async fn delete_api_document_raw(&self, namespace: impl ToString, slug: impl ToString) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/apis/{}/{}", request::path_segment(namespace), request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::DELETE, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Get a specific API document version. + pub async fn retrieve_api_document_version(&self, namespace: impl ToString, slug: impl ToString, semver: impl ToString) -> Result { + let response = self.retrieve_api_document_version_raw(namespace, slug, semver).await?; + Ok(response.data) + } + + pub async fn retrieve_api_document_version_raw(&self, namespace: impl ToString, slug: impl ToString, semver: impl ToString) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/apis/{}/{}/version/{}", request::path_segment(namespace), request::path_segment(slug), request::path_segment(semver)); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Text, + auth: None, + }; + request::send_text(&inner, spec, request_options).await + } +/// Update the registry file content for an API document version. + pub async fn update_api_document_version(&self, namespace: impl ToString, slug: impl ToString, semver: impl ToString, params: RegistryupdateApiDocumentVersionParams) -> Result { + let response = self.update_api_document_version_raw(namespace, slug, semver, params).await?; + Ok(response.data) + } + + pub async fn update_api_document_version_raw(&self, namespace: impl ToString, slug: impl ToString, semver: impl ToString, params: RegistryupdateApiDocumentVersionParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/apis/{}/{}/version/{}", request::path_segment(namespace), request::path_segment(slug), request::path_segment(semver)); + let spec = RequestSpec { + method: reqwest::Method::PATCH, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("document".to_string(), serde_json::to_value(¶ms.document).map_err(Error::Encode)?); + if let Some(value) = ¶ms.last_known_version_sha { + body.insert("lastKnownVersionSha".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Delete a specific API document version. + pub async fn delete_api_document_version(&self, namespace: impl ToString, slug: impl ToString, semver: impl ToString) -> Result { + let response = self.delete_api_document_version_raw(namespace, slug, semver).await?; + Ok(response.data) + } + + pub async fn delete_api_document_version_raw(&self, namespace: impl ToString, slug: impl ToString, semver: impl ToString) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/apis/{}/{}/version/{}", request::path_segment(namespace), request::path_segment(slug), request::path_segment(semver)); + let spec = RequestSpec { + method: reqwest::Method::DELETE, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Get metadata (uid, content shas, version sha, tags) for a specific API document version. + pub async fn list_api_document_version_metadata(&self, namespace: impl ToString, slug: impl ToString, semver: impl ToString) -> Result { + let response = self.list_api_document_version_metadata_raw(namespace, slug, semver).await?; + Ok(response.data) + } + + pub async fn list_api_document_version_metadata_raw(&self, namespace: impl ToString, slug: impl ToString, semver: impl ToString) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/apis/{}/{}/version/{}/metadata", request::path_segment(namespace), request::path_segment(slug), request::path_segment(semver)); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Create a new API document version. + pub async fn create_api_document_version(&self, namespace: impl ToString, slug: impl ToString, params: RegistrycreateApiDocumentVersionParams) -> Result { + let response = self.create_api_document_version_raw(namespace, slug, params).await?; + Ok(response.data) + } + + pub async fn create_api_document_version_raw(&self, namespace: impl ToString, slug: impl ToString, params: RegistrycreateApiDocumentVersionParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/apis/{}/{}/version", request::path_segment(namespace), request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::POST, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("version".to_string(), serde_json::to_value(¶ms.version).map_err(Error::Encode)?); + body.insert("document".to_string(), serde_json::to_value(¶ms.document).map_err(Error::Encode)?); + if let Some(value) = ¶ms.force { + body.insert("force".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + if let Some(value) = ¶ms.last_known_version_sha { + body.insert("lastKnownVersionSha".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Add an access group to an API document. + pub async fn create_api_document_access_group(&self, namespace: impl ToString, slug: impl ToString, params: RegistrycreateApiDocumentAccessGroupParams) -> Result { + let response = self.create_api_document_access_group_raw(namespace, slug, params).await?; + Ok(response.data) + } + + pub async fn create_api_document_access_group_raw(&self, namespace: impl ToString, slug: impl ToString, params: RegistrycreateApiDocumentAccessGroupParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/apis/{}/{}/access-group", request::path_segment(namespace), request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::POST, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("accessGroupSlug".to_string(), serde_json::to_value(¶ms.access_group_slug).map_err(Error::Encode)?); + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Remove an access group from an API document. + pub async fn delete_api_document_access_group(&self, namespace: impl ToString, slug: impl ToString, params: RegistrydeleteApiDocumentAccessGroupParams) -> Result { + let response = self.delete_api_document_access_group_raw(namespace, slug, params).await?; + Ok(response.data) + } + + pub async fn delete_api_document_access_group_raw(&self, namespace: impl ToString, slug: impl ToString, params: RegistrydeleteApiDocumentAccessGroupParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/apis/{}/{}/access-group", request::path_segment(namespace), request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::DELETE, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("accessGroupSlug".to_string(), serde_json::to_value(¶ms.access_group_slug).map_err(Error::Encode)?); + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +} + diff --git a/src/resources/rules.rs b/src/resources/rules.rs new file mode 100644 index 0000000..5b9d153 --- /dev/null +++ b/src/resources/rules.rs @@ -0,0 +1,301 @@ +use std::collections::HashMap; +use std::sync::Arc; + +use bytes::Bytes; +use reqwest::header::HeaderMap; +use serde::{Deserialize, Serialize}; + +use crate::client::ClientInner; +use crate::error::Error; +use crate::models::*; +use crate::request::{self, RawResponse, RequestOptions, RequestSpec}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RulecreateRulesetParams { + #[serde(rename = "title")] + pub title: String, + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "slug")] + pub slug: String, + #[serde(rename = "isPrivate", skip_serializing_if = "Option::is_none")] + pub is_private: Option, + #[serde(rename = "document")] + pub document: String, + #[serde(skip)] + pub request_options: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RuleupdateRulesetParams { + #[serde(rename = "namespace", skip_serializing_if = "Option::is_none")] + pub namespace: Option, + #[serde(rename = "slug", skip_serializing_if = "Option::is_none")] + pub slug: Option, + #[serde(rename = "title", skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "isPrivate", skip_serializing_if = "Option::is_none")] + pub is_private: Option, + #[serde(skip)] + pub request_options: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RulecreateRulesetAccessGroupParams { + #[serde(rename = "accessGroupSlug")] + pub access_group_slug: Slug, + #[serde(skip)] + pub request_options: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RuledeleteRulesetAccessGroupParams { + #[serde(rename = "accessGroupSlug")] + pub access_group_slug: Slug, + #[serde(skip)] + pub request_options: Option, +} + +/// RulesService groups related API operations. +#[derive(Clone)] +pub struct RulesService { + inner: Arc, +} + +impl RulesService { + pub(crate) fn from_inner(inner: Arc) -> Self { + Self { + inner: inner.clone(), + } + } +/// List all rulesets in a namespace. + pub async fn list_rulesets(&self, namespace: impl ToString) -> Result, Error> { + let response = self.list_rulesets_raw(namespace).await?; + Ok(response.data) + } + + pub async fn list_rulesets_raw(&self, namespace: impl ToString) -> Result>, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/rulesets/{}", request::path_segment(namespace)); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Create a rule in a namespace. + pub async fn create_ruleset(&self, namespace: impl ToString, params: RulecreateRulesetParams) -> Result { + let response = self.create_ruleset_raw(namespace, params).await?; + Ok(response.data) + } + + pub async fn create_ruleset_raw(&self, namespace: impl ToString, params: RulecreateRulesetParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/rulesets/{}", request::path_segment(namespace)); + let spec = RequestSpec { + method: reqwest::Method::POST, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("title".to_string(), serde_json::to_value(¶ms.title).map_err(Error::Encode)?); + if let Some(value) = ¶ms.description { + body.insert("description".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + body.insert("slug".to_string(), serde_json::to_value(¶ms.slug).map_err(Error::Encode)?); + if let Some(value) = ¶ms.is_private { + body.insert("isPrivate".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + body.insert("document".to_string(), serde_json::to_value(¶ms.document).map_err(Error::Encode)?); + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Update rule metadata by slug. + pub async fn update_ruleset(&self, namespace: impl ToString, slug: impl ToString, params: RuleupdateRulesetParams) -> Result { + let response = self.update_ruleset_raw(namespace, slug, params).await?; + Ok(response.data) + } + + pub async fn update_ruleset_raw(&self, namespace: impl ToString, slug: impl ToString, params: RuleupdateRulesetParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/rulesets/{}/{}", request::path_segment(namespace), request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::PATCH, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + if let Some(value) = ¶ms.namespace { + body.insert("namespace".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + if let Some(value) = ¶ms.slug { + body.insert("slug".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + if let Some(value) = ¶ms.title { + body.insert("title".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + if let Some(value) = ¶ms.description { + body.insert("description".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + if let Some(value) = ¶ms.is_private { + body.insert("isPrivate".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Delete a rule by slug. + pub async fn delete_ruleset(&self, namespace: impl ToString, slug: impl ToString) -> Result { + let response = self.delete_ruleset_raw(namespace, slug).await?; + Ok(response.data) + } + + pub async fn delete_ruleset_raw(&self, namespace: impl ToString, slug: impl ToString) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/rulesets/{}/{}", request::path_segment(namespace), request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::DELETE, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Get a rule document by slug. + pub async fn retrieve_ruleset_document(&self, namespace: impl ToString, slug: impl ToString) -> Result { + let response = self.retrieve_ruleset_document_raw(namespace, slug).await?; + Ok(response.data) + } + + pub async fn retrieve_ruleset_document_raw(&self, namespace: impl ToString, slug: impl ToString) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/rulesets/{}/{}", request::path_segment(namespace), request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Text, + auth: None, + }; + request::send_text(&inner, spec, request_options).await + } +/// Grant an access group to a rule. + pub async fn create_ruleset_access_group(&self, namespace: impl ToString, slug: impl ToString, params: RulecreateRulesetAccessGroupParams) -> Result { + let response = self.create_ruleset_access_group_raw(namespace, slug, params).await?; + Ok(response.data) + } + + pub async fn create_ruleset_access_group_raw(&self, namespace: impl ToString, slug: impl ToString, params: RulecreateRulesetAccessGroupParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/rulesets/{}/{}/access-group", request::path_segment(namespace), request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::POST, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("accessGroupSlug".to_string(), serde_json::to_value(¶ms.access_group_slug).map_err(Error::Encode)?); + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Remove an access group from a rule. + pub async fn delete_ruleset_access_group(&self, namespace: impl ToString, slug: impl ToString, params: RuledeleteRulesetAccessGroupParams) -> Result { + let response = self.delete_ruleset_access_group_raw(namespace, slug, params).await?; + Ok(response.data) + } + + pub async fn delete_ruleset_access_group_raw(&self, namespace: impl ToString, slug: impl ToString, params: RuledeleteRulesetAccessGroupParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/rulesets/{}/{}/access-group", request::path_segment(namespace), request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::DELETE, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("accessGroupSlug".to_string(), serde_json::to_value(¶ms.access_group_slug).map_err(Error::Encode)?); + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +} + diff --git a/src/resources/scalar_docs.rs b/src/resources/scalar_docs.rs new file mode 100644 index 0000000..e5029de --- /dev/null +++ b/src/resources/scalar_docs.rs @@ -0,0 +1,133 @@ +use std::collections::HashMap; +use std::sync::Arc; + +use bytes::Bytes; +use reqwest::header::HeaderMap; +use serde::{Deserialize, Serialize}; + +use crate::client::ClientInner; +use crate::error::Error; +use crate::models::*; +use crate::request::{self, RawResponse, RequestOptions, RequestSpec}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ScalarDoccreateGuideParams { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "slug", skip_serializing_if = "Option::is_none")] + pub slug: Option, + #[serde(rename = "isPrivate")] + pub is_private: bool, + #[serde(rename = "allowedUsers")] + pub allowed_users: Vec, + #[serde(rename = "allowedDomains")] + pub allowed_domains: Vec, + #[serde(skip)] + pub request_options: Option, +} + +/// ScalarDocsService groups related API operations. +#[derive(Clone)] +pub struct ScalarDocsService { + inner: Arc, +} + +impl ScalarDocsService { + pub(crate) fn from_inner(inner: Arc) -> Self { + Self { + inner: inner.clone(), + } + } +/// List all guide projects. + pub async fn list_guides(&self) -> Result, Error> { + let response = self.list_guides_raw().await?; + Ok(response.data) + } + + pub async fn list_guides_raw(&self) -> Result>, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = "/v1/guides".to_string(); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Create a guide project. + pub async fn create_guide(&self, params: ScalarDoccreateGuideParams) -> Result { + let response = self.create_guide_raw(params).await?; + Ok(response.data) + } + + pub async fn create_guide_raw(&self, params: ScalarDoccreateGuideParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = "/v1/guides".to_string(); + let spec = RequestSpec { + method: reqwest::Method::POST, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("name".to_string(), serde_json::to_value(¶ms.name).map_err(Error::Encode)?); + if let Some(value) = ¶ms.slug { + body.insert("slug".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + body.insert("isPrivate".to_string(), serde_json::to_value(¶ms.is_private).map_err(Error::Encode)?); + body.insert("allowedUsers".to_string(), serde_json::to_value(¶ms.allowed_users).map_err(Error::Encode)?); + body.insert("allowedDomains".to_string(), serde_json::to_value(¶ms.allowed_domains).map_err(Error::Encode)?); + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Start a new publish process. + pub async fn publish_guide(&self, slug: impl ToString) -> Result { + let response = self.publish_guide_raw(slug).await?; + Ok(response.data) + } + + pub async fn publish_guide_raw(&self, slug: impl ToString) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/guides/{}/publish", request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::POST, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +} + diff --git a/src/resources/schemas.rs b/src/resources/schemas.rs new file mode 100644 index 0000000..dfd1c0f --- /dev/null +++ b/src/resources/schemas.rs @@ -0,0 +1,193 @@ +use std::collections::HashMap; +use std::sync::Arc; + +use bytes::Bytes; +use reqwest::header::HeaderMap; +use serde::{Deserialize, Serialize}; + +use crate::client::ClientInner; +use crate::error::Error; +use crate::models::*; +use crate::request::{self, RawResponse, RequestOptions, RequestSpec}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SchemacreateParams { + #[serde(rename = "title")] + pub title: String, + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "version")] + pub version: Version, + #[serde(rename = "slug")] + pub slug: String, + #[serde(rename = "isPrivate", skip_serializing_if = "Option::is_none")] + pub is_private: Option, + #[serde(rename = "document")] + pub document: String, + #[serde(skip)] + pub request_options: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SchemaupdateParams { + #[serde(rename = "title", skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "isPrivate", skip_serializing_if = "Option::is_none")] + pub is_private: Option, + #[serde(skip)] + pub request_options: Option, +} + +/// SchemasService groups related API operations. +#[derive(Clone)] +pub struct SchemasService { + inner: Arc, + pub version: crate::resources::schemas_version::VersionService, + pub access_group: crate::resources::schemas_access_group::AccessGroupService, +} + +impl SchemasService { + pub(crate) fn from_inner(inner: Arc) -> Self { + Self { + inner: inner.clone(), + version: crate::resources::schemas_version::VersionService::from_inner(inner.clone()), + access_group: crate::resources::schemas_access_group::AccessGroupService::from_inner(inner.clone()), + } + } +/// List schemas in a namespace. + pub async fn list(&self, namespace: impl ToString) -> Result, Error> { + let response = self.list_raw(namespace).await?; + Ok(response.data) + } + + pub async fn list_raw(&self, namespace: impl ToString) -> Result>, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/schemas/{}", request::path_segment(namespace)); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Create a schema in a namespace. + pub async fn create(&self, namespace: impl ToString, params: SchemacreateParams) -> Result { + let response = self.create_raw(namespace, params).await?; + Ok(response.data) + } + + pub async fn create_raw(&self, namespace: impl ToString, params: SchemacreateParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/schemas/{}", request::path_segment(namespace)); + let spec = RequestSpec { + method: reqwest::Method::POST, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("title".to_string(), serde_json::to_value(¶ms.title).map_err(Error::Encode)?); + if let Some(value) = ¶ms.description { + body.insert("description".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + body.insert("version".to_string(), serde_json::to_value(¶ms.version).map_err(Error::Encode)?); + body.insert("slug".to_string(), serde_json::to_value(¶ms.slug).map_err(Error::Encode)?); + if let Some(value) = ¶ms.is_private { + body.insert("isPrivate".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + body.insert("document".to_string(), serde_json::to_value(¶ms.document).map_err(Error::Encode)?); + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Update schema metadata. + pub async fn update(&self, namespace: impl ToString, slug: impl ToString, params: SchemaupdateParams) -> Result { + let response = self.update_raw(namespace, slug, params).await?; + Ok(response.data) + } + + pub async fn update_raw(&self, namespace: impl ToString, slug: impl ToString, params: SchemaupdateParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/schemas/{}/{}", request::path_segment(namespace), request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::PATCH, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + if let Some(value) = ¶ms.title { + body.insert("title".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + if let Some(value) = ¶ms.description { + body.insert("description".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + if let Some(value) = ¶ms.is_private { + body.insert("isPrivate".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Delete a schema and all related versions. + pub async fn delete(&self, namespace: impl ToString, slug: impl ToString) -> Result { + let response = self.delete_raw(namespace, slug).await?; + Ok(response.data) + } + + pub async fn delete_raw(&self, namespace: impl ToString, slug: impl ToString) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/schemas/{}/{}", request::path_segment(namespace), request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::DELETE, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +} + diff --git a/src/resources/schemas_access_group.rs b/src/resources/schemas_access_group.rs new file mode 100644 index 0000000..00ed7e2 --- /dev/null +++ b/src/resources/schemas_access_group.rs @@ -0,0 +1,104 @@ +use std::collections::HashMap; +use std::sync::Arc; + +use bytes::Bytes; +use reqwest::header::HeaderMap; +use serde::{Deserialize, Serialize}; + +use crate::client::ClientInner; +use crate::error::Error; +use crate::models::*; +use crate::request::{self, RawResponse, RequestOptions, RequestSpec}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct AccessGroupcreateSchemaParams { + #[serde(rename = "accessGroupSlug")] + pub access_group_slug: Slug, + #[serde(skip)] + pub request_options: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct AccessGroupdeleteSchemaParams { + #[serde(rename = "accessGroupSlug")] + pub access_group_slug: Slug, + #[serde(skip)] + pub request_options: Option, +} + +/// AccessGroupService groups related API operations. +#[derive(Clone)] +pub struct AccessGroupService { + inner: Arc, +} + +impl AccessGroupService { + pub(crate) fn from_inner(inner: Arc) -> Self { + Self { + inner: inner.clone(), + } + } +/// Add an access group to a schema. + pub async fn create_schema(&self, namespace: impl ToString, slug: impl ToString, params: AccessGroupcreateSchemaParams) -> Result { + let response = self.create_schema_raw(namespace, slug, params).await?; + Ok(response.data) + } + + pub async fn create_schema_raw(&self, namespace: impl ToString, slug: impl ToString, params: AccessGroupcreateSchemaParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/schemas/{}/{}/access-group", request::path_segment(namespace), request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::POST, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("accessGroupSlug".to_string(), serde_json::to_value(¶ms.access_group_slug).map_err(Error::Encode)?); + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Remove an access group from a schema. + pub async fn delete_schema(&self, namespace: impl ToString, slug: impl ToString, params: AccessGroupdeleteSchemaParams) -> Result { + let response = self.delete_schema_raw(namespace, slug, params).await?; + Ok(response.data) + } + + pub async fn delete_schema_raw(&self, namespace: impl ToString, slug: impl ToString, params: AccessGroupdeleteSchemaParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/schemas/{}/{}/access-group", request::path_segment(namespace), request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::DELETE, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("accessGroupSlug".to_string(), serde_json::to_value(¶ms.access_group_slug).map_err(Error::Encode)?); + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +} + diff --git a/src/resources/schemas_version.rs b/src/resources/schemas_version.rs new file mode 100644 index 0000000..ff2bb24 --- /dev/null +++ b/src/resources/schemas_version.rs @@ -0,0 +1,122 @@ +use std::collections::HashMap; +use std::sync::Arc; + +use bytes::Bytes; +use reqwest::header::HeaderMap; +use serde::{Deserialize, Serialize}; + +use crate::client::ClientInner; +use crate::error::Error; +use crate::models::*; +use crate::request::{self, RawResponse, RequestOptions, RequestSpec}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct VersioncreateSchemaParams { + #[serde(rename = "version")] + pub version: Version, + #[serde(rename = "document")] + pub document: String, + #[serde(skip)] + pub request_options: Option, +} + +/// VersionService groups related API operations. +#[derive(Clone)] +pub struct VersionService { + inner: Arc, +} + +impl VersionService { + pub(crate) fn from_inner(inner: Arc) -> Self { + Self { + inner: inner.clone(), + } + } +/// Get a specific schema version document. + pub async fn retrieve_schema(&self, namespace: impl ToString, slug: impl ToString, semver: impl ToString) -> Result { + let response = self.retrieve_schema_raw(namespace, slug, semver).await?; + Ok(response.data) + } + + pub async fn retrieve_schema_raw(&self, namespace: impl ToString, slug: impl ToString, semver: impl ToString) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/schemas/{}/{}/version/{}", request::path_segment(namespace), request::path_segment(slug), request::path_segment(semver)); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Text, + auth: None, + }; + request::send_text(&inner, spec, request_options).await + } +/// Delete a schema version. + pub async fn delete_schema(&self, namespace: impl ToString, slug: impl ToString, semver: impl ToString) -> Result { + let response = self.delete_schema_raw(namespace, slug, semver).await?; + Ok(response.data) + } + + pub async fn delete_schema_raw(&self, namespace: impl ToString, slug: impl ToString, semver: impl ToString) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/schemas/{}/{}/version/{}", request::path_segment(namespace), request::path_segment(slug), request::path_segment(semver)); + let spec = RequestSpec { + method: reqwest::Method::DELETE, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Create a schema version. + pub async fn create_schema(&self, namespace: impl ToString, slug: impl ToString, params: VersioncreateSchemaParams) -> Result { + let response = self.create_schema_raw(namespace, slug, params).await?; + Ok(response.data) + } + + pub async fn create_schema_raw(&self, namespace: impl ToString, slug: impl ToString, params: VersioncreateSchemaParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/schemas/{}/{}/version", request::path_segment(namespace), request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::POST, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("version".to_string(), serde_json::to_value(¶ms.version).map_err(Error::Encode)?); + body.insert("document".to_string(), serde_json::to_value(¶ms.document).map_err(Error::Encode)?); + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +} + diff --git a/src/resources/teams.rs b/src/resources/teams.rs new file mode 100644 index 0000000..b6bdd33 --- /dev/null +++ b/src/resources/teams.rs @@ -0,0 +1,53 @@ +use std::collections::HashMap; +use std::sync::Arc; + +use bytes::Bytes; +use reqwest::header::HeaderMap; +use serde::{Deserialize, Serialize}; + +use crate::client::ClientInner; +use crate::error::Error; +use crate::models::*; +use crate::request::{self, RawResponse, RequestOptions, RequestSpec}; + +/// TeamsService groups related API operations. +#[derive(Clone)] +pub struct TeamsService { + inner: Arc, +} + +impl TeamsService { + pub(crate) fn from_inner(inner: Arc) -> Self { + Self { + inner: inner.clone(), + } + } +/// List all available teams + pub async fn list(&self) -> Result, Error> { + let response = self.list_raw().await?; + Ok(response.data) + } + + pub async fn list_raw(&self) -> Result>, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = "/v1/teams".to_string(); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +} + diff --git a/src/resources/themes.rs b/src/resources/themes.rs new file mode 100644 index 0000000..5c2430c --- /dev/null +++ b/src/resources/themes.rs @@ -0,0 +1,242 @@ +use std::collections::HashMap; +use std::sync::Arc; + +use bytes::Bytes; +use reqwest::header::HeaderMap; +use serde::{Deserialize, Serialize}; + +use crate::client::ClientInner; +use crate::error::Error; +use crate::models::*; +use crate::request::{self, RawResponse, RequestOptions, RequestSpec}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ThemecreateParams { + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "slug")] + pub slug: String, + #[serde(rename = "document")] + pub document: String, + #[serde(skip)] + pub request_options: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ThemeupdateParams { + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(skip)] + pub request_options: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ThemereplaceDocumentParams { + #[serde(rename = "document")] + pub document: String, + #[serde(skip)] + pub request_options: Option, +} + +/// ThemesService groups related API operations. +#[derive(Clone)] +pub struct ThemesService { + inner: Arc, +} + +impl ThemesService { + pub(crate) fn from_inner(inner: Arc) -> Self { + Self { + inner: inner.clone(), + } + } +/// List all team themes. + pub async fn list(&self) -> Result, Error> { + let response = self.list_raw().await?; + Ok(response.data) + } + + pub async fn list_raw(&self) -> Result>, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = "/v1/themes".to_string(); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Create a team theme. + pub async fn create(&self, params: ThemecreateParams) -> Result { + let response = self.create_raw(params).await?; + Ok(response.data) + } + + pub async fn create_raw(&self, params: ThemecreateParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = "/v1/themes".to_string(); + let spec = RequestSpec { + method: reqwest::Method::POST, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("name".to_string(), serde_json::to_value(¶ms.name).map_err(Error::Encode)?); + if let Some(value) = ¶ms.description { + body.insert("description".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + body.insert("slug".to_string(), serde_json::to_value(¶ms.slug).map_err(Error::Encode)?); + body.insert("document".to_string(), serde_json::to_value(¶ms.document).map_err(Error::Encode)?); + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Update theme metadata. + pub async fn update(&self, slug: impl ToString, params: ThemeupdateParams) -> Result { + let response = self.update_raw(slug, params).await?; + Ok(response.data) + } + + pub async fn update_raw(&self, slug: impl ToString, params: ThemeupdateParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/themes/{}", request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::PATCH, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + if let Some(value) = ¶ms.name { + body.insert("name".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + if let Some(value) = ¶ms.description { + body.insert("description".to_string(), serde_json::to_value(value).map_err(Error::Encode)?); + } + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Replace the theme document. + pub async fn replace_document(&self, slug: impl ToString, params: ThemereplaceDocumentParams) -> Result { + let response = self.replace_document_raw(slug, params).await?; + Ok(response.data) + } + + pub async fn replace_document_raw(&self, slug: impl ToString, params: ThemereplaceDocumentParams) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let mut cookies = Vec::new(); + let request_options = params.request_options.clone(); + let path = format!("/v1/themes/{}", request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::PUT, + path: path.as_str(), + query, + cookies, + headers, + json: Some({ + let mut body = serde_json::Map::new(); + body.insert("document".to_string(), serde_json::to_value(¶ms.document).map_err(Error::Encode)?); + serde_json::Value::Object(body) + }), + bytes: None, + content_type: Some("application/json"), + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Delete a theme by slug. + pub async fn delete(&self, slug: impl ToString) -> Result { + let response = self.delete_raw(slug).await?; + Ok(response.data) + } + + pub async fn delete_raw(&self, slug: impl ToString) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/themes/{}", request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::DELETE, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Json, + auth: None, + }; + request::send_json::<_>(&inner, spec, request_options).await + } +/// Get the theme document by slug. + pub async fn retrieve(&self, slug: impl ToString) -> Result { + let response = self.retrieve_raw(slug).await?; + Ok(response.data) + } + + pub async fn retrieve_raw(&self, slug: impl ToString) -> Result, Error> { + let inner = self.inner.clone(); + let mut headers = HeaderMap::new(); + let mut query = Vec::new(); + let cookies = Vec::new(); + let request_options = None; + let path = format!("/v1/themes/{}", request::path_segment(slug)); + let spec = RequestSpec { + method: reqwest::Method::GET, + path: path.as_str(), + query, + cookies, + headers, + json: None, + bytes: None, + content_type: None, + response_mode: request::ResponseMode::Text, + auth: None, + }; + request::send_text(&inner, spec, request_options).await + } +} + diff --git a/src/webhooks.rs b/src/webhooks.rs new file mode 100644 index 0000000..ddb398a --- /dev/null +++ b/src/webhooks.rs @@ -0,0 +1,133 @@ +use base64::Engine; +use hmac::{Hmac, Mac}; +use ring::signature; +use serde::{Deserialize, Serialize}; +use sha2::Sha256; +use std::collections::HashSet; +use std::time::{Duration, SystemTime}; +use crate::models::*; + +type HmacSha256 = Hmac; + +pub const WEBHOOK_EVENT_NAMES: &[&str] = &[]; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct WebhookEvent { + #[serde(rename = "type")] + pub type_: String, + pub payload: serde_json::Value, +} + +pub struct WebhookVerifyOptions<'a> { + pub secrets: Vec<&'a str>, + pub public_key: Option<&'a [u8]>, + pub algorithm: &'a str, + pub timestamp: Option, + pub timestamp_tolerance: Option, + pub replay_store: Option<&'a mut HashSet>, + pub replay_id: Option, +} + +impl<'a> Default for WebhookVerifyOptions<'a> { + fn default() -> Self { + Self { secrets: Vec::new(), public_key: None, algorithm: "hmac-sha256", timestamp: None, timestamp_tolerance: None, replay_store: None, replay_id: None } + } +} + +pub fn verify_webhook_signature(payload: &[u8], secret: &str, signature_header: &str) -> bool { + verify_webhook_signature_with_options(payload, signature_header, WebhookVerifyOptions { secrets: vec![secret], ..Default::default() }) +} + +pub fn verify_webhook_signature_with_options(payload: &[u8], signature_header: &str, mut options: WebhookVerifyOptions<'_>) -> bool { + if let (Some(timestamp), Some(tolerance)) = (options.timestamp, options.timestamp_tolerance) { + if SystemTime::now().duration_since(timestamp).unwrap_or_else(|_| timestamp.duration_since(SystemTime::now()).unwrap_or_default()) > tolerance { + return false; + } + } + if let Some(store) = options.replay_store.as_mut() { + let replay_id = options.replay_id.clone().unwrap_or_else(|| signature_header.to_string()); + if store.contains(&replay_id) { return false; } + store.insert(replay_id); + } + if options.algorithm != "hmac-sha256" { + return verify_webhook_asymmetric(payload, options.public_key.unwrap_or_default(), signature_header, options.algorithm); + } + options.secrets.into_iter().any(|secret| verify_webhook_hmac_sha256(payload, secret, signature_header)) +} + +fn verify_webhook_hmac_sha256(payload: &[u8], secret: &str, signature_header: &str) -> bool { + if secret.is_empty() { + return false; + } + let mut mac = HmacSha256::new_from_slice(secret.as_bytes()).expect("HMAC accepts keys of any size"); + mac.update(payload); + let expected = mac.finalize().into_bytes(); + signature_candidates(signature_header).into_iter().any(|candidate| { + decode_signature(&candidate) + .map(|decoded| decoded.len() == expected.len() && constant_time_eq(&decoded, &expected)) + .unwrap_or(false) + }) +} + +pub fn verify_webhook_rsa_sha256(payload: &[u8], public_key: &[u8], signature_header: &str) -> bool { + verify_webhook_asymmetric(payload, public_key, signature_header, "rsa-sha256") +} + +pub fn verify_webhook_ecdsa_sha256(payload: &[u8], public_key: &[u8], signature_header: &str) -> bool { + verify_webhook_asymmetric(payload, public_key, signature_header, "ecdsa-sha256") +} + +pub fn verify_webhook_ed25519(payload: &[u8], public_key: &[u8], signature_header: &str) -> bool { + verify_webhook_asymmetric(payload, public_key, signature_header, "ed25519") +} + +fn verify_webhook_asymmetric(payload: &[u8], public_key: &[u8], signature_header: &str, algorithm: &str) -> bool { + if public_key.is_empty() { return false; } + let verifier: &dyn signature::VerificationAlgorithm = match algorithm { + "rsa-sha256" => &signature::RSA_PKCS1_2048_8192_SHA256, + "ecdsa-sha256" => &signature::ECDSA_P256_SHA256_ASN1, + "ed25519" => &signature::ED25519, + _ => return false, + }; + let key = signature::UnparsedPublicKey::new(verifier, public_key); + signature_candidates(signature_header).into_iter().any(|candidate| decode_signature(&candidate).map(|sig| key.verify(payload, &sig).is_ok()).unwrap_or(false)) +} + +pub fn parse_webhook_event(payload: &[u8], secret: Option<&str>, signature_header: Option<&str>) -> Result { + if let Some(secret) = secret { + let signature = signature_header.ok_or_else(|| "missing webhook signature header".to_string())?; + if !verify_webhook_signature(payload, secret, signature) { + return Err("webhook signature verification failed".to_string()); + } + } + let value: serde_json::Value = serde_json::from_slice(payload).map_err(|error| error.to_string())?; + let event_type = value.get("type").and_then(|value| value.as_str()).ok_or_else(|| "webhook payload is missing discriminator: type".to_string())?; + if !WEBHOOK_EVENT_NAMES.is_empty() && !WEBHOOK_EVENT_NAMES.contains(&event_type) { + return Err(format!("unknown webhook event type: {event_type}")); + } + Ok(WebhookEvent { type_: event_type.to_string(), payload: value }) +} + +fn signature_candidates(header: &str) -> Vec { + header + .split(|c: char| c == ',' || c.is_whitespace()) + .map(|part| part.trim().to_string()) + .filter(|part| !part.starts_with("t=") && !part.starts_with("ts=") && !part.starts_with("timestamp=")) + .map(|part| part.trim_start_matches("sha256=").trim_start_matches("v0=").trim_start_matches("v1=").trim_start_matches("sig=").trim_start_matches("signature=").to_string()) + .filter(|part| !part.is_empty()) + .collect() +} + +fn decode_signature(candidate: &str) -> Option> { + hex::decode(candidate) + .ok() + .or_else(|| base64::engine::general_purpose::STANDARD.decode(candidate).ok()) +} + +fn constant_time_eq(left: &[u8], right: &[u8]) -> bool { + let mut diff = left.len() ^ right.len(); + for index in 0..left.len().max(right.len()) { + diff |= usize::from(*left.get(index).unwrap_or(&0) ^ *right.get(index).unwrap_or(&0)); + } + diff == 0 +}