import createClient, { type Client } from 'openapi-fetch'; import type { components, paths } from './generated/schema'; export type { components, paths }; export type ServerInfo = components['schemas']['ServerInfo']; export type Problem = components['schemas']['Problem']; export type ApiClient = Client; export interface ApiClientOptions { /** Адрес сервера без завершающего слеша; пусто — тот же origin (веб). */ baseUrl?: string; fetch?: typeof globalThis.fetch; } /** Создаёт типизированный клиент публичного API (контракт — api/openapi.yaml). */ export function createApiClient(opts: ApiClientOptions = {}): ApiClient { return createClient({ baseUrl: opts.baseUrl ?? '', fetch: opts.fetch, // OpenAPI query arrays (UploadStatusFilter) use form + explode: false. querySerializer: { array: { style: 'form', explode: false } }, }); }