@openrouter/sdk 0.0.0-beta.4 → 0.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/REACT_QUERY.md +4 -4
- package/README.md +32 -17
- package/dist/{esm/funcs/postCreditsCoinbase.d.ts → commonjs/funcs/creditsPostCreditsCoinbase.d.ts} +2 -2
- package/dist/commonjs/funcs/creditsPostCreditsCoinbase.d.ts.map +1 -0
- package/dist/commonjs/funcs/{postCreditsCoinbase.js → creditsPostCreditsCoinbase.js} +3 -3
- package/dist/commonjs/funcs/creditsPostCreditsCoinbase.js.map +1 -0
- package/dist/commonjs/funcs/{embeddingsPostEmbeddings.d.ts → embeddingsGenerate.d.ts} +2 -2
- package/dist/commonjs/funcs/embeddingsGenerate.d.ts.map +1 -0
- package/dist/commonjs/funcs/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +3 -3
- package/dist/commonjs/funcs/embeddingsGenerate.js.map +1 -0
- package/dist/{esm/funcs/parametersGetParametersAuthorSlug.d.ts → commonjs/funcs/modelGetParametersAuthorSlug.d.ts} +2 -2
- package/dist/commonjs/funcs/modelGetParametersAuthorSlug.d.ts.map +1 -0
- package/dist/commonjs/funcs/{parametersGetParametersAuthorSlug.js → modelGetParametersAuthorSlug.js} +3 -3
- package/dist/commonjs/funcs/modelGetParametersAuthorSlug.js.map +1 -0
- package/dist/commonjs/funcs/oAuthPostAuthKeys.d.ts +17 -0
- package/dist/commonjs/funcs/oAuthPostAuthKeys.d.ts.map +1 -0
- package/dist/commonjs/funcs/oAuthPostAuthKeys.js +116 -0
- package/dist/commonjs/funcs/oAuthPostAuthKeys.js.map +1 -0
- package/dist/commonjs/funcs/oAuthPostAuthKeysCode.d.ts +17 -0
- package/dist/commonjs/funcs/oAuthPostAuthKeysCode.d.ts.map +1 -0
- package/dist/commonjs/funcs/oAuthPostAuthKeysCode.js +116 -0
- package/dist/commonjs/funcs/oAuthPostAuthKeysCode.js.map +1 -0
- package/dist/{esm/funcs/getProviders.d.ts → commonjs/funcs/providersGetProviders.d.ts} +5 -2
- package/dist/commonjs/funcs/providersGetProviders.d.ts.map +1 -0
- package/dist/commonjs/funcs/{getProviders.js → providersGetProviders.js} +6 -3
- package/dist/commonjs/funcs/providersGetProviders.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/models/operations/index.d.ts +2 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/postauthkeys.d.ts +132 -0
- package/dist/commonjs/models/operations/postauthkeys.d.ts.map +1 -0
- package/dist/commonjs/models/operations/postauthkeys.js +175 -0
- package/dist/commonjs/models/operations/postauthkeys.js.map +1 -0
- package/dist/commonjs/models/operations/postauthkeyscode.d.ts +167 -0
- package/dist/commonjs/models/operations/postauthkeyscode.d.ts.map +1 -0
- package/dist/commonjs/models/operations/postauthkeyscode.js +210 -0
- package/dist/commonjs/models/operations/postauthkeyscode.js.map +1 -0
- package/dist/commonjs/react-query/creditsPostCreditsCoinbase.d.ts +21 -0
- package/dist/commonjs/react-query/creditsPostCreditsCoinbase.d.ts.map +1 -0
- package/dist/commonjs/react-query/creditsPostCreditsCoinbase.js +44 -0
- package/dist/commonjs/react-query/creditsPostCreditsCoinbase.js.map +1 -0
- package/dist/commonjs/react-query/embeddingsGenerate.d.ts +23 -0
- package/dist/commonjs/react-query/embeddingsGenerate.d.ts.map +1 -0
- package/dist/commonjs/react-query/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +13 -13
- package/dist/commonjs/react-query/embeddingsGenerate.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +6 -4
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +6 -4
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/react-query/modelGetParametersAuthorSlug.d.ts +38 -0
- package/dist/commonjs/react-query/modelGetParametersAuthorSlug.d.ts.map +1 -0
- package/dist/commonjs/react-query/modelGetParametersAuthorSlug.js +88 -0
- package/dist/commonjs/react-query/modelGetParametersAuthorSlug.js.map +1 -0
- package/dist/commonjs/react-query/oAuthPostAuthKeys.d.ts +23 -0
- package/dist/commonjs/react-query/oAuthPostAuthKeys.d.ts.map +1 -0
- package/dist/commonjs/react-query/oAuthPostAuthKeys.js +47 -0
- package/dist/commonjs/react-query/oAuthPostAuthKeys.js.map +1 -0
- package/dist/commonjs/react-query/oAuthPostAuthKeysCode.d.ts +23 -0
- package/dist/commonjs/react-query/oAuthPostAuthKeysCode.d.ts.map +1 -0
- package/dist/commonjs/react-query/oAuthPostAuthKeysCode.js +47 -0
- package/dist/commonjs/react-query/oAuthPostAuthKeysCode.js.map +1 -0
- package/dist/commonjs/react-query/providersGetProviders.d.ts +23 -0
- package/dist/commonjs/react-query/providersGetProviders.d.ts.map +1 -0
- package/dist/commonjs/react-query/providersGetProviders.js +69 -0
- package/dist/commonjs/react-query/providersGetProviders.js.map +1 -0
- package/dist/commonjs/sdk/credits.d.ts +9 -0
- package/dist/commonjs/sdk/credits.d.ts.map +1 -0
- package/dist/commonjs/sdk/credits.js +19 -0
- package/dist/commonjs/sdk/credits.js.map +1 -0
- package/dist/commonjs/sdk/embeddings.d.ts +1 -1
- package/dist/commonjs/sdk/embeddings.d.ts.map +1 -1
- package/dist/commonjs/sdk/embeddings.js +3 -3
- package/dist/commonjs/sdk/embeddings.js.map +1 -1
- package/dist/commonjs/sdk/{parameters.d.ts → model.d.ts} +2 -2
- package/dist/commonjs/sdk/model.d.ts.map +1 -0
- package/dist/commonjs/sdk/model.js +19 -0
- package/dist/commonjs/sdk/model.js.map +1 -0
- package/dist/commonjs/sdk/oauth.d.ts +19 -0
- package/dist/commonjs/sdk/oauth.d.ts.map +1 -0
- package/dist/commonjs/sdk/oauth.js +32 -0
- package/dist/commonjs/sdk/oauth.js.map +1 -0
- package/dist/commonjs/sdk/providers.d.ts +9 -0
- package/dist/commonjs/sdk/providers.d.ts.map +1 -0
- package/dist/commonjs/sdk/providers.js +19 -0
- package/dist/commonjs/sdk/providers.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +12 -8
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +15 -14
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/{commonjs/funcs/postCreditsCoinbase.d.ts → esm/funcs/creditsPostCreditsCoinbase.d.ts} +2 -2
- package/dist/esm/funcs/creditsPostCreditsCoinbase.d.ts.map +1 -0
- package/dist/esm/funcs/{postCreditsCoinbase.js → creditsPostCreditsCoinbase.js} +2 -2
- package/dist/esm/funcs/creditsPostCreditsCoinbase.js.map +1 -0
- package/dist/esm/funcs/{embeddingsPostEmbeddings.d.ts → embeddingsGenerate.d.ts} +2 -2
- package/dist/esm/funcs/embeddingsGenerate.d.ts.map +1 -0
- package/dist/esm/funcs/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +2 -2
- package/dist/esm/funcs/embeddingsGenerate.js.map +1 -0
- package/dist/{commonjs/funcs/parametersGetParametersAuthorSlug.d.ts → esm/funcs/modelGetParametersAuthorSlug.d.ts} +2 -2
- package/dist/esm/funcs/modelGetParametersAuthorSlug.d.ts.map +1 -0
- package/dist/esm/funcs/{parametersGetParametersAuthorSlug.js → modelGetParametersAuthorSlug.js} +2 -2
- package/dist/esm/funcs/modelGetParametersAuthorSlug.js.map +1 -0
- package/dist/esm/funcs/oAuthPostAuthKeys.d.ts +17 -0
- package/dist/esm/funcs/oAuthPostAuthKeys.d.ts.map +1 -0
- package/dist/esm/funcs/oAuthPostAuthKeys.js +80 -0
- package/dist/esm/funcs/oAuthPostAuthKeys.js.map +1 -0
- package/dist/esm/funcs/oAuthPostAuthKeysCode.d.ts +17 -0
- package/dist/esm/funcs/oAuthPostAuthKeysCode.d.ts.map +1 -0
- package/dist/esm/funcs/oAuthPostAuthKeysCode.js +80 -0
- package/dist/esm/funcs/oAuthPostAuthKeysCode.js.map +1 -0
- package/dist/{commonjs/funcs/getProviders.d.ts → esm/funcs/providersGetProviders.d.ts} +5 -2
- package/dist/esm/funcs/providersGetProviders.d.ts.map +1 -0
- package/dist/esm/funcs/{getProviders.js → providersGetProviders.js} +5 -2
- package/dist/esm/funcs/providersGetProviders.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/models/operations/index.d.ts +2 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/postauthkeys.d.ts +132 -0
- package/dist/esm/models/operations/postauthkeys.d.ts.map +1 -0
- package/dist/esm/models/operations/postauthkeys.js +133 -0
- package/dist/esm/models/operations/postauthkeys.js.map +1 -0
- package/dist/esm/models/operations/postauthkeyscode.d.ts +167 -0
- package/dist/esm/models/operations/postauthkeyscode.d.ts.map +1 -0
- package/dist/esm/models/operations/postauthkeyscode.js +166 -0
- package/dist/esm/models/operations/postauthkeyscode.js.map +1 -0
- package/dist/esm/react-query/creditsPostCreditsCoinbase.d.ts +21 -0
- package/dist/esm/react-query/creditsPostCreditsCoinbase.d.ts.map +1 -0
- package/dist/esm/react-query/{postCreditsCoinbase.js → creditsPostCreditsCoinbase.js} +10 -10
- package/dist/esm/react-query/creditsPostCreditsCoinbase.js.map +1 -0
- package/dist/esm/react-query/embeddingsGenerate.d.ts +23 -0
- package/dist/esm/react-query/embeddingsGenerate.d.ts.map +1 -0
- package/dist/esm/react-query/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +10 -10
- package/dist/esm/react-query/embeddingsGenerate.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +6 -4
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +6 -4
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/react-query/modelGetParametersAuthorSlug.d.ts +38 -0
- package/dist/esm/react-query/modelGetParametersAuthorSlug.d.ts.map +1 -0
- package/dist/esm/react-query/modelGetParametersAuthorSlug.js +78 -0
- package/dist/esm/react-query/modelGetParametersAuthorSlug.js.map +1 -0
- package/dist/esm/react-query/oAuthPostAuthKeys.d.ts +23 -0
- package/dist/esm/react-query/oAuthPostAuthKeys.d.ts.map +1 -0
- package/dist/esm/react-query/oAuthPostAuthKeys.js +42 -0
- package/dist/esm/react-query/oAuthPostAuthKeys.js.map +1 -0
- package/dist/esm/react-query/oAuthPostAuthKeysCode.d.ts +23 -0
- package/dist/esm/react-query/oAuthPostAuthKeysCode.d.ts.map +1 -0
- package/dist/esm/react-query/oAuthPostAuthKeysCode.js +42 -0
- package/dist/esm/react-query/oAuthPostAuthKeysCode.js.map +1 -0
- package/dist/esm/react-query/providersGetProviders.d.ts +23 -0
- package/dist/esm/react-query/providersGetProviders.d.ts.map +1 -0
- package/dist/esm/react-query/providersGetProviders.js +60 -0
- package/dist/esm/react-query/providersGetProviders.js.map +1 -0
- package/dist/esm/sdk/credits.d.ts +9 -0
- package/dist/esm/sdk/credits.d.ts.map +1 -0
- package/dist/esm/sdk/credits.js +15 -0
- package/dist/esm/sdk/credits.js.map +1 -0
- package/dist/esm/sdk/embeddings.d.ts +1 -1
- package/dist/esm/sdk/embeddings.d.ts.map +1 -1
- package/dist/esm/sdk/embeddings.js +3 -3
- package/dist/esm/sdk/embeddings.js.map +1 -1
- package/dist/esm/sdk/{parameters.d.ts → model.d.ts} +2 -2
- package/dist/esm/sdk/model.d.ts.map +1 -0
- package/dist/esm/sdk/{parameters.js → model.js} +4 -4
- package/dist/esm/sdk/model.js.map +1 -0
- package/dist/esm/sdk/oauth.d.ts +19 -0
- package/dist/esm/sdk/oauth.d.ts.map +1 -0
- package/dist/esm/sdk/oauth.js +28 -0
- package/dist/esm/sdk/oauth.js.map +1 -0
- package/dist/esm/sdk/providers.d.ts +9 -0
- package/dist/esm/sdk/providers.d.ts.map +1 -0
- package/dist/esm/sdk/providers.js +15 -0
- package/dist/esm/sdk/providers.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +12 -8
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +15 -14
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/docs/sdks/credits/README.md +95 -0
- package/docs/sdks/embeddings/README.md +8 -8
- package/docs/sdks/{parameters → model}/README.md +12 -12
- package/docs/sdks/oauth/README.md +199 -0
- package/docs/sdks/openrouter/README.md +0 -183
- package/docs/sdks/providers/README.md +104 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/{postCreditsCoinbase.ts → creditsPostCreditsCoinbase.ts} +1 -1
- package/src/funcs/{embeddingsPostEmbeddings.ts → embeddingsGenerate.ts} +1 -1
- package/src/funcs/{parametersGetParametersAuthorSlug.ts → modelGetParametersAuthorSlug.ts} +1 -1
- package/src/funcs/oAuthPostAuthKeys.ts +164 -0
- package/src/funcs/oAuthPostAuthKeysCode.ts +164 -0
- package/src/funcs/{getProviders.ts → providersGetProviders.ts} +4 -1
- package/src/lib/config.ts +3 -3
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/postauthkeys.ts +272 -0
- package/src/models/operations/postauthkeyscode.ts +352 -0
- package/src/react-query/{postCreditsCoinbase.ts → creditsPostCreditsCoinbase.ts} +18 -18
- package/src/react-query/{embeddingsPostEmbeddings.ts → embeddingsGenerate.ts} +18 -19
- package/src/react-query/index.ts +6 -4
- package/src/react-query/{parametersGetParametersAuthorSlug.ts → modelGetParametersAuthorSlug.ts} +29 -34
- package/src/react-query/oAuthPostAuthKeys.ts +88 -0
- package/src/react-query/oAuthPostAuthKeysCode.ts +89 -0
- package/src/react-query/{getProviders.ts → providersGetProviders.ts} +35 -27
- package/src/sdk/credits.ts +26 -0
- package/src/sdk/embeddings.ts +3 -3
- package/src/sdk/{parameters.ts → model.ts} +3 -3
- package/src/sdk/oauth.ts +45 -0
- package/src/sdk/providers.ts +22 -0
- package/src/sdk/sdk.ts +22 -31
- package/dist/commonjs/funcs/embeddingsPostEmbeddings.d.ts.map +0 -1
- package/dist/commonjs/funcs/embeddingsPostEmbeddings.js.map +0 -1
- package/dist/commonjs/funcs/getProviders.d.ts.map +0 -1
- package/dist/commonjs/funcs/getProviders.js.map +0 -1
- package/dist/commonjs/funcs/parametersGetParametersAuthorSlug.d.ts.map +0 -1
- package/dist/commonjs/funcs/parametersGetParametersAuthorSlug.js.map +0 -1
- package/dist/commonjs/funcs/postCreditsCoinbase.d.ts.map +0 -1
- package/dist/commonjs/funcs/postCreditsCoinbase.js.map +0 -1
- package/dist/commonjs/react-query/embeddingsPostEmbeddings.d.ts +0 -23
- package/dist/commonjs/react-query/embeddingsPostEmbeddings.d.ts.map +0 -1
- package/dist/commonjs/react-query/embeddingsPostEmbeddings.js.map +0 -1
- package/dist/commonjs/react-query/getProviders.d.ts +0 -17
- package/dist/commonjs/react-query/getProviders.d.ts.map +0 -1
- package/dist/commonjs/react-query/getProviders.js +0 -63
- package/dist/commonjs/react-query/getProviders.js.map +0 -1
- package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.d.ts +0 -38
- package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.d.ts.map +0 -1
- package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.js +0 -88
- package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.js.map +0 -1
- package/dist/commonjs/react-query/postCreditsCoinbase.d.ts +0 -21
- package/dist/commonjs/react-query/postCreditsCoinbase.d.ts.map +0 -1
- package/dist/commonjs/react-query/postCreditsCoinbase.js +0 -44
- package/dist/commonjs/react-query/postCreditsCoinbase.js.map +0 -1
- package/dist/commonjs/sdk/parameters.d.ts.map +0 -1
- package/dist/commonjs/sdk/parameters.js +0 -19
- package/dist/commonjs/sdk/parameters.js.map +0 -1
- package/dist/esm/funcs/embeddingsPostEmbeddings.d.ts.map +0 -1
- package/dist/esm/funcs/embeddingsPostEmbeddings.js.map +0 -1
- package/dist/esm/funcs/getProviders.d.ts.map +0 -1
- package/dist/esm/funcs/getProviders.js.map +0 -1
- package/dist/esm/funcs/parametersGetParametersAuthorSlug.d.ts.map +0 -1
- package/dist/esm/funcs/parametersGetParametersAuthorSlug.js.map +0 -1
- package/dist/esm/funcs/postCreditsCoinbase.d.ts.map +0 -1
- package/dist/esm/funcs/postCreditsCoinbase.js.map +0 -1
- package/dist/esm/react-query/embeddingsPostEmbeddings.d.ts +0 -23
- package/dist/esm/react-query/embeddingsPostEmbeddings.d.ts.map +0 -1
- package/dist/esm/react-query/embeddingsPostEmbeddings.js.map +0 -1
- package/dist/esm/react-query/getProviders.d.ts +0 -17
- package/dist/esm/react-query/getProviders.d.ts.map +0 -1
- package/dist/esm/react-query/getProviders.js +0 -54
- package/dist/esm/react-query/getProviders.js.map +0 -1
- package/dist/esm/react-query/parametersGetParametersAuthorSlug.d.ts +0 -38
- package/dist/esm/react-query/parametersGetParametersAuthorSlug.d.ts.map +0 -1
- package/dist/esm/react-query/parametersGetParametersAuthorSlug.js +0 -78
- package/dist/esm/react-query/parametersGetParametersAuthorSlug.js.map +0 -1
- package/dist/esm/react-query/postCreditsCoinbase.d.ts +0 -21
- package/dist/esm/react-query/postCreditsCoinbase.d.ts.map +0 -1
- package/dist/esm/react-query/postCreditsCoinbase.js.map +0 -1
- package/dist/esm/sdk/parameters.d.ts.map +0 -1
- package/dist/esm/sdk/parameters.js.map +0 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { OpenRouterCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
21
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
25
|
+
import { Result } from "../types/fp.js";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Exchange authorization code for API key
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Exchange an authorization code from the PKCE flow for a user-controlled API key
|
|
32
|
+
*/
|
|
33
|
+
export function oAuthPostAuthKeys(
|
|
34
|
+
client: OpenRouterCore,
|
|
35
|
+
request?: operations.PostAuthKeysRequest | undefined,
|
|
36
|
+
options?: RequestOptions,
|
|
37
|
+
): APIPromise<
|
|
38
|
+
Result<
|
|
39
|
+
operations.PostAuthKeysResponse,
|
|
40
|
+
| OpenRouterError
|
|
41
|
+
| ResponseValidationError
|
|
42
|
+
| ConnectionError
|
|
43
|
+
| RequestAbortedError
|
|
44
|
+
| RequestTimeoutError
|
|
45
|
+
| InvalidRequestError
|
|
46
|
+
| UnexpectedClientError
|
|
47
|
+
| SDKValidationError
|
|
48
|
+
>
|
|
49
|
+
> {
|
|
50
|
+
return new APIPromise($do(
|
|
51
|
+
client,
|
|
52
|
+
request,
|
|
53
|
+
options,
|
|
54
|
+
));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function $do(
|
|
58
|
+
client: OpenRouterCore,
|
|
59
|
+
request?: operations.PostAuthKeysRequest | undefined,
|
|
60
|
+
options?: RequestOptions,
|
|
61
|
+
): Promise<
|
|
62
|
+
[
|
|
63
|
+
Result<
|
|
64
|
+
operations.PostAuthKeysResponse,
|
|
65
|
+
| OpenRouterError
|
|
66
|
+
| ResponseValidationError
|
|
67
|
+
| ConnectionError
|
|
68
|
+
| RequestAbortedError
|
|
69
|
+
| RequestTimeoutError
|
|
70
|
+
| InvalidRequestError
|
|
71
|
+
| UnexpectedClientError
|
|
72
|
+
| SDKValidationError
|
|
73
|
+
>,
|
|
74
|
+
APICall,
|
|
75
|
+
]
|
|
76
|
+
> {
|
|
77
|
+
const parsed = safeParse(
|
|
78
|
+
request,
|
|
79
|
+
(value) =>
|
|
80
|
+
operations.PostAuthKeysRequest$outboundSchema.optional().parse(value),
|
|
81
|
+
"Input validation failed",
|
|
82
|
+
);
|
|
83
|
+
if (!parsed.ok) {
|
|
84
|
+
return [parsed, { status: "invalid" }];
|
|
85
|
+
}
|
|
86
|
+
const payload = parsed.value;
|
|
87
|
+
const body = payload === undefined
|
|
88
|
+
? null
|
|
89
|
+
: encodeJSON("body", payload, { explode: true });
|
|
90
|
+
|
|
91
|
+
const path = pathToFunc("/auth/keys")();
|
|
92
|
+
|
|
93
|
+
const headers = new Headers(compactMap({
|
|
94
|
+
"Content-Type": "application/json",
|
|
95
|
+
Accept: "application/json",
|
|
96
|
+
}));
|
|
97
|
+
|
|
98
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
99
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
100
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
101
|
+
|
|
102
|
+
const context = {
|
|
103
|
+
options: client._options,
|
|
104
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
105
|
+
operationID: "post_/auth/keys",
|
|
106
|
+
oAuth2Scopes: [],
|
|
107
|
+
|
|
108
|
+
resolvedSecurity: requestSecurity,
|
|
109
|
+
|
|
110
|
+
securitySource: client._options.apiKey,
|
|
111
|
+
retryConfig: options?.retries
|
|
112
|
+
|| client._options.retryConfig
|
|
113
|
+
|| { strategy: "none" },
|
|
114
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const requestRes = client._createRequest(context, {
|
|
118
|
+
security: requestSecurity,
|
|
119
|
+
method: "POST",
|
|
120
|
+
baseURL: options?.serverURL,
|
|
121
|
+
path: path,
|
|
122
|
+
headers: headers,
|
|
123
|
+
body: body,
|
|
124
|
+
userAgent: client._options.userAgent,
|
|
125
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
126
|
+
}, options);
|
|
127
|
+
if (!requestRes.ok) {
|
|
128
|
+
return [requestRes, { status: "invalid" }];
|
|
129
|
+
}
|
|
130
|
+
const req = requestRes.value;
|
|
131
|
+
|
|
132
|
+
const doResult = await client._do(req, {
|
|
133
|
+
context,
|
|
134
|
+
errorCodes: ["4XX", "5XX"],
|
|
135
|
+
retryConfig: context.retryConfig,
|
|
136
|
+
retryCodes: context.retryCodes,
|
|
137
|
+
});
|
|
138
|
+
if (!doResult.ok) {
|
|
139
|
+
return [doResult, { status: "request-error", request: req }];
|
|
140
|
+
}
|
|
141
|
+
const response = doResult.value;
|
|
142
|
+
|
|
143
|
+
const [result] = await M.match<
|
|
144
|
+
operations.PostAuthKeysResponse,
|
|
145
|
+
| OpenRouterError
|
|
146
|
+
| ResponseValidationError
|
|
147
|
+
| ConnectionError
|
|
148
|
+
| RequestAbortedError
|
|
149
|
+
| RequestTimeoutError
|
|
150
|
+
| InvalidRequestError
|
|
151
|
+
| UnexpectedClientError
|
|
152
|
+
| SDKValidationError
|
|
153
|
+
>(
|
|
154
|
+
M.json(200, operations.PostAuthKeysResponse$inboundSchema),
|
|
155
|
+
M.fail("4XX"),
|
|
156
|
+
M.fail("5XX"),
|
|
157
|
+
M.json("default", operations.PostAuthKeysResponse$inboundSchema),
|
|
158
|
+
)(response, req);
|
|
159
|
+
if (!result.ok) {
|
|
160
|
+
return [result, { status: "complete", request: req, response }];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return [result, { status: "complete", request: req, response }];
|
|
164
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { OpenRouterCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
21
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
25
|
+
import { Result } from "../types/fp.js";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Create authorization code
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Create an authorization code for the PKCE flow to generate a user-controlled API key
|
|
32
|
+
*/
|
|
33
|
+
export function oAuthPostAuthKeysCode(
|
|
34
|
+
client: OpenRouterCore,
|
|
35
|
+
request?: operations.PostAuthKeysCodeRequest | undefined,
|
|
36
|
+
options?: RequestOptions,
|
|
37
|
+
): APIPromise<
|
|
38
|
+
Result<
|
|
39
|
+
operations.PostAuthKeysCodeResponse,
|
|
40
|
+
| OpenRouterError
|
|
41
|
+
| ResponseValidationError
|
|
42
|
+
| ConnectionError
|
|
43
|
+
| RequestAbortedError
|
|
44
|
+
| RequestTimeoutError
|
|
45
|
+
| InvalidRequestError
|
|
46
|
+
| UnexpectedClientError
|
|
47
|
+
| SDKValidationError
|
|
48
|
+
>
|
|
49
|
+
> {
|
|
50
|
+
return new APIPromise($do(
|
|
51
|
+
client,
|
|
52
|
+
request,
|
|
53
|
+
options,
|
|
54
|
+
));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function $do(
|
|
58
|
+
client: OpenRouterCore,
|
|
59
|
+
request?: operations.PostAuthKeysCodeRequest | undefined,
|
|
60
|
+
options?: RequestOptions,
|
|
61
|
+
): Promise<
|
|
62
|
+
[
|
|
63
|
+
Result<
|
|
64
|
+
operations.PostAuthKeysCodeResponse,
|
|
65
|
+
| OpenRouterError
|
|
66
|
+
| ResponseValidationError
|
|
67
|
+
| ConnectionError
|
|
68
|
+
| RequestAbortedError
|
|
69
|
+
| RequestTimeoutError
|
|
70
|
+
| InvalidRequestError
|
|
71
|
+
| UnexpectedClientError
|
|
72
|
+
| SDKValidationError
|
|
73
|
+
>,
|
|
74
|
+
APICall,
|
|
75
|
+
]
|
|
76
|
+
> {
|
|
77
|
+
const parsed = safeParse(
|
|
78
|
+
request,
|
|
79
|
+
(value) =>
|
|
80
|
+
operations.PostAuthKeysCodeRequest$outboundSchema.optional().parse(value),
|
|
81
|
+
"Input validation failed",
|
|
82
|
+
);
|
|
83
|
+
if (!parsed.ok) {
|
|
84
|
+
return [parsed, { status: "invalid" }];
|
|
85
|
+
}
|
|
86
|
+
const payload = parsed.value;
|
|
87
|
+
const body = payload === undefined
|
|
88
|
+
? null
|
|
89
|
+
: encodeJSON("body", payload, { explode: true });
|
|
90
|
+
|
|
91
|
+
const path = pathToFunc("/auth/keys/code")();
|
|
92
|
+
|
|
93
|
+
const headers = new Headers(compactMap({
|
|
94
|
+
"Content-Type": "application/json",
|
|
95
|
+
Accept: "application/json",
|
|
96
|
+
}));
|
|
97
|
+
|
|
98
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
99
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
100
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
101
|
+
|
|
102
|
+
const context = {
|
|
103
|
+
options: client._options,
|
|
104
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
105
|
+
operationID: "post_/auth/keys/code",
|
|
106
|
+
oAuth2Scopes: [],
|
|
107
|
+
|
|
108
|
+
resolvedSecurity: requestSecurity,
|
|
109
|
+
|
|
110
|
+
securitySource: client._options.apiKey,
|
|
111
|
+
retryConfig: options?.retries
|
|
112
|
+
|| client._options.retryConfig
|
|
113
|
+
|| { strategy: "none" },
|
|
114
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const requestRes = client._createRequest(context, {
|
|
118
|
+
security: requestSecurity,
|
|
119
|
+
method: "POST",
|
|
120
|
+
baseURL: options?.serverURL,
|
|
121
|
+
path: path,
|
|
122
|
+
headers: headers,
|
|
123
|
+
body: body,
|
|
124
|
+
userAgent: client._options.userAgent,
|
|
125
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
126
|
+
}, options);
|
|
127
|
+
if (!requestRes.ok) {
|
|
128
|
+
return [requestRes, { status: "invalid" }];
|
|
129
|
+
}
|
|
130
|
+
const req = requestRes.value;
|
|
131
|
+
|
|
132
|
+
const doResult = await client._do(req, {
|
|
133
|
+
context,
|
|
134
|
+
errorCodes: ["4XX", "5XX"],
|
|
135
|
+
retryConfig: context.retryConfig,
|
|
136
|
+
retryCodes: context.retryCodes,
|
|
137
|
+
});
|
|
138
|
+
if (!doResult.ok) {
|
|
139
|
+
return [doResult, { status: "request-error", request: req }];
|
|
140
|
+
}
|
|
141
|
+
const response = doResult.value;
|
|
142
|
+
|
|
143
|
+
const [result] = await M.match<
|
|
144
|
+
operations.PostAuthKeysCodeResponse,
|
|
145
|
+
| OpenRouterError
|
|
146
|
+
| ResponseValidationError
|
|
147
|
+
| ConnectionError
|
|
148
|
+
| RequestAbortedError
|
|
149
|
+
| RequestTimeoutError
|
|
150
|
+
| InvalidRequestError
|
|
151
|
+
| UnexpectedClientError
|
|
152
|
+
| SDKValidationError
|
|
153
|
+
>(
|
|
154
|
+
M.json(200, operations.PostAuthKeysCodeResponse$inboundSchema),
|
|
155
|
+
M.fail("4XX"),
|
|
156
|
+
M.fail("5XX"),
|
|
157
|
+
M.json("default", operations.PostAuthKeysCodeResponse$inboundSchema),
|
|
158
|
+
)(response, req);
|
|
159
|
+
if (!result.ok) {
|
|
160
|
+
return [result, { status: "complete", request: req, response }];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return [result, { status: "complete", request: req, response }];
|
|
164
|
+
}
|
|
@@ -23,7 +23,10 @@ import * as operations from "../models/operations/index.js";
|
|
|
23
23
|
import { APICall, APIPromise } from "../types/async.js";
|
|
24
24
|
import { Result } from "../types/fp.js";
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* List all available model providers
|
|
28
|
+
*/
|
|
29
|
+
export function providersGetProviders(
|
|
27
30
|
client: OpenRouterCore,
|
|
28
31
|
options?: RequestOptions,
|
|
29
32
|
): APIPromise<
|
package/src/lib/config.ts
CHANGED
|
@@ -59,8 +59,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
59
59
|
export const SDK_METADATA = {
|
|
60
60
|
language: "typescript",
|
|
61
61
|
openapiDocVersion: "1.0.0",
|
|
62
|
-
sdkVersion: "0.0.0-beta.
|
|
63
|
-
genVersion: "2.
|
|
62
|
+
sdkVersion: "0.0.0-beta.5",
|
|
63
|
+
genVersion: "2.714.1",
|
|
64
64
|
userAgent:
|
|
65
|
-
"speakeasy-sdk/typescript 0.0.0-beta.
|
|
65
|
+
"speakeasy-sdk/typescript 0.0.0-beta.5 2.714.1 1.0.0 @openrouter/sdk",
|
|
66
66
|
} as const;
|
|
@@ -18,6 +18,8 @@ export * from "./getmodelsuser.js";
|
|
|
18
18
|
export * from "./getparametersauthorslug.js";
|
|
19
19
|
export * from "./getproviders.js";
|
|
20
20
|
export * from "./patchkeyshash.js";
|
|
21
|
+
export * from "./postauthkeys.js";
|
|
22
|
+
export * from "./postauthkeyscode.js";
|
|
21
23
|
export * from "./postchatcompletions.js";
|
|
22
24
|
export * from "./postcreditscoinbase.js";
|
|
23
25
|
export * from "./postembeddings.js";
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
import * as models from "../index.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The method used to generate the code challenge
|
|
15
|
+
*/
|
|
16
|
+
export const PostAuthKeysCodeChallengeMethod = {
|
|
17
|
+
S256: "S256",
|
|
18
|
+
Plain: "plain",
|
|
19
|
+
} as const;
|
|
20
|
+
/**
|
|
21
|
+
* The method used to generate the code challenge
|
|
22
|
+
*/
|
|
23
|
+
export type PostAuthKeysCodeChallengeMethod = ClosedEnum<
|
|
24
|
+
typeof PostAuthKeysCodeChallengeMethod
|
|
25
|
+
>;
|
|
26
|
+
|
|
27
|
+
export type PostAuthKeysRequest = {
|
|
28
|
+
/**
|
|
29
|
+
* The authorization code received from the OAuth redirect
|
|
30
|
+
*/
|
|
31
|
+
code: string;
|
|
32
|
+
/**
|
|
33
|
+
* The code verifier if code_challenge was used in the authorization request
|
|
34
|
+
*/
|
|
35
|
+
codeVerifier?: string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* The method used to generate the code challenge
|
|
38
|
+
*/
|
|
39
|
+
codeChallengeMethod?: PostAuthKeysCodeChallengeMethod | undefined;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Successfully exchanged code for an API key
|
|
44
|
+
*/
|
|
45
|
+
export type PostAuthKeysResponseBody = {
|
|
46
|
+
/**
|
|
47
|
+
* The API key to use for OpenRouter requests
|
|
48
|
+
*/
|
|
49
|
+
key: string;
|
|
50
|
+
/**
|
|
51
|
+
* User ID associated with the API key
|
|
52
|
+
*/
|
|
53
|
+
userId: string | null;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type PostAuthKeysResponse =
|
|
57
|
+
| PostAuthKeysResponseBody
|
|
58
|
+
| models.ErrorResponse;
|
|
59
|
+
|
|
60
|
+
/** @internal */
|
|
61
|
+
export const PostAuthKeysCodeChallengeMethod$inboundSchema: z.ZodNativeEnum<
|
|
62
|
+
typeof PostAuthKeysCodeChallengeMethod
|
|
63
|
+
> = z.nativeEnum(PostAuthKeysCodeChallengeMethod);
|
|
64
|
+
|
|
65
|
+
/** @internal */
|
|
66
|
+
export const PostAuthKeysCodeChallengeMethod$outboundSchema: z.ZodNativeEnum<
|
|
67
|
+
typeof PostAuthKeysCodeChallengeMethod
|
|
68
|
+
> = PostAuthKeysCodeChallengeMethod$inboundSchema;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @internal
|
|
72
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
73
|
+
*/
|
|
74
|
+
export namespace PostAuthKeysCodeChallengeMethod$ {
|
|
75
|
+
/** @deprecated use `PostAuthKeysCodeChallengeMethod$inboundSchema` instead. */
|
|
76
|
+
export const inboundSchema = PostAuthKeysCodeChallengeMethod$inboundSchema;
|
|
77
|
+
/** @deprecated use `PostAuthKeysCodeChallengeMethod$outboundSchema` instead. */
|
|
78
|
+
export const outboundSchema = PostAuthKeysCodeChallengeMethod$outboundSchema;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** @internal */
|
|
82
|
+
export const PostAuthKeysRequest$inboundSchema: z.ZodType<
|
|
83
|
+
PostAuthKeysRequest,
|
|
84
|
+
z.ZodTypeDef,
|
|
85
|
+
unknown
|
|
86
|
+
> = z.object({
|
|
87
|
+
code: z.string(),
|
|
88
|
+
code_verifier: z.string().optional(),
|
|
89
|
+
code_challenge_method: PostAuthKeysCodeChallengeMethod$inboundSchema
|
|
90
|
+
.optional(),
|
|
91
|
+
}).transform((v) => {
|
|
92
|
+
return remap$(v, {
|
|
93
|
+
"code_verifier": "codeVerifier",
|
|
94
|
+
"code_challenge_method": "codeChallengeMethod",
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
/** @internal */
|
|
99
|
+
export type PostAuthKeysRequest$Outbound = {
|
|
100
|
+
code: string;
|
|
101
|
+
code_verifier?: string | undefined;
|
|
102
|
+
code_challenge_method?: string | undefined;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/** @internal */
|
|
106
|
+
export const PostAuthKeysRequest$outboundSchema: z.ZodType<
|
|
107
|
+
PostAuthKeysRequest$Outbound,
|
|
108
|
+
z.ZodTypeDef,
|
|
109
|
+
PostAuthKeysRequest
|
|
110
|
+
> = z.object({
|
|
111
|
+
code: z.string(),
|
|
112
|
+
codeVerifier: z.string().optional(),
|
|
113
|
+
codeChallengeMethod: PostAuthKeysCodeChallengeMethod$outboundSchema
|
|
114
|
+
.optional(),
|
|
115
|
+
}).transform((v) => {
|
|
116
|
+
return remap$(v, {
|
|
117
|
+
codeVerifier: "code_verifier",
|
|
118
|
+
codeChallengeMethod: "code_challenge_method",
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @internal
|
|
124
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
125
|
+
*/
|
|
126
|
+
export namespace PostAuthKeysRequest$ {
|
|
127
|
+
/** @deprecated use `PostAuthKeysRequest$inboundSchema` instead. */
|
|
128
|
+
export const inboundSchema = PostAuthKeysRequest$inboundSchema;
|
|
129
|
+
/** @deprecated use `PostAuthKeysRequest$outboundSchema` instead. */
|
|
130
|
+
export const outboundSchema = PostAuthKeysRequest$outboundSchema;
|
|
131
|
+
/** @deprecated use `PostAuthKeysRequest$Outbound` instead. */
|
|
132
|
+
export type Outbound = PostAuthKeysRequest$Outbound;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function postAuthKeysRequestToJSON(
|
|
136
|
+
postAuthKeysRequest: PostAuthKeysRequest,
|
|
137
|
+
): string {
|
|
138
|
+
return JSON.stringify(
|
|
139
|
+
PostAuthKeysRequest$outboundSchema.parse(postAuthKeysRequest),
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function postAuthKeysRequestFromJSON(
|
|
144
|
+
jsonString: string,
|
|
145
|
+
): SafeParseResult<PostAuthKeysRequest, SDKValidationError> {
|
|
146
|
+
return safeParse(
|
|
147
|
+
jsonString,
|
|
148
|
+
(x) => PostAuthKeysRequest$inboundSchema.parse(JSON.parse(x)),
|
|
149
|
+
`Failed to parse 'PostAuthKeysRequest' from JSON`,
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** @internal */
|
|
154
|
+
export const PostAuthKeysResponseBody$inboundSchema: z.ZodType<
|
|
155
|
+
PostAuthKeysResponseBody,
|
|
156
|
+
z.ZodTypeDef,
|
|
157
|
+
unknown
|
|
158
|
+
> = z.object({
|
|
159
|
+
key: z.string(),
|
|
160
|
+
user_id: z.nullable(z.string()),
|
|
161
|
+
}).transform((v) => {
|
|
162
|
+
return remap$(v, {
|
|
163
|
+
"user_id": "userId",
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
/** @internal */
|
|
168
|
+
export type PostAuthKeysResponseBody$Outbound = {
|
|
169
|
+
key: string;
|
|
170
|
+
user_id: string | null;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/** @internal */
|
|
174
|
+
export const PostAuthKeysResponseBody$outboundSchema: z.ZodType<
|
|
175
|
+
PostAuthKeysResponseBody$Outbound,
|
|
176
|
+
z.ZodTypeDef,
|
|
177
|
+
PostAuthKeysResponseBody
|
|
178
|
+
> = z.object({
|
|
179
|
+
key: z.string(),
|
|
180
|
+
userId: z.nullable(z.string()),
|
|
181
|
+
}).transform((v) => {
|
|
182
|
+
return remap$(v, {
|
|
183
|
+
userId: "user_id",
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @internal
|
|
189
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
190
|
+
*/
|
|
191
|
+
export namespace PostAuthKeysResponseBody$ {
|
|
192
|
+
/** @deprecated use `PostAuthKeysResponseBody$inboundSchema` instead. */
|
|
193
|
+
export const inboundSchema = PostAuthKeysResponseBody$inboundSchema;
|
|
194
|
+
/** @deprecated use `PostAuthKeysResponseBody$outboundSchema` instead. */
|
|
195
|
+
export const outboundSchema = PostAuthKeysResponseBody$outboundSchema;
|
|
196
|
+
/** @deprecated use `PostAuthKeysResponseBody$Outbound` instead. */
|
|
197
|
+
export type Outbound = PostAuthKeysResponseBody$Outbound;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export function postAuthKeysResponseBodyToJSON(
|
|
201
|
+
postAuthKeysResponseBody: PostAuthKeysResponseBody,
|
|
202
|
+
): string {
|
|
203
|
+
return JSON.stringify(
|
|
204
|
+
PostAuthKeysResponseBody$outboundSchema.parse(postAuthKeysResponseBody),
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export function postAuthKeysResponseBodyFromJSON(
|
|
209
|
+
jsonString: string,
|
|
210
|
+
): SafeParseResult<PostAuthKeysResponseBody, SDKValidationError> {
|
|
211
|
+
return safeParse(
|
|
212
|
+
jsonString,
|
|
213
|
+
(x) => PostAuthKeysResponseBody$inboundSchema.parse(JSON.parse(x)),
|
|
214
|
+
`Failed to parse 'PostAuthKeysResponseBody' from JSON`,
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** @internal */
|
|
219
|
+
export const PostAuthKeysResponse$inboundSchema: z.ZodType<
|
|
220
|
+
PostAuthKeysResponse,
|
|
221
|
+
z.ZodTypeDef,
|
|
222
|
+
unknown
|
|
223
|
+
> = z.union([
|
|
224
|
+
z.lazy(() => PostAuthKeysResponseBody$inboundSchema),
|
|
225
|
+
models.ErrorResponse$inboundSchema,
|
|
226
|
+
]);
|
|
227
|
+
|
|
228
|
+
/** @internal */
|
|
229
|
+
export type PostAuthKeysResponse$Outbound =
|
|
230
|
+
| PostAuthKeysResponseBody$Outbound
|
|
231
|
+
| models.ErrorResponse$Outbound;
|
|
232
|
+
|
|
233
|
+
/** @internal */
|
|
234
|
+
export const PostAuthKeysResponse$outboundSchema: z.ZodType<
|
|
235
|
+
PostAuthKeysResponse$Outbound,
|
|
236
|
+
z.ZodTypeDef,
|
|
237
|
+
PostAuthKeysResponse
|
|
238
|
+
> = z.union([
|
|
239
|
+
z.lazy(() => PostAuthKeysResponseBody$outboundSchema),
|
|
240
|
+
models.ErrorResponse$outboundSchema,
|
|
241
|
+
]);
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* @internal
|
|
245
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
246
|
+
*/
|
|
247
|
+
export namespace PostAuthKeysResponse$ {
|
|
248
|
+
/** @deprecated use `PostAuthKeysResponse$inboundSchema` instead. */
|
|
249
|
+
export const inboundSchema = PostAuthKeysResponse$inboundSchema;
|
|
250
|
+
/** @deprecated use `PostAuthKeysResponse$outboundSchema` instead. */
|
|
251
|
+
export const outboundSchema = PostAuthKeysResponse$outboundSchema;
|
|
252
|
+
/** @deprecated use `PostAuthKeysResponse$Outbound` instead. */
|
|
253
|
+
export type Outbound = PostAuthKeysResponse$Outbound;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function postAuthKeysResponseToJSON(
|
|
257
|
+
postAuthKeysResponse: PostAuthKeysResponse,
|
|
258
|
+
): string {
|
|
259
|
+
return JSON.stringify(
|
|
260
|
+
PostAuthKeysResponse$outboundSchema.parse(postAuthKeysResponse),
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export function postAuthKeysResponseFromJSON(
|
|
265
|
+
jsonString: string,
|
|
266
|
+
): SafeParseResult<PostAuthKeysResponse, SDKValidationError> {
|
|
267
|
+
return safeParse(
|
|
268
|
+
jsonString,
|
|
269
|
+
(x) => PostAuthKeysResponse$inboundSchema.parse(JSON.parse(x)),
|
|
270
|
+
`Failed to parse 'PostAuthKeysResponse' from JSON`,
|
|
271
|
+
);
|
|
272
|
+
}
|