@reverbia/sdk 1.0.0 → 1.1.0-next.20251230221037

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.
Files changed (110) hide show
  1. package/README.md +290 -45
  2. package/dist/expo/index.cjs +3428 -0
  3. package/dist/expo/index.d.mts +1217 -0
  4. package/dist/expo/index.d.ts +1217 -0
  5. package/dist/expo/index.mjs +3395 -0
  6. package/dist/index.cjs +972 -0
  7. package/dist/index.d.mts +1514 -0
  8. package/dist/index.d.ts +1514 -0
  9. package/dist/index.mjs +934 -0
  10. package/dist/next/index.cjs +64 -0
  11. package/dist/next/index.d.mts +23 -0
  12. package/dist/next/index.d.ts +23 -0
  13. package/dist/next/index.mjs +39 -0
  14. package/dist/polyfills/index.cjs +61 -0
  15. package/dist/polyfills/index.d.mts +9 -0
  16. package/dist/polyfills/index.d.ts +9 -0
  17. package/dist/polyfills/index.mjs +34 -0
  18. package/dist/react/chunk-KUFGQF6E.mjs +290 -0
  19. package/dist/react/chunk-T56Y62G7.mjs +410 -0
  20. package/dist/react/index.cjs +7982 -0
  21. package/dist/react/index.d.mts +3139 -0
  22. package/dist/react/index.d.ts +3139 -0
  23. package/dist/react/index.mjs +7209 -0
  24. package/dist/react/storage-Z2NBANCK.mjs +29 -0
  25. package/dist/react/useEncryption-5RTXKDNZ.mjs +31 -0
  26. package/dist/vercel/index.cjs +86 -0
  27. package/dist/vercel/index.d.mts +119 -0
  28. package/dist/vercel/index.d.ts +119 -0
  29. package/dist/vercel/index.mjs +57 -0
  30. package/package.json +91 -16
  31. package/dist/cjs/client/client/client.gen.d.ts +0 -2
  32. package/dist/cjs/client/client/client.gen.js +0 -203
  33. package/dist/cjs/client/client/index.d.ts +0 -8
  34. package/dist/cjs/client/client/index.js +0 -16
  35. package/dist/cjs/client/client/types.gen.d.ts +0 -99
  36. package/dist/cjs/client/client/types.gen.js +0 -3
  37. package/dist/cjs/client/client/utils.gen.d.ts +0 -40
  38. package/dist/cjs/client/client/utils.gen.js +0 -314
  39. package/dist/cjs/client/client.gen.d.ts +0 -12
  40. package/dist/cjs/client/client.gen.js +0 -6
  41. package/dist/cjs/client/core/auth.gen.d.ts +0 -18
  42. package/dist/cjs/client/core/auth.gen.js +0 -18
  43. package/dist/cjs/client/core/bodySerializer.gen.d.ts +0 -25
  44. package/dist/cjs/client/core/bodySerializer.gen.js +0 -60
  45. package/dist/cjs/client/core/params.gen.d.ts +0 -43
  46. package/dist/cjs/client/core/params.gen.js +0 -104
  47. package/dist/cjs/client/core/pathSerializer.gen.d.ts +0 -33
  48. package/dist/cjs/client/core/pathSerializer.gen.js +0 -123
  49. package/dist/cjs/client/core/queryKeySerializer.gen.d.ts +0 -18
  50. package/dist/cjs/client/core/queryKeySerializer.gen.js +0 -105
  51. package/dist/cjs/client/core/serverSentEvents.gen.d.ts +0 -71
  52. package/dist/cjs/client/core/serverSentEvents.gen.js +0 -139
  53. package/dist/cjs/client/core/types.gen.d.ts +0 -78
  54. package/dist/cjs/client/core/types.gen.js +0 -3
  55. package/dist/cjs/client/core/utils.gen.d.ts +0 -19
  56. package/dist/cjs/client/core/utils.gen.js +0 -93
  57. package/dist/cjs/client/index.d.ts +0 -2
  58. package/dist/cjs/client/index.js +0 -18
  59. package/dist/cjs/client/sdk.gen.d.ts +0 -27
  60. package/dist/cjs/client/sdk.gen.js +0 -33
  61. package/dist/cjs/client/types.gen.d.ts +0 -120
  62. package/dist/cjs/client/types.gen.js +0 -3
  63. package/dist/esm/client/client/client.gen.d.ts +0 -2
  64. package/dist/esm/client/client/client.gen.js +0 -199
  65. package/dist/esm/client/client/index.d.ts +0 -8
  66. package/dist/esm/client/client/index.js +0 -6
  67. package/dist/esm/client/client/types.gen.d.ts +0 -99
  68. package/dist/esm/client/client/types.gen.js +0 -2
  69. package/dist/esm/client/client/utils.gen.d.ts +0 -40
  70. package/dist/esm/client/client/utils.gen.js +0 -302
  71. package/dist/esm/client/client.gen.d.ts +0 -12
  72. package/dist/esm/client/client.gen.js +0 -3
  73. package/dist/esm/client/core/auth.gen.d.ts +0 -18
  74. package/dist/esm/client/core/auth.gen.js +0 -14
  75. package/dist/esm/client/core/bodySerializer.gen.d.ts +0 -25
  76. package/dist/esm/client/core/bodySerializer.gen.js +0 -57
  77. package/dist/esm/client/core/params.gen.d.ts +0 -43
  78. package/dist/esm/client/core/params.gen.js +0 -100
  79. package/dist/esm/client/core/pathSerializer.gen.d.ts +0 -33
  80. package/dist/esm/client/core/pathSerializer.gen.js +0 -114
  81. package/dist/esm/client/core/queryKeySerializer.gen.d.ts +0 -18
  82. package/dist/esm/client/core/queryKeySerializer.gen.js +0 -99
  83. package/dist/esm/client/core/serverSentEvents.gen.d.ts +0 -71
  84. package/dist/esm/client/core/serverSentEvents.gen.js +0 -135
  85. package/dist/esm/client/core/types.gen.d.ts +0 -78
  86. package/dist/esm/client/core/types.gen.js +0 -2
  87. package/dist/esm/client/core/utils.gen.d.ts +0 -19
  88. package/dist/esm/client/core/utils.gen.js +0 -87
  89. package/dist/esm/client/index.d.ts +0 -2
  90. package/dist/esm/client/index.js +0 -2
  91. package/dist/esm/client/sdk.gen.d.ts +0 -27
  92. package/dist/esm/client/sdk.gen.js +0 -28
  93. package/dist/esm/client/types.gen.d.ts +0 -120
  94. package/dist/esm/client/types.gen.js +0 -2
  95. package/dist/types/client/client/client.gen.d.ts +0 -2
  96. package/dist/types/client/client/index.d.ts +0 -8
  97. package/dist/types/client/client/types.gen.d.ts +0 -99
  98. package/dist/types/client/client/utils.gen.d.ts +0 -40
  99. package/dist/types/client/client.gen.d.ts +0 -12
  100. package/dist/types/client/core/auth.gen.d.ts +0 -18
  101. package/dist/types/client/core/bodySerializer.gen.d.ts +0 -25
  102. package/dist/types/client/core/params.gen.d.ts +0 -43
  103. package/dist/types/client/core/pathSerializer.gen.d.ts +0 -33
  104. package/dist/types/client/core/queryKeySerializer.gen.d.ts +0 -18
  105. package/dist/types/client/core/serverSentEvents.gen.d.ts +0 -71
  106. package/dist/types/client/core/types.gen.d.ts +0 -78
  107. package/dist/types/client/core/utils.gen.d.ts +0 -19
  108. package/dist/types/client/index.d.ts +0 -2
  109. package/dist/types/client/sdk.gen.d.ts +0 -27
  110. package/dist/types/client/types.gen.d.ts +0 -120
@@ -1,135 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
- export const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) => {
3
- let lastEventId;
4
- const sleep = sseSleepFn ??
5
- ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
6
- const createStream = async function* () {
7
- let retryDelay = sseDefaultRetryDelay ?? 3000;
8
- let attempt = 0;
9
- const signal = options.signal ?? new AbortController().signal;
10
- while (true) {
11
- if (signal.aborted)
12
- break;
13
- attempt++;
14
- const headers = options.headers instanceof Headers
15
- ? options.headers
16
- : new Headers(options.headers);
17
- if (lastEventId !== undefined) {
18
- headers.set('Last-Event-ID', lastEventId);
19
- }
20
- try {
21
- const requestInit = {
22
- redirect: 'follow',
23
- ...options,
24
- body: options.serializedBody,
25
- headers,
26
- signal,
27
- };
28
- let request = new Request(url, requestInit);
29
- if (onRequest) {
30
- request = await onRequest(url, requestInit);
31
- }
32
- // fetch must be assigned here, otherwise it would throw the error:
33
- // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
34
- const _fetch = options.fetch ?? globalThis.fetch;
35
- const response = await _fetch(request);
36
- if (!response.ok)
37
- throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
38
- if (!response.body)
39
- throw new Error('No body in SSE response');
40
- const reader = response.body
41
- .pipeThrough(new TextDecoderStream())
42
- .getReader();
43
- let buffer = '';
44
- const abortHandler = () => {
45
- try {
46
- reader.cancel();
47
- }
48
- catch {
49
- // noop
50
- }
51
- };
52
- signal.addEventListener('abort', abortHandler);
53
- try {
54
- while (true) {
55
- const { done, value } = await reader.read();
56
- if (done)
57
- break;
58
- buffer += value;
59
- const chunks = buffer.split('\n\n');
60
- buffer = chunks.pop() ?? '';
61
- for (const chunk of chunks) {
62
- const lines = chunk.split('\n');
63
- const dataLines = [];
64
- let eventName;
65
- for (const line of lines) {
66
- if (line.startsWith('data:')) {
67
- dataLines.push(line.replace(/^data:\s*/, ''));
68
- }
69
- else if (line.startsWith('event:')) {
70
- eventName = line.replace(/^event:\s*/, '');
71
- }
72
- else if (line.startsWith('id:')) {
73
- lastEventId = line.replace(/^id:\s*/, '');
74
- }
75
- else if (line.startsWith('retry:')) {
76
- const parsed = Number.parseInt(line.replace(/^retry:\s*/, ''), 10);
77
- if (!Number.isNaN(parsed)) {
78
- retryDelay = parsed;
79
- }
80
- }
81
- }
82
- let data;
83
- let parsedJson = false;
84
- if (dataLines.length) {
85
- const rawData = dataLines.join('\n');
86
- try {
87
- data = JSON.parse(rawData);
88
- parsedJson = true;
89
- }
90
- catch {
91
- data = rawData;
92
- }
93
- }
94
- if (parsedJson) {
95
- if (responseValidator) {
96
- await responseValidator(data);
97
- }
98
- if (responseTransformer) {
99
- data = await responseTransformer(data);
100
- }
101
- }
102
- onSseEvent?.({
103
- data,
104
- event: eventName,
105
- id: lastEventId,
106
- retry: retryDelay,
107
- });
108
- if (dataLines.length) {
109
- yield data;
110
- }
111
- }
112
- }
113
- }
114
- finally {
115
- signal.removeEventListener('abort', abortHandler);
116
- reader.releaseLock();
117
- }
118
- break; // exit loop on normal completion
119
- }
120
- catch (error) {
121
- // connection failed or aborted; retry after delay
122
- onSseError?.(error);
123
- if (sseMaxRetryAttempts !== undefined &&
124
- attempt >= sseMaxRetryAttempts) {
125
- break; // stop after firing error
126
- }
127
- // exponential backoff: double retry each attempt, cap at 30s
128
- const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);
129
- await sleep(backoff);
130
- }
131
- }
132
- };
133
- const stream = createStream();
134
- return { stream };
135
- };
@@ -1,78 +0,0 @@
1
- import type { Auth, AuthToken } from './auth.gen';
2
- import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from './bodySerializer.gen';
3
- export type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
4
- export type Client<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
5
- /**
6
- * Returns the final request URL.
7
- */
8
- buildUrl: BuildUrlFn;
9
- getConfig: () => Config;
10
- request: RequestFn;
11
- setConfig: (config: Config) => Config;
12
- } & {
13
- [K in HttpMethod]: MethodFn;
14
- } & ([SseFn] extends [never] ? {
15
- sse?: never;
16
- } : {
17
- sse: {
18
- [K in HttpMethod]: SseFn;
19
- };
20
- });
21
- export interface Config {
22
- /**
23
- * Auth token or a function returning auth token. The resolved value will be
24
- * added to the request payload as defined by its `security` array.
25
- */
26
- auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
27
- /**
28
- * A function for serializing request body parameter. By default,
29
- * {@link JSON.stringify()} will be used.
30
- */
31
- bodySerializer?: BodySerializer | null;
32
- /**
33
- * An object containing any HTTP headers that you want to pre-populate your
34
- * `Headers` object with.
35
- *
36
- * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
37
- */
38
- headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
39
- /**
40
- * The request method.
41
- *
42
- * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
43
- */
44
- method?: Uppercase<HttpMethod>;
45
- /**
46
- * A function for serializing request query parameters. By default, arrays
47
- * will be exploded in form style, objects will be exploded in deepObject
48
- * style, and reserved characters are percent-encoded.
49
- *
50
- * This method will have no effect if the native `paramsSerializer()` Axios
51
- * API function is used.
52
- *
53
- * {@link https://swagger.io/docs/specification/serialization/#query View examples}
54
- */
55
- querySerializer?: QuerySerializer | QuerySerializerOptions;
56
- /**
57
- * A function validating request data. This is useful if you want to ensure
58
- * the request conforms to the desired shape, so it can be safely sent to
59
- * the server.
60
- */
61
- requestValidator?: (data: unknown) => Promise<unknown>;
62
- /**
63
- * A function transforming response data before it's returned. This is useful
64
- * for post-processing data, e.g. converting ISO strings into Date objects.
65
- */
66
- responseTransformer?: (data: unknown) => Promise<unknown>;
67
- /**
68
- * A function validating response data. This is useful if you want to ensure
69
- * the response conforms to the desired shape, so it can be safely passed to
70
- * the transformers and returned to the user.
71
- */
72
- responseValidator?: (data: unknown) => Promise<unknown>;
73
- }
74
- type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] ? true : [T] extends [never | undefined] ? [undefined] extends [T] ? false : true : false;
75
- export type OmitNever<T extends Record<string, unknown>> = {
76
- [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true ? never : K]: T[K];
77
- };
78
- export {};
@@ -1,2 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
- export {};
@@ -1,19 +0,0 @@
1
- import type { BodySerializer, QuerySerializer } from './bodySerializer.gen';
2
- export interface PathSerializer {
3
- path: Record<string, unknown>;
4
- url: string;
5
- }
6
- export declare const PATH_PARAM_RE: RegExp;
7
- export declare const defaultPathSerializer: ({ path, url: _url }: PathSerializer) => string;
8
- export declare const getUrl: ({ baseUrl, path, query, querySerializer, url: _url, }: {
9
- baseUrl?: string;
10
- path?: Record<string, unknown>;
11
- query?: Record<string, unknown>;
12
- querySerializer: QuerySerializer;
13
- url: string;
14
- }) => string;
15
- export declare function getValidRequestBody(options: {
16
- body?: unknown;
17
- bodySerializer?: BodySerializer | null;
18
- serializedBody?: unknown;
19
- }): unknown;
@@ -1,87 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
- import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam, } from './pathSerializer.gen';
3
- export const PATH_PARAM_RE = /\{[^{}]+\}/g;
4
- export const defaultPathSerializer = ({ path, url: _url }) => {
5
- let url = _url;
6
- const matches = _url.match(PATH_PARAM_RE);
7
- if (matches) {
8
- for (const match of matches) {
9
- let explode = false;
10
- let name = match.substring(1, match.length - 1);
11
- let style = 'simple';
12
- if (name.endsWith('*')) {
13
- explode = true;
14
- name = name.substring(0, name.length - 1);
15
- }
16
- if (name.startsWith('.')) {
17
- name = name.substring(1);
18
- style = 'label';
19
- }
20
- else if (name.startsWith(';')) {
21
- name = name.substring(1);
22
- style = 'matrix';
23
- }
24
- const value = path[name];
25
- if (value === undefined || value === null) {
26
- continue;
27
- }
28
- if (Array.isArray(value)) {
29
- url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
30
- continue;
31
- }
32
- if (typeof value === 'object') {
33
- url = url.replace(match, serializeObjectParam({
34
- explode,
35
- name,
36
- style,
37
- value: value,
38
- valueOnly: true,
39
- }));
40
- continue;
41
- }
42
- if (style === 'matrix') {
43
- url = url.replace(match, `;${serializePrimitiveParam({
44
- name,
45
- value: value,
46
- })}`);
47
- continue;
48
- }
49
- const replaceValue = encodeURIComponent(style === 'label' ? `.${value}` : value);
50
- url = url.replace(match, replaceValue);
51
- }
52
- }
53
- return url;
54
- };
55
- export const getUrl = ({ baseUrl, path, query, querySerializer, url: _url, }) => {
56
- const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
57
- let url = (baseUrl ?? '') + pathUrl;
58
- if (path) {
59
- url = defaultPathSerializer({ path, url });
60
- }
61
- let search = query ? querySerializer(query) : '';
62
- if (search.startsWith('?')) {
63
- search = search.substring(1);
64
- }
65
- if (search) {
66
- url += `?${search}`;
67
- }
68
- return url;
69
- };
70
- export function getValidRequestBody(options) {
71
- const hasBody = options.body !== undefined;
72
- const isSerializedBody = hasBody && options.bodySerializer;
73
- if (isSerializedBody) {
74
- if ('serializedBody' in options) {
75
- const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== '';
76
- return hasSerializedBody ? options.serializedBody : null;
77
- }
78
- // not all clients implement a serializedBody property (i.e. client-axios)
79
- return options.body !== '' ? options.body : null;
80
- }
81
- // plain/text body
82
- if (hasBody) {
83
- return options.body;
84
- }
85
- // no body was provided
86
- return undefined;
87
- }
@@ -1,2 +0,0 @@
1
- export type * from './types.gen';
2
- export * from './sdk.gen';
@@ -1,2 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
- export * from './sdk.gen';
@@ -1,27 +0,0 @@
1
- import type { Client, Options as Options2, TDataShape } from './client';
2
- import type { GetHealthData, GetHealthErrors, GetHealthResponses, PostApiV1ChatCompletionsData, PostApiV1ChatCompletionsErrors, PostApiV1ChatCompletionsResponses } from './types.gen';
3
- export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
4
- /**
5
- * You can provide a client instance returned by `createClient()` instead of
6
- * individual options. This might be also useful if you want to implement a
7
- * custom client.
8
- */
9
- client?: Client;
10
- /**
11
- * You can pass arbitrary values through the `meta` object. This can be
12
- * used to access values that aren't defined as part of the SDK function.
13
- */
14
- meta?: Record<string, unknown>;
15
- };
16
- /**
17
- * Create chat completion
18
- *
19
- * Generates a chat completion using the configured gateway.
20
- */
21
- export declare const postApiV1ChatCompletions: <ThrowOnError extends boolean = false>(options: Options<PostApiV1ChatCompletionsData, ThrowOnError>) => import("./client").RequestResult<PostApiV1ChatCompletionsResponses, PostApiV1ChatCompletionsErrors, ThrowOnError>;
22
- /**
23
- * Health check
24
- *
25
- * Returns the current health status of the service.
26
- */
27
- export declare const getHealth: <ThrowOnError extends boolean = false>(options?: Options<GetHealthData, ThrowOnError>) => import("./client").RequestResult<GetHealthResponses, GetHealthErrors, ThrowOnError>;
@@ -1,28 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
- import { client } from './client.gen';
3
- /**
4
- * Create chat completion
5
- *
6
- * Generates a chat completion using the configured gateway.
7
- */
8
- export const postApiV1ChatCompletions = (options) => {
9
- return (options.client ?? client).post({
10
- url: '/api/v1/chat/completions',
11
- ...options,
12
- headers: {
13
- 'Content-Type': 'application/json',
14
- ...options.headers
15
- }
16
- });
17
- };
18
- /**
19
- * Health check
20
- *
21
- * Returns the current health status of the service.
22
- */
23
- export const getHealth = (options) => {
24
- return (options?.client ?? client).get({
25
- url: '/health',
26
- ...options
27
- });
28
- };
@@ -1,120 +0,0 @@
1
- export type ClientOptions = {
2
- baseUrl: `${string}://${string}` | (string & {});
3
- };
4
- export type HandlersHealthResponse = {
5
- /**
6
- * Status indicates the service health status
7
- */
8
- status?: string;
9
- /**
10
- * Timestamp is the Unix timestamp of the response
11
- */
12
- timestamp?: number;
13
- /**
14
- * Version is the current API version
15
- */
16
- version?: string;
17
- };
18
- export type LlmapiChatCompletionRequest = {
19
- /**
20
- * Messages is the conversation history
21
- */
22
- messages?: Array<LlmapiMessage>;
23
- /**
24
- * Model is the model identifier
25
- */
26
- model?: string;
27
- /**
28
- * Stream indicates if response should be streamed
29
- */
30
- stream?: boolean;
31
- };
32
- export type LlmapiChatCompletionResponse = {
33
- /**
34
- * Choices contains the completion choices
35
- */
36
- choices?: Array<LlmapiChoice>;
37
- /**
38
- * ID is the completion ID
39
- */
40
- id?: string;
41
- /**
42
- * Model is the model used
43
- */
44
- model?: string;
45
- };
46
- export type LlmapiChoice = {
47
- /**
48
- * FinishReason indicates why the completion stopped
49
- */
50
- finish_reason?: string;
51
- /**
52
- * Index is the choice index
53
- */
54
- index?: number;
55
- message?: LlmapiMessage;
56
- };
57
- /**
58
- * Message is the generated message
59
- */
60
- export type LlmapiMessage = {
61
- /**
62
- * Content is the message content
63
- */
64
- content?: string;
65
- role?: LlmapiRole;
66
- };
67
- /**
68
- * Role is the message role (system, user, assistant)
69
- */
70
- export type LlmapiRole = string;
71
- export type ResponseErrorResponse = {
72
- error?: string;
73
- };
74
- export type PostApiV1ChatCompletionsData = {
75
- /**
76
- * Chat completion request
77
- */
78
- body: LlmapiChatCompletionRequest;
79
- path?: never;
80
- query?: never;
81
- url: '/api/v1/chat/completions';
82
- };
83
- export type PostApiV1ChatCompletionsErrors = {
84
- /**
85
- * Bad Request
86
- */
87
- 400: ResponseErrorResponse;
88
- /**
89
- * Internal Server Error
90
- */
91
- 500: ResponseErrorResponse;
92
- };
93
- export type PostApiV1ChatCompletionsError = PostApiV1ChatCompletionsErrors[keyof PostApiV1ChatCompletionsErrors];
94
- export type PostApiV1ChatCompletionsResponses = {
95
- /**
96
- * OK
97
- */
98
- 200: LlmapiChatCompletionResponse;
99
- };
100
- export type PostApiV1ChatCompletionsResponse = PostApiV1ChatCompletionsResponses[keyof PostApiV1ChatCompletionsResponses];
101
- export type GetHealthData = {
102
- body?: never;
103
- path?: never;
104
- query?: never;
105
- url: '/health';
106
- };
107
- export type GetHealthErrors = {
108
- /**
109
- * Internal Server Error
110
- */
111
- 500: ResponseErrorResponse;
112
- };
113
- export type GetHealthError = GetHealthErrors[keyof GetHealthErrors];
114
- export type GetHealthResponses = {
115
- /**
116
- * OK
117
- */
118
- 200: HandlersHealthResponse;
119
- };
120
- export type GetHealthResponse = GetHealthResponses[keyof GetHealthResponses];
@@ -1,2 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
- export {};
@@ -1,2 +0,0 @@
1
- import type { Client, Config } from './types.gen';
2
- export declare const createClient: (config?: Config) => Client;
@@ -1,8 +0,0 @@
1
- export type { Auth } from '../core/auth.gen';
2
- export type { QuerySerializerOptions } from '../core/bodySerializer.gen';
3
- export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from '../core/bodySerializer.gen';
4
- export { buildClientParams } from '../core/params.gen';
5
- export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
6
- export { createClient } from './client.gen';
7
- export type { Client, ClientOptions, Config, CreateClientConfig, Options, RequestOptions, RequestResult, TDataShape, } from './types.gen';
8
- export { createConfig } from './utils.gen';
@@ -1,99 +0,0 @@
1
- import type { Auth } from '../core/auth.gen';
2
- import type { ServerSentEventsOptions, ServerSentEventsResult } from '../core/serverSentEvents.gen';
3
- import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen';
4
- import type { Middleware } from './utils.gen';
5
- export interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, CoreConfig {
6
- /**
7
- * Base URL for all requests made by this client.
8
- */
9
- baseUrl?: T['baseUrl'];
10
- /**
11
- * Fetch API implementation. You can use this option to provide a custom
12
- * fetch instance.
13
- *
14
- * @default globalThis.fetch
15
- */
16
- fetch?: typeof fetch;
17
- /**
18
- * Return the response data parsed in a specified format. By default, `auto`
19
- * will infer the appropriate method from the `Content-Type` response header.
20
- * You can override this behavior with any of the {@link Body} methods.
21
- * Select `stream` if you don't want to parse response data at all.
22
- *
23
- * @default 'auto'
24
- */
25
- parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
26
- /**
27
- * Throw an error instead of returning it in the response?
28
- *
29
- * @default false
30
- */
31
- throwOnError?: T['throwOnError'];
32
- }
33
- export interface RequestOptions<TData = unknown, ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
34
- throwOnError: ThrowOnError;
35
- }>, Pick<ServerSentEventsOptions<TData>, 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
36
- /**
37
- * Any body that you want to add to your request.
38
- *
39
- * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
40
- */
41
- body?: unknown;
42
- path?: Record<string, unknown>;
43
- query?: Record<string, unknown>;
44
- /**
45
- * Security mechanism(s) to use for the request.
46
- */
47
- security?: ReadonlyArray<Auth>;
48
- url: Url;
49
- }
50
- export interface ResolvedRequestOptions<ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, ThrowOnError, Url> {
51
- serializedBody?: string;
52
- }
53
- export type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean> = ThrowOnError extends true ? Promise<{
54
- data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
55
- response: Response;
56
- }> : Promise<({
57
- data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
58
- error: undefined;
59
- } | {
60
- data: undefined;
61
- error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
62
- }) & {
63
- response: Response;
64
- }>;
65
- export interface ClientOptions {
66
- baseUrl?: string;
67
- throwOnError?: boolean;
68
- }
69
- type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<TData, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError>;
70
- type SseFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<TData, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData, TError>>;
71
- type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<TData, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError>;
72
- type BuildUrlFn = <TData extends {
73
- body?: unknown;
74
- path?: Record<string, unknown>;
75
- query?: Record<string, unknown>;
76
- url: string;
77
- }>(options: TData & Options<TData>) => string;
78
- export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
79
- interceptors: Middleware<Response, unknown, ResolvedRequestOptions>;
80
- };
81
- /**
82
- * The `createClientConfig()` function will be called on client initialization
83
- * and the returned object will become the client's initial configuration.
84
- *
85
- * You may want to initialize your client this way instead of calling
86
- * `setConfig()`. This is useful for example if you're using Next.js
87
- * to ensure your client always has the correct values.
88
- */
89
- export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
90
- export interface TDataShape {
91
- body?: unknown;
92
- headers?: unknown;
93
- path?: unknown;
94
- query?: unknown;
95
- url: string;
96
- }
97
- type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
98
- export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = OmitKeys<RequestOptions<TResponse, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
99
- export {};
@@ -1,40 +0,0 @@
1
- import type { QuerySerializer, QuerySerializerOptions } from '../core/bodySerializer.gen';
2
- import type { Client, ClientOptions, Config, RequestOptions } from './types.gen';
3
- export declare const createQuerySerializer: <T = unknown>({ parameters, ...args }?: QuerySerializerOptions) => (queryParams: T) => string;
4
- /**
5
- * Infers parseAs value from provided Content-Type header.
6
- */
7
- export declare const getParseAs: (contentType: string | null) => Exclude<Config["parseAs"], "auto">;
8
- export declare const setAuthParams: ({ security, ...options }: Pick<Required<RequestOptions>, "security"> & Pick<RequestOptions, "auth" | "query"> & {
9
- headers: Headers;
10
- }) => Promise<void>;
11
- export declare const buildUrl: Client['buildUrl'];
12
- export declare const getUrl: ({ baseUrl, path, query, querySerializer, url: _url, }: {
13
- baseUrl?: string;
14
- path?: Record<string, unknown>;
15
- query?: Record<string, unknown>;
16
- querySerializer: QuerySerializer;
17
- url: string;
18
- }) => string;
19
- export declare const mergeConfigs: (a: Config, b: Config) => Config;
20
- export declare const mergeHeaders: (...headers: Array<Required<Config>["headers"] | undefined>) => Headers;
21
- type ErrInterceptor<Err, Res, Options> = (error: Err, response: Res, options: Options) => Err | Promise<Err>;
22
- type ReqInterceptor<Options> = (options: Options) => void | Promise<void>;
23
- type ResInterceptor<Res, Options> = (response: Res, options: Options) => Res | Promise<Res>;
24
- declare class Interceptors<Interceptor> {
25
- fns: Array<Interceptor | null>;
26
- clear(): void;
27
- eject(id: number | Interceptor): void;
28
- exists(id: number | Interceptor): boolean;
29
- getInterceptorIndex(id: number | Interceptor): number;
30
- update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
31
- use(fn: Interceptor): number;
32
- }
33
- export interface Middleware<Res, Err, Options> {
34
- error: Interceptors<ErrInterceptor<Err, Res, Options>>;
35
- request: Interceptors<ReqInterceptor<Options>>;
36
- response: Interceptors<ResInterceptor<Res, Options>>;
37
- }
38
- export declare const createInterceptors: <Res, Err, Options>() => Middleware<Res, Err, Options>;
39
- export declare const createConfig: <T extends ClientOptions = ClientOptions>(override?: Config<Omit<ClientOptions, keyof T> & T>) => Config<Omit<ClientOptions, keyof T> & T>;
40
- export {};