diff --git a/README.md b/README.md index 1f2b95e..c5a0b4a 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Developer-friendly, idiomatic Typescript SDK for the *access-service-typescript* ## Summary -Scalar API: Public facing api to manage all scalar platform entities +Access Service: Public facing api to manage all scalar platform entities @@ -154,6 +154,10 @@ run(); * [postv1ApisNamespaceSlugAccessGroup](docs/sdks/apidocs/README.md#postv1apisnamespaceslugaccessgroup) - Add API access group * [deletev1ApisNamespaceSlugAccessGroup](docs/sdks/apidocs/README.md#deletev1apisnamespaceslugaccessgroup) - Delete API access group +### [auth](docs/sdks/auth/README.md) + +* [postv1AuthExchange](docs/sdks/auth/README.md#postv1authexchange) - Exchange token + ### [guides](docs/sdks/guides/README.md) * [getv1Guides](docs/sdks/guides/README.md#getv1guides) - List all projects @@ -227,6 +231,7 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md). - [`apiDocsPostv1ApisNamespace`](docs/sdks/apidocs/README.md#postv1apisnamespace) - Create an API - [`apiDocsPostv1ApisNamespaceSlugAccessGroup`](docs/sdks/apidocs/README.md#postv1apisnamespaceslugaccessgroup) - Add API access group - [`apiDocsPostv1ApisNamespaceSlugVersion`](docs/sdks/apidocs/README.md#postv1apisnamespaceslugversion) - Create version +- [`authPostv1AuthExchange`](docs/sdks/auth/README.md#postv1authexchange) - Exchange token - [`guidesGetv1Guides`](docs/sdks/guides/README.md#getv1guides) - List all projects - [`guidesPostv1Guides`](docs/sdks/guides/README.md#postv1guides) - Create new project - [`guidesPostv1GuidesSlugPublish`](docs/sdks/guides/README.md#postv1guidesslugpublish) - Publish project diff --git a/code-samples.yaml b/code-samples.yaml index 96e4863..4a9c277 100644 --- a/code-samples.yaml +++ b/code-samples.yaml @@ -57,6 +57,12 @@ actions: - "lang": "typescript" "label": "getv1ApisNamespaceSlugVersionSemver" "source": "import { Scalar } from \"@scalar/sdk\";\n\nconst scalar = new Scalar({\n bearerAuth: \"\",\n});\n\nasync function run() {\n const result = await scalar.apiDocs.getv1ApisNamespaceSlugVersionSemver({\n namespace: \"\",\n slug: \"\",\n semver: \"\",\n });\n\n console.log(result);\n}\n\nrun();" + - target: $["paths"]["/v1/auth/exchange"]["post"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "postv1AuthExchange" + "source": "import { Scalar } from \"@scalar/sdk\";\n\nconst scalar = new Scalar();\n\nasync function run() {\n const result = await scalar.auth.postv1AuthExchange({\n personalToken: \"\",\n });\n\n console.log(result);\n}\n\nrun();" - target: $["paths"]["/v1/guides"]["get"] update: "x-codeSamples": diff --git a/docs/models/components/security.md b/docs/models/components/security.md index 42f4b22..5389c89 100644 --- a/docs/models/components/security.md +++ b/docs/models/components/security.md @@ -5,13 +5,11 @@ ```typescript import { Security } from "@scalar/sdk/models/components"; -let value: Security = { - bearerAuth: "", -}; +let value: Security = {}; ``` ## Fields | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `bearerAuth` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file +| `bearerAuth` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/embedstatus.md b/docs/models/operations/embedstatus.md new file mode 100644 index 0000000..83d7e4f --- /dev/null +++ b/docs/models/operations/embedstatus.md @@ -0,0 +1,15 @@ +# EmbedStatus + +## Example Usage + +```typescript +import { EmbedStatus } from "@scalar/sdk/models/operations"; + +let value: EmbedStatus = "complete"; +``` + +## Values + +```typescript +"complete" | "failed" +``` \ No newline at end of file diff --git a/docs/models/operations/getv1guidesresponsebody.md b/docs/models/operations/getv1guidesresponsebody.md index 5d791aa..cc35a06 100644 --- a/docs/models/operations/getv1guidesresponsebody.md +++ b/docs/models/operations/getv1guidesresponsebody.md @@ -6,7 +6,6 @@ import { Getv1GuidesResponseBody } from "@scalar/sdk/models/operations"; let value: Getv1GuidesResponseBody = { - uid: "", name: "", }; ``` @@ -15,7 +14,9 @@ let value: Getv1GuidesResponseBody = { | Field | Type | Required | Description | | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `uid` | *string* | :heavy_check_mark: | N/A | +| `uid` | *string* | :heavy_minus_sign: | N/A | +| `createdAt` | *number* | :heavy_minus_sign: | N/A | +| `updatedAt` | *number* | :heavy_minus_sign: | N/A | | `name` | *string* | :heavy_check_mark: | N/A | | `activeDeployment` | [operations.ActiveDeployment](../../models/operations/activedeployment.md) | :heavy_minus_sign: | N/A | | `lastPublished` | *number* | :heavy_minus_sign: | N/A | @@ -25,8 +26,6 @@ let value: Getv1GuidesResponseBody = { | `typesenseId` | *number* | :heavy_minus_sign: | N/A | | `isPrivate` | *boolean* | :heavy_minus_sign: | N/A | | `accessGroups` | *string*[] | :heavy_minus_sign: | N/A | -| `createdAt` | *number* | :heavy_minus_sign: | N/A | -| `updatedAt` | *number* | :heavy_minus_sign: | N/A | | `slug` | *string* | :heavy_minus_sign: | N/A | | `publishStatus` | *string* | :heavy_minus_sign: | N/A | | `publishMessage` | *string* | :heavy_minus_sign: | N/A | diff --git a/docs/models/operations/getv1schemasnamespaceversions.md b/docs/models/operations/getv1schemasnamespaceversions.md index a427691..724df89 100644 --- a/docs/models/operations/getv1schemasnamespaceversions.md +++ b/docs/models/operations/getv1schemasnamespaceversions.md @@ -13,6 +13,6 @@ let value: Getv1SchemasNamespaceVersions = {}; | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | | `uid` | *string* | :heavy_minus_sign: | N/A | -| `version` | *string* | :heavy_minus_sign: | N/A | | `createdAt` | *number* | :heavy_minus_sign: | N/A | -| `updatedAt` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `updatedAt` | *number* | :heavy_minus_sign: | N/A | +| `version` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/postv1authexchangerequestbody.md b/docs/models/operations/postv1authexchangerequestbody.md new file mode 100644 index 0000000..19d0fa0 --- /dev/null +++ b/docs/models/operations/postv1authexchangerequestbody.md @@ -0,0 +1,17 @@ +# Postv1AuthExchangeRequestBody + +## Example Usage + +```typescript +import { Postv1AuthExchangeRequestBody } from "@scalar/sdk/models/operations"; + +let value: Postv1AuthExchangeRequestBody = { + personalToken: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `personalToken` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/postv1authexchangeresponsebody.md b/docs/models/operations/postv1authexchangeresponsebody.md new file mode 100644 index 0000000..58e97e1 --- /dev/null +++ b/docs/models/operations/postv1authexchangeresponsebody.md @@ -0,0 +1,19 @@ +# Postv1AuthExchangeResponseBody + +Default Response + +## Example Usage + +```typescript +import { Postv1AuthExchangeResponseBody } from "@scalar/sdk/models/operations"; + +let value: Postv1AuthExchangeResponseBody = { + accessToken: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `accessToken` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/repository.md b/docs/models/operations/repository.md index 4f17d3b..fbd04a4 100644 --- a/docs/models/operations/repository.md +++ b/docs/models/operations/repository.md @@ -21,4 +21,7 @@ let value: Repository = { | `name` | *string* | :heavy_check_mark: | N/A | | `configPath` | *string* | :heavy_minus_sign: | N/A | | `branch` | *string* | :heavy_minus_sign: | N/A | -| `publishOnMerge` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `publishOnMerge` | *boolean* | :heavy_minus_sign: | N/A | +| `publishPreviews` | *boolean* | :heavy_minus_sign: | N/A | +| `prComments` | *boolean* | :heavy_minus_sign: | N/A | +| `expired` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/versions.md b/docs/models/operations/versions.md index 2707646..d098033 100644 --- a/docs/models/operations/versions.md +++ b/docs/models/operations/versions.md @@ -14,10 +14,11 @@ let value: Versions = { ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `uid` | *string* | :heavy_check_mark: | N/A | -| `createdAt` | *number* | :heavy_check_mark: | N/A | -| `version` | *string* | :heavy_check_mark: | N/A | -| `tags` | *string*[] | :heavy_minus_sign: | N/A | -| `corpusUid` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `uid` | *string* | :heavy_check_mark: | N/A | +| `createdAt` | *number* | :heavy_check_mark: | N/A | +| `version` | *string* | :heavy_check_mark: | N/A | +| `upgraded` | *boolean* | :heavy_minus_sign: | N/A | +| `embedStatus` | [operations.EmbedStatus](../../models/operations/embedstatus.md) | :heavy_minus_sign: | N/A | +| `tags` | *string*[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/sdks/auth/README.md b/docs/sdks/auth/README.md new file mode 100644 index 0000000..aaff14b --- /dev/null +++ b/docs/sdks/auth/README.md @@ -0,0 +1,84 @@ +# Auth +(*auth*) + +## Overview + +Auth + +### Available Operations + +* [postv1AuthExchange](#postv1authexchange) - Exchange token + +## postv1AuthExchange + +Exchange personal token for access platform token + +### Example Usage + +```typescript +import { Scalar } from "@scalar/sdk"; + +const scalar = new Scalar(); + +async function run() { + const result = await scalar.auth.postv1AuthExchange({ + personalToken: "", + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { ScalarCore } from "@scalar/sdk/core.js"; +import { authPostv1AuthExchange } from "@scalar/sdk/funcs/authPostv1AuthExchange.js"; + +// Use `ScalarCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const scalar = new ScalarCore(); + +async function run() { + const res = await authPostv1AuthExchange(scalar, { + personalToken: "", + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("authPostv1AuthExchange failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.Postv1AuthExchangeRequestBody](../../models/operations/postv1authexchangerequestbody.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.Postv1AuthExchangeResponseBody](../../models/operations/postv1authexchangeresponsebody.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------------ | ------------------------------ | ------------------------------ | +| errors.FourHundred | 400 | application/json | +| errors.FourHundredAndOne | 401 | application/json | +| errors.FourHundredAndThree | 403 | application/json | +| errors.FourHundredAndFour | 404 | application/json | +| errors.FourHundredAndTwentyTwo | 422 | application/json | +| errors.FiveHundred | 500 | application/json | +| errors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/scalar/README.md b/docs/sdks/scalar/README.md index 61fa9b1..8bd5d20 100644 --- a/docs/sdks/scalar/README.md +++ b/docs/sdks/scalar/README.md @@ -2,6 +2,6 @@ ## Overview -Scalar API: Public facing api to manage all scalar platform entities +Access Service: Public facing api to manage all scalar platform entities ### Available Operations diff --git a/jsr.json b/jsr.json index 9e97a4f..a82c84d 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "@scalar/sdk", - "version": "0.1.0", + "version": "0.1.1", "exports": { ".": "./src/index.ts", "./models/errors": "./src/models/errors/index.ts", diff --git a/package.json b/package.json index b2a2709..d314934 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@scalar/sdk", - "version": "0.1.0", + "version": "0.1.1", "author": "Scalar", "type": "module", "tshy": { diff --git a/src/funcs/authPostv1AuthExchange.ts b/src/funcs/authPostv1AuthExchange.ts new file mode 100644 index 0000000..70e7620 --- /dev/null +++ b/src/funcs/authPostv1AuthExchange.ts @@ -0,0 +1,184 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { ScalarCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import * as errors from "../models/errors/index.js"; +import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; +import { ScalarError } from "../models/errors/scalarerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Exchange token + * + * @remarks + * Exchange personal token for access platform token + */ +export function authPostv1AuthExchange( + client: ScalarCore, + request: operations.Postv1AuthExchangeRequestBody, + options?: RequestOptions, +): APIPromise< + Result< + operations.Postv1AuthExchangeResponseBody, + | errors.FourHundred + | errors.FourHundredAndOne + | errors.FourHundredAndThree + | errors.FourHundredAndFour + | errors.FourHundredAndTwentyTwo + | errors.FiveHundred + | ScalarError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: ScalarCore, + request: operations.Postv1AuthExchangeRequestBody, + options?: RequestOptions, +): Promise< + [ + Result< + operations.Postv1AuthExchangeResponseBody, + | errors.FourHundred + | errors.FourHundredAndOne + | errors.FourHundredAndThree + | errors.FourHundredAndFour + | errors.FourHundredAndTwentyTwo + | errors.FiveHundred + | ScalarError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => + operations.Postv1AuthExchangeRequestBody$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/auth/exchange")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + })); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "postv1AuthExchange", + oAuth2Scopes: [], + + resolvedSecurity: null, + + securitySource: null, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.Postv1AuthExchangeResponseBody, + | errors.FourHundred + | errors.FourHundredAndOne + | errors.FourHundredAndThree + | errors.FourHundredAndFour + | errors.FourHundredAndTwentyTwo + | errors.FiveHundred + | ScalarError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, operations.Postv1AuthExchangeResponseBody$inboundSchema), + M.jsonErr(400, errors.FourHundred$inboundSchema), + M.jsonErr(401, errors.FourHundredAndOne$inboundSchema), + M.jsonErr(403, errors.FourHundredAndThree$inboundSchema), + M.jsonErr(404, errors.FourHundredAndFour$inboundSchema), + M.jsonErr(422, errors.FourHundredAndTwentyTwo$inboundSchema), + M.jsonErr(500, errors.FiveHundred$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req, { extraFields: responseFields }); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/src/lib/config.ts b/src/lib/config.ts index 386ba0b..92786ad 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -57,8 +57,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", - openapiDocVersion: "0.1.0", - sdkVersion: "0.1.0", + openapiDocVersion: "0.1.1", + sdkVersion: "0.1.1", genVersion: "2.634.2", - userAgent: "speakeasy-sdk/typescript 0.1.0 2.634.2 0.1.0 @scalar/sdk", + userAgent: "speakeasy-sdk/typescript 0.1.1 2.634.2 0.1.1 @scalar/sdk", } as const; diff --git a/src/models/components/security.ts b/src/models/components/security.ts index 2a51ce1..c88c60c 100644 --- a/src/models/components/security.ts +++ b/src/models/components/security.ts @@ -9,7 +9,7 @@ import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Security = { - bearerAuth: string; + bearerAuth?: string | undefined; }; /** @internal */ @@ -18,7 +18,7 @@ export const Security$inboundSchema: z.ZodType< z.ZodTypeDef, unknown > = z.object({ - BearerAuth: z.string(), + BearerAuth: z.string().optional(), }).transform((v) => { return remap$(v, { "BearerAuth": "bearerAuth", @@ -27,7 +27,7 @@ export const Security$inboundSchema: z.ZodType< /** @internal */ export type Security$Outbound = { - BearerAuth: string; + BearerAuth?: string | undefined; }; /** @internal */ @@ -36,7 +36,7 @@ export const Security$outboundSchema: z.ZodType< z.ZodTypeDef, Security > = z.object({ - bearerAuth: z.string(), + bearerAuth: z.string().optional(), }).transform((v) => { return remap$(v, { bearerAuth: "BearerAuth", diff --git a/src/models/operations/getv1apisnamespace.ts b/src/models/operations/getv1apisnamespace.ts index 1d09ce7..f5e17d1 100644 --- a/src/models/operations/getv1apisnamespace.ts +++ b/src/models/operations/getv1apisnamespace.ts @@ -4,6 +4,7 @@ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; @@ -11,12 +12,19 @@ export type Getv1ApisNamespaceRequest = { namespace: string; }; +export const EmbedStatus = { + Complete: "complete", + Failed: "failed", +} as const; +export type EmbedStatus = ClosedEnum; + export type Versions = { uid: string; createdAt: number; version: string; + upgraded?: boolean | undefined; + embedStatus?: EmbedStatus | null | undefined; tags?: Array | undefined; - corpusUid?: string | null | undefined; }; export type ResponseBody = { @@ -85,6 +93,25 @@ export function getv1ApisNamespaceRequestFromJSON( ); } +/** @internal */ +export const EmbedStatus$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(EmbedStatus); + +/** @internal */ +export const EmbedStatus$outboundSchema: z.ZodNativeEnum = + EmbedStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace EmbedStatus$ { + /** @deprecated use `EmbedStatus$inboundSchema` instead. */ + export const inboundSchema = EmbedStatus$inboundSchema; + /** @deprecated use `EmbedStatus$outboundSchema` instead. */ + export const outboundSchema = EmbedStatus$outboundSchema; +} + /** @internal */ export const Versions$inboundSchema: z.ZodType< Versions, @@ -94,8 +121,9 @@ export const Versions$inboundSchema: z.ZodType< uid: z.string(), createdAt: z.number(), version: z.string(), + upgraded: z.boolean().default(false), + embedStatus: z.nullable(EmbedStatus$inboundSchema).optional(), tags: z.array(z.string()).optional(), - corpusUid: z.nullable(z.string()).optional(), }); /** @internal */ @@ -103,8 +131,9 @@ export type Versions$Outbound = { uid: string; createdAt: number; version: string; + upgraded: boolean; + embedStatus?: string | null | undefined; tags?: Array | undefined; - corpusUid?: string | null | undefined; }; /** @internal */ @@ -116,8 +145,9 @@ export const Versions$outboundSchema: z.ZodType< uid: z.string(), createdAt: z.number(), version: z.string(), + upgraded: z.boolean().default(false), + embedStatus: z.nullable(EmbedStatus$outboundSchema).optional(), tags: z.array(z.string()).optional(), - corpusUid: z.nullable(z.string()).optional(), }); /** @@ -153,10 +183,10 @@ export const ResponseBody$inboundSchema: z.ZodType< z.ZodTypeDef, unknown > = z.object({ - uid: z.string().default("amI88WF4as9cEKCly3gmf"), + uid: z.string().default("CiyS1tx4Woh7xpHKxsUiL"), version: z.string(), title: z.string().default(""), - slug: z.string().default("descriptive-toucan-aqxgdb4"), + slug: z.string().default("felicitous-crystal-ctkqos6"), description: z.string().default(""), namespace: z.string(), isPrivate: z.boolean().default(false), @@ -183,10 +213,10 @@ export const ResponseBody$outboundSchema: z.ZodType< z.ZodTypeDef, ResponseBody > = z.object({ - uid: z.string().default("amI88WF4as9cEKCly3gmf"), + uid: z.string().default("CiyS1tx4Woh7xpHKxsUiL"), version: z.string(), title: z.string().default(""), - slug: z.string().default("descriptive-toucan-aqxgdb4"), + slug: z.string().default("felicitous-crystal-ctkqos6"), description: z.string().default(""), namespace: z.string(), isPrivate: z.boolean().default(false), diff --git a/src/models/operations/getv1guides.ts b/src/models/operations/getv1guides.ts index c7bd45c..155d6e8 100644 --- a/src/models/operations/getv1guides.ts +++ b/src/models/operations/getv1guides.ts @@ -20,10 +20,15 @@ export type Repository = { configPath?: string | undefined; branch?: string | undefined; publishOnMerge?: boolean | undefined; + publishPreviews?: boolean | undefined; + prComments?: boolean | undefined; + expired?: boolean | undefined; }; export type Getv1GuidesResponseBody = { - uid: string; + uid?: string | undefined; + createdAt?: number | undefined; + updatedAt?: number | undefined; name: string; activeDeployment?: ActiveDeployment | null | undefined; lastPublished?: number | null | undefined; @@ -33,8 +38,6 @@ export type Getv1GuidesResponseBody = { typesenseId?: number | undefined; isPrivate?: boolean | undefined; accessGroups?: Array | undefined; - createdAt?: number | undefined; - updatedAt?: number | undefined; slug?: string | undefined; publishStatus?: string | undefined; publishMessage?: string | undefined; @@ -113,6 +116,9 @@ export const Repository$inboundSchema: z.ZodType< configPath: z.string().default(""), branch: z.string().default(""), publishOnMerge: z.boolean().default(false), + publishPreviews: z.boolean().default(false), + prComments: z.boolean().default(false), + expired: z.boolean().default(false), }); /** @internal */ @@ -123,6 +129,9 @@ export type Repository$Outbound = { configPath: string; branch: string; publishOnMerge: boolean; + publishPreviews: boolean; + prComments: boolean; + expired: boolean; }; /** @internal */ @@ -137,6 +146,9 @@ export const Repository$outboundSchema: z.ZodType< configPath: z.string().default(""), branch: z.string().default(""), publishOnMerge: z.boolean().default(false), + publishPreviews: z.boolean().default(false), + prComments: z.boolean().default(false), + expired: z.boolean().default(false), }); /** @@ -172,7 +184,9 @@ export const Getv1GuidesResponseBody$inboundSchema: z.ZodType< z.ZodTypeDef, unknown > = z.object({ - uid: z.string(), + uid: z.string().default("wPtEJmUnuUZPNWLjBWNqW"), + createdAt: z.number().int().default(1756935697), + updatedAt: z.number().int().default(1756935697), name: z.string(), activeDeployment: z.nullable(z.lazy(() => ActiveDeployment$inboundSchema)) .optional(), @@ -183,8 +197,6 @@ export const Getv1GuidesResponseBody$inboundSchema: z.ZodType< typesenseId: z.number().optional(), isPrivate: z.boolean().default(false), accessGroups: z.array(z.string()).optional(), - createdAt: z.number().int().default(1749789036), - updatedAt: z.number().int().default(1749789036), slug: z.string().optional(), publishStatus: z.string().default(""), publishMessage: z.string().default(""), @@ -194,6 +206,8 @@ export const Getv1GuidesResponseBody$inboundSchema: z.ZodType< /** @internal */ export type Getv1GuidesResponseBody$Outbound = { uid: string; + createdAt: number; + updatedAt: number; name: string; activeDeployment?: ActiveDeployment$Outbound | null | undefined; lastPublished?: number | null | undefined; @@ -203,8 +217,6 @@ export type Getv1GuidesResponseBody$Outbound = { typesenseId?: number | undefined; isPrivate: boolean; accessGroups?: Array | undefined; - createdAt: number; - updatedAt: number; slug?: string | undefined; publishStatus: string; publishMessage: string; @@ -217,7 +229,9 @@ export const Getv1GuidesResponseBody$outboundSchema: z.ZodType< z.ZodTypeDef, Getv1GuidesResponseBody > = z.object({ - uid: z.string(), + uid: z.string().default("wPtEJmUnuUZPNWLjBWNqW"), + createdAt: z.number().int().default(1756935697), + updatedAt: z.number().int().default(1756935697), name: z.string(), activeDeployment: z.nullable(z.lazy(() => ActiveDeployment$outboundSchema)) .optional(), @@ -228,8 +242,6 @@ export const Getv1GuidesResponseBody$outboundSchema: z.ZodType< typesenseId: z.number().optional(), isPrivate: z.boolean().default(false), accessGroups: z.array(z.string()).optional(), - createdAt: z.number().int().default(1749789036), - updatedAt: z.number().int().default(1749789036), slug: z.string().optional(), publishStatus: z.string().default(""), publishMessage: z.string().default(""), diff --git a/src/models/operations/getv1rulesetsnamespace.ts b/src/models/operations/getv1rulesetsnamespace.ts index add3b63..1939f93 100644 --- a/src/models/operations/getv1rulesetsnamespace.ts +++ b/src/models/operations/getv1rulesetsnamespace.ts @@ -82,10 +82,10 @@ export const Getv1RulesetsNamespaceResponseBody$inboundSchema: z.ZodType< z.ZodTypeDef, unknown > = z.object({ - uid: z.string().default("a4O07DTYy35wPEJBedtFC"), + uid: z.string().default("IvAH525rwBfOMVz0QrKDo"), title: z.string().default(""), description: z.string().default(""), - slug: z.string().default("cheerful-structure-4r3xs45"), + slug: z.string().default("select-vapor-uw2trbi"), namespace: z.string(), isPrivate: z.boolean().default(false), }); @@ -106,10 +106,10 @@ export const Getv1RulesetsNamespaceResponseBody$outboundSchema: z.ZodType< z.ZodTypeDef, Getv1RulesetsNamespaceResponseBody > = z.object({ - uid: z.string().default("a4O07DTYy35wPEJBedtFC"), + uid: z.string().default("IvAH525rwBfOMVz0QrKDo"), title: z.string().default(""), description: z.string().default(""), - slug: z.string().default("cheerful-structure-4r3xs45"), + slug: z.string().default("select-vapor-uw2trbi"), namespace: z.string(), isPrivate: z.boolean().default(false), }); diff --git a/src/models/operations/getv1schemasnamespace.ts b/src/models/operations/getv1schemasnamespace.ts index 8dff8b9..164476f 100644 --- a/src/models/operations/getv1schemasnamespace.ts +++ b/src/models/operations/getv1schemasnamespace.ts @@ -13,9 +13,9 @@ export type Getv1SchemasNamespaceRequest = { export type Getv1SchemasNamespaceVersions = { uid?: string | undefined; - version?: string | undefined; createdAt?: number | undefined; updatedAt?: number | undefined; + version?: string | undefined; }; export type Getv1SchemasNamespaceResponseBody = { @@ -90,18 +90,18 @@ export const Getv1SchemasNamespaceVersions$inboundSchema: z.ZodType< z.ZodTypeDef, unknown > = z.object({ - uid: z.string().default("HbRUPunHKcEEEJyqQKK12"), + uid: z.string().default("gYCFCtsCLKtk5GWx9DNyK"), + createdAt: z.number().int().default(1756935697), + updatedAt: z.number().int().default(1756935697), version: z.string().default("0.0.1"), - createdAt: z.number().default(1749789036), - updatedAt: z.number().default(1749789036), }); /** @internal */ export type Getv1SchemasNamespaceVersions$Outbound = { uid: string; - version: string; createdAt: number; updatedAt: number; + version: string; }; /** @internal */ @@ -110,10 +110,10 @@ export const Getv1SchemasNamespaceVersions$outboundSchema: z.ZodType< z.ZodTypeDef, Getv1SchemasNamespaceVersions > = z.object({ - uid: z.string().default("HbRUPunHKcEEEJyqQKK12"), + uid: z.string().default("gYCFCtsCLKtk5GWx9DNyK"), + createdAt: z.number().int().default(1756935697), + updatedAt: z.number().int().default(1756935697), version: z.string().default("0.0.1"), - createdAt: z.number().default(1749789036), - updatedAt: z.number().default(1749789036), }); /** @@ -155,10 +155,10 @@ export const Getv1SchemasNamespaceResponseBody$inboundSchema: z.ZodType< z.ZodTypeDef, unknown > = z.object({ - uid: z.string().default("EJf7mbMSAiOlgOAR6b06M"), + uid: z.string().default("RE3V55oO1ILdO0pxd2CeR"), title: z.string().default(""), description: z.string().default(""), - slug: z.string().default("commendable-heron-wb1p68i"), + slug: z.string().default("animated-peak-waam2gl"), namespace: z.string(), isPrivate: z.boolean().default(false), versions: z.array(z.lazy(() => Getv1SchemasNamespaceVersions$inboundSchema)), @@ -181,10 +181,10 @@ export const Getv1SchemasNamespaceResponseBody$outboundSchema: z.ZodType< z.ZodTypeDef, Getv1SchemasNamespaceResponseBody > = z.object({ - uid: z.string().default("EJf7mbMSAiOlgOAR6b06M"), + uid: z.string().default("RE3V55oO1ILdO0pxd2CeR"), title: z.string().default(""), description: z.string().default(""), - slug: z.string().default("commendable-heron-wb1p68i"), + slug: z.string().default("animated-peak-waam2gl"), namespace: z.string(), isPrivate: z.boolean().default(false), versions: z.array(z.lazy(() => Getv1SchemasNamespaceVersions$outboundSchema)), diff --git a/src/models/operations/index.ts b/src/models/operations/index.ts index e5a4a7f..47a183e 100644 --- a/src/models/operations/index.ts +++ b/src/models/operations/index.ts @@ -31,6 +31,7 @@ export * from "./patchv1themesslug.js"; export * from "./postv1apisnamespace.js"; export * from "./postv1apisnamespaceslugaccessgroup.js"; export * from "./postv1apisnamespaceslugversion.js"; +export * from "./postv1authexchange.js"; export * from "./postv1guides.js"; export * from "./postv1guidesslugpublish.js"; export * from "./postv1loginportals.js"; diff --git a/src/models/operations/postv1authexchange.ts b/src/models/operations/postv1authexchange.ts new file mode 100644 index 0000000..659ec78 --- /dev/null +++ b/src/models/operations/postv1authexchange.ts @@ -0,0 +1,131 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type Postv1AuthExchangeRequestBody = { + personalToken: string; +}; + +/** + * Default Response + */ +export type Postv1AuthExchangeResponseBody = { + accessToken: string; +}; + +/** @internal */ +export const Postv1AuthExchangeRequestBody$inboundSchema: z.ZodType< + Postv1AuthExchangeRequestBody, + z.ZodTypeDef, + unknown +> = z.object({ + personalToken: z.string(), +}); + +/** @internal */ +export type Postv1AuthExchangeRequestBody$Outbound = { + personalToken: string; +}; + +/** @internal */ +export const Postv1AuthExchangeRequestBody$outboundSchema: z.ZodType< + Postv1AuthExchangeRequestBody$Outbound, + z.ZodTypeDef, + Postv1AuthExchangeRequestBody +> = z.object({ + personalToken: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Postv1AuthExchangeRequestBody$ { + /** @deprecated use `Postv1AuthExchangeRequestBody$inboundSchema` instead. */ + export const inboundSchema = Postv1AuthExchangeRequestBody$inboundSchema; + /** @deprecated use `Postv1AuthExchangeRequestBody$outboundSchema` instead. */ + export const outboundSchema = Postv1AuthExchangeRequestBody$outboundSchema; + /** @deprecated use `Postv1AuthExchangeRequestBody$Outbound` instead. */ + export type Outbound = Postv1AuthExchangeRequestBody$Outbound; +} + +export function postv1AuthExchangeRequestBodyToJSON( + postv1AuthExchangeRequestBody: Postv1AuthExchangeRequestBody, +): string { + return JSON.stringify( + Postv1AuthExchangeRequestBody$outboundSchema.parse( + postv1AuthExchangeRequestBody, + ), + ); +} + +export function postv1AuthExchangeRequestBodyFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Postv1AuthExchangeRequestBody$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Postv1AuthExchangeRequestBody' from JSON`, + ); +} + +/** @internal */ +export const Postv1AuthExchangeResponseBody$inboundSchema: z.ZodType< + Postv1AuthExchangeResponseBody, + z.ZodTypeDef, + unknown +> = z.object({ + accessToken: z.string(), +}); + +/** @internal */ +export type Postv1AuthExchangeResponseBody$Outbound = { + accessToken: string; +}; + +/** @internal */ +export const Postv1AuthExchangeResponseBody$outboundSchema: z.ZodType< + Postv1AuthExchangeResponseBody$Outbound, + z.ZodTypeDef, + Postv1AuthExchangeResponseBody +> = z.object({ + accessToken: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Postv1AuthExchangeResponseBody$ { + /** @deprecated use `Postv1AuthExchangeResponseBody$inboundSchema` instead. */ + export const inboundSchema = Postv1AuthExchangeResponseBody$inboundSchema; + /** @deprecated use `Postv1AuthExchangeResponseBody$outboundSchema` instead. */ + export const outboundSchema = Postv1AuthExchangeResponseBody$outboundSchema; + /** @deprecated use `Postv1AuthExchangeResponseBody$Outbound` instead. */ + export type Outbound = Postv1AuthExchangeResponseBody$Outbound; +} + +export function postv1AuthExchangeResponseBodyToJSON( + postv1AuthExchangeResponseBody: Postv1AuthExchangeResponseBody, +): string { + return JSON.stringify( + Postv1AuthExchangeResponseBody$outboundSchema.parse( + postv1AuthExchangeResponseBody, + ), + ); +} + +export function postv1AuthExchangeResponseBodyFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Postv1AuthExchangeResponseBody$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Postv1AuthExchangeResponseBody' from JSON`, + ); +} diff --git a/src/sdk/auth.ts b/src/sdk/auth.ts new file mode 100644 index 0000000..dc42045 --- /dev/null +++ b/src/sdk/auth.ts @@ -0,0 +1,27 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { authPostv1AuthExchange } from "../funcs/authPostv1AuthExchange.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class Auth extends ClientSDK { + /** + * Exchange token + * + * @remarks + * Exchange personal token for access platform token + */ + async postv1AuthExchange( + request: operations.Postv1AuthExchangeRequestBody, + options?: RequestOptions, + ): Promise { + return unwrapAsync(authPostv1AuthExchange( + this, + request, + options, + )); + } +} diff --git a/src/sdk/sdk.ts b/src/sdk/sdk.ts index 020e2c5..085da00 100644 --- a/src/sdk/sdk.ts +++ b/src/sdk/sdk.ts @@ -4,6 +4,7 @@ import { ClientSDK } from "../lib/sdks.js"; import { APIDocs } from "./apidocs.js"; +import { Auth } from "./auth.js"; import { Guides } from "./guides.js"; import { LoginPortals } from "./loginportals.js"; import { Rules } from "./rules.js"; @@ -40,4 +41,9 @@ export class Scalar extends ClientSDK { get guides(): Guides { return (this._guides ??= new Guides(this._options)); } + + private _auth?: Auth; + get auth(): Auth { + return (this._auth ??= new Auth(this._options)); + } }