diff --git a/src/api/client.ts b/src/api/client.ts index 48dc0fb..4d73f58 100644 --- a/src/api/client.ts +++ b/src/api/client.ts @@ -1,6 +1,8 @@ import createClient, { FetchOptions } from 'openapi-fetch'; -import { paths } from './schema.js'; +import { FilterKeys } from '../utils/types.js'; + +import { components, paths } from './schema.js'; export type ApiClient = ReturnType>; @@ -10,23 +12,9 @@ export function createApiClient( return createClient(...params); } -type FilterKeys = { - [K in keyof Obj]: K extends Matchers ? Obj[K] : never; -}[keyof Obj]; - -type NestedOmit = { - [P in keyof T as P extends K ? never : P]: NestedOmit< - T[P], - K extends `${Exclude}.${infer R}` ? R : never - >; -}; - -type RawClientOptions< +export type ApiClientOptions< METHOD extends keyof ApiClient, PATH extends Parameters[0], > = FetchOptions>>; -export type ClientOptions< - METHOD extends keyof ApiClient, - PATH extends Parameters[0], -> = NestedOmit, 'params.query.version'>; +export type ApiError = components['schemas'][keyof components['schemas']]; diff --git a/src/api/schema.d.ts b/src/api/schema.d.ts index 39d49d5..410ac4a 100644 --- a/src/api/schema.d.ts +++ b/src/api/schema.d.ts @@ -93,25 +93,25 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -219,31 +219,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -255,40 +255,38 @@ export interface paths { }; }; responses: { - /** @description Default Response */ + /** @description Success */ 204: { - content: { - "application/json": Record; - }; + content: never; }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -388,31 +386,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -426,28 +424,43 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + results: { + id?: string; + name?: string; + schema?: { + [key: string]: unknown; + }; + model_ids?: string[]; + }[]; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -465,34 +478,40 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/octet-stream": string; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -509,34 +528,73 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + id: string; + name?: string; + model_id?: string; + model_name?: string | null; + status?: string | null; + status_message?: string | null; + tuning_type?: string; + parameters?: Record; + preferred?: boolean; + task_id?: string; + task_name?: string; + /** Format: date-time */ + started_at?: string | null; + /** Format: date-time */ + finished_at?: string | null; + /** Format: date-time */ + created_at?: string; + validation_files?: unknown[] | null; + training_files?: unknown[] | null; + evaluation_files?: unknown[] | null; + datapoints?: { + loss: { + data: { + value: number; + epoch: number; + }; + /** Format: date-time */ + timestamp: string; + }[]; + }; + }; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -551,34 +609,38 @@ export interface paths { }; }; responses: { + /** @description Success */ + 204: { + content: never; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -601,34 +663,73 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + id: string; + name?: string; + model_id?: string; + model_name?: string | null; + status?: string | null; + status_message?: string | null; + tuning_type?: string; + parameters?: Record; + preferred?: boolean; + task_id?: string; + task_name?: string; + /** Format: date-time */ + started_at?: string | null; + /** Format: date-time */ + finished_at?: string | null; + /** Format: date-time */ + created_at?: string; + validation_files?: unknown[] | null; + training_files?: unknown[] | null; + evaluation_files?: unknown[] | null; + datapoints?: { + loss: { + data: { + value: number; + epoch: number; + }; + /** Format: date-time */ + timestamp: string; + }[]; + }; + }; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -650,34 +751,73 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + id: string; + name?: string; + model_id?: string; + model_name?: string | null; + status?: string | null; + status_message?: string | null; + tuning_type?: string; + parameters?: Record; + preferred?: boolean; + task_id?: string; + task_name?: string; + /** Format: date-time */ + started_at?: string | null; + /** Format: date-time */ + finished_at?: string | null; + /** Format: date-time */ + created_at?: string; + validation_files?: unknown[] | null; + training_files?: unknown[] | null; + evaluation_files?: unknown[] | null; + datapoints?: { + loss: { + data: { + value: number; + epoch: number; + }; + /** Format: date-time */ + timestamp: string; + }[]; + }; + }; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -695,28 +835,68 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + totalCount: number; + results: ({ + id: string; + name?: string; + model_id?: string; + model_name?: string | null; + status?: string | null; + status_message?: string | null; + tuning_type?: string; + parameters?: Record; + preferred?: boolean; + task_id?: string; + task_name?: string; + /** Format: date-time */ + started_at?: string | null; + /** Format: date-time */ + finished_at?: string | null; + /** Format: date-time */ + created_at?: string; + validation_files?: unknown[] | null; + training_files?: unknown[] | null; + evaluation_files?: unknown[] | null; + datapoints?: { + loss: { + data: { + value: number; + epoch: number; + }; + /** Format: date-time */ + timestamp: string; + }[]; + }; + })[]; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -753,34 +933,73 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + id: string; + name?: string; + model_id?: string; + model_name?: string | null; + status?: string | null; + status_message?: string | null; + tuning_type?: string; + parameters?: Record; + preferred?: boolean; + task_id?: string; + task_name?: string; + /** Format: date-time */ + started_at?: string | null; + /** Format: date-time */ + finished_at?: string | null; + /** Format: date-time */ + created_at?: string; + validation_files?: unknown[] | null; + training_files?: unknown[] | null; + evaluation_files?: unknown[] | null; + datapoints?: { + loss: { + data: { + value: number; + epoch: number; + }; + /** Format: date-time */ + timestamp: string; + }[]; + }; + }; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -799,7 +1018,7 @@ export interface paths { model_id?: string; prompt_id?: string; use_default?: boolean | null; - input: string; + input: string | string[]; template?: { id?: string; value?: string; @@ -815,34 +1034,49 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + model_id: string; + created_at: string; + results?: (({ + token_count?: number | null; + tokens?: string[] | null; + })[]) | null; + }; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -881,34 +1115,85 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + results?: { + hap?: { + success: boolean; + score: number; + flagged: boolean; + position: { + start: number; + end: number; + }; + tokens?: { + token?: string; + index?: number; + score?: number; + }[]; + }[]; + stigma?: { + success: boolean; + score: number; + flagged: boolean; + position: { + start: number; + end: number; + }; + tokens?: { + token?: string; + index?: number; + score?: number; + }[]; + }[]; + implicit_hate?: { + success: boolean; + score: number; + flagged: boolean; + position: { + start: number; + end: number; + }; + tokens?: { + token?: string; + index?: number; + score?: number; + }[]; + }[]; + }[]; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -989,28 +1274,73 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "text/event-stream": ({ + id?: string | null; + model_id: string; + /** Format: date-time */ + created_at?: string; + input_parameters?: { + [key: string]: unknown; + } | null; + results: ({ + input_text?: string | null; + generated_text?: string | null; + generated_token_count?: number | null; + input_token_count?: number | null; + stop_reason?: string | null; + stop_sequence?: string | null; + generated_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + rank?: number | null; + top_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + })[]) | null; + })[]) | null; + input_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + rank?: number | null; + top_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + })[]) | null; + })[]) | null; + seed?: (string | null) | (number | null); + moderation?: { + [key: string]: unknown; + } | null; + [key: string]: unknown; + })[]; + })[]; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1027,34 +1357,51 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + id: number; + /** Format: date-time */ + created_at: string; + /** Format: date-time */ + updated_at: string; + comment?: string | null; + categories: string[]; + api_request: string; + }; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1077,34 +1424,51 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + id: number; + /** Format: date-time */ + created_at: string; + /** Format: date-time */ + updated_at: string; + comment?: string | null; + categories: string[]; + api_request: string; + }; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1127,34 +1491,51 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + id: number; + /** Format: date-time */ + created_at: string; + /** Format: date-time */ + updated_at: string; + comment?: string | null; + categories: string[]; + api_request: string; + }; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1168,22 +1549,35 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: { + concurrency: { + limit: number; + remaining: number; + }; + }; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1276,28 +1670,100 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + results: ({ + parameters: { + model_id?: string; + temperature?: number; + top_k?: number; + top_p?: number; + typical_p?: number; + repetition_penalty?: number; + length_penalty?: Record; + }; + error?: (({ + status_code: number; + message?: string; + extensions?: { + code?: string; + reason?: string; + }; + } | null) | ({ + status_code: number; + extensions?: { + code?: string; + reason?: string; + }; + } | null)) | null; + result?: ({ + id?: string | null; + model_id: string; + /** Format: date-time */ + created_at?: string; + input_parameters?: { + [key: string]: unknown; + } | null; + results: ({ + input_text?: string | null; + generated_text?: string | null; + generated_token_count?: number | null; + input_token_count?: number | null; + stop_reason?: string | null; + stop_sequence?: string | null; + generated_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + rank?: number | null; + top_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + })[]) | null; + })[]) | null; + input_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + rank?: number | null; + top_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + })[]) | null; + })[]) | null; + seed?: (string | null) | (number | null); + moderation?: { + [key: string]: unknown; + } | null; + [key: string]: unknown; + })[]; + }) | null; + })[]; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1318,28 +1784,73 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + id?: string | null; + model_id: string; + /** Format: date-time */ + created_at?: string; + input_parameters?: { + [key: string]: unknown; + } | null; + results: ({ + input_text?: string | null; + generated_text?: string | null; + generated_token_count?: number | null; + input_token_count?: number | null; + stop_reason?: string | null; + stop_sequence?: string | null; + generated_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + rank?: number | null; + top_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + })[]) | null; + })[]) | null; + input_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + rank?: number | null; + top_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + })[]) | null; + })[]) | null; + seed?: (string | null) | (number | null); + moderation?: { + [key: string]: unknown; + } | null; + [key: string]: unknown; + })[]; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1356,19 +1867,19 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1401,25 +1912,25 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1501,28 +2012,74 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "text/event-stream": ({ + id?: string | null; + model_id?: string; + /** Format: date-time */ + created_at?: string; + input_parameters?: { + [key: string]: unknown; + } | null; + results: ({ + input_text?: string | null; + generated_text?: string | null; + generated_token_count?: number | null; + input_token_count?: number | null; + stop_reason?: string | null; + stop_sequence?: string | null; + generated_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + rank?: number | null; + top_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + })[]) | null; + })[]) | null; + input_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + rank?: number | null; + top_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + })[]) | null; + })[]) | null; + seed?: (string | null) | (number | null); + moderation?: { + [key: string]: unknown; + } | null; + [key: string]: unknown; + })[]; + conversation_id: string | null; + })[]; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1604,34 +2161,42 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + result: string; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1713,28 +2278,74 @@ export interface paths { }; }; responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + id?: string | null; + model_id?: string; + /** Format: date-time */ + created_at?: string; + input_parameters?: { + [key: string]: unknown; + } | null; + results: ({ + input_text?: string | null; + generated_text?: string | null; + generated_token_count?: number | null; + input_token_count?: number | null; + stop_reason?: string | null; + stop_sequence?: string | null; + generated_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + rank?: number | null; + top_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + })[]) | null; + })[]) | null; + input_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + rank?: number | null; + top_tokens?: (({ + text?: string | null; + logprob?: (number | null) | (string | null); + })[]) | null; + })[]) | null; + seed?: (string | null) | (number | null); + moderation?: { + [key: string]: unknown; + } | null; + [key: string]: unknown; + })[]; + conversation_id: string | null; + }; + }; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1769,25 +2380,25 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1804,34 +2415,38 @@ export interface paths { }; }; responses: { + /** @description Success */ + 204: { + content: never; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1879,31 +2494,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1918,34 +2533,38 @@ export interface paths { }; }; responses: { + /** @description Success */ + 204: { + content: never; + }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -1999,25 +2618,25 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -2113,31 +2732,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -2304,31 +2923,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -2343,40 +2962,38 @@ export interface paths { }; }; responses: { - /** @description Default Response */ + /** @description Success */ 204: { - content: { - "application/json": Record; - }; + content: never; }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -2477,31 +3094,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -2598,25 +3215,25 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -2780,31 +3397,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -2837,31 +3454,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -2900,31 +3517,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -2939,40 +3556,38 @@ export interface paths { }; }; responses: { - /** @description Default Response */ + /** @description Success */ 204: { - content: { - "application/json": Record; - }; + content: never; }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -3013,31 +3628,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -3070,25 +3685,25 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -3124,31 +3739,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -3222,31 +3837,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -3285,25 +3900,25 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -3329,31 +3944,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -3395,31 +4010,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -3434,40 +4049,38 @@ export interface paths { }; }; responses: { - /** @description Default Response */ + /** @description Success */ 204: { - content: { - "application/json": Record; - }; + content: never; }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -3514,25 +4127,25 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -3569,31 +4182,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -3627,31 +4240,31 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The server can not find requested resource. */ 404: { content: { - "application/json": components["responses"]["NotFoundResponse"]; + "application/json": components["schemas"]["NotFoundResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -3685,25 +4298,25 @@ export interface paths { /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ 400: { content: { - "application/json": components["responses"]["BadRequestResponse"]; + "application/json": components["schemas"]["BadRequestResponse"]; }; }; - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ 401: { content: { - "application/json": components["responses"]["UnauthorizedResponse"]; + "application/json": components["schemas"]["UnauthorizedResponse"]; }; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ 429: { content: { - "application/json": components["responses"]["ToManyRequestsResponse"]; + "application/json": components["schemas"]["TooManyRequestsResponse"]; }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ 500: { content: { - "application/json": components["responses"]["InternalServerErrorResponse"]; + "application/json": components["schemas"]["InternalServerErrorResponse"]; }; }; }; @@ -3715,29 +4328,68 @@ export type webhooks = Record; export interface components { schemas: { - }; - responses: { - /** @description Unauthorized route accesss. */ + /** @description Unauthorized route access. */ UnauthorizedResponse: { - content: never; + /** @enum {unknown} */ + status_code: 401; + /** @enum {unknown} */ + error: "Unauthorized"; + /** @enum {unknown} */ + message: "Invalid authorization"; + extensions?: { + /** @enum {unknown} */ + code?: "AUTH_ERROR"; + /** @enum {unknown} */ + reason?: "INVALID_AUTHORIZATION"; + }; }; /** @description The server can not find requested resource. */ NotFoundResponse: { - content: never; + /** @enum {unknown} */ + status_code: 404; + error: string; + message: string; + extensions?: Record; }; /** @description The user has sent too many requests in a given amount of time ("rate limiting").. */ - ToManyRequestsResponse: { - content: never; + TooManyRequestsResponse: { + /** @enum {unknown} */ + status_code: 429; + error: string; + message: string; + /** @enum {unknown} */ + code: "TOO_MANY_REQUESTS"; + extensions?: { + state?: { + expires_in_ms?: number; + }; + }; }; /** @description Server could not understand the request due to invalid syntax. In most cases relates with the schema validation. */ BadRequestResponse: { - content: never; + /** @enum {unknown} */ + status_code: 400; + error: string; + message: string; + extension?: { + /** @enum {unknown} */ + code?: "INVALID_INPUT"; + state?: Record; + }; }; /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ InternalServerErrorResponse: { - content: never; + /** @enum {unknown} */ + status_code: 500; + error: string; + message: string; + extensions?: { + /** @enum {unknown} */ + code?: "INTERNAL_SERVER_ERROR"; + }; }; }; + responses: never; parameters: never; requestBodies: never; headers: never; diff --git a/src/client.ts b/src/client.ts index c9dff24..7673531 100644 --- a/src/client.ts +++ b/src/client.ts @@ -3,11 +3,13 @@ import { Transform, TransformCallback } from 'node:stream'; import fetchRetry from 'fetch-retry'; import fetch from 'cross-fetch'; -import { InvalidInputError, clientErrorWrapper } from './errors.js'; +import { InvalidInputError } from './errors.js'; import { version } from './buildInfo.js'; import { lookupApiKey, lookupEndpoint } from './helpers/config.js'; -import { ApiClient, ClientOptions, createApiClient } from './api/client.js'; +import { ApiClient, ApiClientOptions, createApiClient } from './api/client.js'; import { fetchSSE } from './utils/stream.js'; +import { NestedOmit } from './utils/types.js'; +import { clientErrorWrapper } from './utils/errors.js'; export type RawHeaders = Record; @@ -17,6 +19,11 @@ export interface Configuration { headers?: RawHeaders; } +type ClientOptions< + METHOD extends keyof ApiClient, + PATH extends Parameters[0], +> = NestedOmit, 'params.query.version'>; + export class Client { readonly #client: ApiClient; readonly #endpoint: string; diff --git a/src/errors.ts b/src/errors.ts index 6c99690..67dd9ee 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -1,6 +1,4 @@ -import { FetchResponse } from 'openapi-fetch'; - -import { APIError } from './api-types.js'; +import { ApiError } from './api/client.js'; export class BaseError extends Error {} @@ -10,7 +8,7 @@ export class InternalError extends BaseError {} export class NetworkError extends BaseError {} -export class HttpError extends BaseError { +export class HttpError extends BaseError implements ApiError { status_code: number; error: string; extension?: @@ -28,17 +26,3 @@ export class HttpError extends BaseError { this.extension = error.extension; } } - -export async function clientErrorWrapper( - request: Promise>, -) { - try { - const { data, error } = await request; - if (error) throw new HttpError(error as unknown as APIError); // TODO avoid typecast - return data; - } catch (err) { - if (err instanceof TypeError && err.name) - throw new NetworkError('Unable to connect', { cause: err }); - throw new InternalError('Request failed', { cause: err }); - } -} diff --git a/src/types.ts b/src/types.ts deleted file mode 100644 index f6a2daf..0000000 --- a/src/types.ts +++ /dev/null @@ -1,10 +0,0 @@ -type UnionKeys = T extends T ? keyof T : never; -type StrictUnionHelper = T extends any - ? T & Partial, keyof T>, never>> - : never; -export type StrictUnion = StrictUnionHelper; - -export type AtLeastOne }> = Partial & - U[keyof U]; - -export type ExcludeEmpty = T extends AtLeastOne ? T : never; diff --git a/src/utils/errors.ts b/src/utils/errors.ts new file mode 100644 index 0000000..14c1226 --- /dev/null +++ b/src/utils/errors.ts @@ -0,0 +1,18 @@ +import { FetchResponse } from 'openapi-fetch'; + +import { HttpError, InternalError, NetworkError } from '../errors.js'; +import { APIError } from '../api-types.js'; + +export async function clientErrorWrapper( + request: Promise>, +) { + try { + const { data, error } = await request; + if (error) throw new HttpError(error as unknown as APIError); // TODO avoid typecast + return data; + } catch (err) { + if (err instanceof TypeError && err.name) + throw new NetworkError('Unable to connect', { cause: err }); + throw new InternalError('Request failed', { cause: err }); + } +} diff --git a/src/utils/types.ts b/src/utils/types.ts new file mode 100644 index 0000000..982f7a2 --- /dev/null +++ b/src/utils/types.ts @@ -0,0 +1,16 @@ +type UnionKeys = T extends T ? keyof T : never; +type StrictUnionHelper = T extends any + ? T & Partial, keyof T>, never>> + : never; +export type StrictUnion = StrictUnionHelper; + +export type FilterKeys = { + [K in keyof Obj]: K extends Matchers ? Obj[K] : never; +}[keyof Obj]; + +export type NestedOmit = { + [P in keyof T as P extends K ? never : P]: NestedOmit< + T[P], + K extends `${Exclude}.${infer R}` ? R : never + >; +};