fork of hey-api/openapi-ts because I need some additional things

Merge pull request #3115 from hey-api/copilot/fix-module-resolution-node16

Fix: Support moduleResolution "node16" alongside "nodenext"

authored by

Lubos and committed by
GitHub
f842dcd9 b057a8e3

+30803 -6
+5
.changeset/thirty-shoes-judge.md
··· 1 + --- 2 + "@hey-api/openapi-ts": patch 3 + --- 4 + 5 + **output**: default to `.js` extension when module resolution is set to `node16`
+16
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { type ClientOptions, type Config, createClient, createConfig } from './client/index.js'; 4 + import type { ClientOptions as ClientOptions2 } from './types.gen.js'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 15 + 16 + export const client = createClient(createConfig<ClientOptions2>({ baseUrl: 'http://localhost:3000/base' }));
+261
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/client/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { HttpResponse } from '@angular/common/http'; 4 + import { 5 + HttpClient, 6 + HttpErrorResponse, 7 + HttpEventType, 8 + HttpRequest, 9 + } from '@angular/common/http'; 10 + import { 11 + assertInInjectionContext, 12 + inject, 13 + provideAppInitializer, 14 + runInInjectionContext, 15 + } from '@angular/core'; 16 + import { firstValueFrom } from 'rxjs'; 17 + import { filter } from 'rxjs/operators'; 18 + 19 + import { createSseClient } from '../core/serverSentEvents.gen.js'; 20 + import type { HttpMethod } from '../core/types.gen.js'; 21 + import { getValidRequestBody } from '../core/utils.gen.js'; 22 + import type { 23 + Client, 24 + Config, 25 + RequestOptions, 26 + ResolvedRequestOptions, 27 + ResponseStyle, 28 + } from './types.gen.js'; 29 + import { 30 + buildUrl, 31 + createConfig, 32 + createInterceptors, 33 + mergeConfigs, 34 + mergeHeaders, 35 + setAuthParams, 36 + } from './utils.gen.js'; 37 + 38 + export function provideHeyApiClient(client: Client) { 39 + return provideAppInitializer(() => { 40 + const httpClient = inject(HttpClient); 41 + client.setConfig({ httpClient }); 42 + }); 43 + } 44 + 45 + export const createClient = (config: Config = {}): Client => { 46 + let _config = mergeConfigs(createConfig(), config); 47 + 48 + const getConfig = (): Config => ({ ..._config }); 49 + 50 + const setConfig = (config: Config): Config => { 51 + _config = mergeConfigs(_config, config); 52 + return getConfig(); 53 + }; 54 + 55 + const interceptors = createInterceptors< 56 + HttpRequest<unknown>, 57 + HttpResponse<unknown>, 58 + unknown, 59 + ResolvedRequestOptions 60 + >(); 61 + 62 + const requestOptions = < 63 + ThrowOnError extends boolean = false, 64 + TResponseStyle extends ResponseStyle = 'fields', 65 + >( 66 + options: RequestOptions<unknown, TResponseStyle, ThrowOnError>, 67 + ) => { 68 + const opts = { 69 + ..._config, 70 + ...options, 71 + headers: mergeHeaders(_config.headers, options.headers), 72 + httpClient: options.httpClient ?? _config.httpClient, 73 + serializedBody: undefined, 74 + }; 75 + 76 + if (!opts.httpClient) { 77 + if (opts.injector) { 78 + opts.httpClient = runInInjectionContext(opts.injector, () => 79 + inject(HttpClient), 80 + ); 81 + } else { 82 + assertInInjectionContext(requestOptions); 83 + opts.httpClient = inject(HttpClient); 84 + } 85 + } 86 + 87 + if (opts.body !== undefined && opts.bodySerializer) { 88 + opts.serializedBody = opts.bodySerializer(opts.body); 89 + } 90 + 91 + // remove Content-Type header if body is empty to avoid sending invalid requests 92 + if (opts.body === undefined || opts.serializedBody === '') { 93 + opts.headers.delete('Content-Type'); 94 + } 95 + 96 + const url = buildUrl(opts as any); 97 + 98 + const req = new HttpRequest<unknown>( 99 + opts.method ?? 'GET', 100 + url, 101 + getValidRequestBody(opts), 102 + { 103 + redirect: 'follow', 104 + ...opts, 105 + }, 106 + ); 107 + 108 + return { opts, req, url }; 109 + }; 110 + 111 + const beforeRequest = async (options: RequestOptions) => { 112 + const { opts, req, url } = requestOptions(options); 113 + 114 + if (opts.security) { 115 + await setAuthParams({ 116 + ...opts, 117 + security: opts.security, 118 + }); 119 + } 120 + 121 + if (opts.requestValidator) { 122 + await opts.requestValidator(opts); 123 + } 124 + 125 + return { opts, req, url }; 126 + }; 127 + 128 + const request: Client['request'] = async (options) => { 129 + // @ts-expect-error 130 + const { opts, req: initialReq } = await beforeRequest(options); 131 + 132 + let req = initialReq; 133 + 134 + for (const fn of interceptors.request.fns) { 135 + if (fn) { 136 + req = await fn(req, opts as any); 137 + } 138 + } 139 + 140 + const result: { 141 + request: HttpRequest<unknown>; 142 + response: any; 143 + } = { 144 + request: req, 145 + response: null, 146 + }; 147 + 148 + try { 149 + result.response = (await firstValueFrom( 150 + opts 151 + .httpClient!.request(req) 152 + .pipe(filter((event) => event.type === HttpEventType.Response)), 153 + )) as HttpResponse<unknown>; 154 + 155 + for (const fn of interceptors.response.fns) { 156 + if (fn) { 157 + result.response = await fn(result.response, req, opts as any); 158 + } 159 + } 160 + 161 + let bodyResponse = result.response.body; 162 + 163 + if (opts.responseValidator) { 164 + await opts.responseValidator(bodyResponse); 165 + } 166 + 167 + if (opts.responseTransformer) { 168 + bodyResponse = await opts.responseTransformer(bodyResponse); 169 + } 170 + 171 + return opts.responseStyle === 'data' 172 + ? bodyResponse 173 + : { data: bodyResponse, ...result }; 174 + } catch (error) { 175 + if (error instanceof HttpErrorResponse) { 176 + result.response = error; 177 + } 178 + 179 + let finalError = error instanceof HttpErrorResponse ? error.error : error; 180 + 181 + for (const fn of interceptors.error.fns) { 182 + if (fn) { 183 + finalError = (await fn( 184 + finalError, 185 + result.response as any, 186 + req, 187 + opts as any, 188 + )) as string; 189 + } 190 + } 191 + 192 + if (opts.throwOnError) { 193 + throw finalError; 194 + } 195 + 196 + return opts.responseStyle === 'data' 197 + ? undefined 198 + : { 199 + error: finalError, 200 + ...result, 201 + }; 202 + } 203 + }; 204 + 205 + const makeMethodFn = 206 + (method: Uppercase<HttpMethod>) => (options: RequestOptions) => 207 + request({ ...options, method }); 208 + 209 + const makeSseFn = 210 + (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => { 211 + const { opts, url } = await beforeRequest(options); 212 + return createSseClient({ 213 + ...opts, 214 + body: opts.body as BodyInit | null | undefined, 215 + headers: opts.headers as unknown as Record<string, string>, 216 + method, 217 + url, 218 + }); 219 + }; 220 + 221 + return { 222 + buildUrl, 223 + connect: makeMethodFn('CONNECT'), 224 + delete: makeMethodFn('DELETE'), 225 + get: makeMethodFn('GET'), 226 + getConfig, 227 + head: makeMethodFn('HEAD'), 228 + interceptors, 229 + options: makeMethodFn('OPTIONS'), 230 + patch: makeMethodFn('PATCH'), 231 + post: makeMethodFn('POST'), 232 + put: makeMethodFn('PUT'), 233 + request, 234 + requestOptions: (options) => { 235 + if (options.security) { 236 + throw new Error('Security is not supported in requestOptions'); 237 + } 238 + 239 + if (options.requestValidator) { 240 + throw new Error( 241 + 'Request validation is not supported in requestOptions', 242 + ); 243 + } 244 + 245 + return requestOptions(options).req; 246 + }, 247 + setConfig, 248 + sse: { 249 + connect: makeSseFn('CONNECT'), 250 + delete: makeSseFn('DELETE'), 251 + get: makeSseFn('GET'), 252 + head: makeSseFn('HEAD'), 253 + options: makeSseFn('OPTIONS'), 254 + patch: makeSseFn('PATCH'), 255 + post: makeSseFn('POST'), 256 + put: makeSseFn('PUT'), 257 + trace: makeSseFn('TRACE'), 258 + }, 259 + trace: makeMethodFn('TRACE'), 260 + } as Client; 261 + };
+25
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/client/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type { Auth } from '../core/auth.gen.js'; 4 + export type { QuerySerializerOptions } from '../core/bodySerializer.gen.js'; 5 + export { 6 + formDataBodySerializer, 7 + jsonBodySerializer, 8 + urlSearchParamsBodySerializer, 9 + } from '../core/bodySerializer.gen.js'; 10 + export { buildClientParams } from '../core/params.gen.js'; 11 + export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen.js'; 12 + export { createClient } from './client.gen.js'; 13 + export type { 14 + Client, 15 + ClientOptions, 16 + Config, 17 + CreateClientConfig, 18 + Options, 19 + RequestOptions, 20 + RequestResult, 21 + ResolvedRequestOptions, 22 + ResponseStyle, 23 + TDataShape, 24 + } from './types.gen.js'; 25 + export { createConfig, mergeHeaders } from './utils.gen.js';
+256
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/client/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { 4 + HttpClient, 5 + HttpErrorResponse, 6 + HttpHeaders, 7 + HttpRequest, 8 + HttpResponse, 9 + } from '@angular/common/http'; 10 + import type { Injector } from '@angular/core'; 11 + 12 + import type { Auth } from '../core/auth.gen.js'; 13 + import type { 14 + ServerSentEventsOptions, 15 + ServerSentEventsResult, 16 + } from '../core/serverSentEvents.gen.js'; 17 + import type { 18 + Client as CoreClient, 19 + Config as CoreConfig, 20 + } from '../core/types.gen.js'; 21 + import type { Middleware } from './utils.gen.js'; 22 + 23 + export type ResponseStyle = 'data' | 'fields'; 24 + 25 + export interface Config<T extends ClientOptions = ClientOptions> 26 + extends Omit<RequestInit, 'body' | 'headers' | 'method'>, 27 + Omit<CoreConfig, 'headers'> { 28 + /** 29 + * Base URL for all requests made by this client. 30 + */ 31 + baseUrl?: T['baseUrl']; 32 + /** 33 + * An object containing any HTTP headers that you want to pre-populate your 34 + * `HttpHeaders` object with. 35 + * 36 + * {@link https://angular.dev/api/common/http/HttpHeaders#constructor See more} 37 + */ 38 + headers?: 39 + | HttpHeaders 40 + | Record< 41 + string, 42 + | string 43 + | number 44 + | boolean 45 + | (string | number | boolean)[] 46 + | null 47 + | undefined 48 + | unknown 49 + >; 50 + /** 51 + * The HTTP client to use for making requests. 52 + */ 53 + httpClient?: HttpClient; 54 + /** 55 + * Should we return only data or multiple fields (data, error, response, etc.)? 56 + * 57 + * @default 'fields' 58 + */ 59 + responseStyle?: ResponseStyle; 60 + 61 + /** 62 + * Throw an error instead of returning it in the response? 63 + * 64 + * @default false 65 + */ 66 + throwOnError?: T['throwOnError']; 67 + } 68 + 69 + export interface RequestOptions< 70 + TData = unknown, 71 + TResponseStyle extends ResponseStyle = 'fields', 72 + ThrowOnError extends boolean = boolean, 73 + Url extends string = string, 74 + > extends Config<{ 75 + responseStyle: TResponseStyle; 76 + throwOnError: ThrowOnError; 77 + }>, 78 + Pick< 79 + ServerSentEventsOptions<TData>, 80 + | 'onSseError' 81 + | 'onSseEvent' 82 + | 'sseDefaultRetryDelay' 83 + | 'sseMaxRetryAttempts' 84 + | 'sseMaxRetryDelay' 85 + > { 86 + /** 87 + * Any body that you want to add to your request. 88 + * 89 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} 90 + */ 91 + body?: unknown; 92 + /** 93 + * Optional custom injector for dependency resolution if you don't implicitly or explicitly provide one. 94 + */ 95 + injector?: Injector; 96 + path?: Record<string, unknown>; 97 + query?: Record<string, unknown>; 98 + /** 99 + * Security mechanism(s) to use for the request. 100 + */ 101 + security?: ReadonlyArray<Auth>; 102 + url: Url; 103 + } 104 + 105 + export interface ResolvedRequestOptions< 106 + TResponseStyle extends ResponseStyle = 'fields', 107 + ThrowOnError extends boolean = boolean, 108 + Url extends string = string, 109 + > extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> { 110 + serializedBody?: string; 111 + } 112 + 113 + export type RequestResult< 114 + TData = unknown, 115 + TError = unknown, 116 + ThrowOnError extends boolean = boolean, 117 + TResponseStyle extends ResponseStyle = 'fields', 118 + > = Promise< 119 + ThrowOnError extends true 120 + ? TResponseStyle extends 'data' 121 + ? TData extends Record<string, unknown> 122 + ? TData[keyof TData] 123 + : TData 124 + : { 125 + data: TData extends Record<string, unknown> 126 + ? TData[keyof TData] 127 + : TData; 128 + request: HttpRequest<unknown>; 129 + response: HttpResponse<TData>; 130 + } 131 + : TResponseStyle extends 'data' 132 + ? 133 + | (TData extends Record<string, unknown> ? TData[keyof TData] : TData) 134 + | undefined 135 + : 136 + | { 137 + data: TData extends Record<string, unknown> 138 + ? TData[keyof TData] 139 + : TData; 140 + error: undefined; 141 + request: HttpRequest<unknown>; 142 + response: HttpResponse<TData>; 143 + } 144 + | { 145 + data: undefined; 146 + error: TError[keyof TError]; 147 + request: HttpRequest<unknown>; 148 + response: HttpErrorResponse & { 149 + error: TError[keyof TError] | null; 150 + }; 151 + } 152 + >; 153 + 154 + export interface ClientOptions { 155 + baseUrl?: string; 156 + responseStyle?: ResponseStyle; 157 + throwOnError?: boolean; 158 + } 159 + 160 + type MethodFn = < 161 + TData = unknown, 162 + TError = unknown, 163 + ThrowOnError extends boolean = false, 164 + TResponseStyle extends ResponseStyle = 'fields', 165 + >( 166 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>, 167 + ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>; 168 + 169 + type SseFn = < 170 + TData = unknown, 171 + TError = unknown, 172 + ThrowOnError extends boolean = false, 173 + TResponseStyle extends ResponseStyle = 'fields', 174 + >( 175 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>, 176 + ) => Promise<ServerSentEventsResult<TData, TError>>; 177 + 178 + type RequestFn = < 179 + TData = unknown, 180 + TError = unknown, 181 + ThrowOnError extends boolean = false, 182 + TResponseStyle extends ResponseStyle = 'fields', 183 + >( 184 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & 185 + Pick< 186 + Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 187 + 'method' 188 + >, 189 + ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>; 190 + 191 + type RequestOptionsFn = < 192 + ThrowOnError extends boolean = false, 193 + TResponseStyle extends ResponseStyle = 'fields', 194 + >( 195 + options: RequestOptions<unknown, TResponseStyle, ThrowOnError>, 196 + ) => HttpRequest<unknown>; 197 + 198 + type BuildUrlFn = < 199 + TData extends { 200 + body?: unknown; 201 + path?: Record<string, unknown>; 202 + query?: Record<string, unknown>; 203 + url: string; 204 + }, 205 + >( 206 + options: TData & Options<TData>, 207 + ) => string; 208 + 209 + export type Client = CoreClient< 210 + RequestFn, 211 + Config, 212 + MethodFn, 213 + BuildUrlFn, 214 + SseFn 215 + > & { 216 + interceptors: Middleware< 217 + HttpRequest<unknown>, 218 + HttpResponse<unknown>, 219 + unknown, 220 + ResolvedRequestOptions 221 + >; 222 + requestOptions: RequestOptionsFn; 223 + }; 224 + 225 + /** 226 + * The `createClientConfig()` function will be called on client initialization 227 + * and the returned object will become the client's initial configuration. 228 + * 229 + * You may want to initialize your client this way instead of calling 230 + * `setConfig()`. This is useful for example if you're using Next.js 231 + * to ensure your client always has the correct values. 232 + */ 233 + export type CreateClientConfig<T extends ClientOptions = ClientOptions> = ( 234 + override?: Config<ClientOptions & T>, 235 + ) => Config<Required<ClientOptions> & T>; 236 + 237 + export interface TDataShape { 238 + body?: unknown; 239 + headers?: unknown; 240 + path?: unknown; 241 + query?: unknown; 242 + url: string; 243 + } 244 + 245 + type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>; 246 + 247 + export type Options< 248 + TData extends TDataShape = TDataShape, 249 + ThrowOnError extends boolean = boolean, 250 + TResponse = unknown, 251 + TResponseStyle extends ResponseStyle = 'fields', 252 + > = OmitKeys< 253 + RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 254 + 'body' | 'path' | 'query' | 'url' 255 + > & 256 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
+426
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/client/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { HttpHeaders } from '@angular/common/http'; 4 + 5 + import { getAuthToken } from '../core/auth.gen.js'; 6 + import type { 7 + QuerySerializer, 8 + QuerySerializerOptions, 9 + } from '../core/bodySerializer.gen.js'; 10 + import { 11 + serializeArrayParam, 12 + serializeObjectParam, 13 + serializePrimitiveParam, 14 + } from '../core/pathSerializer.gen.js'; 15 + import type { Client, ClientOptions, Config, RequestOptions } from './types.gen.js'; 16 + 17 + interface PathSerializer { 18 + path: Record<string, unknown>; 19 + url: string; 20 + } 21 + 22 + const PATH_PARAM_RE = /\{[^{}]+\}/g; 23 + 24 + type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; 25 + type MatrixStyle = 'label' | 'matrix' | 'simple'; 26 + type ArraySeparatorStyle = ArrayStyle | MatrixStyle; 27 + 28 + const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { 29 + let url = _url; 30 + const matches = _url.match(PATH_PARAM_RE); 31 + if (matches) { 32 + for (const match of matches) { 33 + let explode = false; 34 + let name = match.substring(1, match.length - 1); 35 + let style: ArraySeparatorStyle = 'simple'; 36 + 37 + if (name.endsWith('*')) { 38 + explode = true; 39 + name = name.substring(0, name.length - 1); 40 + } 41 + 42 + if (name.startsWith('.')) { 43 + name = name.substring(1); 44 + style = 'label'; 45 + } else if (name.startsWith(';')) { 46 + name = name.substring(1); 47 + style = 'matrix'; 48 + } 49 + 50 + const value = path[name]; 51 + 52 + if (value === undefined || value === null) { 53 + continue; 54 + } 55 + 56 + if (Array.isArray(value)) { 57 + url = url.replace( 58 + match, 59 + serializeArrayParam({ explode, name, style, value }), 60 + ); 61 + continue; 62 + } 63 + 64 + if (typeof value === 'object') { 65 + url = url.replace( 66 + match, 67 + serializeObjectParam({ 68 + explode, 69 + name, 70 + style, 71 + value: value as Record<string, unknown>, 72 + valueOnly: true, 73 + }), 74 + ); 75 + continue; 76 + } 77 + 78 + if (style === 'matrix') { 79 + url = url.replace( 80 + match, 81 + `;${serializePrimitiveParam({ 82 + name, 83 + value: value as string, 84 + })}`, 85 + ); 86 + continue; 87 + } 88 + 89 + const replaceValue = encodeURIComponent( 90 + style === 'label' ? `.${value as string}` : (value as string), 91 + ); 92 + url = url.replace(match, replaceValue); 93 + } 94 + } 95 + return url; 96 + }; 97 + 98 + export const createQuerySerializer = <T = unknown>({ 99 + parameters = {}, 100 + ...args 101 + }: QuerySerializerOptions = {}) => { 102 + const querySerializer = (queryParams: T) => { 103 + const search: string[] = []; 104 + if (queryParams && typeof queryParams === 'object') { 105 + for (const name in queryParams) { 106 + const value = queryParams[name]; 107 + 108 + if (value === undefined || value === null) { 109 + continue; 110 + } 111 + 112 + const options = parameters[name] || args; 113 + 114 + if (Array.isArray(value)) { 115 + const serializedArray = serializeArrayParam({ 116 + allowReserved: options.allowReserved, 117 + explode: true, 118 + name, 119 + style: 'form', 120 + value, 121 + ...options.array, 122 + }); 123 + if (serializedArray) search.push(serializedArray); 124 + } else if (typeof value === 'object') { 125 + const serializedObject = serializeObjectParam({ 126 + allowReserved: options.allowReserved, 127 + explode: true, 128 + name, 129 + style: 'deepObject', 130 + value: value as Record<string, unknown>, 131 + ...options.object, 132 + }); 133 + if (serializedObject) search.push(serializedObject); 134 + } else { 135 + const serializedPrimitive = serializePrimitiveParam({ 136 + allowReserved: options.allowReserved, 137 + name, 138 + value: value as string, 139 + }); 140 + if (serializedPrimitive) search.push(serializedPrimitive); 141 + } 142 + } 143 + } 144 + return search.join('&'); 145 + }; 146 + return querySerializer; 147 + }; 148 + 149 + /** 150 + * Infers parseAs value from provided Content-Type header. 151 + */ 152 + export const getParseAs = ( 153 + contentType: string | null, 154 + ): 'blob' | 'formData' | 'json' | 'stream' | 'text' | undefined => { 155 + if (!contentType) { 156 + // If no Content-Type header is provided, the best we can do is return the raw response body, 157 + // which is effectively the same as the 'stream' option. 158 + return 'stream'; 159 + } 160 + 161 + const cleanContent = contentType.split(';')[0]?.trim(); 162 + 163 + if (!cleanContent) { 164 + return; 165 + } 166 + 167 + if ( 168 + cleanContent.startsWith('application/json') || 169 + cleanContent.endsWith('+json') 170 + ) { 171 + return 'json'; 172 + } 173 + 174 + if (cleanContent === 'multipart/form-data') { 175 + return 'formData'; 176 + } 177 + 178 + if ( 179 + ['application/', 'audio/', 'image/', 'video/'].some((type) => 180 + cleanContent.startsWith(type), 181 + ) 182 + ) { 183 + return 'blob'; 184 + } 185 + 186 + if (cleanContent.startsWith('text/')) { 187 + return 'text'; 188 + } 189 + 190 + return; 191 + }; 192 + 193 + export const setAuthParams = async ( 194 + options: Pick<Required<RequestOptions>, 'security'> & 195 + Pick<RequestOptions, 'auth' | 'query'> & { 196 + headers: HttpHeaders; 197 + }, 198 + ) => { 199 + for (const auth of options.security) { 200 + const token = await getAuthToken(auth, options.auth); 201 + 202 + if (!token) { 203 + continue; 204 + } 205 + 206 + const name = auth.name ?? 'Authorization'; 207 + 208 + switch (auth.in) { 209 + case 'query': 210 + if (!options.query) { 211 + options.query = {}; 212 + } 213 + options.query[name] = token; 214 + break; 215 + case 'cookie': 216 + options.headers = options.headers.append('Cookie', `${name}=${token}`); 217 + break; 218 + case 'header': 219 + default: 220 + options.headers = options.headers.set(name, token); 221 + break; 222 + } 223 + 224 + return; 225 + } 226 + }; 227 + 228 + export const buildUrl: Client['buildUrl'] = (options) => { 229 + const url = getUrl({ 230 + baseUrl: options.baseUrl as string, 231 + path: options.path, 232 + query: options.query, 233 + querySerializer: 234 + typeof options.querySerializer === 'function' 235 + ? options.querySerializer 236 + : createQuerySerializer(options.querySerializer), 237 + url: options.url, 238 + }); 239 + return url; 240 + }; 241 + 242 + export const getUrl = ({ 243 + baseUrl, 244 + path, 245 + query, 246 + querySerializer, 247 + url: _url, 248 + }: { 249 + baseUrl?: string; 250 + path?: Record<string, unknown>; 251 + query?: Record<string, unknown>; 252 + querySerializer: QuerySerializer; 253 + url: string; 254 + }) => { 255 + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; 256 + let url = (baseUrl ?? '') + pathUrl; 257 + if (path) { 258 + url = defaultPathSerializer({ path, url }); 259 + } 260 + let search = query ? querySerializer(query) : ''; 261 + if (search.startsWith('?')) { 262 + search = search.substring(1); 263 + } 264 + if (search) { 265 + url += `?${search}`; 266 + } 267 + return url; 268 + }; 269 + 270 + export const mergeConfigs = (a: Config, b: Config): Config => { 271 + const config = { ...a, ...b }; 272 + if (config.baseUrl?.endsWith('/')) { 273 + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); 274 + } 275 + config.headers = mergeHeaders(a.headers, b.headers); 276 + return config; 277 + }; 278 + 279 + export const mergeHeaders = ( 280 + ...headers: Array<Required<Config>['headers'] | undefined> 281 + ): HttpHeaders => { 282 + let mergedHeaders = new HttpHeaders(); 283 + 284 + for (const header of headers) { 285 + if (!header || typeof header !== 'object') { 286 + continue; 287 + } 288 + 289 + if (header instanceof HttpHeaders) { 290 + // Merge HttpHeaders instance 291 + header.keys().forEach((key) => { 292 + const values = header.getAll(key); 293 + if (values) { 294 + values.forEach((value) => { 295 + mergedHeaders = mergedHeaders.append(key, value); 296 + }); 297 + } 298 + }); 299 + } else { 300 + // Merge plain object headers 301 + for (const [key, value] of Object.entries(header)) { 302 + if (value === null) { 303 + mergedHeaders = mergedHeaders.delete(key); 304 + } else if (Array.isArray(value)) { 305 + for (const v of value) { 306 + mergedHeaders = mergedHeaders.append(key, v as string); 307 + } 308 + } else if (value !== undefined) { 309 + // assume object headers are meant to be JSON stringified, i.e. their 310 + // content value in OpenAPI specification is 'application/json' 311 + mergedHeaders = mergedHeaders.set( 312 + key, 313 + typeof value === 'object' 314 + ? JSON.stringify(value) 315 + : (value as string), 316 + ); 317 + } 318 + } 319 + } 320 + } 321 + 322 + return mergedHeaders; 323 + }; 324 + 325 + type ErrInterceptor<Err, Res, Req, Options> = ( 326 + error: Err, 327 + response: Res, 328 + request: Req, 329 + options: Options, 330 + ) => Err | Promise<Err>; 331 + 332 + type ReqInterceptor<Req, Options> = ( 333 + request: Req, 334 + options: Options, 335 + ) => Req | Promise<Req>; 336 + 337 + type ResInterceptor<Res, Req, Options> = ( 338 + response: Res, 339 + request: Req, 340 + options: Options, 341 + ) => Res | Promise<Res>; 342 + 343 + class Interceptors<Interceptor> { 344 + fns: Array<Interceptor | null> = []; 345 + 346 + clear(): void { 347 + this.fns = []; 348 + } 349 + 350 + eject(id: number | Interceptor): void { 351 + const index = this.getInterceptorIndex(id); 352 + if (this.fns[index]) { 353 + this.fns[index] = null; 354 + } 355 + } 356 + 357 + exists(id: number | Interceptor): boolean { 358 + const index = this.getInterceptorIndex(id); 359 + return Boolean(this.fns[index]); 360 + } 361 + 362 + getInterceptorIndex(id: number | Interceptor): number { 363 + if (typeof id === 'number') { 364 + return this.fns[id] ? id : -1; 365 + } 366 + return this.fns.indexOf(id); 367 + } 368 + 369 + update( 370 + id: number | Interceptor, 371 + fn: Interceptor, 372 + ): number | Interceptor | false { 373 + const index = this.getInterceptorIndex(id); 374 + if (this.fns[index]) { 375 + this.fns[index] = fn; 376 + return id; 377 + } 378 + return false; 379 + } 380 + 381 + use(fn: Interceptor): number { 382 + this.fns.push(fn); 383 + return this.fns.length - 1; 384 + } 385 + } 386 + 387 + export interface Middleware<Req, Res, Err, Options> { 388 + error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>; 389 + request: Interceptors<ReqInterceptor<Req, Options>>; 390 + response: Interceptors<ResInterceptor<Res, Req, Options>>; 391 + } 392 + 393 + export const createInterceptors = <Req, Res, Err, Options>(): Middleware< 394 + Req, 395 + Res, 396 + Err, 397 + Options 398 + > => ({ 399 + error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(), 400 + request: new Interceptors<ReqInterceptor<Req, Options>>(), 401 + response: new Interceptors<ResInterceptor<Res, Req, Options>>(), 402 + }); 403 + 404 + const defaultQuerySerializer = createQuerySerializer({ 405 + allowReserved: false, 406 + array: { 407 + explode: true, 408 + style: 'form', 409 + }, 410 + object: { 411 + explode: true, 412 + style: 'deepObject', 413 + }, 414 + }); 415 + 416 + const defaultHeaders = { 417 + 'Content-Type': 'application/json', 418 + }; 419 + 420 + export const createConfig = <T extends ClientOptions = ClientOptions>( 421 + override: Config<Omit<ClientOptions, keyof T> & T> = {}, 422 + ): Config<Omit<ClientOptions, keyof T> & T> => ({ 423 + headers: defaultHeaders, 424 + querySerializer: defaultQuerySerializer, 425 + ...override, 426 + });
+42
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/core/auth.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type AuthToken = string | undefined; 4 + 5 + export interface Auth { 6 + /** 7 + * Which part of the request do we use to send the auth? 8 + * 9 + * @default 'header' 10 + */ 11 + in?: 'header' | 'query' | 'cookie'; 12 + /** 13 + * Header or query parameter name. 14 + * 15 + * @default 'Authorization' 16 + */ 17 + name?: string; 18 + scheme?: 'basic' | 'bearer'; 19 + type: 'apiKey' | 'http'; 20 + } 21 + 22 + export const getAuthToken = async ( 23 + auth: Auth, 24 + callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken, 25 + ): Promise<string | undefined> => { 26 + const token = 27 + typeof callback === 'function' ? await callback(auth) : callback; 28 + 29 + if (!token) { 30 + return; 31 + } 32 + 33 + if (auth.scheme === 'bearer') { 34 + return `Bearer ${token}`; 35 + } 36 + 37 + if (auth.scheme === 'basic') { 38 + return `Basic ${btoa(token)}`; 39 + } 40 + 41 + return token; 42 + };
+100
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/core/bodySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { 4 + ArrayStyle, 5 + ObjectStyle, 6 + SerializerOptions, 7 + } from './pathSerializer.gen.js'; 8 + 9 + export type QuerySerializer = (query: Record<string, unknown>) => string; 10 + 11 + export type BodySerializer = (body: any) => any; 12 + 13 + type QuerySerializerOptionsObject = { 14 + allowReserved?: boolean; 15 + array?: Partial<SerializerOptions<ArrayStyle>>; 16 + object?: Partial<SerializerOptions<ObjectStyle>>; 17 + }; 18 + 19 + export type QuerySerializerOptions = QuerySerializerOptionsObject & { 20 + /** 21 + * Per-parameter serialization overrides. When provided, these settings 22 + * override the global array/object settings for specific parameter names. 23 + */ 24 + parameters?: Record<string, QuerySerializerOptionsObject>; 25 + }; 26 + 27 + const serializeFormDataPair = ( 28 + data: FormData, 29 + key: string, 30 + value: unknown, 31 + ): void => { 32 + if (typeof value === 'string' || value instanceof Blob) { 33 + data.append(key, value); 34 + } else if (value instanceof Date) { 35 + data.append(key, value.toISOString()); 36 + } else { 37 + data.append(key, JSON.stringify(value)); 38 + } 39 + }; 40 + 41 + const serializeUrlSearchParamsPair = ( 42 + data: URLSearchParams, 43 + key: string, 44 + value: unknown, 45 + ): void => { 46 + if (typeof value === 'string') { 47 + data.append(key, value); 48 + } else { 49 + data.append(key, JSON.stringify(value)); 50 + } 51 + }; 52 + 53 + export const formDataBodySerializer = { 54 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 55 + body: T, 56 + ): FormData => { 57 + const data = new FormData(); 58 + 59 + Object.entries(body).forEach(([key, value]) => { 60 + if (value === undefined || value === null) { 61 + return; 62 + } 63 + if (Array.isArray(value)) { 64 + value.forEach((v) => serializeFormDataPair(data, key, v)); 65 + } else { 66 + serializeFormDataPair(data, key, value); 67 + } 68 + }); 69 + 70 + return data; 71 + }, 72 + }; 73 + 74 + export const jsonBodySerializer = { 75 + bodySerializer: <T>(body: T): string => 76 + JSON.stringify(body, (_key, value) => 77 + typeof value === 'bigint' ? value.toString() : value, 78 + ), 79 + }; 80 + 81 + export const urlSearchParamsBodySerializer = { 82 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 83 + body: T, 84 + ): string => { 85 + const data = new URLSearchParams(); 86 + 87 + Object.entries(body).forEach(([key, value]) => { 88 + if (value === undefined || value === null) { 89 + return; 90 + } 91 + if (Array.isArray(value)) { 92 + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); 93 + } else { 94 + serializeUrlSearchParamsPair(data, key, value); 95 + } 96 + }); 97 + 98 + return data.toString(); 99 + }, 100 + };
+176
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/core/params.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + type Slot = 'body' | 'headers' | 'path' | 'query'; 4 + 5 + export type Field = 6 + | { 7 + in: Exclude<Slot, 'body'>; 8 + /** 9 + * Field name. This is the name we want the user to see and use. 10 + */ 11 + key: string; 12 + /** 13 + * Field mapped name. This is the name we want to use in the request. 14 + * If omitted, we use the same value as `key`. 15 + */ 16 + map?: string; 17 + } 18 + | { 19 + in: Extract<Slot, 'body'>; 20 + /** 21 + * Key isn't required for bodies. 22 + */ 23 + key?: string; 24 + map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 36 + }; 37 + 38 + export interface Fields { 39 + allowExtra?: Partial<Record<Slot, boolean>>; 40 + args?: ReadonlyArray<Field>; 41 + } 42 + 43 + export type FieldsConfig = ReadonlyArray<Field | Fields>; 44 + 45 + const extraPrefixesMap: Record<string, Slot> = { 46 + $body_: 'body', 47 + $headers_: 'headers', 48 + $path_: 'path', 49 + $query_: 'query', 50 + }; 51 + const extraPrefixes = Object.entries(extraPrefixesMap); 52 + 53 + type KeyMap = Map< 54 + string, 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 63 + >; 64 + 65 + const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { 66 + if (!map) { 67 + map = new Map(); 68 + } 69 + 70 + for (const config of fields) { 71 + if ('in' in config) { 72 + if (config.key) { 73 + map.set(config.key, { 74 + in: config.in, 75 + map: config.map, 76 + }); 77 + } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 82 + } else if (config.args) { 83 + buildKeyMap(config.args, map); 84 + } 85 + } 86 + 87 + return map; 88 + }; 89 + 90 + interface Params { 91 + body: unknown; 92 + headers: Record<string, unknown>; 93 + path: Record<string, unknown>; 94 + query: Record<string, unknown>; 95 + } 96 + 97 + const stripEmptySlots = (params: Params) => { 98 + for (const [slot, value] of Object.entries(params)) { 99 + if (value && typeof value === 'object' && !Object.keys(value).length) { 100 + delete params[slot as Slot]; 101 + } 102 + } 103 + }; 104 + 105 + export const buildClientParams = ( 106 + args: ReadonlyArray<unknown>, 107 + fields: FieldsConfig, 108 + ) => { 109 + const params: Params = { 110 + body: {}, 111 + headers: {}, 112 + path: {}, 113 + query: {}, 114 + }; 115 + 116 + const map = buildKeyMap(fields); 117 + 118 + let config: FieldsConfig[number] | undefined; 119 + 120 + for (const [index, arg] of args.entries()) { 121 + if (fields[index]) { 122 + config = fields[index]; 123 + } 124 + 125 + if (!config) { 126 + continue; 127 + } 128 + 129 + if ('in' in config) { 130 + if (config.key) { 131 + const field = map.get(config.key)!; 132 + const name = field.map || config.key; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 136 + } else { 137 + params.body = arg; 138 + } 139 + } else { 140 + for (const [key, value] of Object.entries(arg ?? {})) { 141 + const field = map.get(key); 142 + 143 + if (field) { 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 150 + } else { 151 + const extra = extraPrefixes.find(([prefix]) => 152 + key.startsWith(prefix), 153 + ); 154 + 155 + if (extra) { 156 + const [prefix, slot] = extra; 157 + (params[slot] as Record<string, unknown>)[ 158 + key.slice(prefix.length) 159 + ] = value; 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 162 + if (allowed) { 163 + (params[slot as Slot] as Record<string, unknown>)[key] = value; 164 + break; 165 + } 166 + } 167 + } 168 + } 169 + } 170 + } 171 + } 172 + 173 + stripEmptySlots(params); 174 + 175 + return params; 176 + };
+181
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/core/pathSerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + interface SerializeOptions<T> 4 + extends SerializePrimitiveOptions, 5 + SerializerOptions<T> {} 6 + 7 + interface SerializePrimitiveOptions { 8 + allowReserved?: boolean; 9 + name: string; 10 + } 11 + 12 + export interface SerializerOptions<T> { 13 + /** 14 + * @default true 15 + */ 16 + explode: boolean; 17 + style: T; 18 + } 19 + 20 + export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; 21 + export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; 22 + type MatrixStyle = 'label' | 'matrix' | 'simple'; 23 + export type ObjectStyle = 'form' | 'deepObject'; 24 + type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; 25 + 26 + interface SerializePrimitiveParam extends SerializePrimitiveOptions { 27 + value: string; 28 + } 29 + 30 + export const separatorArrayExplode = (style: ArraySeparatorStyle) => { 31 + switch (style) { 32 + case 'label': 33 + return '.'; 34 + case 'matrix': 35 + return ';'; 36 + case 'simple': 37 + return ','; 38 + default: 39 + return '&'; 40 + } 41 + }; 42 + 43 + export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { 44 + switch (style) { 45 + case 'form': 46 + return ','; 47 + case 'pipeDelimited': 48 + return '|'; 49 + case 'spaceDelimited': 50 + return '%20'; 51 + default: 52 + return ','; 53 + } 54 + }; 55 + 56 + export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { 57 + switch (style) { 58 + case 'label': 59 + return '.'; 60 + case 'matrix': 61 + return ';'; 62 + case 'simple': 63 + return ','; 64 + default: 65 + return '&'; 66 + } 67 + }; 68 + 69 + export const serializeArrayParam = ({ 70 + allowReserved, 71 + explode, 72 + name, 73 + style, 74 + value, 75 + }: SerializeOptions<ArraySeparatorStyle> & { 76 + value: unknown[]; 77 + }) => { 78 + if (!explode) { 79 + const joinedValues = ( 80 + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) 81 + ).join(separatorArrayNoExplode(style)); 82 + switch (style) { 83 + case 'label': 84 + return `.${joinedValues}`; 85 + case 'matrix': 86 + return `;${name}=${joinedValues}`; 87 + case 'simple': 88 + return joinedValues; 89 + default: 90 + return `${name}=${joinedValues}`; 91 + } 92 + } 93 + 94 + const separator = separatorArrayExplode(style); 95 + const joinedValues = value 96 + .map((v) => { 97 + if (style === 'label' || style === 'simple') { 98 + return allowReserved ? v : encodeURIComponent(v as string); 99 + } 100 + 101 + return serializePrimitiveParam({ 102 + allowReserved, 103 + name, 104 + value: v as string, 105 + }); 106 + }) 107 + .join(separator); 108 + return style === 'label' || style === 'matrix' 109 + ? separator + joinedValues 110 + : joinedValues; 111 + }; 112 + 113 + export const serializePrimitiveParam = ({ 114 + allowReserved, 115 + name, 116 + value, 117 + }: SerializePrimitiveParam) => { 118 + if (value === undefined || value === null) { 119 + return ''; 120 + } 121 + 122 + if (typeof value === 'object') { 123 + throw new Error( 124 + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', 125 + ); 126 + } 127 + 128 + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; 129 + }; 130 + 131 + export const serializeObjectParam = ({ 132 + allowReserved, 133 + explode, 134 + name, 135 + style, 136 + value, 137 + valueOnly, 138 + }: SerializeOptions<ObjectSeparatorStyle> & { 139 + value: Record<string, unknown> | Date; 140 + valueOnly?: boolean; 141 + }) => { 142 + if (value instanceof Date) { 143 + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; 144 + } 145 + 146 + if (style !== 'deepObject' && !explode) { 147 + let values: string[] = []; 148 + Object.entries(value).forEach(([key, v]) => { 149 + values = [ 150 + ...values, 151 + key, 152 + allowReserved ? (v as string) : encodeURIComponent(v as string), 153 + ]; 154 + }); 155 + const joinedValues = values.join(','); 156 + switch (style) { 157 + case 'form': 158 + return `${name}=${joinedValues}`; 159 + case 'label': 160 + return `.${joinedValues}`; 161 + case 'matrix': 162 + return `;${name}=${joinedValues}`; 163 + default: 164 + return joinedValues; 165 + } 166 + } 167 + 168 + const separator = separatorObjectExplode(style); 169 + const joinedValues = Object.entries(value) 170 + .map(([key, v]) => 171 + serializePrimitiveParam({ 172 + allowReserved, 173 + name: style === 'deepObject' ? `${name}[${key}]` : key, 174 + value: v as string, 175 + }), 176 + ) 177 + .join(separator); 178 + return style === 'label' || style === 'matrix' 179 + ? separator + joinedValues 180 + : joinedValues; 181 + };
+136
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/core/queryKeySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + /** 4 + * JSON-friendly union that mirrors what Pinia Colada can hash. 5 + */ 6 + export type JsonValue = 7 + | null 8 + | string 9 + | number 10 + | boolean 11 + | JsonValue[] 12 + | { [key: string]: JsonValue }; 13 + 14 + /** 15 + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. 16 + */ 17 + export const queryKeyJsonReplacer = (_key: string, value: unknown) => { 18 + if ( 19 + value === undefined || 20 + typeof value === 'function' || 21 + typeof value === 'symbol' 22 + ) { 23 + return undefined; 24 + } 25 + if (typeof value === 'bigint') { 26 + return value.toString(); 27 + } 28 + if (value instanceof Date) { 29 + return value.toISOString(); 30 + } 31 + return value; 32 + }; 33 + 34 + /** 35 + * Safely stringifies a value and parses it back into a JsonValue. 36 + */ 37 + export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { 38 + try { 39 + const json = JSON.stringify(input, queryKeyJsonReplacer); 40 + if (json === undefined) { 41 + return undefined; 42 + } 43 + return JSON.parse(json) as JsonValue; 44 + } catch { 45 + return undefined; 46 + } 47 + }; 48 + 49 + /** 50 + * Detects plain objects (including objects with a null prototype). 51 + */ 52 + const isPlainObject = (value: unknown): value is Record<string, unknown> => { 53 + if (value === null || typeof value !== 'object') { 54 + return false; 55 + } 56 + const prototype = Object.getPrototypeOf(value as object); 57 + return prototype === Object.prototype || prototype === null; 58 + }; 59 + 60 + /** 61 + * Turns URLSearchParams into a sorted JSON object for deterministic keys. 62 + */ 63 + const serializeSearchParams = (params: URLSearchParams): JsonValue => { 64 + const entries = Array.from(params.entries()).sort(([a], [b]) => 65 + a.localeCompare(b), 66 + ); 67 + const result: Record<string, JsonValue> = {}; 68 + 69 + for (const [key, value] of entries) { 70 + const existing = result[key]; 71 + if (existing === undefined) { 72 + result[key] = value; 73 + continue; 74 + } 75 + 76 + if (Array.isArray(existing)) { 77 + (existing as string[]).push(value); 78 + } else { 79 + result[key] = [existing, value]; 80 + } 81 + } 82 + 83 + return result; 84 + }; 85 + 86 + /** 87 + * Normalizes any accepted value into a JSON-friendly shape for query keys. 88 + */ 89 + export const serializeQueryKeyValue = ( 90 + value: unknown, 91 + ): JsonValue | undefined => { 92 + if (value === null) { 93 + return null; 94 + } 95 + 96 + if ( 97 + typeof value === 'string' || 98 + typeof value === 'number' || 99 + typeof value === 'boolean' 100 + ) { 101 + return value; 102 + } 103 + 104 + if ( 105 + value === undefined || 106 + typeof value === 'function' || 107 + typeof value === 'symbol' 108 + ) { 109 + return undefined; 110 + } 111 + 112 + if (typeof value === 'bigint') { 113 + return value.toString(); 114 + } 115 + 116 + if (value instanceof Date) { 117 + return value.toISOString(); 118 + } 119 + 120 + if (Array.isArray(value)) { 121 + return stringifyToJsonValue(value); 122 + } 123 + 124 + if ( 125 + typeof URLSearchParams !== 'undefined' && 126 + value instanceof URLSearchParams 127 + ) { 128 + return serializeSearchParams(value); 129 + } 130 + 131 + if (isPlainObject(value)) { 132 + return stringifyToJsonValue(value); 133 + } 134 + 135 + return undefined; 136 + };
+266
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/core/serverSentEvents.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Config } from './types.gen.js'; 4 + 5 + export type ServerSentEventsOptions<TData = unknown> = Omit< 6 + RequestInit, 7 + 'method' 8 + > & 9 + Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & { 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 + * Implementing clients can call request interceptors inside this hook. 19 + */ 20 + onRequest?: (url: string, init: RequestInit) => Promise<Request>; 21 + /** 22 + * Callback invoked when a network or parsing error occurs during streaming. 23 + * 24 + * This option applies only if the endpoint returns a stream of events. 25 + * 26 + * @param error The error that occurred. 27 + */ 28 + onSseError?: (error: unknown) => void; 29 + /** 30 + * Callback invoked when an event is streamed from the server. 31 + * 32 + * This option applies only if the endpoint returns a stream of events. 33 + * 34 + * @param event Event streamed from the server. 35 + * @returns Nothing (void). 36 + */ 37 + onSseEvent?: (event: StreamEvent<TData>) => void; 38 + serializedBody?: RequestInit['body']; 39 + /** 40 + * Default retry delay in milliseconds. 41 + * 42 + * This option applies only if the endpoint returns a stream of events. 43 + * 44 + * @default 3000 45 + */ 46 + sseDefaultRetryDelay?: number; 47 + /** 48 + * Maximum number of retry attempts before giving up. 49 + */ 50 + sseMaxRetryAttempts?: number; 51 + /** 52 + * Maximum retry delay in milliseconds. 53 + * 54 + * Applies only when exponential backoff is used. 55 + * 56 + * This option applies only if the endpoint returns a stream of events. 57 + * 58 + * @default 30000 59 + */ 60 + sseMaxRetryDelay?: number; 61 + /** 62 + * Optional sleep function for retry backoff. 63 + * 64 + * Defaults to using `setTimeout`. 65 + */ 66 + sseSleepFn?: (ms: number) => Promise<void>; 67 + url: string; 68 + }; 69 + 70 + export interface StreamEvent<TData = unknown> { 71 + data: TData; 72 + event?: string; 73 + id?: string; 74 + retry?: number; 75 + } 76 + 77 + export type ServerSentEventsResult< 78 + TData = unknown, 79 + TReturn = void, 80 + TNext = unknown, 81 + > = { 82 + stream: AsyncGenerator< 83 + TData extends Record<string, unknown> ? TData[keyof TData] : TData, 84 + TReturn, 85 + TNext 86 + >; 87 + }; 88 + 89 + export const createSseClient = <TData = unknown>({ 90 + onRequest, 91 + onSseError, 92 + onSseEvent, 93 + responseTransformer, 94 + responseValidator, 95 + sseDefaultRetryDelay, 96 + sseMaxRetryAttempts, 97 + sseMaxRetryDelay, 98 + sseSleepFn, 99 + url, 100 + ...options 101 + }: ServerSentEventsOptions): ServerSentEventsResult<TData> => { 102 + let lastEventId: string | undefined; 103 + 104 + const sleep = 105 + sseSleepFn ?? 106 + ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); 107 + 108 + const createStream = async function* () { 109 + let retryDelay: number = sseDefaultRetryDelay ?? 3000; 110 + let attempt = 0; 111 + const signal = options.signal ?? new AbortController().signal; 112 + 113 + while (true) { 114 + if (signal.aborted) break; 115 + 116 + attempt++; 117 + 118 + const headers = 119 + options.headers instanceof Headers 120 + ? options.headers 121 + : new Headers(options.headers as Record<string, string> | undefined); 122 + 123 + if (lastEventId !== undefined) { 124 + headers.set('Last-Event-ID', lastEventId); 125 + } 126 + 127 + try { 128 + const requestInit: RequestInit = { 129 + redirect: 'follow', 130 + ...options, 131 + body: options.serializedBody, 132 + headers, 133 + signal, 134 + }; 135 + let request = new Request(url, requestInit); 136 + if (onRequest) { 137 + request = await onRequest(url, requestInit); 138 + } 139 + // fetch must be assigned here, otherwise it would throw the error: 140 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 141 + const _fetch = options.fetch ?? globalThis.fetch; 142 + const response = await _fetch(request); 143 + 144 + if (!response.ok) 145 + throw new Error( 146 + `SSE failed: ${response.status} ${response.statusText}`, 147 + ); 148 + 149 + if (!response.body) throw new Error('No body in SSE response'); 150 + 151 + const reader = response.body 152 + .pipeThrough(new TextDecoderStream()) 153 + .getReader(); 154 + 155 + let buffer = ''; 156 + 157 + const abortHandler = () => { 158 + try { 159 + reader.cancel(); 160 + } catch { 161 + // noop 162 + } 163 + }; 164 + 165 + signal.addEventListener('abort', abortHandler); 166 + 167 + try { 168 + while (true) { 169 + const { done, value } = await reader.read(); 170 + if (done) break; 171 + buffer += value; 172 + // Normalize line endings: CRLF -> LF, then CR -> LF 173 + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); 174 + 175 + const chunks = buffer.split('\n\n'); 176 + buffer = chunks.pop() ?? ''; 177 + 178 + for (const chunk of chunks) { 179 + const lines = chunk.split('\n'); 180 + const dataLines: Array<string> = []; 181 + let eventName: string | undefined; 182 + 183 + for (const line of lines) { 184 + if (line.startsWith('data:')) { 185 + dataLines.push(line.replace(/^data:\s*/, '')); 186 + } else if (line.startsWith('event:')) { 187 + eventName = line.replace(/^event:\s*/, ''); 188 + } else if (line.startsWith('id:')) { 189 + lastEventId = line.replace(/^id:\s*/, ''); 190 + } else if (line.startsWith('retry:')) { 191 + const parsed = Number.parseInt( 192 + line.replace(/^retry:\s*/, ''), 193 + 10, 194 + ); 195 + if (!Number.isNaN(parsed)) { 196 + retryDelay = parsed; 197 + } 198 + } 199 + } 200 + 201 + let data: unknown; 202 + let parsedJson = false; 203 + 204 + if (dataLines.length) { 205 + const rawData = dataLines.join('\n'); 206 + try { 207 + data = JSON.parse(rawData); 208 + parsedJson = true; 209 + } catch { 210 + data = rawData; 211 + } 212 + } 213 + 214 + if (parsedJson) { 215 + if (responseValidator) { 216 + await responseValidator(data); 217 + } 218 + 219 + if (responseTransformer) { 220 + data = await responseTransformer(data); 221 + } 222 + } 223 + 224 + onSseEvent?.({ 225 + data, 226 + event: eventName, 227 + id: lastEventId, 228 + retry: retryDelay, 229 + }); 230 + 231 + if (dataLines.length) { 232 + yield data as any; 233 + } 234 + } 235 + } 236 + } finally { 237 + signal.removeEventListener('abort', abortHandler); 238 + reader.releaseLock(); 239 + } 240 + 241 + break; // exit loop on normal completion 242 + } catch (error) { 243 + // connection failed or aborted; retry after delay 244 + onSseError?.(error); 245 + 246 + if ( 247 + sseMaxRetryAttempts !== undefined && 248 + attempt >= sseMaxRetryAttempts 249 + ) { 250 + break; // stop after firing error 251 + } 252 + 253 + // exponential backoff: double retry each attempt, cap at 30s 254 + const backoff = Math.min( 255 + retryDelay * 2 ** (attempt - 1), 256 + sseMaxRetryDelay ?? 30000, 257 + ); 258 + await sleep(backoff); 259 + } 260 + } 261 + }; 262 + 263 + const stream = createStream(); 264 + 265 + return { stream }; 266 + };
+118
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/core/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth, AuthToken } from './auth.gen.js'; 4 + import type { 5 + BodySerializer, 6 + QuerySerializer, 7 + QuerySerializerOptions, 8 + } from './bodySerializer.gen.js'; 9 + 10 + export type HttpMethod = 11 + | 'connect' 12 + | 'delete' 13 + | 'get' 14 + | 'head' 15 + | 'options' 16 + | 'patch' 17 + | 'post' 18 + | 'put' 19 + | 'trace'; 20 + 21 + export type Client< 22 + RequestFn = never, 23 + Config = unknown, 24 + MethodFn = never, 25 + BuildUrlFn = never, 26 + SseFn = never, 27 + > = { 28 + /** 29 + * Returns the final request URL. 30 + */ 31 + buildUrl: BuildUrlFn; 32 + getConfig: () => Config; 33 + request: RequestFn; 34 + setConfig: (config: Config) => Config; 35 + } & { 36 + [K in HttpMethod]: MethodFn; 37 + } & ([SseFn] extends [never] 38 + ? { sse?: never } 39 + : { sse: { [K in HttpMethod]: SseFn } }); 40 + 41 + export interface Config { 42 + /** 43 + * Auth token or a function returning auth token. The resolved value will be 44 + * added to the request payload as defined by its `security` array. 45 + */ 46 + auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken; 47 + /** 48 + * A function for serializing request body parameter. By default, 49 + * {@link JSON.stringify()} will be used. 50 + */ 51 + bodySerializer?: BodySerializer | null; 52 + /** 53 + * An object containing any HTTP headers that you want to pre-populate your 54 + * `Headers` object with. 55 + * 56 + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} 57 + */ 58 + headers?: 59 + | RequestInit['headers'] 60 + | Record< 61 + string, 62 + | string 63 + | number 64 + | boolean 65 + | (string | number | boolean)[] 66 + | null 67 + | undefined 68 + | unknown 69 + >; 70 + /** 71 + * The request method. 72 + * 73 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} 74 + */ 75 + method?: Uppercase<HttpMethod>; 76 + /** 77 + * A function for serializing request query parameters. By default, arrays 78 + * will be exploded in form style, objects will be exploded in deepObject 79 + * style, and reserved characters are percent-encoded. 80 + * 81 + * This method will have no effect if the native `paramsSerializer()` Axios 82 + * API function is used. 83 + * 84 + * {@link https://swagger.io/docs/specification/serialization/#query View examples} 85 + */ 86 + querySerializer?: QuerySerializer | QuerySerializerOptions; 87 + /** 88 + * A function validating request data. This is useful if you want to ensure 89 + * the request conforms to the desired shape, so it can be safely sent to 90 + * the server. 91 + */ 92 + requestValidator?: (data: unknown) => Promise<unknown>; 93 + /** 94 + * A function transforming response data before it's returned. This is useful 95 + * for post-processing data, e.g. converting ISO strings into Date objects. 96 + */ 97 + responseTransformer?: (data: unknown) => Promise<unknown>; 98 + /** 99 + * A function validating response data. This is useful if you want to ensure 100 + * the response conforms to the desired shape, so it can be safely passed to 101 + * the transformers and returned to the user. 102 + */ 103 + responseValidator?: (data: unknown) => Promise<unknown>; 104 + } 105 + 106 + type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 + ? true 108 + : [T] extends [never | undefined] 109 + ? [undefined] extends [T] 110 + ? false 111 + : true 112 + : false; 113 + 114 + export type OmitNever<T extends Record<string, unknown>> = { 115 + [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 + ? never 117 + : K]: T[K]; 118 + };
+143
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/core/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { BodySerializer, QuerySerializer } from './bodySerializer.gen.js'; 4 + import { 5 + type ArraySeparatorStyle, 6 + serializeArrayParam, 7 + serializeObjectParam, 8 + serializePrimitiveParam, 9 + } from './pathSerializer.gen.js'; 10 + 11 + export interface PathSerializer { 12 + path: Record<string, unknown>; 13 + url: string; 14 + } 15 + 16 + export const PATH_PARAM_RE = /\{[^{}]+\}/g; 17 + 18 + export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { 19 + let url = _url; 20 + const matches = _url.match(PATH_PARAM_RE); 21 + if (matches) { 22 + for (const match of matches) { 23 + let explode = false; 24 + let name = match.substring(1, match.length - 1); 25 + let style: ArraySeparatorStyle = 'simple'; 26 + 27 + if (name.endsWith('*')) { 28 + explode = true; 29 + name = name.substring(0, name.length - 1); 30 + } 31 + 32 + if (name.startsWith('.')) { 33 + name = name.substring(1); 34 + style = 'label'; 35 + } else if (name.startsWith(';')) { 36 + name = name.substring(1); 37 + style = 'matrix'; 38 + } 39 + 40 + const value = path[name]; 41 + 42 + if (value === undefined || value === null) { 43 + continue; 44 + } 45 + 46 + if (Array.isArray(value)) { 47 + url = url.replace( 48 + match, 49 + serializeArrayParam({ explode, name, style, value }), 50 + ); 51 + continue; 52 + } 53 + 54 + if (typeof value === 'object') { 55 + url = url.replace( 56 + match, 57 + serializeObjectParam({ 58 + explode, 59 + name, 60 + style, 61 + value: value as Record<string, unknown>, 62 + valueOnly: true, 63 + }), 64 + ); 65 + continue; 66 + } 67 + 68 + if (style === 'matrix') { 69 + url = url.replace( 70 + match, 71 + `;${serializePrimitiveParam({ 72 + name, 73 + value: value as string, 74 + })}`, 75 + ); 76 + continue; 77 + } 78 + 79 + const replaceValue = encodeURIComponent( 80 + style === 'label' ? `.${value as string}` : (value as string), 81 + ); 82 + url = url.replace(match, replaceValue); 83 + } 84 + } 85 + return url; 86 + }; 87 + 88 + export const getUrl = ({ 89 + baseUrl, 90 + path, 91 + query, 92 + querySerializer, 93 + url: _url, 94 + }: { 95 + baseUrl?: string; 96 + path?: Record<string, unknown>; 97 + query?: Record<string, unknown>; 98 + querySerializer: QuerySerializer; 99 + url: string; 100 + }) => { 101 + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; 102 + let url = (baseUrl ?? '') + pathUrl; 103 + if (path) { 104 + url = defaultPathSerializer({ path, url }); 105 + } 106 + let search = query ? querySerializer(query) : ''; 107 + if (search.startsWith('?')) { 108 + search = search.substring(1); 109 + } 110 + if (search) { 111 + url += `?${search}`; 112 + } 113 + return url; 114 + }; 115 + 116 + export function getValidRequestBody(options: { 117 + body?: unknown; 118 + bodySerializer?: BodySerializer | null; 119 + serializedBody?: unknown; 120 + }) { 121 + const hasBody = options.body !== undefined; 122 + const isSerializedBody = hasBody && options.bodySerializer; 123 + 124 + if (isSerializedBody) { 125 + if ('serializedBody' in options) { 126 + const hasSerializedBody = 127 + options.serializedBody !== undefined && options.serializedBody !== ''; 128 + 129 + return hasSerializedBody ? options.serializedBody : null; 130 + } 131 + 132 + // not all clients implement a serializedBody property (i.e. client-axios) 133 + return options.body !== '' ? options.body : null; 134 + } 135 + 136 + // plain/text body 137 + if (hasBody) { 138 + return options.body; 139 + } 140 + 141 + // no body was provided 142 + return undefined; 143 + }
+4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export { apiVVersionODataControllerCount, callToTestOrderOfParams, callWithDefaultOptionalParameters, callWithDefaultParameters, callWithDescriptions, callWithDuplicateResponses, callWithNoContentResponse, callWithParameters, callWithResponse, callWithResponseAndNoContentResponse, callWithResponses, callWithResultFromHeader, callWithWeirdParameterNames, collectionFormat, complexParams, complexTypes, deleteCallWithoutParametersAndResponse, deleteFoo, deprecatedCall, dummyA, dummyB, duplicateName, duplicateName2, duplicateName3, duplicateName4, export_, fileResponse, fooWow, getApiVbyApiVersionSimpleOperation, getCallWithOptionalParam, getCallWithoutParametersAndResponse, headCallWithoutParametersAndResponse, import_, multipartRequest, multipartResponse, nonAsciiæøåÆøÅöôêÊ字符串, type Options, optionsCallWithoutParametersAndResponse, patchApiVbyApiVersionNoTag, patchCallWithoutParametersAndResponse, postApiVbyApiVersionFormData, postApiVbyApiVersionRequestBody, postCallWithOptionalParam, postCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, putWithFormUrlEncoded, testErrorCode, types, uploadFile } from './sdk.gen.js'; 4 + export type { _3eNum1Период, _400, AdditionalPropertiesIntegerIssue, AdditionalPropertiesUnknownIssue, AdditionalPropertiesUnknownIssue2, AdditionalPropertiesUnknownIssue3, AdditionalPropertiesUnknownIssueWritable, AnyOfAnyAndNull, AnyOfArrays, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountResponses, ArrayWithAnyOfProperties, ArrayWithArray, ArrayWithBooleans, ArrayWithNumbers, ArrayWithProperties, ArrayWithReferences, ArrayWithStrings, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponse, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesError, CallWithResponsesErrors, CallWithResponsesResponse, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CamelCaseCommentWithBreaks, CharactersInDescription, ClientOptions, CollectionFormatData, CommentWithBackticks, CommentWithBackticksAndQuotes, CommentWithBreaks, CommentWithExpressionPlaceholders, CommentWithQuotes, CommentWithReservedCharacters, CommentWithSlashes, ComplexParamsData, ComplexParamsResponse, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponse, ComplexTypesResponses, CompositionBaseModel, CompositionExtendedModel, CompositionWithAllOfAndNullable, CompositionWithAnyOf, CompositionWithAnyOfAndNullable, CompositionWithAnyOfAnonymous, CompositionWithNestedAnyAndTypeNull, CompositionWithNestedAnyOfAndNull, CompositionWithOneOf, CompositionWithOneOfAndComplexArrayDictionary, CompositionWithOneOfAndNullable, CompositionWithOneOfAndProperties, CompositionWithOneOfAndSimpleArrayDictionary, CompositionWithOneOfAndSimpleDictionary, CompositionWithOneOfAnonymous, CompositionWithOneOfDiscriminator, ConstValue, Default, DeleteCallWithoutParametersAndResponseData, DeleteFooData, DeleteFooData2, DeleteFooData3, DeprecatedCallData, DeprecatedModel, DictionaryWithArray, DictionaryWithDictionary, DictionaryWithProperties, DictionaryWithPropertiesAndAdditionalProperties, DictionaryWithReference, DictionaryWithString, DummyAData, DummyAResponse, DummyAResponses, DummyBData, DummyBResponse, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, EnumFromDescription, EnumWithExtensions, EnumWithNumbers, EnumWithReplacedCharacters, EnumWithStrings, EnumWithXEnumNames, ExportData, ExternalRefA, ExternalRefB, ExternalSharedExternalSharedModel, File, FileResponseData, FileResponseResponse, FileResponseResponses, FileWritable, FooWowData, FooWowResponses, FreeFormObjectWithAdditionalPropertiesEqEmptyObject, FreeFormObjectWithAdditionalPropertiesEqTrue, FreeFormObjectWithoutAdditionalProperties, GenericSchemaDuplicateIssue1SystemBoolean, GenericSchemaDuplicateIssue1SystemBooleanWritable, GenericSchemaDuplicateIssue1SystemString, GenericSchemaDuplicateIssue1SystemStringWritable, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, Import, ImportData, ImportResponse, ImportResponses, IoK8sApimachineryPkgApisMetaV1DeleteOptions, IoK8sApimachineryPkgApisMetaV1Preconditions, ModelCircle, ModelFromZendesk, ModelSquare, ModelThatExtends, ModelThatExtendsExtends, ModelWithAdditionalPropertiesEqTrue, ModelWithAnyOfConstantSizeArray, ModelWithAnyOfConstantSizeArrayAndIntersect, ModelWithAnyOfConstantSizeArrayNullable, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable, ModelWithArray, ModelWithArrayReadOnlyAndWriteOnly, ModelWithArrayReadOnlyAndWriteOnlyWritable, ModelWithBackticksInDescription, ModelWithBoolean, ModelWithCircularReference, ModelWithConst, ModelWithConstantSizeArray, ModelWithDictionary, ModelWithDuplicateImports, ModelWithDuplicateProperties, ModelWithEnum, ModelWithEnumFromDescription, ModelWithEnumWithHyphen, ModelWithInteger, ModelWithNestedArrayEnums, ModelWithNestedArrayEnumsData, ModelWithNestedArrayEnumsDataBar, ModelWithNestedArrayEnumsDataFoo, ModelWithNestedCompositionEnums, ModelWithNestedEnums, ModelWithNestedProperties, ModelWithNullableObject, ModelWithNullableString, ModelWithNumericEnumUnion, ModelWithOneOfAndProperties, ModelWithOneOfEnum, ModelWithOrderedProperties, ModelWithPattern, ModelWithPatternWritable, ModelWithPrefixItemsConstantSizeArray, ModelWithProperties, ModelWithPropertiesWritable, ModelWithReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnlyWritable, ModelWithReference, ModelWithReferenceWritable, ModelWithString, ModelWithStringError, MultipartRequestData, MultipartResponseData, MultipartResponseResponse, MultipartResponseResponses, NestedAnyOfArraysNullable, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Responses, NonAsciiStringæøåÆøÅöôêÊ字符串, NullableObject, OneOfAllOfIssue, OneOfAllOfIssueWritable, OptionsCallWithoutParametersAndResponseData, Pageable, ParameterSimpleParameterUnused, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PostServiceWithEmptyTagResponse, PostServiceWithEmptyTagResponse2, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, SchemaWithFormRestrictedKeys, SimpleBoolean, SimpleFile, SimpleFormData, SimpleInteger, SimpleParameter, SimpleReference, SimpleRequestBody, SimpleString, SimpleStringWithPattern, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponse, TypesResponses, UploadFileData, UploadFileResponse, UploadFileResponses, XFooBar } from './types.gen.js';
+206
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/sdk.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { client } from './client.gen.js'; 4 + import { type Client, formDataBodySerializer, type Options as Options2, type TDataShape, urlSearchParamsBodySerializer } from './client/index.js'; 5 + import type { ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponses, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesErrors, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CollectionFormatData, ComplexParamsData, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponses, DeleteCallWithoutParametersAndResponseData, DeleteFooData3, DeprecatedCallData, DummyAData, DummyAResponses, DummyBData, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, ExportData, FileResponseData, FileResponseResponses, FooWowData, FooWowResponses, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, ImportData, ImportResponses, MultipartRequestData, MultipartResponseData, MultipartResponseResponses, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Responses, OptionsCallWithoutParametersAndResponseData, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponses, UploadFileData, UploadFileResponses } from './types.gen.js'; 6 + 7 + export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & { 8 + /** 9 + * You can provide a client instance returned by `createClient()` instead of 10 + * individual options. This might be also useful if you want to implement a 11 + * custom client. 12 + */ 13 + client?: Client; 14 + /** 15 + * You can pass arbitrary values through the `meta` object. This can be 16 + * used to access values that aren't defined as part of the SDK function. 17 + */ 18 + meta?: Record<string, unknown>; 19 + }; 20 + 21 + export const export_ = <ThrowOnError extends boolean = false>(options?: Options<ExportData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 22 + 23 + export const patchApiVbyApiVersionNoTag = <ThrowOnError extends boolean = false>(options?: Options<PatchApiVbyApiVersionNoTagData, ThrowOnError>) => (options?.client ?? client).patch<PatchApiVbyApiVersionNoTagResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 24 + 25 + export const import_ = <ThrowOnError extends boolean = false>(options: Options<ImportData, ThrowOnError>) => (options.client ?? client).post<ImportResponses, unknown, ThrowOnError>({ 26 + url: '/api/v{api-version}/no+tag', 27 + ...options, 28 + headers: { 29 + 'Content-Type': 'application/json', 30 + ...options.headers 31 + } 32 + }); 33 + 34 + export const fooWow = <ThrowOnError extends boolean = false>(options?: Options<FooWowData, ThrowOnError>) => (options?.client ?? client).put<FooWowResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 35 + 36 + export const apiVVersionODataControllerCount = <ThrowOnError extends boolean = false>(options?: Options<ApiVVersionODataControllerCountData, ThrowOnError>) => (options?.client ?? client).get<ApiVVersionODataControllerCountResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple/$count', ...options }); 37 + 38 + export const getApiVbyApiVersionSimpleOperation = <ThrowOnError extends boolean = false>(options: Options<GetApiVbyApiVersionSimpleOperationData, ThrowOnError>) => (options.client ?? client).get<GetApiVbyApiVersionSimpleOperationResponses, GetApiVbyApiVersionSimpleOperationErrors, ThrowOnError>({ url: '/api/v{api-version}/simple:operation', ...options }); 39 + 40 + export const deleteCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<DeleteCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 41 + 42 + export const getCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<GetCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 43 + 44 + export const headCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<HeadCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).head<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 45 + 46 + export const optionsCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<OptionsCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).options<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 47 + 48 + export const patchCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PatchCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).patch<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 49 + 50 + export const postCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PostCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 51 + 52 + export const putCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PutCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 53 + 54 + export const deleteFoo = <ThrowOnError extends boolean = false>(options: Options<DeleteFooData3, ThrowOnError>) => (options.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', ...options }); 55 + 56 + export const callWithDescriptions = <ThrowOnError extends boolean = false>(options?: Options<CallWithDescriptionsData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/descriptions', ...options }); 57 + 58 + /** 59 + * @deprecated 60 + */ 61 + export const deprecatedCall = <ThrowOnError extends boolean = false>(options: Options<DeprecatedCallData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/parameters/deprecated', ...options }); 62 + 63 + export const callWithParameters = <ThrowOnError extends boolean = false>(options: Options<CallWithParametersData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ 64 + url: '/api/v{api-version}/parameters/{parameterPath}', 65 + ...options, 66 + headers: { 67 + 'Content-Type': 'application/json', 68 + ...options.headers 69 + } 70 + }); 71 + 72 + export const callWithWeirdParameterNames = <ThrowOnError extends boolean = false>(options: Options<CallWithWeirdParameterNamesData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ 73 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', 74 + ...options, 75 + headers: { 76 + 'Content-Type': 'application/json', 77 + ...options.headers 78 + } 79 + }); 80 + 81 + export const getCallWithOptionalParam = <ThrowOnError extends boolean = false>(options: Options<GetCallWithOptionalParamData, ThrowOnError>) => (options.client ?? client).get<unknown, unknown, ThrowOnError>({ 82 + url: '/api/v{api-version}/parameters', 83 + ...options, 84 + headers: { 85 + 'Content-Type': 'application/json', 86 + ...options.headers 87 + } 88 + }); 89 + 90 + export const postCallWithOptionalParam = <ThrowOnError extends boolean = false>(options: Options<PostCallWithOptionalParamData, ThrowOnError>) => (options.client ?? client).post<PostCallWithOptionalParamResponses, unknown, ThrowOnError>({ 91 + url: '/api/v{api-version}/parameters', 92 + ...options, 93 + headers: { 94 + 'Content-Type': 'application/json', 95 + ...options.headers 96 + } 97 + }); 98 + 99 + export const postApiVbyApiVersionRequestBody = <ThrowOnError extends boolean = false>(options?: Options<PostApiVbyApiVersionRequestBodyData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 100 + url: '/api/v{api-version}/requestBody', 101 + ...options, 102 + headers: { 103 + 'Content-Type': 'application/json', 104 + ...options?.headers 105 + } 106 + }); 107 + 108 + export const postApiVbyApiVersionFormData = <ThrowOnError extends boolean = false>(options?: Options<PostApiVbyApiVersionFormDataData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 109 + ...formDataBodySerializer, 110 + url: '/api/v{api-version}/formData', 111 + ...options, 112 + headers: { 113 + 'Content-Type': null, 114 + ...options?.headers 115 + } 116 + }); 117 + 118 + export const callWithDefaultParameters = <ThrowOnError extends boolean = false>(options?: Options<CallWithDefaultParametersData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 119 + 120 + export const callWithDefaultOptionalParameters = <ThrowOnError extends boolean = false>(options?: Options<CallWithDefaultOptionalParametersData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 121 + 122 + export const callToTestOrderOfParams = <ThrowOnError extends boolean = false>(options: Options<CallToTestOrderOfParamsData, ThrowOnError>) => (options.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 123 + 124 + export const duplicateName = <ThrowOnError extends boolean = false>(options?: Options<DuplicateNameData, ThrowOnError>) => (options?.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 125 + 126 + export const duplicateName2 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName2Data, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 127 + 128 + export const duplicateName3 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName3Data, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 129 + 130 + export const duplicateName4 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName4Data, ThrowOnError>) => (options?.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 131 + 132 + export const callWithNoContentResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithNoContentResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithNoContentResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no-content', ...options }); 133 + 134 + export const callWithResponseAndNoContentResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponseAndNoContentResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithResponseAndNoContentResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/response-and-no-content', ...options }); 135 + 136 + export const dummyA = <ThrowOnError extends boolean = false>(options?: Options<DummyAData, ThrowOnError>) => (options?.client ?? client).get<DummyAResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/a', ...options }); 137 + 138 + export const dummyB = <ThrowOnError extends boolean = false>(options?: Options<DummyBData, ThrowOnError>) => (options?.client ?? client).get<DummyBResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/b', ...options }); 139 + 140 + export const callWithResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 141 + 142 + export const callWithDuplicateResponses = <ThrowOnError extends boolean = false>(options?: Options<CallWithDuplicateResponsesData, ThrowOnError>) => (options?.client ?? client).post<CallWithDuplicateResponsesResponses, CallWithDuplicateResponsesErrors, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 143 + 144 + export const callWithResponses = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponsesData, ThrowOnError>) => (options?.client ?? client).put<CallWithResponsesResponses, CallWithResponsesErrors, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 145 + 146 + export const collectionFormat = <ThrowOnError extends boolean = false>(options: Options<CollectionFormatData, ThrowOnError>) => (options.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/collectionFormat', ...options }); 147 + 148 + export const types = <ThrowOnError extends boolean = false>(options: Options<TypesData, ThrowOnError>) => (options.client ?? client).get<TypesResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/types', ...options }); 149 + 150 + export const uploadFile = <ThrowOnError extends boolean = false>(options: Options<UploadFileData, ThrowOnError>) => (options.client ?? client).post<UploadFileResponses, unknown, ThrowOnError>({ 151 + ...urlSearchParamsBodySerializer, 152 + url: '/api/v{api-version}/upload', 153 + ...options, 154 + headers: { 155 + 'Content-Type': 'application/x-www-form-urlencoded', 156 + ...options.headers 157 + } 158 + }); 159 + 160 + export const fileResponse = <ThrowOnError extends boolean = false>(options: Options<FileResponseData, ThrowOnError>) => (options.client ?? client).get<FileResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/file/{id}', ...options }); 161 + 162 + export const complexTypes = <ThrowOnError extends boolean = false>(options: Options<ComplexTypesData, ThrowOnError>) => (options.client ?? client).get<ComplexTypesResponses, ComplexTypesErrors, ThrowOnError>({ 163 + querySerializer: { parameters: { parameterObject: { object: { style: 'form' } } } }, 164 + url: '/api/v{api-version}/complex', 165 + ...options 166 + }); 167 + 168 + export const multipartResponse = <ThrowOnError extends boolean = false>(options?: Options<MultipartResponseData, ThrowOnError>) => (options?.client ?? client).get<MultipartResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multipart', ...options }); 169 + 170 + export const multipartRequest = <ThrowOnError extends boolean = false>(options?: Options<MultipartRequestData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 171 + ...formDataBodySerializer, 172 + url: '/api/v{api-version}/multipart', 173 + ...options, 174 + headers: { 175 + 'Content-Type': null, 176 + ...options?.headers 177 + } 178 + }); 179 + 180 + export const complexParams = <ThrowOnError extends boolean = false>(options: Options<ComplexParamsData, ThrowOnError>) => (options.client ?? client).put<ComplexParamsResponses, unknown, ThrowOnError>({ 181 + url: '/api/v{api-version}/complex/{id}', 182 + ...options, 183 + headers: { 184 + 'Content-Type': 'application/json-patch+json', 185 + ...options.headers 186 + } 187 + }); 188 + 189 + export const callWithResultFromHeader = <ThrowOnError extends boolean = false>(options?: Options<CallWithResultFromHeaderData, ThrowOnError>) => (options?.client ?? client).post<CallWithResultFromHeaderResponses, CallWithResultFromHeaderErrors, ThrowOnError>({ url: '/api/v{api-version}/header', ...options }); 190 + 191 + export const testErrorCode = <ThrowOnError extends boolean = false>(options: Options<TestErrorCodeData, ThrowOnError>) => (options.client ?? client).post<TestErrorCodeResponses, TestErrorCodeErrors, ThrowOnError>({ url: '/api/v{api-version}/error', ...options }); 192 + 193 + export const nonAsciiæøåÆøÅöôêÊ字符串 = <ThrowOnError extends boolean = false>(options: Options<NonAsciiæøåÆøÅöôêÊ字符串Data, ThrowOnError>) => (options.client ?? client).post<NonAsciiæøåÆøÅöôêÊ字符串Responses, unknown, ThrowOnError>({ url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', ...options }); 194 + 195 + /** 196 + * Login User 197 + */ 198 + export const putWithFormUrlEncoded = <ThrowOnError extends boolean = false>(options: Options<PutWithFormUrlEncodedData, ThrowOnError>) => (options.client ?? client).put<unknown, unknown, ThrowOnError>({ 199 + ...urlSearchParamsBodySerializer, 200 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', 201 + ...options, 202 + headers: { 203 + 'Content-Type': 'application/x-www-form-urlencoded', 204 + ...options.headers 205 + } 206 + });
+2091
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-angular/tsconfig-node16-sdk/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type ClientOptions = { 4 + baseUrl: 'http://localhost:3000/base' | (string & {}); 5 + }; 6 + 7 + /** 8 + * Model with number-only name 9 + */ 10 + export type _400 = string; 11 + 12 + /** 13 + * External ref to shared model (A) 14 + */ 15 + export type ExternalRefA = ExternalSharedExternalSharedModel; 16 + 17 + /** 18 + * External ref to shared model (B) 19 + */ 20 + export type ExternalRefB = ExternalSharedExternalSharedModel; 21 + 22 + /** 23 + * Testing multiline comments in string: First line 24 + * Second line 25 + * 26 + * Fourth line 27 + */ 28 + export type CamelCaseCommentWithBreaks = number; 29 + 30 + /** 31 + * Testing multiline comments in string: First line 32 + * Second line 33 + * 34 + * Fourth line 35 + */ 36 + export type CommentWithBreaks = number; 37 + 38 + /** 39 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 40 + */ 41 + export type CommentWithBackticks = number; 42 + 43 + /** 44 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 45 + */ 46 + export type CommentWithBackticksAndQuotes = number; 47 + 48 + /** 49 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 50 + */ 51 + export type CommentWithSlashes = number; 52 + 53 + /** 54 + * Testing expression placeholders in string: ${expression} should work 55 + */ 56 + export type CommentWithExpressionPlaceholders = number; 57 + 58 + /** 59 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 60 + */ 61 + export type CommentWithQuotes = number; 62 + 63 + /** 64 + * Testing reserved characters in string: * inline * and ** inline ** should work 65 + */ 66 + export type CommentWithReservedCharacters = number; 67 + 68 + /** 69 + * This is a simple number 70 + */ 71 + export type SimpleInteger = number; 72 + 73 + /** 74 + * This is a simple boolean 75 + */ 76 + export type SimpleBoolean = boolean; 77 + 78 + /** 79 + * This is a simple string 80 + */ 81 + export type SimpleString = string; 82 + 83 + /** 84 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 85 + */ 86 + export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; 87 + 88 + /** 89 + * This is a simple file 90 + */ 91 + export type SimpleFile = Blob | File; 92 + 93 + /** 94 + * This is a simple reference 95 + */ 96 + export type SimpleReference = ModelWithString; 97 + 98 + /** 99 + * This is a simple string 100 + */ 101 + export type SimpleStringWithPattern = string | null; 102 + 103 + /** 104 + * This is a simple enum with strings 105 + */ 106 + export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | '\'Single Quote\'' | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; 107 + 108 + export type EnumWithReplacedCharacters = '\'Single Quote\'' | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; 109 + 110 + /** 111 + * This is a simple enum with numbers 112 + */ 113 + export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; 114 + 115 + /** 116 + * Success=1,Warning=2,Error=3 117 + */ 118 + export type EnumFromDescription = number; 119 + 120 + /** 121 + * This is a simple enum with numbers 122 + */ 123 + export type EnumWithExtensions = 200 | 400 | 500; 124 + 125 + export type EnumWithXEnumNames = 0 | 1 | 2; 126 + 127 + /** 128 + * This is a simple array with numbers 129 + */ 130 + export type ArrayWithNumbers = Array<number>; 131 + 132 + /** 133 + * This is a simple array with booleans 134 + */ 135 + export type ArrayWithBooleans = Array<boolean>; 136 + 137 + /** 138 + * This is a simple array with strings 139 + */ 140 + export type ArrayWithStrings = Array<string>; 141 + 142 + /** 143 + * This is a simple array with references 144 + */ 145 + export type ArrayWithReferences = Array<ModelWithString>; 146 + 147 + /** 148 + * This is a simple array containing an array 149 + */ 150 + export type ArrayWithArray = Array<Array<ModelWithString>>; 151 + 152 + /** 153 + * This is a simple array with properties 154 + */ 155 + export type ArrayWithProperties = Array<{ 156 + '16x16'?: CamelCaseCommentWithBreaks; 157 + bar?: string; 158 + }>; 159 + 160 + /** 161 + * This is a simple array with any of properties 162 + */ 163 + export type ArrayWithAnyOfProperties = Array<{ 164 + foo?: string; 165 + } | { 166 + bar?: string; 167 + }>; 168 + 169 + export type AnyOfAnyAndNull = { 170 + data?: unknown | null; 171 + }; 172 + 173 + /** 174 + * This is a simple array with any of properties 175 + */ 176 + export type AnyOfArrays = { 177 + results?: Array<{ 178 + foo?: string; 179 + } | { 180 + bar?: string; 181 + }>; 182 + }; 183 + 184 + /** 185 + * This is a string dictionary 186 + */ 187 + export type DictionaryWithString = { 188 + [key: string]: string; 189 + }; 190 + 191 + export type DictionaryWithPropertiesAndAdditionalProperties = { 192 + foo?: number; 193 + bar?: boolean; 194 + [key: string]: string | number | boolean | undefined; 195 + }; 196 + 197 + /** 198 + * This is a string reference 199 + */ 200 + export type DictionaryWithReference = { 201 + [key: string]: ModelWithString; 202 + }; 203 + 204 + /** 205 + * This is a complex dictionary 206 + */ 207 + export type DictionaryWithArray = { 208 + [key: string]: Array<ModelWithString>; 209 + }; 210 + 211 + /** 212 + * This is a string dictionary 213 + */ 214 + export type DictionaryWithDictionary = { 215 + [key: string]: { 216 + [key: string]: string; 217 + }; 218 + }; 219 + 220 + /** 221 + * This is a complex dictionary 222 + */ 223 + export type DictionaryWithProperties = { 224 + [key: string]: { 225 + foo?: string; 226 + bar?: string; 227 + }; 228 + }; 229 + 230 + /** 231 + * This is a model with one number property 232 + */ 233 + export type ModelWithInteger = { 234 + /** 235 + * This is a simple number property 236 + */ 237 + prop?: number; 238 + }; 239 + 240 + /** 241 + * This is a model with one boolean property 242 + */ 243 + export type ModelWithBoolean = { 244 + /** 245 + * This is a simple boolean property 246 + */ 247 + prop?: boolean; 248 + }; 249 + 250 + /** 251 + * This is a model with one string property 252 + */ 253 + export type ModelWithString = { 254 + /** 255 + * This is a simple string property 256 + */ 257 + prop?: string; 258 + }; 259 + 260 + /** 261 + * This is a model with one string property 262 + */ 263 + export type ModelWithStringError = { 264 + /** 265 + * This is a simple string property 266 + */ 267 + prop?: string; 268 + }; 269 + 270 + /** 271 + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) 272 + */ 273 + export type ModelFromZendesk = string; 274 + 275 + /** 276 + * This is a model with one string property 277 + */ 278 + export type ModelWithNullableString = { 279 + /** 280 + * This is a simple string property 281 + */ 282 + nullableProp1?: string | null; 283 + /** 284 + * This is a simple string property 285 + */ 286 + nullableRequiredProp1: string | null; 287 + /** 288 + * This is a simple string property 289 + */ 290 + nullableProp2?: string | null; 291 + /** 292 + * This is a simple string property 293 + */ 294 + nullableRequiredProp2: string | null; 295 + /** 296 + * This is a simple enum with strings 297 + */ 298 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 299 + }; 300 + 301 + /** 302 + * This is a model with one enum 303 + */ 304 + export type ModelWithEnum = { 305 + /** 306 + * This is a simple enum with strings 307 + */ 308 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 309 + /** 310 + * These are the HTTP error code enums 311 + */ 312 + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; 313 + /** 314 + * Simple boolean enum 315 + */ 316 + bool?: true; 317 + }; 318 + 319 + /** 320 + * This is a model with one enum with escaped name 321 + */ 322 + export type ModelWithEnumWithHyphen = { 323 + /** 324 + * Foo-Bar-Baz-Qux 325 + */ 326 + 'foo-bar-baz-qux'?: '3.0'; 327 + }; 328 + 329 + /** 330 + * This is a model with one enum 331 + */ 332 + export type ModelWithEnumFromDescription = { 333 + /** 334 + * Success=1,Warning=2,Error=3 335 + */ 336 + test?: number; 337 + }; 338 + 339 + /** 340 + * This is a model with nested enums 341 + */ 342 + export type ModelWithNestedEnums = { 343 + dictionaryWithEnum?: { 344 + [key: string]: 'Success' | 'Warning' | 'Error'; 345 + }; 346 + dictionaryWithEnumFromDescription?: { 347 + [key: string]: number; 348 + }; 349 + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; 350 + arrayWithDescription?: Array<number>; 351 + /** 352 + * This is a simple enum with strings 353 + */ 354 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 355 + }; 356 + 357 + /** 358 + * This is a model with one property containing a reference 359 + */ 360 + export type ModelWithReference = { 361 + prop?: ModelWithProperties; 362 + }; 363 + 364 + /** 365 + * This is a model with one property containing an array 366 + */ 367 + export type ModelWithArrayReadOnlyAndWriteOnly = { 368 + prop?: Array<ModelWithReadOnlyAndWriteOnly>; 369 + propWithFile?: Array<Blob | File>; 370 + propWithNumber?: Array<number>; 371 + }; 372 + 373 + /** 374 + * This is a model with one property containing an array 375 + */ 376 + export type ModelWithArray = { 377 + prop?: Array<ModelWithString>; 378 + propWithFile?: Array<Blob | File>; 379 + propWithNumber?: Array<number>; 380 + }; 381 + 382 + /** 383 + * This is a model with one property containing a dictionary 384 + */ 385 + export type ModelWithDictionary = { 386 + prop?: { 387 + [key: string]: string; 388 + }; 389 + }; 390 + 391 + /** 392 + * This is a deprecated model with a deprecated property 393 + * 394 + * @deprecated 395 + */ 396 + export type DeprecatedModel = { 397 + /** 398 + * This is a deprecated property 399 + * 400 + * @deprecated 401 + */ 402 + prop?: string; 403 + }; 404 + 405 + /** 406 + * This is a model with one property containing a circular reference 407 + */ 408 + export type ModelWithCircularReference = { 409 + prop?: ModelWithCircularReference; 410 + }; 411 + 412 + /** 413 + * This is a model with one property with a 'one of' relationship 414 + */ 415 + export type CompositionWithOneOf = { 416 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 417 + }; 418 + 419 + /** 420 + * This is a model with one property with a 'one of' relationship where the options are not $ref 421 + */ 422 + export type CompositionWithOneOfAnonymous = { 423 + propA?: { 424 + propA?: string; 425 + } | string | number; 426 + }; 427 + 428 + /** 429 + * Circle 430 + */ 431 + export type ModelCircle = { 432 + kind: string; 433 + radius?: number; 434 + }; 435 + 436 + /** 437 + * Square 438 + */ 439 + export type ModelSquare = { 440 + kind: string; 441 + sideLength?: number; 442 + }; 443 + 444 + /** 445 + * This is a model with one property with a 'one of' relationship where the options are not $ref 446 + */ 447 + export type CompositionWithOneOfDiscriminator = ({ 448 + kind: 'circle'; 449 + } & ModelCircle) | ({ 450 + kind: 'square'; 451 + } & ModelSquare); 452 + 453 + /** 454 + * This is a model with one property with a 'any of' relationship 455 + */ 456 + export type CompositionWithAnyOf = { 457 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 458 + }; 459 + 460 + /** 461 + * This is a model with one property with a 'any of' relationship where the options are not $ref 462 + */ 463 + export type CompositionWithAnyOfAnonymous = { 464 + propA?: { 465 + propA?: string; 466 + } | string | number; 467 + }; 468 + 469 + /** 470 + * This is a model with nested 'any of' property with a type null 471 + */ 472 + export type CompositionWithNestedAnyAndTypeNull = { 473 + propA?: Array<ModelWithDictionary | null> | Array<ModelWithArray | null>; 474 + }; 475 + 476 + export type _3eNum1Период = 'Bird' | 'Dog'; 477 + 478 + export type ConstValue = 'ConstValue'; 479 + 480 + /** 481 + * This is a model with one property with a 'any of' relationship where the options are not $ref 482 + */ 483 + export type CompositionWithNestedAnyOfAndNull = { 484 + /** 485 + * Scopes 486 + */ 487 + propA?: Array<_3eNum1Период | ConstValue> | null; 488 + }; 489 + 490 + /** 491 + * This is a model with one property with a 'one of' relationship 492 + */ 493 + export type CompositionWithOneOfAndNullable = { 494 + propA?: { 495 + boolean?: boolean; 496 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 497 + }; 498 + 499 + /** 500 + * This is a model that contains a simple dictionary within composition 501 + */ 502 + export type CompositionWithOneOfAndSimpleDictionary = { 503 + propA?: boolean | { 504 + [key: string]: number; 505 + }; 506 + }; 507 + 508 + /** 509 + * This is a model that contains a dictionary of simple arrays within composition 510 + */ 511 + export type CompositionWithOneOfAndSimpleArrayDictionary = { 512 + propA?: boolean | { 513 + [key: string]: Array<boolean>; 514 + }; 515 + }; 516 + 517 + /** 518 + * This is a model that contains a dictionary of complex arrays (composited) within composition 519 + */ 520 + export type CompositionWithOneOfAndComplexArrayDictionary = { 521 + propA?: boolean | { 522 + [key: string]: Array<number | string>; 523 + }; 524 + }; 525 + 526 + /** 527 + * This is a model with one property with a 'all of' relationship 528 + */ 529 + export type CompositionWithAllOfAndNullable = { 530 + propA?: ({ 531 + boolean?: boolean; 532 + } & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null; 533 + }; 534 + 535 + /** 536 + * This is a model with one property with a 'any of' relationship 537 + */ 538 + export type CompositionWithAnyOfAndNullable = { 539 + propA?: { 540 + boolean?: boolean; 541 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 542 + }; 543 + 544 + /** 545 + * This is a base model with two simple optional properties 546 + */ 547 + export type CompositionBaseModel = { 548 + firstName?: string; 549 + lastname?: string; 550 + }; 551 + 552 + /** 553 + * This is a model that extends the base model 554 + */ 555 + export type CompositionExtendedModel = CompositionBaseModel & { 556 + age: number; 557 + firstName: string; 558 + lastname: string; 559 + }; 560 + 561 + /** 562 + * This is a model with one nested property 563 + */ 564 + export type ModelWithProperties = { 565 + required: string; 566 + readonly requiredAndReadOnly: string; 567 + requiredAndNullable: string | null; 568 + string?: string; 569 + number?: number; 570 + boolean?: boolean; 571 + reference?: ModelWithString; 572 + 'property with space'?: string; 573 + default?: string; 574 + try?: string; 575 + readonly '@namespace.string'?: string; 576 + readonly '@namespace.integer'?: number; 577 + }; 578 + 579 + /** 580 + * This is a model with one nested property 581 + */ 582 + export type ModelWithNestedProperties = { 583 + readonly first: { 584 + readonly second: { 585 + readonly third: string | null; 586 + } | null; 587 + } | null; 588 + }; 589 + 590 + /** 591 + * This is a model with duplicated properties 592 + */ 593 + export type ModelWithDuplicateProperties = { 594 + prop?: ModelWithString; 595 + }; 596 + 597 + /** 598 + * This is a model with ordered properties 599 + */ 600 + export type ModelWithOrderedProperties = { 601 + zebra?: string; 602 + apple?: string; 603 + hawaii?: string; 604 + }; 605 + 606 + /** 607 + * This is a model with duplicated imports 608 + */ 609 + export type ModelWithDuplicateImports = { 610 + propA?: ModelWithString; 611 + propB?: ModelWithString; 612 + propC?: ModelWithString; 613 + }; 614 + 615 + /** 616 + * This is a model that extends another model 617 + */ 618 + export type ModelThatExtends = ModelWithString & { 619 + propExtendsA?: string; 620 + propExtendsB?: ModelWithString; 621 + }; 622 + 623 + /** 624 + * This is a model that extends another model 625 + */ 626 + export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { 627 + propExtendsC?: string; 628 + propExtendsD?: ModelWithString; 629 + }; 630 + 631 + /** 632 + * This is a model that contains a some patterns 633 + */ 634 + export type ModelWithPattern = { 635 + key: string; 636 + name: string; 637 + readonly enabled?: boolean; 638 + readonly modified?: string; 639 + id?: string; 640 + text?: string; 641 + patternWithSingleQuotes?: string; 642 + patternWithNewline?: string; 643 + patternWithBacktick?: string; 644 + }; 645 + 646 + export type File = { 647 + /** 648 + * Id 649 + */ 650 + readonly id?: string; 651 + /** 652 + * Updated at 653 + */ 654 + readonly updated_at?: string; 655 + /** 656 + * Created at 657 + */ 658 + readonly created_at?: string; 659 + /** 660 + * Mime 661 + */ 662 + mime: string; 663 + /** 664 + * File 665 + */ 666 + readonly file?: string; 667 + }; 668 + 669 + export type Default = { 670 + name?: string; 671 + }; 672 + 673 + export type Pageable = { 674 + page?: number; 675 + size?: number; 676 + sort?: Array<string>; 677 + }; 678 + 679 + /** 680 + * This is a free-form object without additionalProperties. 681 + */ 682 + export type FreeFormObjectWithoutAdditionalProperties = { 683 + [key: string]: unknown; 684 + }; 685 + 686 + /** 687 + * This is a free-form object with additionalProperties: true. 688 + */ 689 + export type FreeFormObjectWithAdditionalPropertiesEqTrue = { 690 + [key: string]: unknown; 691 + }; 692 + 693 + /** 694 + * This is a free-form object with additionalProperties: {}. 695 + */ 696 + export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { 697 + [key: string]: unknown; 698 + }; 699 + 700 + export type ModelWithConst = { 701 + String?: 'String'; 702 + number?: 0; 703 + null?: null; 704 + withType?: 'Some string'; 705 + }; 706 + 707 + /** 708 + * This is a model with one property and additionalProperties: true 709 + */ 710 + export type ModelWithAdditionalPropertiesEqTrue = { 711 + /** 712 + * This is a simple string property 713 + */ 714 + prop?: string; 715 + [key: string]: unknown | string | undefined; 716 + }; 717 + 718 + export type NestedAnyOfArraysNullable = { 719 + nullableArray?: Array<string | boolean> | null; 720 + }; 721 + 722 + export type CompositionWithOneOfAndProperties = ({ 723 + foo: SimpleParameter; 724 + } | { 725 + bar: NonAsciiStringæøåÆøÅöôêÊ字符串; 726 + }) & { 727 + baz: number | null; 728 + qux: number; 729 + }; 730 + 731 + /** 732 + * An object that can be null 733 + */ 734 + export type NullableObject = { 735 + foo?: string; 736 + } | null; 737 + 738 + /** 739 + * Some % character 740 + */ 741 + export type CharactersInDescription = string; 742 + 743 + export type ModelWithNullableObject = { 744 + data?: NullableObject; 745 + }; 746 + 747 + export type ModelWithOneOfEnum = { 748 + foo: 'Bar'; 749 + } | { 750 + foo: 'Baz'; 751 + } | { 752 + foo: 'Qux'; 753 + } | { 754 + content: string; 755 + foo: 'Quux'; 756 + } | { 757 + content: [ 758 + string, 759 + string 760 + ]; 761 + foo: 'Corge'; 762 + }; 763 + 764 + export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; 765 + 766 + export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; 767 + 768 + export type ModelWithNestedArrayEnumsData = { 769 + foo?: Array<ModelWithNestedArrayEnumsDataFoo>; 770 + bar?: Array<ModelWithNestedArrayEnumsDataBar>; 771 + }; 772 + 773 + export type ModelWithNestedArrayEnums = { 774 + array_strings?: Array<string>; 775 + data?: ModelWithNestedArrayEnumsData; 776 + }; 777 + 778 + export type ModelWithNestedCompositionEnums = { 779 + foo?: ModelWithNestedArrayEnumsDataFoo; 780 + }; 781 + 782 + export type ModelWithReadOnlyAndWriteOnly = { 783 + foo: string; 784 + readonly bar: string; 785 + }; 786 + 787 + export type ModelWithConstantSizeArray = [ 788 + number, 789 + number 790 + ]; 791 + 792 + export type ModelWithAnyOfConstantSizeArray = [ 793 + number | string, 794 + number | string, 795 + number | string 796 + ]; 797 + 798 + export type ModelWithPrefixItemsConstantSizeArray = [ 799 + ModelWithInteger, 800 + number | string, 801 + string 802 + ]; 803 + 804 + export type ModelWithAnyOfConstantSizeArrayNullable = [ 805 + number | null | string, 806 + number | null | string, 807 + number | null | string 808 + ]; 809 + 810 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ 811 + number | Import, 812 + number | Import 813 + ]; 814 + 815 + export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ 816 + number & string, 817 + number & string 818 + ]; 819 + 820 + export type ModelWithNumericEnumUnion = { 821 + /** 822 + * Период 823 + */ 824 + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; 825 + }; 826 + 827 + /** 828 + * Some description with `back ticks` 829 + */ 830 + export type ModelWithBackticksInDescription = { 831 + /** 832 + * The template `that` should be used for parsing and importing the contents of the CSV file. 833 + * 834 + * <br/><p>There is one placeholder currently supported:<ul> <li><b>${x}</b> - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)</li></ul><p>Example of a correct JSON template:</p> 835 + * <pre> 836 + * [ 837 + * { 838 + * "resourceType": "Asset", 839 + * "identifier": { 840 + * "name": "${1}", 841 + * "domain": { 842 + * "name": "${2}", 843 + * "community": { 844 + * "name": "Some Community" 845 + * } 846 + * } 847 + * }, 848 + * "attributes" : { 849 + * "00000000-0000-0000-0000-000000003115" : [ { 850 + * "value" : "${3}" 851 + * } ], 852 + * "00000000-0000-0000-0000-000000000222" : [ { 853 + * "value" : "${4}" 854 + * } ] 855 + * } 856 + * } 857 + * ] 858 + * </pre> 859 + */ 860 + template?: string; 861 + }; 862 + 863 + export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & { 864 + baz: number | null; 865 + qux: number; 866 + }; 867 + 868 + /** 869 + * Model used to test deduplication strategy (unused) 870 + */ 871 + export type ParameterSimpleParameterUnused = string; 872 + 873 + /** 874 + * Model used to test deduplication strategy 875 + */ 876 + export type PostServiceWithEmptyTagResponse = string; 877 + 878 + /** 879 + * Model used to test deduplication strategy 880 + */ 881 + export type PostServiceWithEmptyTagResponse2 = string; 882 + 883 + /** 884 + * Model used to test deduplication strategy 885 + */ 886 + export type DeleteFooData = string; 887 + 888 + /** 889 + * Model used to test deduplication strategy 890 + */ 891 + export type DeleteFooData2 = string; 892 + 893 + /** 894 + * Model with restricted keyword name 895 + */ 896 + export type Import = string; 897 + 898 + export type SchemaWithFormRestrictedKeys = { 899 + description?: string; 900 + 'x-enum-descriptions'?: string; 901 + 'x-enum-varnames'?: string; 902 + 'x-enumNames'?: string; 903 + title?: string; 904 + object?: { 905 + description?: string; 906 + 'x-enum-descriptions'?: string; 907 + 'x-enum-varnames'?: string; 908 + 'x-enumNames'?: string; 909 + title?: string; 910 + }; 911 + array?: Array<{ 912 + description?: string; 913 + 'x-enum-descriptions'?: string; 914 + 'x-enum-varnames'?: string; 915 + 'x-enumNames'?: string; 916 + title?: string; 917 + }>; 918 + }; 919 + 920 + /** 921 + * This schema was giving PascalCase transformations a hard time 922 + */ 923 + export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = { 924 + /** 925 + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. 926 + */ 927 + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; 928 + }; 929 + 930 + /** 931 + * This schema was giving PascalCase transformations a hard time 932 + */ 933 + export type IoK8sApimachineryPkgApisMetaV1Preconditions = { 934 + /** 935 + * Specifies the target ResourceVersion 936 + */ 937 + resourceVersion?: string; 938 + /** 939 + * Specifies the target UID. 940 + */ 941 + uid?: string; 942 + }; 943 + 944 + export type AdditionalPropertiesUnknownIssue = { 945 + [key: string]: string | number; 946 + }; 947 + 948 + export type AdditionalPropertiesUnknownIssue2 = { 949 + [key: string]: string | number; 950 + }; 951 + 952 + export type AdditionalPropertiesUnknownIssue3 = string & { 953 + entries: { 954 + [key: string]: AdditionalPropertiesUnknownIssue; 955 + }; 956 + }; 957 + 958 + export type AdditionalPropertiesIntegerIssue = { 959 + value: number; 960 + [key: string]: number; 961 + }; 962 + 963 + export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 964 + 965 + export type GenericSchemaDuplicateIssue1SystemBoolean = { 966 + item?: boolean; 967 + error?: string | null; 968 + readonly hasError?: boolean; 969 + data?: { 970 + [key: string]: never; 971 + }; 972 + }; 973 + 974 + export type GenericSchemaDuplicateIssue1SystemString = { 975 + item?: string | null; 976 + error?: string | null; 977 + readonly hasError?: boolean; 978 + }; 979 + 980 + export type ExternalSharedExternalSharedModel = { 981 + id: string; 982 + name?: string; 983 + }; 984 + 985 + /** 986 + * This is a model with one property containing a reference 987 + */ 988 + export type ModelWithReferenceWritable = { 989 + prop?: ModelWithPropertiesWritable; 990 + }; 991 + 992 + /** 993 + * This is a model with one property containing an array 994 + */ 995 + export type ModelWithArrayReadOnlyAndWriteOnlyWritable = { 996 + prop?: Array<ModelWithReadOnlyAndWriteOnlyWritable>; 997 + propWithFile?: Array<Blob | File>; 998 + propWithNumber?: Array<number>; 999 + }; 1000 + 1001 + /** 1002 + * This is a model with one nested property 1003 + */ 1004 + export type ModelWithPropertiesWritable = { 1005 + required: string; 1006 + requiredAndNullable: string | null; 1007 + string?: string; 1008 + number?: number; 1009 + boolean?: boolean; 1010 + reference?: ModelWithString; 1011 + 'property with space'?: string; 1012 + default?: string; 1013 + try?: string; 1014 + }; 1015 + 1016 + /** 1017 + * This is a model that contains a some patterns 1018 + */ 1019 + export type ModelWithPatternWritable = { 1020 + key: string; 1021 + name: string; 1022 + id?: string; 1023 + text?: string; 1024 + patternWithSingleQuotes?: string; 1025 + patternWithNewline?: string; 1026 + patternWithBacktick?: string; 1027 + }; 1028 + 1029 + export type FileWritable = { 1030 + /** 1031 + * Mime 1032 + */ 1033 + mime: string; 1034 + }; 1035 + 1036 + export type ModelWithReadOnlyAndWriteOnlyWritable = { 1037 + foo: string; 1038 + baz: string; 1039 + }; 1040 + 1041 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = [ 1042 + number | Import, 1043 + number | Import 1044 + ]; 1045 + 1046 + export type AdditionalPropertiesUnknownIssueWritable = { 1047 + [key: string]: string | number; 1048 + }; 1049 + 1050 + export type OneOfAllOfIssueWritable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 1051 + 1052 + export type GenericSchemaDuplicateIssue1SystemBooleanWritable = { 1053 + item?: boolean; 1054 + error?: string | null; 1055 + data?: { 1056 + [key: string]: never; 1057 + }; 1058 + }; 1059 + 1060 + export type GenericSchemaDuplicateIssue1SystemStringWritable = { 1061 + item?: string | null; 1062 + error?: string | null; 1063 + }; 1064 + 1065 + /** 1066 + * This is a reusable parameter 1067 + */ 1068 + export type SimpleParameter = string; 1069 + 1070 + /** 1071 + * Parameter with illegal characters 1072 + */ 1073 + export type XFooBar = ModelWithString; 1074 + 1075 + /** 1076 + * A reusable request body 1077 + */ 1078 + export type SimpleRequestBody = ModelWithString; 1079 + 1080 + /** 1081 + * A reusable request body 1082 + */ 1083 + export type SimpleFormData = ModelWithString; 1084 + 1085 + export type ExportData = { 1086 + body?: never; 1087 + path?: never; 1088 + query?: never; 1089 + url: '/api/v{api-version}/no+tag'; 1090 + }; 1091 + 1092 + export type PatchApiVbyApiVersionNoTagData = { 1093 + body?: never; 1094 + path?: never; 1095 + query?: never; 1096 + url: '/api/v{api-version}/no+tag'; 1097 + }; 1098 + 1099 + export type PatchApiVbyApiVersionNoTagResponses = { 1100 + /** 1101 + * OK 1102 + */ 1103 + default: unknown; 1104 + }; 1105 + 1106 + export type ImportData = { 1107 + body: ModelWithReadOnlyAndWriteOnlyWritable | ModelWithArrayReadOnlyAndWriteOnlyWritable; 1108 + path?: never; 1109 + query?: never; 1110 + url: '/api/v{api-version}/no+tag'; 1111 + }; 1112 + 1113 + export type ImportResponses = { 1114 + /** 1115 + * Success 1116 + */ 1117 + 200: ModelFromZendesk; 1118 + /** 1119 + * Default success response 1120 + */ 1121 + default: ModelWithReadOnlyAndWriteOnly; 1122 + }; 1123 + 1124 + export type ImportResponse = ImportResponses[keyof ImportResponses]; 1125 + 1126 + export type FooWowData = { 1127 + body?: never; 1128 + path?: never; 1129 + query?: never; 1130 + url: '/api/v{api-version}/no+tag'; 1131 + }; 1132 + 1133 + export type FooWowResponses = { 1134 + /** 1135 + * OK 1136 + */ 1137 + default: unknown; 1138 + }; 1139 + 1140 + export type ApiVVersionODataControllerCountData = { 1141 + body?: never; 1142 + path?: never; 1143 + query?: never; 1144 + url: '/api/v{api-version}/simple/$count'; 1145 + }; 1146 + 1147 + export type ApiVVersionODataControllerCountResponses = { 1148 + /** 1149 + * Success 1150 + */ 1151 + 200: ModelFromZendesk; 1152 + }; 1153 + 1154 + export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; 1155 + 1156 + export type GetApiVbyApiVersionSimpleOperationData = { 1157 + body?: never; 1158 + path: { 1159 + /** 1160 + * foo in method 1161 + */ 1162 + foo_param: string; 1163 + }; 1164 + query?: never; 1165 + url: '/api/v{api-version}/simple:operation'; 1166 + }; 1167 + 1168 + export type GetApiVbyApiVersionSimpleOperationErrors = { 1169 + /** 1170 + * Default error response 1171 + */ 1172 + default: ModelWithBoolean; 1173 + }; 1174 + 1175 + export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; 1176 + 1177 + export type GetApiVbyApiVersionSimpleOperationResponses = { 1178 + /** 1179 + * Response is a simple number 1180 + */ 1181 + 200: number; 1182 + }; 1183 + 1184 + export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; 1185 + 1186 + export type DeleteCallWithoutParametersAndResponseData = { 1187 + body?: never; 1188 + path?: never; 1189 + query?: never; 1190 + url: '/api/v{api-version}/simple'; 1191 + }; 1192 + 1193 + export type GetCallWithoutParametersAndResponseData = { 1194 + body?: never; 1195 + path?: never; 1196 + query?: never; 1197 + url: '/api/v{api-version}/simple'; 1198 + }; 1199 + 1200 + export type HeadCallWithoutParametersAndResponseData = { 1201 + body?: never; 1202 + path?: never; 1203 + query?: never; 1204 + url: '/api/v{api-version}/simple'; 1205 + }; 1206 + 1207 + export type OptionsCallWithoutParametersAndResponseData = { 1208 + body?: never; 1209 + path?: never; 1210 + query?: never; 1211 + url: '/api/v{api-version}/simple'; 1212 + }; 1213 + 1214 + export type PatchCallWithoutParametersAndResponseData = { 1215 + body?: never; 1216 + path?: never; 1217 + query?: never; 1218 + url: '/api/v{api-version}/simple'; 1219 + }; 1220 + 1221 + export type PostCallWithoutParametersAndResponseData = { 1222 + body?: never; 1223 + path?: never; 1224 + query?: never; 1225 + url: '/api/v{api-version}/simple'; 1226 + }; 1227 + 1228 + export type PutCallWithoutParametersAndResponseData = { 1229 + body?: never; 1230 + path?: never; 1231 + query?: never; 1232 + url: '/api/v{api-version}/simple'; 1233 + }; 1234 + 1235 + export type DeleteFooData3 = { 1236 + body?: never; 1237 + headers: { 1238 + /** 1239 + * Parameter with illegal characters 1240 + */ 1241 + 'x-Foo-Bar': ModelWithString; 1242 + }; 1243 + path: { 1244 + /** 1245 + * foo in method 1246 + */ 1247 + foo_param: string; 1248 + /** 1249 + * bar in method 1250 + */ 1251 + BarParam: string; 1252 + }; 1253 + query?: never; 1254 + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; 1255 + }; 1256 + 1257 + export type CallWithDescriptionsData = { 1258 + body?: never; 1259 + path?: never; 1260 + query?: { 1261 + /** 1262 + * Testing multiline comments in string: First line 1263 + * Second line 1264 + * 1265 + * Fourth line 1266 + */ 1267 + parameterWithBreaks?: string; 1268 + /** 1269 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1270 + */ 1271 + parameterWithBackticks?: string; 1272 + /** 1273 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1274 + */ 1275 + parameterWithSlashes?: string; 1276 + /** 1277 + * Testing expression placeholders in string: ${expression} should work 1278 + */ 1279 + parameterWithExpressionPlaceholders?: string; 1280 + /** 1281 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1282 + */ 1283 + parameterWithQuotes?: string; 1284 + /** 1285 + * Testing reserved characters in string: * inline * and ** inline ** should work 1286 + */ 1287 + parameterWithReservedCharacters?: string; 1288 + }; 1289 + url: '/api/v{api-version}/descriptions'; 1290 + }; 1291 + 1292 + export type DeprecatedCallData = { 1293 + body?: never; 1294 + headers: { 1295 + /** 1296 + * This parameter is deprecated 1297 + * 1298 + * @deprecated 1299 + */ 1300 + parameter: DeprecatedModel | null; 1301 + }; 1302 + path?: never; 1303 + query?: never; 1304 + url: '/api/v{api-version}/parameters/deprecated'; 1305 + }; 1306 + 1307 + export type CallWithParametersData = { 1308 + /** 1309 + * This is the parameter that goes into the body 1310 + */ 1311 + body: { 1312 + [key: string]: unknown; 1313 + } | null; 1314 + headers: { 1315 + /** 1316 + * This is the parameter that goes into the header 1317 + */ 1318 + parameterHeader: string | null; 1319 + }; 1320 + path: { 1321 + /** 1322 + * This is the parameter that goes into the path 1323 + */ 1324 + parameterPath: string | null; 1325 + /** 1326 + * api-version should be required in standalone clients 1327 + */ 1328 + 'api-version': string | null; 1329 + }; 1330 + query: { 1331 + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; 1332 + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; 1333 + /** 1334 + * This is the parameter that goes into the query params 1335 + */ 1336 + cursor: string | null; 1337 + }; 1338 + url: '/api/v{api-version}/parameters/{parameterPath}'; 1339 + }; 1340 + 1341 + export type CallWithWeirdParameterNamesData = { 1342 + /** 1343 + * This is the parameter that goes into the body 1344 + */ 1345 + body: ModelWithString | null; 1346 + headers: { 1347 + /** 1348 + * This is the parameter that goes into the request header 1349 + */ 1350 + 'parameter.header': string | null; 1351 + }; 1352 + path: { 1353 + /** 1354 + * This is the parameter that goes into the path 1355 + */ 1356 + 'parameter.path.1'?: string; 1357 + /** 1358 + * This is the parameter that goes into the path 1359 + */ 1360 + 'parameter-path-2'?: string; 1361 + /** 1362 + * This is the parameter that goes into the path 1363 + */ 1364 + 'PARAMETER-PATH-3'?: string; 1365 + /** 1366 + * api-version should be required in standalone clients 1367 + */ 1368 + 'api-version': string | null; 1369 + }; 1370 + query: { 1371 + /** 1372 + * This is the parameter with a reserved keyword 1373 + */ 1374 + default?: string; 1375 + /** 1376 + * This is the parameter that goes into the request query params 1377 + */ 1378 + 'parameter-query': string | null; 1379 + }; 1380 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; 1381 + }; 1382 + 1383 + export type GetCallWithOptionalParamData = { 1384 + /** 1385 + * This is a required parameter 1386 + */ 1387 + body: ModelWithOneOfEnum; 1388 + path?: never; 1389 + query?: { 1390 + /** 1391 + * This is an optional parameter 1392 + */ 1393 + page?: number; 1394 + }; 1395 + url: '/api/v{api-version}/parameters'; 1396 + }; 1397 + 1398 + export type PostCallWithOptionalParamData = { 1399 + /** 1400 + * This is an optional parameter 1401 + */ 1402 + body?: { 1403 + offset?: number | null; 1404 + }; 1405 + path?: never; 1406 + query: { 1407 + /** 1408 + * This is a required parameter 1409 + */ 1410 + parameter: Pageable; 1411 + }; 1412 + url: '/api/v{api-version}/parameters'; 1413 + }; 1414 + 1415 + export type PostCallWithOptionalParamResponses = { 1416 + /** 1417 + * Response is a simple number 1418 + */ 1419 + 200: number; 1420 + /** 1421 + * Success 1422 + */ 1423 + 204: void; 1424 + }; 1425 + 1426 + export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; 1427 + 1428 + export type PostApiVbyApiVersionRequestBodyData = { 1429 + /** 1430 + * A reusable request body 1431 + */ 1432 + body?: SimpleRequestBody; 1433 + path?: never; 1434 + query?: { 1435 + /** 1436 + * This is a reusable parameter 1437 + */ 1438 + parameter?: string; 1439 + }; 1440 + url: '/api/v{api-version}/requestBody'; 1441 + }; 1442 + 1443 + export type PostApiVbyApiVersionFormDataData = { 1444 + /** 1445 + * A reusable request body 1446 + */ 1447 + body?: SimpleFormData; 1448 + path?: never; 1449 + query?: { 1450 + /** 1451 + * This is a reusable parameter 1452 + */ 1453 + parameter?: string; 1454 + }; 1455 + url: '/api/v{api-version}/formData'; 1456 + }; 1457 + 1458 + export type CallWithDefaultParametersData = { 1459 + body?: never; 1460 + path?: never; 1461 + query?: { 1462 + /** 1463 + * This is a simple string with default value 1464 + */ 1465 + parameterString?: string | null; 1466 + /** 1467 + * This is a simple number with default value 1468 + */ 1469 + parameterNumber?: number | null; 1470 + /** 1471 + * This is a simple boolean with default value 1472 + */ 1473 + parameterBoolean?: boolean | null; 1474 + /** 1475 + * This is a simple enum with default value 1476 + */ 1477 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1478 + /** 1479 + * This is a simple model with default value 1480 + */ 1481 + parameterModel?: ModelWithString | null; 1482 + }; 1483 + url: '/api/v{api-version}/defaults'; 1484 + }; 1485 + 1486 + export type CallWithDefaultOptionalParametersData = { 1487 + body?: never; 1488 + path?: never; 1489 + query?: { 1490 + /** 1491 + * This is a simple string that is optional with default value 1492 + */ 1493 + parameterString?: string; 1494 + /** 1495 + * This is a simple number that is optional with default value 1496 + */ 1497 + parameterNumber?: number; 1498 + /** 1499 + * This is a simple boolean that is optional with default value 1500 + */ 1501 + parameterBoolean?: boolean; 1502 + /** 1503 + * This is a simple enum that is optional with default value 1504 + */ 1505 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1506 + /** 1507 + * This is a simple model that is optional with default value 1508 + */ 1509 + parameterModel?: ModelWithString; 1510 + }; 1511 + url: '/api/v{api-version}/defaults'; 1512 + }; 1513 + 1514 + export type CallToTestOrderOfParamsData = { 1515 + body?: never; 1516 + path?: never; 1517 + query: { 1518 + /** 1519 + * This is a optional string with default 1520 + */ 1521 + parameterOptionalStringWithDefault?: string; 1522 + /** 1523 + * This is a optional string with empty default 1524 + */ 1525 + parameterOptionalStringWithEmptyDefault?: string; 1526 + /** 1527 + * This is a optional string with no default 1528 + */ 1529 + parameterOptionalStringWithNoDefault?: string; 1530 + /** 1531 + * This is a string with default 1532 + */ 1533 + parameterStringWithDefault: string; 1534 + /** 1535 + * This is a string with empty default 1536 + */ 1537 + parameterStringWithEmptyDefault: string; 1538 + /** 1539 + * This is a string with no default 1540 + */ 1541 + parameterStringWithNoDefault: string; 1542 + /** 1543 + * This is a string that can be null with no default 1544 + */ 1545 + parameterStringNullableWithNoDefault?: string | null; 1546 + /** 1547 + * This is a string that can be null with default 1548 + */ 1549 + parameterStringNullableWithDefault?: string | null; 1550 + }; 1551 + url: '/api/v{api-version}/defaults'; 1552 + }; 1553 + 1554 + export type DuplicateNameData = { 1555 + body?: never; 1556 + path?: never; 1557 + query?: never; 1558 + url: '/api/v{api-version}/duplicate'; 1559 + }; 1560 + 1561 + export type DuplicateName2Data = { 1562 + body?: never; 1563 + path?: never; 1564 + query?: never; 1565 + url: '/api/v{api-version}/duplicate'; 1566 + }; 1567 + 1568 + export type DuplicateName3Data = { 1569 + body?: never; 1570 + path?: never; 1571 + query?: never; 1572 + url: '/api/v{api-version}/duplicate'; 1573 + }; 1574 + 1575 + export type DuplicateName4Data = { 1576 + body?: never; 1577 + path?: never; 1578 + query?: never; 1579 + url: '/api/v{api-version}/duplicate'; 1580 + }; 1581 + 1582 + export type CallWithNoContentResponseData = { 1583 + body?: never; 1584 + path?: never; 1585 + query?: never; 1586 + url: '/api/v{api-version}/no-content'; 1587 + }; 1588 + 1589 + export type CallWithNoContentResponseResponses = { 1590 + /** 1591 + * Success 1592 + */ 1593 + 204: void; 1594 + }; 1595 + 1596 + export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; 1597 + 1598 + export type CallWithResponseAndNoContentResponseData = { 1599 + body?: never; 1600 + path?: never; 1601 + query?: never; 1602 + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; 1603 + }; 1604 + 1605 + export type CallWithResponseAndNoContentResponseResponses = { 1606 + /** 1607 + * Response is a simple number 1608 + */ 1609 + 200: number; 1610 + /** 1611 + * Success 1612 + */ 1613 + 204: void; 1614 + }; 1615 + 1616 + export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; 1617 + 1618 + export type DummyAData = { 1619 + body?: never; 1620 + path?: never; 1621 + query?: never; 1622 + url: '/api/v{api-version}/multiple-tags/a'; 1623 + }; 1624 + 1625 + export type DummyAResponses = { 1626 + 200: _400; 1627 + }; 1628 + 1629 + export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; 1630 + 1631 + export type DummyBData = { 1632 + body?: never; 1633 + path?: never; 1634 + query?: never; 1635 + url: '/api/v{api-version}/multiple-tags/b'; 1636 + }; 1637 + 1638 + export type DummyBResponses = { 1639 + /** 1640 + * Success 1641 + */ 1642 + 204: void; 1643 + }; 1644 + 1645 + export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; 1646 + 1647 + export type CallWithResponseData = { 1648 + body?: never; 1649 + path?: never; 1650 + query?: never; 1651 + url: '/api/v{api-version}/response'; 1652 + }; 1653 + 1654 + export type CallWithResponseResponses = { 1655 + default: Import; 1656 + }; 1657 + 1658 + export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; 1659 + 1660 + export type CallWithDuplicateResponsesData = { 1661 + body?: never; 1662 + path?: never; 1663 + query?: never; 1664 + url: '/api/v{api-version}/response'; 1665 + }; 1666 + 1667 + export type CallWithDuplicateResponsesErrors = { 1668 + /** 1669 + * Message for 500 error 1670 + */ 1671 + 500: ModelWithStringError; 1672 + /** 1673 + * Message for 501 error 1674 + */ 1675 + 501: ModelWithStringError; 1676 + /** 1677 + * Message for 502 error 1678 + */ 1679 + 502: ModelWithStringError; 1680 + /** 1681 + * Message for 4XX errors 1682 + */ 1683 + '4XX': DictionaryWithArray; 1684 + /** 1685 + * Default error response 1686 + */ 1687 + default: ModelWithBoolean; 1688 + }; 1689 + 1690 + export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; 1691 + 1692 + export type CallWithDuplicateResponsesResponses = { 1693 + /** 1694 + * Message for 200 response 1695 + */ 1696 + 200: ModelWithBoolean & ModelWithInteger; 1697 + /** 1698 + * Message for 201 response 1699 + */ 1700 + 201: ModelWithString; 1701 + /** 1702 + * Message for 202 response 1703 + */ 1704 + 202: ModelWithString; 1705 + }; 1706 + 1707 + export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; 1708 + 1709 + export type CallWithResponsesData = { 1710 + body?: never; 1711 + path?: never; 1712 + query?: never; 1713 + url: '/api/v{api-version}/response'; 1714 + }; 1715 + 1716 + export type CallWithResponsesErrors = { 1717 + /** 1718 + * Message for 500 error 1719 + */ 1720 + 500: ModelWithStringError; 1721 + /** 1722 + * Message for 501 error 1723 + */ 1724 + 501: ModelWithStringError; 1725 + /** 1726 + * Message for 502 error 1727 + */ 1728 + 502: ModelWithStringError; 1729 + /** 1730 + * Message for default response 1731 + */ 1732 + default: ModelWithStringError; 1733 + }; 1734 + 1735 + export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; 1736 + 1737 + export type CallWithResponsesResponses = { 1738 + /** 1739 + * Message for 200 response 1740 + */ 1741 + 200: { 1742 + readonly '@namespace.string'?: string; 1743 + readonly '@namespace.integer'?: number; 1744 + readonly value?: Array<ModelWithString>; 1745 + }; 1746 + /** 1747 + * Message for 201 response 1748 + */ 1749 + 201: ModelThatExtends; 1750 + /** 1751 + * Message for 202 response 1752 + */ 1753 + 202: ModelThatExtendsExtends; 1754 + }; 1755 + 1756 + export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; 1757 + 1758 + export type CollectionFormatData = { 1759 + body?: never; 1760 + path?: never; 1761 + query: { 1762 + /** 1763 + * This is an array parameter that is sent as csv format (comma-separated values) 1764 + */ 1765 + parameterArrayCSV: Array<string> | null; 1766 + /** 1767 + * This is an array parameter that is sent as ssv format (space-separated values) 1768 + */ 1769 + parameterArraySSV: Array<string> | null; 1770 + /** 1771 + * This is an array parameter that is sent as tsv format (tab-separated values) 1772 + */ 1773 + parameterArrayTSV: Array<string> | null; 1774 + /** 1775 + * This is an array parameter that is sent as pipes format (pipe-separated values) 1776 + */ 1777 + parameterArrayPipes: Array<string> | null; 1778 + /** 1779 + * This is an array parameter that is sent as multi format (multiple parameter instances) 1780 + */ 1781 + parameterArrayMulti: Array<string> | null; 1782 + }; 1783 + url: '/api/v{api-version}/collectionFormat'; 1784 + }; 1785 + 1786 + export type TypesData = { 1787 + body?: never; 1788 + path?: { 1789 + /** 1790 + * This is a number parameter 1791 + */ 1792 + id?: number; 1793 + }; 1794 + query: { 1795 + /** 1796 + * This is a number parameter 1797 + */ 1798 + parameterNumber: number; 1799 + /** 1800 + * This is a string parameter 1801 + */ 1802 + parameterString: string | null; 1803 + /** 1804 + * This is a boolean parameter 1805 + */ 1806 + parameterBoolean: boolean | null; 1807 + /** 1808 + * This is an object parameter 1809 + */ 1810 + parameterObject: { 1811 + [key: string]: unknown; 1812 + } | null; 1813 + /** 1814 + * This is an array parameter 1815 + */ 1816 + parameterArray: Array<string> | null; 1817 + /** 1818 + * This is a dictionary parameter 1819 + */ 1820 + parameterDictionary: { 1821 + [key: string]: unknown; 1822 + } | null; 1823 + /** 1824 + * This is an enum parameter 1825 + */ 1826 + parameterEnum: 'Success' | 'Warning' | 'Error' | null; 1827 + }; 1828 + url: '/api/v{api-version}/types'; 1829 + }; 1830 + 1831 + export type TypesResponses = { 1832 + /** 1833 + * Response is a simple number 1834 + */ 1835 + 200: number; 1836 + /** 1837 + * Response is a simple string 1838 + */ 1839 + 201: string; 1840 + /** 1841 + * Response is a simple boolean 1842 + */ 1843 + 202: boolean; 1844 + /** 1845 + * Response is a simple object 1846 + */ 1847 + 203: { 1848 + [key: string]: unknown; 1849 + }; 1850 + }; 1851 + 1852 + export type TypesResponse = TypesResponses[keyof TypesResponses]; 1853 + 1854 + export type UploadFileData = { 1855 + body: Blob | File; 1856 + path: { 1857 + /** 1858 + * api-version should be required in standalone clients 1859 + */ 1860 + 'api-version': string | null; 1861 + }; 1862 + query?: never; 1863 + url: '/api/v{api-version}/upload'; 1864 + }; 1865 + 1866 + export type UploadFileResponses = { 1867 + 200: boolean; 1868 + }; 1869 + 1870 + export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; 1871 + 1872 + export type FileResponseData = { 1873 + body?: never; 1874 + path: { 1875 + id: string; 1876 + /** 1877 + * api-version should be required in standalone clients 1878 + */ 1879 + 'api-version': string; 1880 + }; 1881 + query?: never; 1882 + url: '/api/v{api-version}/file/{id}'; 1883 + }; 1884 + 1885 + export type FileResponseResponses = { 1886 + /** 1887 + * Success 1888 + */ 1889 + 200: Blob | File; 1890 + }; 1891 + 1892 + export type FileResponseResponse = FileResponseResponses[keyof FileResponseResponses]; 1893 + 1894 + export type ComplexTypesData = { 1895 + body?: never; 1896 + path?: never; 1897 + query: { 1898 + /** 1899 + * Parameter containing object 1900 + */ 1901 + parameterObject: { 1902 + first?: { 1903 + second?: { 1904 + third?: string; 1905 + }; 1906 + }; 1907 + }; 1908 + /** 1909 + * Parameter containing reference 1910 + */ 1911 + parameterReference: ModelWithString; 1912 + }; 1913 + url: '/api/v{api-version}/complex'; 1914 + }; 1915 + 1916 + export type ComplexTypesErrors = { 1917 + /** 1918 + * 400 `server` error 1919 + */ 1920 + 400: unknown; 1921 + /** 1922 + * 500 server error 1923 + */ 1924 + 500: unknown; 1925 + }; 1926 + 1927 + export type ComplexTypesResponses = { 1928 + /** 1929 + * Successful response 1930 + */ 1931 + 200: Array<ModelWithString>; 1932 + }; 1933 + 1934 + export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; 1935 + 1936 + export type MultipartResponseData = { 1937 + body?: never; 1938 + path?: never; 1939 + query?: never; 1940 + url: '/api/v{api-version}/multipart'; 1941 + }; 1942 + 1943 + export type MultipartResponseResponses = { 1944 + /** 1945 + * OK 1946 + */ 1947 + 200: { 1948 + file?: Blob | File; 1949 + metadata?: { 1950 + foo?: string; 1951 + bar?: string; 1952 + }; 1953 + }; 1954 + }; 1955 + 1956 + export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; 1957 + 1958 + export type MultipartRequestData = { 1959 + body?: { 1960 + content?: Blob | File; 1961 + data?: ModelWithString | null; 1962 + }; 1963 + path?: never; 1964 + query?: never; 1965 + url: '/api/v{api-version}/multipart'; 1966 + }; 1967 + 1968 + export type ComplexParamsData = { 1969 + body?: { 1970 + readonly key: string | null; 1971 + name: string | null; 1972 + enabled?: boolean; 1973 + type: 'Monkey' | 'Horse' | 'Bird'; 1974 + listOfModels?: Array<ModelWithString> | null; 1975 + listOfStrings?: Array<string> | null; 1976 + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 1977 + readonly user?: { 1978 + readonly id?: number; 1979 + readonly name?: string | null; 1980 + }; 1981 + }; 1982 + path: { 1983 + id: number; 1984 + /** 1985 + * api-version should be required in standalone clients 1986 + */ 1987 + 'api-version': string; 1988 + }; 1989 + query?: never; 1990 + url: '/api/v{api-version}/complex/{id}'; 1991 + }; 1992 + 1993 + export type ComplexParamsResponses = { 1994 + /** 1995 + * Success 1996 + */ 1997 + 200: ModelWithString; 1998 + }; 1999 + 2000 + export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; 2001 + 2002 + export type CallWithResultFromHeaderData = { 2003 + body?: never; 2004 + path?: never; 2005 + query?: never; 2006 + url: '/api/v{api-version}/header'; 2007 + }; 2008 + 2009 + export type CallWithResultFromHeaderErrors = { 2010 + /** 2011 + * 400 server error 2012 + */ 2013 + 400: unknown; 2014 + /** 2015 + * 500 server error 2016 + */ 2017 + 500: unknown; 2018 + }; 2019 + 2020 + export type CallWithResultFromHeaderResponses = { 2021 + /** 2022 + * Successful response 2023 + */ 2024 + 200: unknown; 2025 + }; 2026 + 2027 + export type TestErrorCodeData = { 2028 + body?: never; 2029 + path?: never; 2030 + query: { 2031 + /** 2032 + * Status code to return 2033 + */ 2034 + status: number; 2035 + }; 2036 + url: '/api/v{api-version}/error'; 2037 + }; 2038 + 2039 + export type TestErrorCodeErrors = { 2040 + /** 2041 + * Custom message: Internal Server Error 2042 + */ 2043 + 500: unknown; 2044 + /** 2045 + * Custom message: Not Implemented 2046 + */ 2047 + 501: unknown; 2048 + /** 2049 + * Custom message: Bad Gateway 2050 + */ 2051 + 502: unknown; 2052 + /** 2053 + * Custom message: Service Unavailable 2054 + */ 2055 + 503: unknown; 2056 + }; 2057 + 2058 + export type TestErrorCodeResponses = { 2059 + /** 2060 + * Custom message: Successful response 2061 + */ 2062 + 200: unknown; 2063 + }; 2064 + 2065 + export type NonAsciiæøåÆøÅöôêÊ字符串Data = { 2066 + body?: never; 2067 + path?: never; 2068 + query: { 2069 + /** 2070 + * Dummy input param 2071 + */ 2072 + nonAsciiParamæøåÆØÅöôêÊ: number; 2073 + }; 2074 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2075 + }; 2076 + 2077 + export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { 2078 + /** 2079 + * Successful response 2080 + */ 2081 + 200: Array<NonAsciiStringæøåÆøÅöôêÊ字符串>; 2082 + }; 2083 + 2084 + export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; 2085 + 2086 + export type PutWithFormUrlEncodedData = { 2087 + body: ArrayWithStrings; 2088 + path?: never; 2089 + query?: never; 2090 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2091 + };
+16
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { type ClientOptions, type Config, createClient, createConfig } from './client/index.js'; 4 + import type { ClientOptions as ClientOptions2 } from './types.gen.js'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 15 + 16 + export const client = createClient(createConfig<ClientOptions2>({ baseURL: 'http://localhost:3000/base' }));
+163
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/client/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { AxiosError, AxiosInstance, RawAxiosRequestHeaders } from 'axios'; 4 + import axios from 'axios'; 5 + 6 + import { createSseClient } from '../core/serverSentEvents.gen.js'; 7 + import type { HttpMethod } from '../core/types.gen.js'; 8 + import { getValidRequestBody } from '../core/utils.gen.js'; 9 + import type { Client, Config, RequestOptions } from './types.gen.js'; 10 + import { 11 + buildUrl, 12 + createConfig, 13 + mergeConfigs, 14 + mergeHeaders, 15 + setAuthParams, 16 + } from './utils.gen.js'; 17 + 18 + export const createClient = (config: Config = {}): Client => { 19 + let _config = mergeConfigs(createConfig(), config); 20 + 21 + let instance: AxiosInstance; 22 + 23 + if (_config.axios && !('Axios' in _config.axios)) { 24 + instance = _config.axios; 25 + } else { 26 + // eslint-disable-next-line @typescript-eslint/no-unused-vars 27 + const { auth, ...configWithoutAuth } = _config; 28 + instance = axios.create(configWithoutAuth); 29 + } 30 + 31 + const getConfig = (): Config => ({ ..._config }); 32 + 33 + const setConfig = (config: Config): Config => { 34 + _config = mergeConfigs(_config, config); 35 + instance.defaults = { 36 + ...instance.defaults, 37 + ..._config, 38 + // @ts-expect-error 39 + headers: mergeHeaders(instance.defaults.headers, _config.headers), 40 + }; 41 + return getConfig(); 42 + }; 43 + 44 + const beforeRequest = async (options: RequestOptions) => { 45 + const opts = { 46 + ..._config, 47 + ...options, 48 + axios: options.axios ?? _config.axios ?? instance, 49 + headers: mergeHeaders(_config.headers, options.headers), 50 + }; 51 + 52 + if (opts.security) { 53 + await setAuthParams({ 54 + ...opts, 55 + security: opts.security, 56 + }); 57 + } 58 + 59 + if (opts.requestValidator) { 60 + await opts.requestValidator(opts); 61 + } 62 + 63 + if (opts.body !== undefined && opts.bodySerializer) { 64 + opts.body = opts.bodySerializer(opts.body); 65 + } 66 + 67 + const url = buildUrl(opts); 68 + 69 + return { opts, url }; 70 + }; 71 + 72 + // @ts-expect-error 73 + const request: Client['request'] = async (options) => { 74 + // @ts-expect-error 75 + const { opts, url } = await beforeRequest(options); 76 + try { 77 + // assign Axios here for consistency with fetch 78 + const _axios = opts.axios!; 79 + // eslint-disable-next-line @typescript-eslint/no-unused-vars 80 + const { auth, ...optsWithoutAuth } = opts; 81 + const response = await _axios({ 82 + ...optsWithoutAuth, 83 + baseURL: '', // the baseURL is already included in `url` 84 + data: getValidRequestBody(opts), 85 + headers: opts.headers as RawAxiosRequestHeaders, 86 + // let `paramsSerializer()` handle query params if it exists 87 + params: !opts.paramsSerializer ? opts.query : undefined, 88 + url, 89 + }); 90 + 91 + let { data } = response; 92 + 93 + if (opts.responseType === 'json') { 94 + if (opts.responseValidator) { 95 + await opts.responseValidator(data); 96 + } 97 + 98 + if (opts.responseTransformer) { 99 + data = await opts.responseTransformer(data); 100 + } 101 + } 102 + 103 + return { 104 + ...response, 105 + data: data ?? {}, 106 + }; 107 + } catch (error) { 108 + const e = error as AxiosError; 109 + if (opts.throwOnError) { 110 + throw e; 111 + } 112 + // @ts-expect-error 113 + e.error = e.response?.data ?? {}; 114 + return e; 115 + } 116 + }; 117 + 118 + const makeMethodFn = 119 + (method: Uppercase<HttpMethod>) => (options: RequestOptions) => 120 + request({ ...options, method }); 121 + 122 + const makeSseFn = 123 + (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => { 124 + const { opts, url } = await beforeRequest(options); 125 + return createSseClient({ 126 + ...opts, 127 + body: opts.body as BodyInit | null | undefined, 128 + headers: opts.headers as Record<string, string>, 129 + method, 130 + // @ts-expect-error 131 + signal: opts.signal, 132 + url, 133 + }); 134 + }; 135 + 136 + return { 137 + buildUrl, 138 + connect: makeMethodFn('CONNECT'), 139 + delete: makeMethodFn('DELETE'), 140 + get: makeMethodFn('GET'), 141 + getConfig, 142 + head: makeMethodFn('HEAD'), 143 + instance, 144 + options: makeMethodFn('OPTIONS'), 145 + patch: makeMethodFn('PATCH'), 146 + post: makeMethodFn('POST'), 147 + put: makeMethodFn('PUT'), 148 + request, 149 + setConfig, 150 + sse: { 151 + connect: makeSseFn('CONNECT'), 152 + delete: makeSseFn('DELETE'), 153 + get: makeSseFn('GET'), 154 + head: makeSseFn('HEAD'), 155 + options: makeSseFn('OPTIONS'), 156 + patch: makeSseFn('PATCH'), 157 + post: makeSseFn('POST'), 158 + put: makeSseFn('PUT'), 159 + trace: makeSseFn('TRACE'), 160 + }, 161 + trace: makeMethodFn('TRACE'), 162 + } as Client; 163 + };
+23
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/client/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type { Auth } from '../core/auth.gen.js'; 4 + export type { QuerySerializerOptions } from '../core/bodySerializer.gen.js'; 5 + export { 6 + formDataBodySerializer, 7 + jsonBodySerializer, 8 + urlSearchParamsBodySerializer, 9 + } from '../core/bodySerializer.gen.js'; 10 + export { buildClientParams } from '../core/params.gen.js'; 11 + export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen.js'; 12 + export { createClient } from './client.gen.js'; 13 + export type { 14 + Client, 15 + ClientOptions, 16 + Config, 17 + CreateClientConfig, 18 + Options, 19 + RequestOptions, 20 + RequestResult, 21 + TDataShape, 22 + } from './types.gen.js'; 23 + export { createConfig } from './utils.gen.js';
+197
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/client/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { 4 + AxiosError, 5 + AxiosInstance, 6 + AxiosRequestHeaders, 7 + AxiosResponse, 8 + AxiosStatic, 9 + CreateAxiosDefaults, 10 + } from 'axios'; 11 + 12 + import type { Auth } from '../core/auth.gen.js'; 13 + import type { 14 + ServerSentEventsOptions, 15 + ServerSentEventsResult, 16 + } from '../core/serverSentEvents.gen.js'; 17 + import type { 18 + Client as CoreClient, 19 + Config as CoreConfig, 20 + } from '../core/types.gen.js'; 21 + 22 + export interface Config<T extends ClientOptions = ClientOptions> 23 + extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>, 24 + CoreConfig { 25 + /** 26 + * Axios implementation. You can use this option to provide either an 27 + * `AxiosStatic` or an `AxiosInstance`. 28 + * 29 + * @default axios 30 + */ 31 + axios?: AxiosStatic | AxiosInstance; 32 + /** 33 + * Base URL for all requests made by this client. 34 + */ 35 + baseURL?: T['baseURL']; 36 + /** 37 + * An object containing any HTTP headers that you want to pre-populate your 38 + * `Headers` object with. 39 + * 40 + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} 41 + */ 42 + headers?: 43 + | AxiosRequestHeaders 44 + | Record< 45 + string, 46 + | string 47 + | number 48 + | boolean 49 + | (string | number | boolean)[] 50 + | null 51 + | undefined 52 + | unknown 53 + >; 54 + /** 55 + * Throw an error instead of returning it in the response? 56 + * 57 + * @default false 58 + */ 59 + throwOnError?: T['throwOnError']; 60 + } 61 + 62 + export interface RequestOptions< 63 + TData = unknown, 64 + ThrowOnError extends boolean = boolean, 65 + Url extends string = string, 66 + > extends Config<{ 67 + throwOnError: ThrowOnError; 68 + }>, 69 + Pick< 70 + ServerSentEventsOptions<TData>, 71 + | 'onSseError' 72 + | 'onSseEvent' 73 + | 'sseDefaultRetryDelay' 74 + | 'sseMaxRetryAttempts' 75 + | 'sseMaxRetryDelay' 76 + > { 77 + /** 78 + * Any body that you want to add to your request. 79 + * 80 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} 81 + */ 82 + body?: unknown; 83 + path?: Record<string, unknown>; 84 + query?: Record<string, unknown>; 85 + /** 86 + * Security mechanism(s) to use for the request. 87 + */ 88 + security?: ReadonlyArray<Auth>; 89 + url: Url; 90 + } 91 + 92 + export interface ClientOptions { 93 + baseURL?: string; 94 + throwOnError?: boolean; 95 + } 96 + 97 + export type RequestResult< 98 + TData = unknown, 99 + TError = unknown, 100 + ThrowOnError extends boolean = boolean, 101 + > = ThrowOnError extends true 102 + ? Promise< 103 + AxiosResponse< 104 + TData extends Record<string, unknown> ? TData[keyof TData] : TData 105 + > 106 + > 107 + : Promise< 108 + | (AxiosResponse< 109 + TData extends Record<string, unknown> ? TData[keyof TData] : TData 110 + > & { error: undefined }) 111 + | (AxiosError< 112 + TError extends Record<string, unknown> ? TError[keyof TError] : TError 113 + > & { 114 + data: undefined; 115 + error: TError extends Record<string, unknown> 116 + ? TError[keyof TError] 117 + : TError; 118 + }) 119 + >; 120 + 121 + type MethodFn = < 122 + TData = unknown, 123 + TError = unknown, 124 + ThrowOnError extends boolean = false, 125 + >( 126 + options: Omit<RequestOptions<TData, ThrowOnError>, 'method'>, 127 + ) => RequestResult<TData, TError, ThrowOnError>; 128 + 129 + type SseFn = < 130 + TData = unknown, 131 + TError = unknown, 132 + ThrowOnError extends boolean = false, 133 + >( 134 + options: Omit<RequestOptions<TData, ThrowOnError>, 'method'>, 135 + ) => Promise<ServerSentEventsResult<TData, TError>>; 136 + 137 + type RequestFn = < 138 + TData = unknown, 139 + TError = unknown, 140 + ThrowOnError extends boolean = false, 141 + >( 142 + options: Omit<RequestOptions<TData, ThrowOnError>, 'method'> & 143 + Pick<Required<RequestOptions<TData, ThrowOnError>>, 'method'>, 144 + ) => RequestResult<TData, TError, ThrowOnError>; 145 + 146 + type BuildUrlFn = < 147 + TData extends { 148 + body?: unknown; 149 + path?: Record<string, unknown>; 150 + query?: Record<string, unknown>; 151 + url: string; 152 + }, 153 + >( 154 + options: TData & Options<TData>, 155 + ) => string; 156 + 157 + export type Client = CoreClient< 158 + RequestFn, 159 + Config, 160 + MethodFn, 161 + BuildUrlFn, 162 + SseFn 163 + > & { 164 + instance: AxiosInstance; 165 + }; 166 + 167 + /** 168 + * The `createClientConfig()` function will be called on client initialization 169 + * and the returned object will become the client's initial configuration. 170 + * 171 + * You may want to initialize your client this way instead of calling 172 + * `setConfig()`. This is useful for example if you're using Next.js 173 + * to ensure your client always has the correct values. 174 + */ 175 + export type CreateClientConfig<T extends ClientOptions = ClientOptions> = ( 176 + override?: Config<ClientOptions & T>, 177 + ) => Config<Required<ClientOptions> & T>; 178 + 179 + export interface TDataShape { 180 + body?: unknown; 181 + headers?: unknown; 182 + path?: unknown; 183 + query?: unknown; 184 + url: string; 185 + } 186 + 187 + type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>; 188 + 189 + export type Options< 190 + TData extends TDataShape = TDataShape, 191 + ThrowOnError extends boolean = boolean, 192 + TResponse = unknown, 193 + > = OmitKeys< 194 + RequestOptions<TResponse, ThrowOnError>, 195 + 'body' | 'path' | 'query' | 'url' 196 + > & 197 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
+213
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/client/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { getAuthToken } from '../core/auth.gen.js'; 4 + import type { QuerySerializerOptions } from '../core/bodySerializer.gen.js'; 5 + import { 6 + serializeArrayParam, 7 + serializeObjectParam, 8 + serializePrimitiveParam, 9 + } from '../core/pathSerializer.gen.js'; 10 + import { getUrl } from '../core/utils.gen.js'; 11 + import type { Client, ClientOptions, Config, RequestOptions } from './types.gen.js'; 12 + 13 + export const createQuerySerializer = <T = unknown>({ 14 + parameters = {}, 15 + ...args 16 + }: QuerySerializerOptions = {}) => { 17 + const querySerializer = (queryParams: T) => { 18 + const search: string[] = []; 19 + if (queryParams && typeof queryParams === 'object') { 20 + for (const name in queryParams) { 21 + const value = queryParams[name]; 22 + 23 + if (value === undefined || value === null) { 24 + continue; 25 + } 26 + 27 + const options = parameters[name] || args; 28 + 29 + if (Array.isArray(value)) { 30 + const serializedArray = serializeArrayParam({ 31 + allowReserved: options.allowReserved, 32 + explode: true, 33 + name, 34 + style: 'form', 35 + value, 36 + ...options.array, 37 + }); 38 + if (serializedArray) search.push(serializedArray); 39 + } else if (typeof value === 'object') { 40 + const serializedObject = serializeObjectParam({ 41 + allowReserved: options.allowReserved, 42 + explode: true, 43 + name, 44 + style: 'deepObject', 45 + value: value as Record<string, unknown>, 46 + ...options.object, 47 + }); 48 + if (serializedObject) search.push(serializedObject); 49 + } else { 50 + const serializedPrimitive = serializePrimitiveParam({ 51 + allowReserved: options.allowReserved, 52 + name, 53 + value: value as string, 54 + }); 55 + if (serializedPrimitive) search.push(serializedPrimitive); 56 + } 57 + } 58 + } 59 + return search.join('&'); 60 + }; 61 + return querySerializer; 62 + }; 63 + 64 + const checkForExistence = ( 65 + options: Pick<RequestOptions, 'auth' | 'query'> & { 66 + headers: Record<any, unknown>; 67 + }, 68 + name?: string, 69 + ): boolean => { 70 + if (!name) { 71 + return false; 72 + } 73 + if (name in options.headers || options.query?.[name]) { 74 + return true; 75 + } 76 + if ( 77 + 'Cookie' in options.headers && 78 + options.headers['Cookie'] && 79 + typeof options.headers['Cookie'] === 'string' 80 + ) { 81 + return options.headers['Cookie'].includes(`${name}=`); 82 + } 83 + return false; 84 + }; 85 + 86 + export const setAuthParams = async ({ 87 + security, 88 + ...options 89 + }: Pick<Required<RequestOptions>, 'security'> & 90 + Pick<RequestOptions, 'auth' | 'query'> & { 91 + headers: Record<any, unknown>; 92 + }) => { 93 + for (const auth of security) { 94 + if (checkForExistence(options, auth.name)) { 95 + continue; 96 + } 97 + const token = await getAuthToken(auth, options.auth); 98 + 99 + if (!token) { 100 + continue; 101 + } 102 + 103 + const name = auth.name ?? 'Authorization'; 104 + 105 + switch (auth.in) { 106 + case 'query': 107 + if (!options.query) { 108 + options.query = {}; 109 + } 110 + options.query[name] = token; 111 + break; 112 + case 'cookie': { 113 + const value = `${name}=${token}`; 114 + if ('Cookie' in options.headers && options.headers['Cookie']) { 115 + options.headers['Cookie'] = `${options.headers['Cookie']}; ${value}`; 116 + } else { 117 + options.headers['Cookie'] = value; 118 + } 119 + break; 120 + } 121 + case 'header': 122 + default: 123 + options.headers[name] = token; 124 + break; 125 + } 126 + } 127 + }; 128 + 129 + export const buildUrl: Client['buildUrl'] = (options) => { 130 + const instanceBaseUrl = options.axios?.defaults?.baseURL; 131 + 132 + const baseUrl = 133 + !!options.baseURL && typeof options.baseURL === 'string' 134 + ? options.baseURL 135 + : instanceBaseUrl; 136 + 137 + return getUrl({ 138 + baseUrl: baseUrl as string, 139 + path: options.path, 140 + // let `paramsSerializer()` handle query params if it exists 141 + query: !options.paramsSerializer ? options.query : undefined, 142 + querySerializer: 143 + typeof options.querySerializer === 'function' 144 + ? options.querySerializer 145 + : createQuerySerializer(options.querySerializer), 146 + url: options.url, 147 + }); 148 + }; 149 + 150 + export const mergeConfigs = (a: Config, b: Config): Config => { 151 + const config = { ...a, ...b }; 152 + config.headers = mergeHeaders(a.headers, b.headers); 153 + return config; 154 + }; 155 + 156 + /** 157 + * Special Axios headers keywords allowing to set headers by request method. 158 + */ 159 + export const axiosHeadersKeywords = [ 160 + 'common', 161 + 'delete', 162 + 'get', 163 + 'head', 164 + 'patch', 165 + 'post', 166 + 'put', 167 + ] as const; 168 + 169 + export const mergeHeaders = ( 170 + ...headers: Array<Required<Config>['headers'] | undefined> 171 + ): Record<any, unknown> => { 172 + const mergedHeaders: Record<any, unknown> = {}; 173 + for (const header of headers) { 174 + if (!header || typeof header !== 'object') { 175 + continue; 176 + } 177 + 178 + const iterator = Object.entries(header); 179 + 180 + for (const [key, value] of iterator) { 181 + if ( 182 + axiosHeadersKeywords.includes( 183 + key as (typeof axiosHeadersKeywords)[number], 184 + ) && 185 + typeof value === 'object' 186 + ) { 187 + mergedHeaders[key] = { 188 + ...(mergedHeaders[key] as Record<any, unknown>), 189 + ...value, 190 + }; 191 + } else if (value === null) { 192 + delete mergedHeaders[key]; 193 + } else if (Array.isArray(value)) { 194 + for (const v of value) { 195 + // @ts-expect-error 196 + mergedHeaders[key] = [...(mergedHeaders[key] ?? []), v as string]; 197 + } 198 + } else if (value !== undefined) { 199 + // assume object headers are meant to be JSON stringified, i.e. their 200 + // content value in OpenAPI specification is 'application/json' 201 + mergedHeaders[key] = 202 + typeof value === 'object' ? JSON.stringify(value) : (value as string); 203 + } 204 + } 205 + } 206 + return mergedHeaders; 207 + }; 208 + 209 + export const createConfig = <T extends ClientOptions = ClientOptions>( 210 + override: Config<Omit<ClientOptions, keyof T> & T> = {}, 211 + ): Config<Omit<ClientOptions, keyof T> & T> => ({ 212 + ...override, 213 + });
+42
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/core/auth.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type AuthToken = string | undefined; 4 + 5 + export interface Auth { 6 + /** 7 + * Which part of the request do we use to send the auth? 8 + * 9 + * @default 'header' 10 + */ 11 + in?: 'header' | 'query' | 'cookie'; 12 + /** 13 + * Header or query parameter name. 14 + * 15 + * @default 'Authorization' 16 + */ 17 + name?: string; 18 + scheme?: 'basic' | 'bearer'; 19 + type: 'apiKey' | 'http'; 20 + } 21 + 22 + export const getAuthToken = async ( 23 + auth: Auth, 24 + callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken, 25 + ): Promise<string | undefined> => { 26 + const token = 27 + typeof callback === 'function' ? await callback(auth) : callback; 28 + 29 + if (!token) { 30 + return; 31 + } 32 + 33 + if (auth.scheme === 'bearer') { 34 + return `Bearer ${token}`; 35 + } 36 + 37 + if (auth.scheme === 'basic') { 38 + return `Basic ${btoa(token)}`; 39 + } 40 + 41 + return token; 42 + };
+100
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/core/bodySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { 4 + ArrayStyle, 5 + ObjectStyle, 6 + SerializerOptions, 7 + } from './pathSerializer.gen.js'; 8 + 9 + export type QuerySerializer = (query: Record<string, unknown>) => string; 10 + 11 + export type BodySerializer = (body: any) => any; 12 + 13 + type QuerySerializerOptionsObject = { 14 + allowReserved?: boolean; 15 + array?: Partial<SerializerOptions<ArrayStyle>>; 16 + object?: Partial<SerializerOptions<ObjectStyle>>; 17 + }; 18 + 19 + export type QuerySerializerOptions = QuerySerializerOptionsObject & { 20 + /** 21 + * Per-parameter serialization overrides. When provided, these settings 22 + * override the global array/object settings for specific parameter names. 23 + */ 24 + parameters?: Record<string, QuerySerializerOptionsObject>; 25 + }; 26 + 27 + const serializeFormDataPair = ( 28 + data: FormData, 29 + key: string, 30 + value: unknown, 31 + ): void => { 32 + if (typeof value === 'string' || value instanceof Blob) { 33 + data.append(key, value); 34 + } else if (value instanceof Date) { 35 + data.append(key, value.toISOString()); 36 + } else { 37 + data.append(key, JSON.stringify(value)); 38 + } 39 + }; 40 + 41 + const serializeUrlSearchParamsPair = ( 42 + data: URLSearchParams, 43 + key: string, 44 + value: unknown, 45 + ): void => { 46 + if (typeof value === 'string') { 47 + data.append(key, value); 48 + } else { 49 + data.append(key, JSON.stringify(value)); 50 + } 51 + }; 52 + 53 + export const formDataBodySerializer = { 54 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 55 + body: T, 56 + ): FormData => { 57 + const data = new FormData(); 58 + 59 + Object.entries(body).forEach(([key, value]) => { 60 + if (value === undefined || value === null) { 61 + return; 62 + } 63 + if (Array.isArray(value)) { 64 + value.forEach((v) => serializeFormDataPair(data, key, v)); 65 + } else { 66 + serializeFormDataPair(data, key, value); 67 + } 68 + }); 69 + 70 + return data; 71 + }, 72 + }; 73 + 74 + export const jsonBodySerializer = { 75 + bodySerializer: <T>(body: T): string => 76 + JSON.stringify(body, (_key, value) => 77 + typeof value === 'bigint' ? value.toString() : value, 78 + ), 79 + }; 80 + 81 + export const urlSearchParamsBodySerializer = { 82 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 83 + body: T, 84 + ): string => { 85 + const data = new URLSearchParams(); 86 + 87 + Object.entries(body).forEach(([key, value]) => { 88 + if (value === undefined || value === null) { 89 + return; 90 + } 91 + if (Array.isArray(value)) { 92 + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); 93 + } else { 94 + serializeUrlSearchParamsPair(data, key, value); 95 + } 96 + }); 97 + 98 + return data.toString(); 99 + }, 100 + };
+176
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/core/params.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + type Slot = 'body' | 'headers' | 'path' | 'query'; 4 + 5 + export type Field = 6 + | { 7 + in: Exclude<Slot, 'body'>; 8 + /** 9 + * Field name. This is the name we want the user to see and use. 10 + */ 11 + key: string; 12 + /** 13 + * Field mapped name. This is the name we want to use in the request. 14 + * If omitted, we use the same value as `key`. 15 + */ 16 + map?: string; 17 + } 18 + | { 19 + in: Extract<Slot, 'body'>; 20 + /** 21 + * Key isn't required for bodies. 22 + */ 23 + key?: string; 24 + map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 36 + }; 37 + 38 + export interface Fields { 39 + allowExtra?: Partial<Record<Slot, boolean>>; 40 + args?: ReadonlyArray<Field>; 41 + } 42 + 43 + export type FieldsConfig = ReadonlyArray<Field | Fields>; 44 + 45 + const extraPrefixesMap: Record<string, Slot> = { 46 + $body_: 'body', 47 + $headers_: 'headers', 48 + $path_: 'path', 49 + $query_: 'query', 50 + }; 51 + const extraPrefixes = Object.entries(extraPrefixesMap); 52 + 53 + type KeyMap = Map< 54 + string, 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 63 + >; 64 + 65 + const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { 66 + if (!map) { 67 + map = new Map(); 68 + } 69 + 70 + for (const config of fields) { 71 + if ('in' in config) { 72 + if (config.key) { 73 + map.set(config.key, { 74 + in: config.in, 75 + map: config.map, 76 + }); 77 + } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 82 + } else if (config.args) { 83 + buildKeyMap(config.args, map); 84 + } 85 + } 86 + 87 + return map; 88 + }; 89 + 90 + interface Params { 91 + body: unknown; 92 + headers: Record<string, unknown>; 93 + path: Record<string, unknown>; 94 + query: Record<string, unknown>; 95 + } 96 + 97 + const stripEmptySlots = (params: Params) => { 98 + for (const [slot, value] of Object.entries(params)) { 99 + if (value && typeof value === 'object' && !Object.keys(value).length) { 100 + delete params[slot as Slot]; 101 + } 102 + } 103 + }; 104 + 105 + export const buildClientParams = ( 106 + args: ReadonlyArray<unknown>, 107 + fields: FieldsConfig, 108 + ) => { 109 + const params: Params = { 110 + body: {}, 111 + headers: {}, 112 + path: {}, 113 + query: {}, 114 + }; 115 + 116 + const map = buildKeyMap(fields); 117 + 118 + let config: FieldsConfig[number] | undefined; 119 + 120 + for (const [index, arg] of args.entries()) { 121 + if (fields[index]) { 122 + config = fields[index]; 123 + } 124 + 125 + if (!config) { 126 + continue; 127 + } 128 + 129 + if ('in' in config) { 130 + if (config.key) { 131 + const field = map.get(config.key)!; 132 + const name = field.map || config.key; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 136 + } else { 137 + params.body = arg; 138 + } 139 + } else { 140 + for (const [key, value] of Object.entries(arg ?? {})) { 141 + const field = map.get(key); 142 + 143 + if (field) { 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 150 + } else { 151 + const extra = extraPrefixes.find(([prefix]) => 152 + key.startsWith(prefix), 153 + ); 154 + 155 + if (extra) { 156 + const [prefix, slot] = extra; 157 + (params[slot] as Record<string, unknown>)[ 158 + key.slice(prefix.length) 159 + ] = value; 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 162 + if (allowed) { 163 + (params[slot as Slot] as Record<string, unknown>)[key] = value; 164 + break; 165 + } 166 + } 167 + } 168 + } 169 + } 170 + } 171 + } 172 + 173 + stripEmptySlots(params); 174 + 175 + return params; 176 + };
+181
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/core/pathSerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + interface SerializeOptions<T> 4 + extends SerializePrimitiveOptions, 5 + SerializerOptions<T> {} 6 + 7 + interface SerializePrimitiveOptions { 8 + allowReserved?: boolean; 9 + name: string; 10 + } 11 + 12 + export interface SerializerOptions<T> { 13 + /** 14 + * @default true 15 + */ 16 + explode: boolean; 17 + style: T; 18 + } 19 + 20 + export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; 21 + export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; 22 + type MatrixStyle = 'label' | 'matrix' | 'simple'; 23 + export type ObjectStyle = 'form' | 'deepObject'; 24 + type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; 25 + 26 + interface SerializePrimitiveParam extends SerializePrimitiveOptions { 27 + value: string; 28 + } 29 + 30 + export const separatorArrayExplode = (style: ArraySeparatorStyle) => { 31 + switch (style) { 32 + case 'label': 33 + return '.'; 34 + case 'matrix': 35 + return ';'; 36 + case 'simple': 37 + return ','; 38 + default: 39 + return '&'; 40 + } 41 + }; 42 + 43 + export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { 44 + switch (style) { 45 + case 'form': 46 + return ','; 47 + case 'pipeDelimited': 48 + return '|'; 49 + case 'spaceDelimited': 50 + return '%20'; 51 + default: 52 + return ','; 53 + } 54 + }; 55 + 56 + export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { 57 + switch (style) { 58 + case 'label': 59 + return '.'; 60 + case 'matrix': 61 + return ';'; 62 + case 'simple': 63 + return ','; 64 + default: 65 + return '&'; 66 + } 67 + }; 68 + 69 + export const serializeArrayParam = ({ 70 + allowReserved, 71 + explode, 72 + name, 73 + style, 74 + value, 75 + }: SerializeOptions<ArraySeparatorStyle> & { 76 + value: unknown[]; 77 + }) => { 78 + if (!explode) { 79 + const joinedValues = ( 80 + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) 81 + ).join(separatorArrayNoExplode(style)); 82 + switch (style) { 83 + case 'label': 84 + return `.${joinedValues}`; 85 + case 'matrix': 86 + return `;${name}=${joinedValues}`; 87 + case 'simple': 88 + return joinedValues; 89 + default: 90 + return `${name}=${joinedValues}`; 91 + } 92 + } 93 + 94 + const separator = separatorArrayExplode(style); 95 + const joinedValues = value 96 + .map((v) => { 97 + if (style === 'label' || style === 'simple') { 98 + return allowReserved ? v : encodeURIComponent(v as string); 99 + } 100 + 101 + return serializePrimitiveParam({ 102 + allowReserved, 103 + name, 104 + value: v as string, 105 + }); 106 + }) 107 + .join(separator); 108 + return style === 'label' || style === 'matrix' 109 + ? separator + joinedValues 110 + : joinedValues; 111 + }; 112 + 113 + export const serializePrimitiveParam = ({ 114 + allowReserved, 115 + name, 116 + value, 117 + }: SerializePrimitiveParam) => { 118 + if (value === undefined || value === null) { 119 + return ''; 120 + } 121 + 122 + if (typeof value === 'object') { 123 + throw new Error( 124 + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', 125 + ); 126 + } 127 + 128 + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; 129 + }; 130 + 131 + export const serializeObjectParam = ({ 132 + allowReserved, 133 + explode, 134 + name, 135 + style, 136 + value, 137 + valueOnly, 138 + }: SerializeOptions<ObjectSeparatorStyle> & { 139 + value: Record<string, unknown> | Date; 140 + valueOnly?: boolean; 141 + }) => { 142 + if (value instanceof Date) { 143 + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; 144 + } 145 + 146 + if (style !== 'deepObject' && !explode) { 147 + let values: string[] = []; 148 + Object.entries(value).forEach(([key, v]) => { 149 + values = [ 150 + ...values, 151 + key, 152 + allowReserved ? (v as string) : encodeURIComponent(v as string), 153 + ]; 154 + }); 155 + const joinedValues = values.join(','); 156 + switch (style) { 157 + case 'form': 158 + return `${name}=${joinedValues}`; 159 + case 'label': 160 + return `.${joinedValues}`; 161 + case 'matrix': 162 + return `;${name}=${joinedValues}`; 163 + default: 164 + return joinedValues; 165 + } 166 + } 167 + 168 + const separator = separatorObjectExplode(style); 169 + const joinedValues = Object.entries(value) 170 + .map(([key, v]) => 171 + serializePrimitiveParam({ 172 + allowReserved, 173 + name: style === 'deepObject' ? `${name}[${key}]` : key, 174 + value: v as string, 175 + }), 176 + ) 177 + .join(separator); 178 + return style === 'label' || style === 'matrix' 179 + ? separator + joinedValues 180 + : joinedValues; 181 + };
+136
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/core/queryKeySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + /** 4 + * JSON-friendly union that mirrors what Pinia Colada can hash. 5 + */ 6 + export type JsonValue = 7 + | null 8 + | string 9 + | number 10 + | boolean 11 + | JsonValue[] 12 + | { [key: string]: JsonValue }; 13 + 14 + /** 15 + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. 16 + */ 17 + export const queryKeyJsonReplacer = (_key: string, value: unknown) => { 18 + if ( 19 + value === undefined || 20 + typeof value === 'function' || 21 + typeof value === 'symbol' 22 + ) { 23 + return undefined; 24 + } 25 + if (typeof value === 'bigint') { 26 + return value.toString(); 27 + } 28 + if (value instanceof Date) { 29 + return value.toISOString(); 30 + } 31 + return value; 32 + }; 33 + 34 + /** 35 + * Safely stringifies a value and parses it back into a JsonValue. 36 + */ 37 + export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { 38 + try { 39 + const json = JSON.stringify(input, queryKeyJsonReplacer); 40 + if (json === undefined) { 41 + return undefined; 42 + } 43 + return JSON.parse(json) as JsonValue; 44 + } catch { 45 + return undefined; 46 + } 47 + }; 48 + 49 + /** 50 + * Detects plain objects (including objects with a null prototype). 51 + */ 52 + const isPlainObject = (value: unknown): value is Record<string, unknown> => { 53 + if (value === null || typeof value !== 'object') { 54 + return false; 55 + } 56 + const prototype = Object.getPrototypeOf(value as object); 57 + return prototype === Object.prototype || prototype === null; 58 + }; 59 + 60 + /** 61 + * Turns URLSearchParams into a sorted JSON object for deterministic keys. 62 + */ 63 + const serializeSearchParams = (params: URLSearchParams): JsonValue => { 64 + const entries = Array.from(params.entries()).sort(([a], [b]) => 65 + a.localeCompare(b), 66 + ); 67 + const result: Record<string, JsonValue> = {}; 68 + 69 + for (const [key, value] of entries) { 70 + const existing = result[key]; 71 + if (existing === undefined) { 72 + result[key] = value; 73 + continue; 74 + } 75 + 76 + if (Array.isArray(existing)) { 77 + (existing as string[]).push(value); 78 + } else { 79 + result[key] = [existing, value]; 80 + } 81 + } 82 + 83 + return result; 84 + }; 85 + 86 + /** 87 + * Normalizes any accepted value into a JSON-friendly shape for query keys. 88 + */ 89 + export const serializeQueryKeyValue = ( 90 + value: unknown, 91 + ): JsonValue | undefined => { 92 + if (value === null) { 93 + return null; 94 + } 95 + 96 + if ( 97 + typeof value === 'string' || 98 + typeof value === 'number' || 99 + typeof value === 'boolean' 100 + ) { 101 + return value; 102 + } 103 + 104 + if ( 105 + value === undefined || 106 + typeof value === 'function' || 107 + typeof value === 'symbol' 108 + ) { 109 + return undefined; 110 + } 111 + 112 + if (typeof value === 'bigint') { 113 + return value.toString(); 114 + } 115 + 116 + if (value instanceof Date) { 117 + return value.toISOString(); 118 + } 119 + 120 + if (Array.isArray(value)) { 121 + return stringifyToJsonValue(value); 122 + } 123 + 124 + if ( 125 + typeof URLSearchParams !== 'undefined' && 126 + value instanceof URLSearchParams 127 + ) { 128 + return serializeSearchParams(value); 129 + } 130 + 131 + if (isPlainObject(value)) { 132 + return stringifyToJsonValue(value); 133 + } 134 + 135 + return undefined; 136 + };
+266
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/core/serverSentEvents.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Config } from './types.gen.js'; 4 + 5 + export type ServerSentEventsOptions<TData = unknown> = Omit< 6 + RequestInit, 7 + 'method' 8 + > & 9 + Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & { 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 + * Implementing clients can call request interceptors inside this hook. 19 + */ 20 + onRequest?: (url: string, init: RequestInit) => Promise<Request>; 21 + /** 22 + * Callback invoked when a network or parsing error occurs during streaming. 23 + * 24 + * This option applies only if the endpoint returns a stream of events. 25 + * 26 + * @param error The error that occurred. 27 + */ 28 + onSseError?: (error: unknown) => void; 29 + /** 30 + * Callback invoked when an event is streamed from the server. 31 + * 32 + * This option applies only if the endpoint returns a stream of events. 33 + * 34 + * @param event Event streamed from the server. 35 + * @returns Nothing (void). 36 + */ 37 + onSseEvent?: (event: StreamEvent<TData>) => void; 38 + serializedBody?: RequestInit['body']; 39 + /** 40 + * Default retry delay in milliseconds. 41 + * 42 + * This option applies only if the endpoint returns a stream of events. 43 + * 44 + * @default 3000 45 + */ 46 + sseDefaultRetryDelay?: number; 47 + /** 48 + * Maximum number of retry attempts before giving up. 49 + */ 50 + sseMaxRetryAttempts?: number; 51 + /** 52 + * Maximum retry delay in milliseconds. 53 + * 54 + * Applies only when exponential backoff is used. 55 + * 56 + * This option applies only if the endpoint returns a stream of events. 57 + * 58 + * @default 30000 59 + */ 60 + sseMaxRetryDelay?: number; 61 + /** 62 + * Optional sleep function for retry backoff. 63 + * 64 + * Defaults to using `setTimeout`. 65 + */ 66 + sseSleepFn?: (ms: number) => Promise<void>; 67 + url: string; 68 + }; 69 + 70 + export interface StreamEvent<TData = unknown> { 71 + data: TData; 72 + event?: string; 73 + id?: string; 74 + retry?: number; 75 + } 76 + 77 + export type ServerSentEventsResult< 78 + TData = unknown, 79 + TReturn = void, 80 + TNext = unknown, 81 + > = { 82 + stream: AsyncGenerator< 83 + TData extends Record<string, unknown> ? TData[keyof TData] : TData, 84 + TReturn, 85 + TNext 86 + >; 87 + }; 88 + 89 + export const createSseClient = <TData = unknown>({ 90 + onRequest, 91 + onSseError, 92 + onSseEvent, 93 + responseTransformer, 94 + responseValidator, 95 + sseDefaultRetryDelay, 96 + sseMaxRetryAttempts, 97 + sseMaxRetryDelay, 98 + sseSleepFn, 99 + url, 100 + ...options 101 + }: ServerSentEventsOptions): ServerSentEventsResult<TData> => { 102 + let lastEventId: string | undefined; 103 + 104 + const sleep = 105 + sseSleepFn ?? 106 + ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); 107 + 108 + const createStream = async function* () { 109 + let retryDelay: number = sseDefaultRetryDelay ?? 3000; 110 + let attempt = 0; 111 + const signal = options.signal ?? new AbortController().signal; 112 + 113 + while (true) { 114 + if (signal.aborted) break; 115 + 116 + attempt++; 117 + 118 + const headers = 119 + options.headers instanceof Headers 120 + ? options.headers 121 + : new Headers(options.headers as Record<string, string> | undefined); 122 + 123 + if (lastEventId !== undefined) { 124 + headers.set('Last-Event-ID', lastEventId); 125 + } 126 + 127 + try { 128 + const requestInit: RequestInit = { 129 + redirect: 'follow', 130 + ...options, 131 + body: options.serializedBody, 132 + headers, 133 + signal, 134 + }; 135 + let request = new Request(url, requestInit); 136 + if (onRequest) { 137 + request = await onRequest(url, requestInit); 138 + } 139 + // fetch must be assigned here, otherwise it would throw the error: 140 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 141 + const _fetch = options.fetch ?? globalThis.fetch; 142 + const response = await _fetch(request); 143 + 144 + if (!response.ok) 145 + throw new Error( 146 + `SSE failed: ${response.status} ${response.statusText}`, 147 + ); 148 + 149 + if (!response.body) throw new Error('No body in SSE response'); 150 + 151 + const reader = response.body 152 + .pipeThrough(new TextDecoderStream()) 153 + .getReader(); 154 + 155 + let buffer = ''; 156 + 157 + const abortHandler = () => { 158 + try { 159 + reader.cancel(); 160 + } catch { 161 + // noop 162 + } 163 + }; 164 + 165 + signal.addEventListener('abort', abortHandler); 166 + 167 + try { 168 + while (true) { 169 + const { done, value } = await reader.read(); 170 + if (done) break; 171 + buffer += value; 172 + // Normalize line endings: CRLF -> LF, then CR -> LF 173 + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); 174 + 175 + const chunks = buffer.split('\n\n'); 176 + buffer = chunks.pop() ?? ''; 177 + 178 + for (const chunk of chunks) { 179 + const lines = chunk.split('\n'); 180 + const dataLines: Array<string> = []; 181 + let eventName: string | undefined; 182 + 183 + for (const line of lines) { 184 + if (line.startsWith('data:')) { 185 + dataLines.push(line.replace(/^data:\s*/, '')); 186 + } else if (line.startsWith('event:')) { 187 + eventName = line.replace(/^event:\s*/, ''); 188 + } else if (line.startsWith('id:')) { 189 + lastEventId = line.replace(/^id:\s*/, ''); 190 + } else if (line.startsWith('retry:')) { 191 + const parsed = Number.parseInt( 192 + line.replace(/^retry:\s*/, ''), 193 + 10, 194 + ); 195 + if (!Number.isNaN(parsed)) { 196 + retryDelay = parsed; 197 + } 198 + } 199 + } 200 + 201 + let data: unknown; 202 + let parsedJson = false; 203 + 204 + if (dataLines.length) { 205 + const rawData = dataLines.join('\n'); 206 + try { 207 + data = JSON.parse(rawData); 208 + parsedJson = true; 209 + } catch { 210 + data = rawData; 211 + } 212 + } 213 + 214 + if (parsedJson) { 215 + if (responseValidator) { 216 + await responseValidator(data); 217 + } 218 + 219 + if (responseTransformer) { 220 + data = await responseTransformer(data); 221 + } 222 + } 223 + 224 + onSseEvent?.({ 225 + data, 226 + event: eventName, 227 + id: lastEventId, 228 + retry: retryDelay, 229 + }); 230 + 231 + if (dataLines.length) { 232 + yield data as any; 233 + } 234 + } 235 + } 236 + } finally { 237 + signal.removeEventListener('abort', abortHandler); 238 + reader.releaseLock(); 239 + } 240 + 241 + break; // exit loop on normal completion 242 + } catch (error) { 243 + // connection failed or aborted; retry after delay 244 + onSseError?.(error); 245 + 246 + if ( 247 + sseMaxRetryAttempts !== undefined && 248 + attempt >= sseMaxRetryAttempts 249 + ) { 250 + break; // stop after firing error 251 + } 252 + 253 + // exponential backoff: double retry each attempt, cap at 30s 254 + const backoff = Math.min( 255 + retryDelay * 2 ** (attempt - 1), 256 + sseMaxRetryDelay ?? 30000, 257 + ); 258 + await sleep(backoff); 259 + } 260 + } 261 + }; 262 + 263 + const stream = createStream(); 264 + 265 + return { stream }; 266 + };
+118
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/core/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth, AuthToken } from './auth.gen.js'; 4 + import type { 5 + BodySerializer, 6 + QuerySerializer, 7 + QuerySerializerOptions, 8 + } from './bodySerializer.gen.js'; 9 + 10 + export type HttpMethod = 11 + | 'connect' 12 + | 'delete' 13 + | 'get' 14 + | 'head' 15 + | 'options' 16 + | 'patch' 17 + | 'post' 18 + | 'put' 19 + | 'trace'; 20 + 21 + export type Client< 22 + RequestFn = never, 23 + Config = unknown, 24 + MethodFn = never, 25 + BuildUrlFn = never, 26 + SseFn = never, 27 + > = { 28 + /** 29 + * Returns the final request URL. 30 + */ 31 + buildUrl: BuildUrlFn; 32 + getConfig: () => Config; 33 + request: RequestFn; 34 + setConfig: (config: Config) => Config; 35 + } & { 36 + [K in HttpMethod]: MethodFn; 37 + } & ([SseFn] extends [never] 38 + ? { sse?: never } 39 + : { sse: { [K in HttpMethod]: SseFn } }); 40 + 41 + export interface Config { 42 + /** 43 + * Auth token or a function returning auth token. The resolved value will be 44 + * added to the request payload as defined by its `security` array. 45 + */ 46 + auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken; 47 + /** 48 + * A function for serializing request body parameter. By default, 49 + * {@link JSON.stringify()} will be used. 50 + */ 51 + bodySerializer?: BodySerializer | null; 52 + /** 53 + * An object containing any HTTP headers that you want to pre-populate your 54 + * `Headers` object with. 55 + * 56 + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} 57 + */ 58 + headers?: 59 + | RequestInit['headers'] 60 + | Record< 61 + string, 62 + | string 63 + | number 64 + | boolean 65 + | (string | number | boolean)[] 66 + | null 67 + | undefined 68 + | unknown 69 + >; 70 + /** 71 + * The request method. 72 + * 73 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} 74 + */ 75 + method?: Uppercase<HttpMethod>; 76 + /** 77 + * A function for serializing request query parameters. By default, arrays 78 + * will be exploded in form style, objects will be exploded in deepObject 79 + * style, and reserved characters are percent-encoded. 80 + * 81 + * This method will have no effect if the native `paramsSerializer()` Axios 82 + * API function is used. 83 + * 84 + * {@link https://swagger.io/docs/specification/serialization/#query View examples} 85 + */ 86 + querySerializer?: QuerySerializer | QuerySerializerOptions; 87 + /** 88 + * A function validating request data. This is useful if you want to ensure 89 + * the request conforms to the desired shape, so it can be safely sent to 90 + * the server. 91 + */ 92 + requestValidator?: (data: unknown) => Promise<unknown>; 93 + /** 94 + * A function transforming response data before it's returned. This is useful 95 + * for post-processing data, e.g. converting ISO strings into Date objects. 96 + */ 97 + responseTransformer?: (data: unknown) => Promise<unknown>; 98 + /** 99 + * A function validating response data. This is useful if you want to ensure 100 + * the response conforms to the desired shape, so it can be safely passed to 101 + * the transformers and returned to the user. 102 + */ 103 + responseValidator?: (data: unknown) => Promise<unknown>; 104 + } 105 + 106 + type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 + ? true 108 + : [T] extends [never | undefined] 109 + ? [undefined] extends [T] 110 + ? false 111 + : true 112 + : false; 113 + 114 + export type OmitNever<T extends Record<string, unknown>> = { 115 + [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 + ? never 117 + : K]: T[K]; 118 + };
+143
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/core/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { BodySerializer, QuerySerializer } from './bodySerializer.gen.js'; 4 + import { 5 + type ArraySeparatorStyle, 6 + serializeArrayParam, 7 + serializeObjectParam, 8 + serializePrimitiveParam, 9 + } from './pathSerializer.gen.js'; 10 + 11 + export interface PathSerializer { 12 + path: Record<string, unknown>; 13 + url: string; 14 + } 15 + 16 + export const PATH_PARAM_RE = /\{[^{}]+\}/g; 17 + 18 + export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { 19 + let url = _url; 20 + const matches = _url.match(PATH_PARAM_RE); 21 + if (matches) { 22 + for (const match of matches) { 23 + let explode = false; 24 + let name = match.substring(1, match.length - 1); 25 + let style: ArraySeparatorStyle = 'simple'; 26 + 27 + if (name.endsWith('*')) { 28 + explode = true; 29 + name = name.substring(0, name.length - 1); 30 + } 31 + 32 + if (name.startsWith('.')) { 33 + name = name.substring(1); 34 + style = 'label'; 35 + } else if (name.startsWith(';')) { 36 + name = name.substring(1); 37 + style = 'matrix'; 38 + } 39 + 40 + const value = path[name]; 41 + 42 + if (value === undefined || value === null) { 43 + continue; 44 + } 45 + 46 + if (Array.isArray(value)) { 47 + url = url.replace( 48 + match, 49 + serializeArrayParam({ explode, name, style, value }), 50 + ); 51 + continue; 52 + } 53 + 54 + if (typeof value === 'object') { 55 + url = url.replace( 56 + match, 57 + serializeObjectParam({ 58 + explode, 59 + name, 60 + style, 61 + value: value as Record<string, unknown>, 62 + valueOnly: true, 63 + }), 64 + ); 65 + continue; 66 + } 67 + 68 + if (style === 'matrix') { 69 + url = url.replace( 70 + match, 71 + `;${serializePrimitiveParam({ 72 + name, 73 + value: value as string, 74 + })}`, 75 + ); 76 + continue; 77 + } 78 + 79 + const replaceValue = encodeURIComponent( 80 + style === 'label' ? `.${value as string}` : (value as string), 81 + ); 82 + url = url.replace(match, replaceValue); 83 + } 84 + } 85 + return url; 86 + }; 87 + 88 + export const getUrl = ({ 89 + baseUrl, 90 + path, 91 + query, 92 + querySerializer, 93 + url: _url, 94 + }: { 95 + baseUrl?: string; 96 + path?: Record<string, unknown>; 97 + query?: Record<string, unknown>; 98 + querySerializer: QuerySerializer; 99 + url: string; 100 + }) => { 101 + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; 102 + let url = (baseUrl ?? '') + pathUrl; 103 + if (path) { 104 + url = defaultPathSerializer({ path, url }); 105 + } 106 + let search = query ? querySerializer(query) : ''; 107 + if (search.startsWith('?')) { 108 + search = search.substring(1); 109 + } 110 + if (search) { 111 + url += `?${search}`; 112 + } 113 + return url; 114 + }; 115 + 116 + export function getValidRequestBody(options: { 117 + body?: unknown; 118 + bodySerializer?: BodySerializer | null; 119 + serializedBody?: unknown; 120 + }) { 121 + const hasBody = options.body !== undefined; 122 + const isSerializedBody = hasBody && options.bodySerializer; 123 + 124 + if (isSerializedBody) { 125 + if ('serializedBody' in options) { 126 + const hasSerializedBody = 127 + options.serializedBody !== undefined && options.serializedBody !== ''; 128 + 129 + return hasSerializedBody ? options.serializedBody : null; 130 + } 131 + 132 + // not all clients implement a serializedBody property (i.e. client-axios) 133 + return options.body !== '' ? options.body : null; 134 + } 135 + 136 + // plain/text body 137 + if (hasBody) { 138 + return options.body; 139 + } 140 + 141 + // no body was provided 142 + return undefined; 143 + }
+4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export { apiVVersionODataControllerCount, callToTestOrderOfParams, callWithDefaultOptionalParameters, callWithDefaultParameters, callWithDescriptions, callWithDuplicateResponses, callWithNoContentResponse, callWithParameters, callWithResponse, callWithResponseAndNoContentResponse, callWithResponses, callWithResultFromHeader, callWithWeirdParameterNames, collectionFormat, complexParams, complexTypes, deleteCallWithoutParametersAndResponse, deleteFoo, deprecatedCall, dummyA, dummyB, duplicateName, duplicateName2, duplicateName3, duplicateName4, export_, fileResponse, fooWow, getApiVbyApiVersionSimpleOperation, getCallWithOptionalParam, getCallWithoutParametersAndResponse, headCallWithoutParametersAndResponse, import_, multipartRequest, multipartResponse, nonAsciiæøåÆøÅöôêÊ字符串, type Options, optionsCallWithoutParametersAndResponse, patchApiVbyApiVersionNoTag, patchCallWithoutParametersAndResponse, postApiVbyApiVersionFormData, postApiVbyApiVersionRequestBody, postCallWithOptionalParam, postCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, putWithFormUrlEncoded, testErrorCode, types, uploadFile } from './sdk.gen.js'; 4 + export type { _3eNum1Период, _400, AdditionalPropertiesIntegerIssue, AdditionalPropertiesUnknownIssue, AdditionalPropertiesUnknownIssue2, AdditionalPropertiesUnknownIssue3, AdditionalPropertiesUnknownIssueWritable, AnyOfAnyAndNull, AnyOfArrays, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountResponses, ArrayWithAnyOfProperties, ArrayWithArray, ArrayWithBooleans, ArrayWithNumbers, ArrayWithProperties, ArrayWithReferences, ArrayWithStrings, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponse, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesError, CallWithResponsesErrors, CallWithResponsesResponse, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CamelCaseCommentWithBreaks, CharactersInDescription, ClientOptions, CollectionFormatData, CommentWithBackticks, CommentWithBackticksAndQuotes, CommentWithBreaks, CommentWithExpressionPlaceholders, CommentWithQuotes, CommentWithReservedCharacters, CommentWithSlashes, ComplexParamsData, ComplexParamsResponse, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponse, ComplexTypesResponses, CompositionBaseModel, CompositionExtendedModel, CompositionWithAllOfAndNullable, CompositionWithAnyOf, CompositionWithAnyOfAndNullable, CompositionWithAnyOfAnonymous, CompositionWithNestedAnyAndTypeNull, CompositionWithNestedAnyOfAndNull, CompositionWithOneOf, CompositionWithOneOfAndComplexArrayDictionary, CompositionWithOneOfAndNullable, CompositionWithOneOfAndProperties, CompositionWithOneOfAndSimpleArrayDictionary, CompositionWithOneOfAndSimpleDictionary, CompositionWithOneOfAnonymous, CompositionWithOneOfDiscriminator, ConstValue, Default, DeleteCallWithoutParametersAndResponseData, DeleteFooData, DeleteFooData2, DeleteFooData3, DeprecatedCallData, DeprecatedModel, DictionaryWithArray, DictionaryWithDictionary, DictionaryWithProperties, DictionaryWithPropertiesAndAdditionalProperties, DictionaryWithReference, DictionaryWithString, DummyAData, DummyAResponse, DummyAResponses, DummyBData, DummyBResponse, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, EnumFromDescription, EnumWithExtensions, EnumWithNumbers, EnumWithReplacedCharacters, EnumWithStrings, EnumWithXEnumNames, ExportData, ExternalRefA, ExternalRefB, ExternalSharedExternalSharedModel, File, FileResponseData, FileResponseResponse, FileResponseResponses, FileWritable, FooWowData, FooWowResponses, FreeFormObjectWithAdditionalPropertiesEqEmptyObject, FreeFormObjectWithAdditionalPropertiesEqTrue, FreeFormObjectWithoutAdditionalProperties, GenericSchemaDuplicateIssue1SystemBoolean, GenericSchemaDuplicateIssue1SystemBooleanWritable, GenericSchemaDuplicateIssue1SystemString, GenericSchemaDuplicateIssue1SystemStringWritable, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, Import, ImportData, ImportResponse, ImportResponses, IoK8sApimachineryPkgApisMetaV1DeleteOptions, IoK8sApimachineryPkgApisMetaV1Preconditions, ModelCircle, ModelFromZendesk, ModelSquare, ModelThatExtends, ModelThatExtendsExtends, ModelWithAdditionalPropertiesEqTrue, ModelWithAnyOfConstantSizeArray, ModelWithAnyOfConstantSizeArrayAndIntersect, ModelWithAnyOfConstantSizeArrayNullable, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable, ModelWithArray, ModelWithArrayReadOnlyAndWriteOnly, ModelWithArrayReadOnlyAndWriteOnlyWritable, ModelWithBackticksInDescription, ModelWithBoolean, ModelWithCircularReference, ModelWithConst, ModelWithConstantSizeArray, ModelWithDictionary, ModelWithDuplicateImports, ModelWithDuplicateProperties, ModelWithEnum, ModelWithEnumFromDescription, ModelWithEnumWithHyphen, ModelWithInteger, ModelWithNestedArrayEnums, ModelWithNestedArrayEnumsData, ModelWithNestedArrayEnumsDataBar, ModelWithNestedArrayEnumsDataFoo, ModelWithNestedCompositionEnums, ModelWithNestedEnums, ModelWithNestedProperties, ModelWithNullableObject, ModelWithNullableString, ModelWithNumericEnumUnion, ModelWithOneOfAndProperties, ModelWithOneOfEnum, ModelWithOrderedProperties, ModelWithPattern, ModelWithPatternWritable, ModelWithPrefixItemsConstantSizeArray, ModelWithProperties, ModelWithPropertiesWritable, ModelWithReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnlyWritable, ModelWithReference, ModelWithReferenceWritable, ModelWithString, ModelWithStringError, MultipartRequestData, MultipartResponseData, MultipartResponseResponse, MultipartResponseResponses, NestedAnyOfArraysNullable, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Responses, NonAsciiStringæøåÆøÅöôêÊ字符串, NullableObject, OneOfAllOfIssue, OneOfAllOfIssueWritable, OptionsCallWithoutParametersAndResponseData, Pageable, ParameterSimpleParameterUnused, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PostServiceWithEmptyTagResponse, PostServiceWithEmptyTagResponse2, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, SchemaWithFormRestrictedKeys, SimpleBoolean, SimpleFile, SimpleFormData, SimpleInteger, SimpleParameter, SimpleReference, SimpleRequestBody, SimpleString, SimpleStringWithPattern, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponse, TypesResponses, UploadFileData, UploadFileResponse, UploadFileResponses, XFooBar } from './types.gen.js';
+247
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/sdk.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { client } from './client.gen.js'; 4 + import { type Client, formDataBodySerializer, type Options as Options2, type TDataShape, urlSearchParamsBodySerializer } from './client/index.js'; 5 + import type { ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponses, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesErrors, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CollectionFormatData, ComplexParamsData, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponses, DeleteCallWithoutParametersAndResponseData, DeleteFooData3, DeprecatedCallData, DummyAData, DummyAResponses, DummyBData, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, ExportData, FileResponseData, FileResponseResponses, FooWowData, FooWowResponses, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, ImportData, ImportResponses, MultipartRequestData, MultipartResponseData, MultipartResponseResponses, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Responses, OptionsCallWithoutParametersAndResponseData, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponses, UploadFileData, UploadFileResponses } from './types.gen.js'; 6 + 7 + export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & { 8 + /** 9 + * You can provide a client instance returned by `createClient()` instead of 10 + * individual options. This might be also useful if you want to implement a 11 + * custom client. 12 + */ 13 + client?: Client; 14 + /** 15 + * You can pass arbitrary values through the `meta` object. This can be 16 + * used to access values that aren't defined as part of the SDK function. 17 + */ 18 + meta?: Record<string, unknown>; 19 + }; 20 + 21 + export const export_ = <ThrowOnError extends boolean = false>(options?: Options<ExportData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 22 + 23 + export const patchApiVbyApiVersionNoTag = <ThrowOnError extends boolean = false>(options?: Options<PatchApiVbyApiVersionNoTagData, ThrowOnError>) => (options?.client ?? client).patch<PatchApiVbyApiVersionNoTagResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 24 + 25 + export const import_ = <ThrowOnError extends boolean = false>(options: Options<ImportData, ThrowOnError>) => (options.client ?? client).post<ImportResponses, unknown, ThrowOnError>({ 26 + responseType: 'json', 27 + url: '/api/v{api-version}/no+tag', 28 + ...options, 29 + headers: { 30 + 'Content-Type': 'application/json', 31 + ...options.headers 32 + } 33 + }); 34 + 35 + export const fooWow = <ThrowOnError extends boolean = false>(options?: Options<FooWowData, ThrowOnError>) => (options?.client ?? client).put<FooWowResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 36 + 37 + export const apiVVersionODataControllerCount = <ThrowOnError extends boolean = false>(options?: Options<ApiVVersionODataControllerCountData, ThrowOnError>) => (options?.client ?? client).get<ApiVVersionODataControllerCountResponses, unknown, ThrowOnError>({ 38 + responseType: 'json', 39 + url: '/api/v{api-version}/simple/$count', 40 + ...options 41 + }); 42 + 43 + export const getApiVbyApiVersionSimpleOperation = <ThrowOnError extends boolean = false>(options: Options<GetApiVbyApiVersionSimpleOperationData, ThrowOnError>) => (options.client ?? client).get<GetApiVbyApiVersionSimpleOperationResponses, GetApiVbyApiVersionSimpleOperationErrors, ThrowOnError>({ 44 + responseType: 'json', 45 + url: '/api/v{api-version}/simple:operation', 46 + ...options 47 + }); 48 + 49 + export const deleteCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<DeleteCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 50 + 51 + export const getCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<GetCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 52 + 53 + export const headCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<HeadCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).head<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 54 + 55 + export const optionsCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<OptionsCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).options<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 56 + 57 + export const patchCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PatchCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).patch<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 58 + 59 + export const postCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PostCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 60 + 61 + export const putCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PutCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 62 + 63 + export const deleteFoo = <ThrowOnError extends boolean = false>(options: Options<DeleteFooData3, ThrowOnError>) => (options.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', ...options }); 64 + 65 + export const callWithDescriptions = <ThrowOnError extends boolean = false>(options?: Options<CallWithDescriptionsData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/descriptions', ...options }); 66 + 67 + /** 68 + * @deprecated 69 + */ 70 + export const deprecatedCall = <ThrowOnError extends boolean = false>(options: Options<DeprecatedCallData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/parameters/deprecated', ...options }); 71 + 72 + export const callWithParameters = <ThrowOnError extends boolean = false>(options: Options<CallWithParametersData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ 73 + url: '/api/v{api-version}/parameters/{parameterPath}', 74 + ...options, 75 + headers: { 76 + 'Content-Type': 'application/json', 77 + ...options.headers 78 + } 79 + }); 80 + 81 + export const callWithWeirdParameterNames = <ThrowOnError extends boolean = false>(options: Options<CallWithWeirdParameterNamesData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ 82 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', 83 + ...options, 84 + headers: { 85 + 'Content-Type': 'application/json', 86 + ...options.headers 87 + } 88 + }); 89 + 90 + export const getCallWithOptionalParam = <ThrowOnError extends boolean = false>(options: Options<GetCallWithOptionalParamData, ThrowOnError>) => (options.client ?? client).get<unknown, unknown, ThrowOnError>({ 91 + url: '/api/v{api-version}/parameters', 92 + ...options, 93 + headers: { 94 + 'Content-Type': 'application/json', 95 + ...options.headers 96 + } 97 + }); 98 + 99 + export const postCallWithOptionalParam = <ThrowOnError extends boolean = false>(options: Options<PostCallWithOptionalParamData, ThrowOnError>) => (options.client ?? client).post<PostCallWithOptionalParamResponses, unknown, ThrowOnError>({ 100 + responseType: 'json', 101 + url: '/api/v{api-version}/parameters', 102 + ...options, 103 + headers: { 104 + 'Content-Type': 'application/json', 105 + ...options.headers 106 + } 107 + }); 108 + 109 + export const postApiVbyApiVersionRequestBody = <ThrowOnError extends boolean = false>(options?: Options<PostApiVbyApiVersionRequestBodyData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 110 + url: '/api/v{api-version}/requestBody', 111 + ...options, 112 + headers: { 113 + 'Content-Type': 'application/json', 114 + ...options?.headers 115 + } 116 + }); 117 + 118 + export const postApiVbyApiVersionFormData = <ThrowOnError extends boolean = false>(options?: Options<PostApiVbyApiVersionFormDataData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 119 + ...formDataBodySerializer, 120 + url: '/api/v{api-version}/formData', 121 + ...options, 122 + headers: { 123 + 'Content-Type': null, 124 + ...options?.headers 125 + } 126 + }); 127 + 128 + export const callWithDefaultParameters = <ThrowOnError extends boolean = false>(options?: Options<CallWithDefaultParametersData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 129 + 130 + export const callWithDefaultOptionalParameters = <ThrowOnError extends boolean = false>(options?: Options<CallWithDefaultOptionalParametersData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 131 + 132 + export const callToTestOrderOfParams = <ThrowOnError extends boolean = false>(options: Options<CallToTestOrderOfParamsData, ThrowOnError>) => (options.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 133 + 134 + export const duplicateName = <ThrowOnError extends boolean = false>(options?: Options<DuplicateNameData, ThrowOnError>) => (options?.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 135 + 136 + export const duplicateName2 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName2Data, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 137 + 138 + export const duplicateName3 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName3Data, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 139 + 140 + export const duplicateName4 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName4Data, ThrowOnError>) => (options?.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 141 + 142 + export const callWithNoContentResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithNoContentResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithNoContentResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no-content', ...options }); 143 + 144 + export const callWithResponseAndNoContentResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponseAndNoContentResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithResponseAndNoContentResponseResponses, unknown, ThrowOnError>({ 145 + responseType: 'json', 146 + url: '/api/v{api-version}/multiple-tags/response-and-no-content', 147 + ...options 148 + }); 149 + 150 + export const dummyA = <ThrowOnError extends boolean = false>(options?: Options<DummyAData, ThrowOnError>) => (options?.client ?? client).get<DummyAResponses, unknown, ThrowOnError>({ 151 + responseType: 'json', 152 + url: '/api/v{api-version}/multiple-tags/a', 153 + ...options 154 + }); 155 + 156 + export const dummyB = <ThrowOnError extends boolean = false>(options?: Options<DummyBData, ThrowOnError>) => (options?.client ?? client).get<DummyBResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/b', ...options }); 157 + 158 + export const callWithResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 159 + 160 + export const callWithDuplicateResponses = <ThrowOnError extends boolean = false>(options?: Options<CallWithDuplicateResponsesData, ThrowOnError>) => (options?.client ?? client).post<CallWithDuplicateResponsesResponses, CallWithDuplicateResponsesErrors, ThrowOnError>({ 161 + responseType: 'json', 162 + url: '/api/v{api-version}/response', 163 + ...options 164 + }); 165 + 166 + export const callWithResponses = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponsesData, ThrowOnError>) => (options?.client ?? client).put<CallWithResponsesResponses, CallWithResponsesErrors, ThrowOnError>({ 167 + responseType: 'json', 168 + url: '/api/v{api-version}/response', 169 + ...options 170 + }); 171 + 172 + export const collectionFormat = <ThrowOnError extends boolean = false>(options: Options<CollectionFormatData, ThrowOnError>) => (options.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/collectionFormat', ...options }); 173 + 174 + export const types = <ThrowOnError extends boolean = false>(options: Options<TypesData, ThrowOnError>) => (options.client ?? client).get<TypesResponses, unknown, ThrowOnError>({ 175 + responseType: 'json', 176 + url: '/api/v{api-version}/types', 177 + ...options 178 + }); 179 + 180 + export const uploadFile = <ThrowOnError extends boolean = false>(options: Options<UploadFileData, ThrowOnError>) => (options.client ?? client).post<UploadFileResponses, unknown, ThrowOnError>({ 181 + ...urlSearchParamsBodySerializer, 182 + responseType: 'json', 183 + url: '/api/v{api-version}/upload', 184 + ...options, 185 + headers: { 186 + 'Content-Type': 'application/x-www-form-urlencoded', 187 + ...options.headers 188 + } 189 + }); 190 + 191 + export const fileResponse = <ThrowOnError extends boolean = false>(options: Options<FileResponseData, ThrowOnError>) => (options.client ?? client).get<FileResponseResponses, unknown, ThrowOnError>({ 192 + responseType: 'blob', 193 + url: '/api/v{api-version}/file/{id}', 194 + ...options 195 + }); 196 + 197 + export const complexTypes = <ThrowOnError extends boolean = false>(options: Options<ComplexTypesData, ThrowOnError>) => (options.client ?? client).get<ComplexTypesResponses, ComplexTypesErrors, ThrowOnError>({ 198 + querySerializer: { parameters: { parameterObject: { object: { style: 'form' } } } }, 199 + responseType: 'json', 200 + url: '/api/v{api-version}/complex', 201 + ...options 202 + }); 203 + 204 + export const multipartResponse = <ThrowOnError extends boolean = false>(options?: Options<MultipartResponseData, ThrowOnError>) => (options?.client ?? client).get<MultipartResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multipart', ...options }); 205 + 206 + export const multipartRequest = <ThrowOnError extends boolean = false>(options?: Options<MultipartRequestData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 207 + ...formDataBodySerializer, 208 + url: '/api/v{api-version}/multipart', 209 + ...options, 210 + headers: { 211 + 'Content-Type': null, 212 + ...options?.headers 213 + } 214 + }); 215 + 216 + export const complexParams = <ThrowOnError extends boolean = false>(options: Options<ComplexParamsData, ThrowOnError>) => (options.client ?? client).put<ComplexParamsResponses, unknown, ThrowOnError>({ 217 + responseType: 'json', 218 + url: '/api/v{api-version}/complex/{id}', 219 + ...options, 220 + headers: { 221 + 'Content-Type': 'application/json-patch+json', 222 + ...options.headers 223 + } 224 + }); 225 + 226 + export const callWithResultFromHeader = <ThrowOnError extends boolean = false>(options?: Options<CallWithResultFromHeaderData, ThrowOnError>) => (options?.client ?? client).post<CallWithResultFromHeaderResponses, CallWithResultFromHeaderErrors, ThrowOnError>({ url: '/api/v{api-version}/header', ...options }); 227 + 228 + export const testErrorCode = <ThrowOnError extends boolean = false>(options: Options<TestErrorCodeData, ThrowOnError>) => (options.client ?? client).post<TestErrorCodeResponses, TestErrorCodeErrors, ThrowOnError>({ url: '/api/v{api-version}/error', ...options }); 229 + 230 + export const nonAsciiæøåÆøÅöôêÊ字符串 = <ThrowOnError extends boolean = false>(options: Options<NonAsciiæøåÆøÅöôêÊ字符串Data, ThrowOnError>) => (options.client ?? client).post<NonAsciiæøåÆøÅöôêÊ字符串Responses, unknown, ThrowOnError>({ 231 + responseType: 'json', 232 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', 233 + ...options 234 + }); 235 + 236 + /** 237 + * Login User 238 + */ 239 + export const putWithFormUrlEncoded = <ThrowOnError extends boolean = false>(options: Options<PutWithFormUrlEncodedData, ThrowOnError>) => (options.client ?? client).put<unknown, unknown, ThrowOnError>({ 240 + ...urlSearchParamsBodySerializer, 241 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', 242 + ...options, 243 + headers: { 244 + 'Content-Type': 'application/x-www-form-urlencoded', 245 + ...options.headers 246 + } 247 + });
+2091
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-node16-sdk/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type ClientOptions = { 4 + baseURL: 'http://localhost:3000/base' | (string & {}); 5 + }; 6 + 7 + /** 8 + * Model with number-only name 9 + */ 10 + export type _400 = string; 11 + 12 + /** 13 + * External ref to shared model (A) 14 + */ 15 + export type ExternalRefA = ExternalSharedExternalSharedModel; 16 + 17 + /** 18 + * External ref to shared model (B) 19 + */ 20 + export type ExternalRefB = ExternalSharedExternalSharedModel; 21 + 22 + /** 23 + * Testing multiline comments in string: First line 24 + * Second line 25 + * 26 + * Fourth line 27 + */ 28 + export type CamelCaseCommentWithBreaks = number; 29 + 30 + /** 31 + * Testing multiline comments in string: First line 32 + * Second line 33 + * 34 + * Fourth line 35 + */ 36 + export type CommentWithBreaks = number; 37 + 38 + /** 39 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 40 + */ 41 + export type CommentWithBackticks = number; 42 + 43 + /** 44 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 45 + */ 46 + export type CommentWithBackticksAndQuotes = number; 47 + 48 + /** 49 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 50 + */ 51 + export type CommentWithSlashes = number; 52 + 53 + /** 54 + * Testing expression placeholders in string: ${expression} should work 55 + */ 56 + export type CommentWithExpressionPlaceholders = number; 57 + 58 + /** 59 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 60 + */ 61 + export type CommentWithQuotes = number; 62 + 63 + /** 64 + * Testing reserved characters in string: * inline * and ** inline ** should work 65 + */ 66 + export type CommentWithReservedCharacters = number; 67 + 68 + /** 69 + * This is a simple number 70 + */ 71 + export type SimpleInteger = number; 72 + 73 + /** 74 + * This is a simple boolean 75 + */ 76 + export type SimpleBoolean = boolean; 77 + 78 + /** 79 + * This is a simple string 80 + */ 81 + export type SimpleString = string; 82 + 83 + /** 84 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 85 + */ 86 + export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; 87 + 88 + /** 89 + * This is a simple file 90 + */ 91 + export type SimpleFile = Blob | File; 92 + 93 + /** 94 + * This is a simple reference 95 + */ 96 + export type SimpleReference = ModelWithString; 97 + 98 + /** 99 + * This is a simple string 100 + */ 101 + export type SimpleStringWithPattern = string | null; 102 + 103 + /** 104 + * This is a simple enum with strings 105 + */ 106 + export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | '\'Single Quote\'' | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; 107 + 108 + export type EnumWithReplacedCharacters = '\'Single Quote\'' | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; 109 + 110 + /** 111 + * This is a simple enum with numbers 112 + */ 113 + export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; 114 + 115 + /** 116 + * Success=1,Warning=2,Error=3 117 + */ 118 + export type EnumFromDescription = number; 119 + 120 + /** 121 + * This is a simple enum with numbers 122 + */ 123 + export type EnumWithExtensions = 200 | 400 | 500; 124 + 125 + export type EnumWithXEnumNames = 0 | 1 | 2; 126 + 127 + /** 128 + * This is a simple array with numbers 129 + */ 130 + export type ArrayWithNumbers = Array<number>; 131 + 132 + /** 133 + * This is a simple array with booleans 134 + */ 135 + export type ArrayWithBooleans = Array<boolean>; 136 + 137 + /** 138 + * This is a simple array with strings 139 + */ 140 + export type ArrayWithStrings = Array<string>; 141 + 142 + /** 143 + * This is a simple array with references 144 + */ 145 + export type ArrayWithReferences = Array<ModelWithString>; 146 + 147 + /** 148 + * This is a simple array containing an array 149 + */ 150 + export type ArrayWithArray = Array<Array<ModelWithString>>; 151 + 152 + /** 153 + * This is a simple array with properties 154 + */ 155 + export type ArrayWithProperties = Array<{ 156 + '16x16'?: CamelCaseCommentWithBreaks; 157 + bar?: string; 158 + }>; 159 + 160 + /** 161 + * This is a simple array with any of properties 162 + */ 163 + export type ArrayWithAnyOfProperties = Array<{ 164 + foo?: string; 165 + } | { 166 + bar?: string; 167 + }>; 168 + 169 + export type AnyOfAnyAndNull = { 170 + data?: unknown | null; 171 + }; 172 + 173 + /** 174 + * This is a simple array with any of properties 175 + */ 176 + export type AnyOfArrays = { 177 + results?: Array<{ 178 + foo?: string; 179 + } | { 180 + bar?: string; 181 + }>; 182 + }; 183 + 184 + /** 185 + * This is a string dictionary 186 + */ 187 + export type DictionaryWithString = { 188 + [key: string]: string; 189 + }; 190 + 191 + export type DictionaryWithPropertiesAndAdditionalProperties = { 192 + foo?: number; 193 + bar?: boolean; 194 + [key: string]: string | number | boolean | undefined; 195 + }; 196 + 197 + /** 198 + * This is a string reference 199 + */ 200 + export type DictionaryWithReference = { 201 + [key: string]: ModelWithString; 202 + }; 203 + 204 + /** 205 + * This is a complex dictionary 206 + */ 207 + export type DictionaryWithArray = { 208 + [key: string]: Array<ModelWithString>; 209 + }; 210 + 211 + /** 212 + * This is a string dictionary 213 + */ 214 + export type DictionaryWithDictionary = { 215 + [key: string]: { 216 + [key: string]: string; 217 + }; 218 + }; 219 + 220 + /** 221 + * This is a complex dictionary 222 + */ 223 + export type DictionaryWithProperties = { 224 + [key: string]: { 225 + foo?: string; 226 + bar?: string; 227 + }; 228 + }; 229 + 230 + /** 231 + * This is a model with one number property 232 + */ 233 + export type ModelWithInteger = { 234 + /** 235 + * This is a simple number property 236 + */ 237 + prop?: number; 238 + }; 239 + 240 + /** 241 + * This is a model with one boolean property 242 + */ 243 + export type ModelWithBoolean = { 244 + /** 245 + * This is a simple boolean property 246 + */ 247 + prop?: boolean; 248 + }; 249 + 250 + /** 251 + * This is a model with one string property 252 + */ 253 + export type ModelWithString = { 254 + /** 255 + * This is a simple string property 256 + */ 257 + prop?: string; 258 + }; 259 + 260 + /** 261 + * This is a model with one string property 262 + */ 263 + export type ModelWithStringError = { 264 + /** 265 + * This is a simple string property 266 + */ 267 + prop?: string; 268 + }; 269 + 270 + /** 271 + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) 272 + */ 273 + export type ModelFromZendesk = string; 274 + 275 + /** 276 + * This is a model with one string property 277 + */ 278 + export type ModelWithNullableString = { 279 + /** 280 + * This is a simple string property 281 + */ 282 + nullableProp1?: string | null; 283 + /** 284 + * This is a simple string property 285 + */ 286 + nullableRequiredProp1: string | null; 287 + /** 288 + * This is a simple string property 289 + */ 290 + nullableProp2?: string | null; 291 + /** 292 + * This is a simple string property 293 + */ 294 + nullableRequiredProp2: string | null; 295 + /** 296 + * This is a simple enum with strings 297 + */ 298 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 299 + }; 300 + 301 + /** 302 + * This is a model with one enum 303 + */ 304 + export type ModelWithEnum = { 305 + /** 306 + * This is a simple enum with strings 307 + */ 308 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 309 + /** 310 + * These are the HTTP error code enums 311 + */ 312 + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; 313 + /** 314 + * Simple boolean enum 315 + */ 316 + bool?: true; 317 + }; 318 + 319 + /** 320 + * This is a model with one enum with escaped name 321 + */ 322 + export type ModelWithEnumWithHyphen = { 323 + /** 324 + * Foo-Bar-Baz-Qux 325 + */ 326 + 'foo-bar-baz-qux'?: '3.0'; 327 + }; 328 + 329 + /** 330 + * This is a model with one enum 331 + */ 332 + export type ModelWithEnumFromDescription = { 333 + /** 334 + * Success=1,Warning=2,Error=3 335 + */ 336 + test?: number; 337 + }; 338 + 339 + /** 340 + * This is a model with nested enums 341 + */ 342 + export type ModelWithNestedEnums = { 343 + dictionaryWithEnum?: { 344 + [key: string]: 'Success' | 'Warning' | 'Error'; 345 + }; 346 + dictionaryWithEnumFromDescription?: { 347 + [key: string]: number; 348 + }; 349 + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; 350 + arrayWithDescription?: Array<number>; 351 + /** 352 + * This is a simple enum with strings 353 + */ 354 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 355 + }; 356 + 357 + /** 358 + * This is a model with one property containing a reference 359 + */ 360 + export type ModelWithReference = { 361 + prop?: ModelWithProperties; 362 + }; 363 + 364 + /** 365 + * This is a model with one property containing an array 366 + */ 367 + export type ModelWithArrayReadOnlyAndWriteOnly = { 368 + prop?: Array<ModelWithReadOnlyAndWriteOnly>; 369 + propWithFile?: Array<Blob | File>; 370 + propWithNumber?: Array<number>; 371 + }; 372 + 373 + /** 374 + * This is a model with one property containing an array 375 + */ 376 + export type ModelWithArray = { 377 + prop?: Array<ModelWithString>; 378 + propWithFile?: Array<Blob | File>; 379 + propWithNumber?: Array<number>; 380 + }; 381 + 382 + /** 383 + * This is a model with one property containing a dictionary 384 + */ 385 + export type ModelWithDictionary = { 386 + prop?: { 387 + [key: string]: string; 388 + }; 389 + }; 390 + 391 + /** 392 + * This is a deprecated model with a deprecated property 393 + * 394 + * @deprecated 395 + */ 396 + export type DeprecatedModel = { 397 + /** 398 + * This is a deprecated property 399 + * 400 + * @deprecated 401 + */ 402 + prop?: string; 403 + }; 404 + 405 + /** 406 + * This is a model with one property containing a circular reference 407 + */ 408 + export type ModelWithCircularReference = { 409 + prop?: ModelWithCircularReference; 410 + }; 411 + 412 + /** 413 + * This is a model with one property with a 'one of' relationship 414 + */ 415 + export type CompositionWithOneOf = { 416 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 417 + }; 418 + 419 + /** 420 + * This is a model with one property with a 'one of' relationship where the options are not $ref 421 + */ 422 + export type CompositionWithOneOfAnonymous = { 423 + propA?: { 424 + propA?: string; 425 + } | string | number; 426 + }; 427 + 428 + /** 429 + * Circle 430 + */ 431 + export type ModelCircle = { 432 + kind: string; 433 + radius?: number; 434 + }; 435 + 436 + /** 437 + * Square 438 + */ 439 + export type ModelSquare = { 440 + kind: string; 441 + sideLength?: number; 442 + }; 443 + 444 + /** 445 + * This is a model with one property with a 'one of' relationship where the options are not $ref 446 + */ 447 + export type CompositionWithOneOfDiscriminator = ({ 448 + kind: 'circle'; 449 + } & ModelCircle) | ({ 450 + kind: 'square'; 451 + } & ModelSquare); 452 + 453 + /** 454 + * This is a model with one property with a 'any of' relationship 455 + */ 456 + export type CompositionWithAnyOf = { 457 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 458 + }; 459 + 460 + /** 461 + * This is a model with one property with a 'any of' relationship where the options are not $ref 462 + */ 463 + export type CompositionWithAnyOfAnonymous = { 464 + propA?: { 465 + propA?: string; 466 + } | string | number; 467 + }; 468 + 469 + /** 470 + * This is a model with nested 'any of' property with a type null 471 + */ 472 + export type CompositionWithNestedAnyAndTypeNull = { 473 + propA?: Array<ModelWithDictionary | null> | Array<ModelWithArray | null>; 474 + }; 475 + 476 + export type _3eNum1Период = 'Bird' | 'Dog'; 477 + 478 + export type ConstValue = 'ConstValue'; 479 + 480 + /** 481 + * This is a model with one property with a 'any of' relationship where the options are not $ref 482 + */ 483 + export type CompositionWithNestedAnyOfAndNull = { 484 + /** 485 + * Scopes 486 + */ 487 + propA?: Array<_3eNum1Период | ConstValue> | null; 488 + }; 489 + 490 + /** 491 + * This is a model with one property with a 'one of' relationship 492 + */ 493 + export type CompositionWithOneOfAndNullable = { 494 + propA?: { 495 + boolean?: boolean; 496 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 497 + }; 498 + 499 + /** 500 + * This is a model that contains a simple dictionary within composition 501 + */ 502 + export type CompositionWithOneOfAndSimpleDictionary = { 503 + propA?: boolean | { 504 + [key: string]: number; 505 + }; 506 + }; 507 + 508 + /** 509 + * This is a model that contains a dictionary of simple arrays within composition 510 + */ 511 + export type CompositionWithOneOfAndSimpleArrayDictionary = { 512 + propA?: boolean | { 513 + [key: string]: Array<boolean>; 514 + }; 515 + }; 516 + 517 + /** 518 + * This is a model that contains a dictionary of complex arrays (composited) within composition 519 + */ 520 + export type CompositionWithOneOfAndComplexArrayDictionary = { 521 + propA?: boolean | { 522 + [key: string]: Array<number | string>; 523 + }; 524 + }; 525 + 526 + /** 527 + * This is a model with one property with a 'all of' relationship 528 + */ 529 + export type CompositionWithAllOfAndNullable = { 530 + propA?: ({ 531 + boolean?: boolean; 532 + } & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null; 533 + }; 534 + 535 + /** 536 + * This is a model with one property with a 'any of' relationship 537 + */ 538 + export type CompositionWithAnyOfAndNullable = { 539 + propA?: { 540 + boolean?: boolean; 541 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 542 + }; 543 + 544 + /** 545 + * This is a base model with two simple optional properties 546 + */ 547 + export type CompositionBaseModel = { 548 + firstName?: string; 549 + lastname?: string; 550 + }; 551 + 552 + /** 553 + * This is a model that extends the base model 554 + */ 555 + export type CompositionExtendedModel = CompositionBaseModel & { 556 + age: number; 557 + firstName: string; 558 + lastname: string; 559 + }; 560 + 561 + /** 562 + * This is a model with one nested property 563 + */ 564 + export type ModelWithProperties = { 565 + required: string; 566 + readonly requiredAndReadOnly: string; 567 + requiredAndNullable: string | null; 568 + string?: string; 569 + number?: number; 570 + boolean?: boolean; 571 + reference?: ModelWithString; 572 + 'property with space'?: string; 573 + default?: string; 574 + try?: string; 575 + readonly '@namespace.string'?: string; 576 + readonly '@namespace.integer'?: number; 577 + }; 578 + 579 + /** 580 + * This is a model with one nested property 581 + */ 582 + export type ModelWithNestedProperties = { 583 + readonly first: { 584 + readonly second: { 585 + readonly third: string | null; 586 + } | null; 587 + } | null; 588 + }; 589 + 590 + /** 591 + * This is a model with duplicated properties 592 + */ 593 + export type ModelWithDuplicateProperties = { 594 + prop?: ModelWithString; 595 + }; 596 + 597 + /** 598 + * This is a model with ordered properties 599 + */ 600 + export type ModelWithOrderedProperties = { 601 + zebra?: string; 602 + apple?: string; 603 + hawaii?: string; 604 + }; 605 + 606 + /** 607 + * This is a model with duplicated imports 608 + */ 609 + export type ModelWithDuplicateImports = { 610 + propA?: ModelWithString; 611 + propB?: ModelWithString; 612 + propC?: ModelWithString; 613 + }; 614 + 615 + /** 616 + * This is a model that extends another model 617 + */ 618 + export type ModelThatExtends = ModelWithString & { 619 + propExtendsA?: string; 620 + propExtendsB?: ModelWithString; 621 + }; 622 + 623 + /** 624 + * This is a model that extends another model 625 + */ 626 + export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { 627 + propExtendsC?: string; 628 + propExtendsD?: ModelWithString; 629 + }; 630 + 631 + /** 632 + * This is a model that contains a some patterns 633 + */ 634 + export type ModelWithPattern = { 635 + key: string; 636 + name: string; 637 + readonly enabled?: boolean; 638 + readonly modified?: string; 639 + id?: string; 640 + text?: string; 641 + patternWithSingleQuotes?: string; 642 + patternWithNewline?: string; 643 + patternWithBacktick?: string; 644 + }; 645 + 646 + export type File = { 647 + /** 648 + * Id 649 + */ 650 + readonly id?: string; 651 + /** 652 + * Updated at 653 + */ 654 + readonly updated_at?: string; 655 + /** 656 + * Created at 657 + */ 658 + readonly created_at?: string; 659 + /** 660 + * Mime 661 + */ 662 + mime: string; 663 + /** 664 + * File 665 + */ 666 + readonly file?: string; 667 + }; 668 + 669 + export type Default = { 670 + name?: string; 671 + }; 672 + 673 + export type Pageable = { 674 + page?: number; 675 + size?: number; 676 + sort?: Array<string>; 677 + }; 678 + 679 + /** 680 + * This is a free-form object without additionalProperties. 681 + */ 682 + export type FreeFormObjectWithoutAdditionalProperties = { 683 + [key: string]: unknown; 684 + }; 685 + 686 + /** 687 + * This is a free-form object with additionalProperties: true. 688 + */ 689 + export type FreeFormObjectWithAdditionalPropertiesEqTrue = { 690 + [key: string]: unknown; 691 + }; 692 + 693 + /** 694 + * This is a free-form object with additionalProperties: {}. 695 + */ 696 + export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { 697 + [key: string]: unknown; 698 + }; 699 + 700 + export type ModelWithConst = { 701 + String?: 'String'; 702 + number?: 0; 703 + null?: null; 704 + withType?: 'Some string'; 705 + }; 706 + 707 + /** 708 + * This is a model with one property and additionalProperties: true 709 + */ 710 + export type ModelWithAdditionalPropertiesEqTrue = { 711 + /** 712 + * This is a simple string property 713 + */ 714 + prop?: string; 715 + [key: string]: unknown | string | undefined; 716 + }; 717 + 718 + export type NestedAnyOfArraysNullable = { 719 + nullableArray?: Array<string | boolean> | null; 720 + }; 721 + 722 + export type CompositionWithOneOfAndProperties = ({ 723 + foo: SimpleParameter; 724 + } | { 725 + bar: NonAsciiStringæøåÆøÅöôêÊ字符串; 726 + }) & { 727 + baz: number | null; 728 + qux: number; 729 + }; 730 + 731 + /** 732 + * An object that can be null 733 + */ 734 + export type NullableObject = { 735 + foo?: string; 736 + } | null; 737 + 738 + /** 739 + * Some % character 740 + */ 741 + export type CharactersInDescription = string; 742 + 743 + export type ModelWithNullableObject = { 744 + data?: NullableObject; 745 + }; 746 + 747 + export type ModelWithOneOfEnum = { 748 + foo: 'Bar'; 749 + } | { 750 + foo: 'Baz'; 751 + } | { 752 + foo: 'Qux'; 753 + } | { 754 + content: string; 755 + foo: 'Quux'; 756 + } | { 757 + content: [ 758 + string, 759 + string 760 + ]; 761 + foo: 'Corge'; 762 + }; 763 + 764 + export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; 765 + 766 + export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; 767 + 768 + export type ModelWithNestedArrayEnumsData = { 769 + foo?: Array<ModelWithNestedArrayEnumsDataFoo>; 770 + bar?: Array<ModelWithNestedArrayEnumsDataBar>; 771 + }; 772 + 773 + export type ModelWithNestedArrayEnums = { 774 + array_strings?: Array<string>; 775 + data?: ModelWithNestedArrayEnumsData; 776 + }; 777 + 778 + export type ModelWithNestedCompositionEnums = { 779 + foo?: ModelWithNestedArrayEnumsDataFoo; 780 + }; 781 + 782 + export type ModelWithReadOnlyAndWriteOnly = { 783 + foo: string; 784 + readonly bar: string; 785 + }; 786 + 787 + export type ModelWithConstantSizeArray = [ 788 + number, 789 + number 790 + ]; 791 + 792 + export type ModelWithAnyOfConstantSizeArray = [ 793 + number | string, 794 + number | string, 795 + number | string 796 + ]; 797 + 798 + export type ModelWithPrefixItemsConstantSizeArray = [ 799 + ModelWithInteger, 800 + number | string, 801 + string 802 + ]; 803 + 804 + export type ModelWithAnyOfConstantSizeArrayNullable = [ 805 + number | null | string, 806 + number | null | string, 807 + number | null | string 808 + ]; 809 + 810 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ 811 + number | Import, 812 + number | Import 813 + ]; 814 + 815 + export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ 816 + number & string, 817 + number & string 818 + ]; 819 + 820 + export type ModelWithNumericEnumUnion = { 821 + /** 822 + * Период 823 + */ 824 + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; 825 + }; 826 + 827 + /** 828 + * Some description with `back ticks` 829 + */ 830 + export type ModelWithBackticksInDescription = { 831 + /** 832 + * The template `that` should be used for parsing and importing the contents of the CSV file. 833 + * 834 + * <br/><p>There is one placeholder currently supported:<ul> <li><b>${x}</b> - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)</li></ul><p>Example of a correct JSON template:</p> 835 + * <pre> 836 + * [ 837 + * { 838 + * "resourceType": "Asset", 839 + * "identifier": { 840 + * "name": "${1}", 841 + * "domain": { 842 + * "name": "${2}", 843 + * "community": { 844 + * "name": "Some Community" 845 + * } 846 + * } 847 + * }, 848 + * "attributes" : { 849 + * "00000000-0000-0000-0000-000000003115" : [ { 850 + * "value" : "${3}" 851 + * } ], 852 + * "00000000-0000-0000-0000-000000000222" : [ { 853 + * "value" : "${4}" 854 + * } ] 855 + * } 856 + * } 857 + * ] 858 + * </pre> 859 + */ 860 + template?: string; 861 + }; 862 + 863 + export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & { 864 + baz: number | null; 865 + qux: number; 866 + }; 867 + 868 + /** 869 + * Model used to test deduplication strategy (unused) 870 + */ 871 + export type ParameterSimpleParameterUnused = string; 872 + 873 + /** 874 + * Model used to test deduplication strategy 875 + */ 876 + export type PostServiceWithEmptyTagResponse = string; 877 + 878 + /** 879 + * Model used to test deduplication strategy 880 + */ 881 + export type PostServiceWithEmptyTagResponse2 = string; 882 + 883 + /** 884 + * Model used to test deduplication strategy 885 + */ 886 + export type DeleteFooData = string; 887 + 888 + /** 889 + * Model used to test deduplication strategy 890 + */ 891 + export type DeleteFooData2 = string; 892 + 893 + /** 894 + * Model with restricted keyword name 895 + */ 896 + export type Import = string; 897 + 898 + export type SchemaWithFormRestrictedKeys = { 899 + description?: string; 900 + 'x-enum-descriptions'?: string; 901 + 'x-enum-varnames'?: string; 902 + 'x-enumNames'?: string; 903 + title?: string; 904 + object?: { 905 + description?: string; 906 + 'x-enum-descriptions'?: string; 907 + 'x-enum-varnames'?: string; 908 + 'x-enumNames'?: string; 909 + title?: string; 910 + }; 911 + array?: Array<{ 912 + description?: string; 913 + 'x-enum-descriptions'?: string; 914 + 'x-enum-varnames'?: string; 915 + 'x-enumNames'?: string; 916 + title?: string; 917 + }>; 918 + }; 919 + 920 + /** 921 + * This schema was giving PascalCase transformations a hard time 922 + */ 923 + export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = { 924 + /** 925 + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. 926 + */ 927 + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; 928 + }; 929 + 930 + /** 931 + * This schema was giving PascalCase transformations a hard time 932 + */ 933 + export type IoK8sApimachineryPkgApisMetaV1Preconditions = { 934 + /** 935 + * Specifies the target ResourceVersion 936 + */ 937 + resourceVersion?: string; 938 + /** 939 + * Specifies the target UID. 940 + */ 941 + uid?: string; 942 + }; 943 + 944 + export type AdditionalPropertiesUnknownIssue = { 945 + [key: string]: string | number; 946 + }; 947 + 948 + export type AdditionalPropertiesUnknownIssue2 = { 949 + [key: string]: string | number; 950 + }; 951 + 952 + export type AdditionalPropertiesUnknownIssue3 = string & { 953 + entries: { 954 + [key: string]: AdditionalPropertiesUnknownIssue; 955 + }; 956 + }; 957 + 958 + export type AdditionalPropertiesIntegerIssue = { 959 + value: number; 960 + [key: string]: number; 961 + }; 962 + 963 + export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 964 + 965 + export type GenericSchemaDuplicateIssue1SystemBoolean = { 966 + item?: boolean; 967 + error?: string | null; 968 + readonly hasError?: boolean; 969 + data?: { 970 + [key: string]: never; 971 + }; 972 + }; 973 + 974 + export type GenericSchemaDuplicateIssue1SystemString = { 975 + item?: string | null; 976 + error?: string | null; 977 + readonly hasError?: boolean; 978 + }; 979 + 980 + export type ExternalSharedExternalSharedModel = { 981 + id: string; 982 + name?: string; 983 + }; 984 + 985 + /** 986 + * This is a model with one property containing a reference 987 + */ 988 + export type ModelWithReferenceWritable = { 989 + prop?: ModelWithPropertiesWritable; 990 + }; 991 + 992 + /** 993 + * This is a model with one property containing an array 994 + */ 995 + export type ModelWithArrayReadOnlyAndWriteOnlyWritable = { 996 + prop?: Array<ModelWithReadOnlyAndWriteOnlyWritable>; 997 + propWithFile?: Array<Blob | File>; 998 + propWithNumber?: Array<number>; 999 + }; 1000 + 1001 + /** 1002 + * This is a model with one nested property 1003 + */ 1004 + export type ModelWithPropertiesWritable = { 1005 + required: string; 1006 + requiredAndNullable: string | null; 1007 + string?: string; 1008 + number?: number; 1009 + boolean?: boolean; 1010 + reference?: ModelWithString; 1011 + 'property with space'?: string; 1012 + default?: string; 1013 + try?: string; 1014 + }; 1015 + 1016 + /** 1017 + * This is a model that contains a some patterns 1018 + */ 1019 + export type ModelWithPatternWritable = { 1020 + key: string; 1021 + name: string; 1022 + id?: string; 1023 + text?: string; 1024 + patternWithSingleQuotes?: string; 1025 + patternWithNewline?: string; 1026 + patternWithBacktick?: string; 1027 + }; 1028 + 1029 + export type FileWritable = { 1030 + /** 1031 + * Mime 1032 + */ 1033 + mime: string; 1034 + }; 1035 + 1036 + export type ModelWithReadOnlyAndWriteOnlyWritable = { 1037 + foo: string; 1038 + baz: string; 1039 + }; 1040 + 1041 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = [ 1042 + number | Import, 1043 + number | Import 1044 + ]; 1045 + 1046 + export type AdditionalPropertiesUnknownIssueWritable = { 1047 + [key: string]: string | number; 1048 + }; 1049 + 1050 + export type OneOfAllOfIssueWritable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 1051 + 1052 + export type GenericSchemaDuplicateIssue1SystemBooleanWritable = { 1053 + item?: boolean; 1054 + error?: string | null; 1055 + data?: { 1056 + [key: string]: never; 1057 + }; 1058 + }; 1059 + 1060 + export type GenericSchemaDuplicateIssue1SystemStringWritable = { 1061 + item?: string | null; 1062 + error?: string | null; 1063 + }; 1064 + 1065 + /** 1066 + * This is a reusable parameter 1067 + */ 1068 + export type SimpleParameter = string; 1069 + 1070 + /** 1071 + * Parameter with illegal characters 1072 + */ 1073 + export type XFooBar = ModelWithString; 1074 + 1075 + /** 1076 + * A reusable request body 1077 + */ 1078 + export type SimpleRequestBody = ModelWithString; 1079 + 1080 + /** 1081 + * A reusable request body 1082 + */ 1083 + export type SimpleFormData = ModelWithString; 1084 + 1085 + export type ExportData = { 1086 + body?: never; 1087 + path?: never; 1088 + query?: never; 1089 + url: '/api/v{api-version}/no+tag'; 1090 + }; 1091 + 1092 + export type PatchApiVbyApiVersionNoTagData = { 1093 + body?: never; 1094 + path?: never; 1095 + query?: never; 1096 + url: '/api/v{api-version}/no+tag'; 1097 + }; 1098 + 1099 + export type PatchApiVbyApiVersionNoTagResponses = { 1100 + /** 1101 + * OK 1102 + */ 1103 + default: unknown; 1104 + }; 1105 + 1106 + export type ImportData = { 1107 + body: ModelWithReadOnlyAndWriteOnlyWritable | ModelWithArrayReadOnlyAndWriteOnlyWritable; 1108 + path?: never; 1109 + query?: never; 1110 + url: '/api/v{api-version}/no+tag'; 1111 + }; 1112 + 1113 + export type ImportResponses = { 1114 + /** 1115 + * Success 1116 + */ 1117 + 200: ModelFromZendesk; 1118 + /** 1119 + * Default success response 1120 + */ 1121 + default: ModelWithReadOnlyAndWriteOnly; 1122 + }; 1123 + 1124 + export type ImportResponse = ImportResponses[keyof ImportResponses]; 1125 + 1126 + export type FooWowData = { 1127 + body?: never; 1128 + path?: never; 1129 + query?: never; 1130 + url: '/api/v{api-version}/no+tag'; 1131 + }; 1132 + 1133 + export type FooWowResponses = { 1134 + /** 1135 + * OK 1136 + */ 1137 + default: unknown; 1138 + }; 1139 + 1140 + export type ApiVVersionODataControllerCountData = { 1141 + body?: never; 1142 + path?: never; 1143 + query?: never; 1144 + url: '/api/v{api-version}/simple/$count'; 1145 + }; 1146 + 1147 + export type ApiVVersionODataControllerCountResponses = { 1148 + /** 1149 + * Success 1150 + */ 1151 + 200: ModelFromZendesk; 1152 + }; 1153 + 1154 + export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; 1155 + 1156 + export type GetApiVbyApiVersionSimpleOperationData = { 1157 + body?: never; 1158 + path: { 1159 + /** 1160 + * foo in method 1161 + */ 1162 + foo_param: string; 1163 + }; 1164 + query?: never; 1165 + url: '/api/v{api-version}/simple:operation'; 1166 + }; 1167 + 1168 + export type GetApiVbyApiVersionSimpleOperationErrors = { 1169 + /** 1170 + * Default error response 1171 + */ 1172 + default: ModelWithBoolean; 1173 + }; 1174 + 1175 + export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; 1176 + 1177 + export type GetApiVbyApiVersionSimpleOperationResponses = { 1178 + /** 1179 + * Response is a simple number 1180 + */ 1181 + 200: number; 1182 + }; 1183 + 1184 + export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; 1185 + 1186 + export type DeleteCallWithoutParametersAndResponseData = { 1187 + body?: never; 1188 + path?: never; 1189 + query?: never; 1190 + url: '/api/v{api-version}/simple'; 1191 + }; 1192 + 1193 + export type GetCallWithoutParametersAndResponseData = { 1194 + body?: never; 1195 + path?: never; 1196 + query?: never; 1197 + url: '/api/v{api-version}/simple'; 1198 + }; 1199 + 1200 + export type HeadCallWithoutParametersAndResponseData = { 1201 + body?: never; 1202 + path?: never; 1203 + query?: never; 1204 + url: '/api/v{api-version}/simple'; 1205 + }; 1206 + 1207 + export type OptionsCallWithoutParametersAndResponseData = { 1208 + body?: never; 1209 + path?: never; 1210 + query?: never; 1211 + url: '/api/v{api-version}/simple'; 1212 + }; 1213 + 1214 + export type PatchCallWithoutParametersAndResponseData = { 1215 + body?: never; 1216 + path?: never; 1217 + query?: never; 1218 + url: '/api/v{api-version}/simple'; 1219 + }; 1220 + 1221 + export type PostCallWithoutParametersAndResponseData = { 1222 + body?: never; 1223 + path?: never; 1224 + query?: never; 1225 + url: '/api/v{api-version}/simple'; 1226 + }; 1227 + 1228 + export type PutCallWithoutParametersAndResponseData = { 1229 + body?: never; 1230 + path?: never; 1231 + query?: never; 1232 + url: '/api/v{api-version}/simple'; 1233 + }; 1234 + 1235 + export type DeleteFooData3 = { 1236 + body?: never; 1237 + headers: { 1238 + /** 1239 + * Parameter with illegal characters 1240 + */ 1241 + 'x-Foo-Bar': ModelWithString; 1242 + }; 1243 + path: { 1244 + /** 1245 + * foo in method 1246 + */ 1247 + foo_param: string; 1248 + /** 1249 + * bar in method 1250 + */ 1251 + BarParam: string; 1252 + }; 1253 + query?: never; 1254 + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; 1255 + }; 1256 + 1257 + export type CallWithDescriptionsData = { 1258 + body?: never; 1259 + path?: never; 1260 + query?: { 1261 + /** 1262 + * Testing multiline comments in string: First line 1263 + * Second line 1264 + * 1265 + * Fourth line 1266 + */ 1267 + parameterWithBreaks?: string; 1268 + /** 1269 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1270 + */ 1271 + parameterWithBackticks?: string; 1272 + /** 1273 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1274 + */ 1275 + parameterWithSlashes?: string; 1276 + /** 1277 + * Testing expression placeholders in string: ${expression} should work 1278 + */ 1279 + parameterWithExpressionPlaceholders?: string; 1280 + /** 1281 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1282 + */ 1283 + parameterWithQuotes?: string; 1284 + /** 1285 + * Testing reserved characters in string: * inline * and ** inline ** should work 1286 + */ 1287 + parameterWithReservedCharacters?: string; 1288 + }; 1289 + url: '/api/v{api-version}/descriptions'; 1290 + }; 1291 + 1292 + export type DeprecatedCallData = { 1293 + body?: never; 1294 + headers: { 1295 + /** 1296 + * This parameter is deprecated 1297 + * 1298 + * @deprecated 1299 + */ 1300 + parameter: DeprecatedModel | null; 1301 + }; 1302 + path?: never; 1303 + query?: never; 1304 + url: '/api/v{api-version}/parameters/deprecated'; 1305 + }; 1306 + 1307 + export type CallWithParametersData = { 1308 + /** 1309 + * This is the parameter that goes into the body 1310 + */ 1311 + body: { 1312 + [key: string]: unknown; 1313 + } | null; 1314 + headers: { 1315 + /** 1316 + * This is the parameter that goes into the header 1317 + */ 1318 + parameterHeader: string | null; 1319 + }; 1320 + path: { 1321 + /** 1322 + * This is the parameter that goes into the path 1323 + */ 1324 + parameterPath: string | null; 1325 + /** 1326 + * api-version should be required in standalone clients 1327 + */ 1328 + 'api-version': string | null; 1329 + }; 1330 + query: { 1331 + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; 1332 + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; 1333 + /** 1334 + * This is the parameter that goes into the query params 1335 + */ 1336 + cursor: string | null; 1337 + }; 1338 + url: '/api/v{api-version}/parameters/{parameterPath}'; 1339 + }; 1340 + 1341 + export type CallWithWeirdParameterNamesData = { 1342 + /** 1343 + * This is the parameter that goes into the body 1344 + */ 1345 + body: ModelWithString | null; 1346 + headers: { 1347 + /** 1348 + * This is the parameter that goes into the request header 1349 + */ 1350 + 'parameter.header': string | null; 1351 + }; 1352 + path: { 1353 + /** 1354 + * This is the parameter that goes into the path 1355 + */ 1356 + 'parameter.path.1'?: string; 1357 + /** 1358 + * This is the parameter that goes into the path 1359 + */ 1360 + 'parameter-path-2'?: string; 1361 + /** 1362 + * This is the parameter that goes into the path 1363 + */ 1364 + 'PARAMETER-PATH-3'?: string; 1365 + /** 1366 + * api-version should be required in standalone clients 1367 + */ 1368 + 'api-version': string | null; 1369 + }; 1370 + query: { 1371 + /** 1372 + * This is the parameter with a reserved keyword 1373 + */ 1374 + default?: string; 1375 + /** 1376 + * This is the parameter that goes into the request query params 1377 + */ 1378 + 'parameter-query': string | null; 1379 + }; 1380 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; 1381 + }; 1382 + 1383 + export type GetCallWithOptionalParamData = { 1384 + /** 1385 + * This is a required parameter 1386 + */ 1387 + body: ModelWithOneOfEnum; 1388 + path?: never; 1389 + query?: { 1390 + /** 1391 + * This is an optional parameter 1392 + */ 1393 + page?: number; 1394 + }; 1395 + url: '/api/v{api-version}/parameters'; 1396 + }; 1397 + 1398 + export type PostCallWithOptionalParamData = { 1399 + /** 1400 + * This is an optional parameter 1401 + */ 1402 + body?: { 1403 + offset?: number | null; 1404 + }; 1405 + path?: never; 1406 + query: { 1407 + /** 1408 + * This is a required parameter 1409 + */ 1410 + parameter: Pageable; 1411 + }; 1412 + url: '/api/v{api-version}/parameters'; 1413 + }; 1414 + 1415 + export type PostCallWithOptionalParamResponses = { 1416 + /** 1417 + * Response is a simple number 1418 + */ 1419 + 200: number; 1420 + /** 1421 + * Success 1422 + */ 1423 + 204: void; 1424 + }; 1425 + 1426 + export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; 1427 + 1428 + export type PostApiVbyApiVersionRequestBodyData = { 1429 + /** 1430 + * A reusable request body 1431 + */ 1432 + body?: SimpleRequestBody; 1433 + path?: never; 1434 + query?: { 1435 + /** 1436 + * This is a reusable parameter 1437 + */ 1438 + parameter?: string; 1439 + }; 1440 + url: '/api/v{api-version}/requestBody'; 1441 + }; 1442 + 1443 + export type PostApiVbyApiVersionFormDataData = { 1444 + /** 1445 + * A reusable request body 1446 + */ 1447 + body?: SimpleFormData; 1448 + path?: never; 1449 + query?: { 1450 + /** 1451 + * This is a reusable parameter 1452 + */ 1453 + parameter?: string; 1454 + }; 1455 + url: '/api/v{api-version}/formData'; 1456 + }; 1457 + 1458 + export type CallWithDefaultParametersData = { 1459 + body?: never; 1460 + path?: never; 1461 + query?: { 1462 + /** 1463 + * This is a simple string with default value 1464 + */ 1465 + parameterString?: string | null; 1466 + /** 1467 + * This is a simple number with default value 1468 + */ 1469 + parameterNumber?: number | null; 1470 + /** 1471 + * This is a simple boolean with default value 1472 + */ 1473 + parameterBoolean?: boolean | null; 1474 + /** 1475 + * This is a simple enum with default value 1476 + */ 1477 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1478 + /** 1479 + * This is a simple model with default value 1480 + */ 1481 + parameterModel?: ModelWithString | null; 1482 + }; 1483 + url: '/api/v{api-version}/defaults'; 1484 + }; 1485 + 1486 + export type CallWithDefaultOptionalParametersData = { 1487 + body?: never; 1488 + path?: never; 1489 + query?: { 1490 + /** 1491 + * This is a simple string that is optional with default value 1492 + */ 1493 + parameterString?: string; 1494 + /** 1495 + * This is a simple number that is optional with default value 1496 + */ 1497 + parameterNumber?: number; 1498 + /** 1499 + * This is a simple boolean that is optional with default value 1500 + */ 1501 + parameterBoolean?: boolean; 1502 + /** 1503 + * This is a simple enum that is optional with default value 1504 + */ 1505 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1506 + /** 1507 + * This is a simple model that is optional with default value 1508 + */ 1509 + parameterModel?: ModelWithString; 1510 + }; 1511 + url: '/api/v{api-version}/defaults'; 1512 + }; 1513 + 1514 + export type CallToTestOrderOfParamsData = { 1515 + body?: never; 1516 + path?: never; 1517 + query: { 1518 + /** 1519 + * This is a optional string with default 1520 + */ 1521 + parameterOptionalStringWithDefault?: string; 1522 + /** 1523 + * This is a optional string with empty default 1524 + */ 1525 + parameterOptionalStringWithEmptyDefault?: string; 1526 + /** 1527 + * This is a optional string with no default 1528 + */ 1529 + parameterOptionalStringWithNoDefault?: string; 1530 + /** 1531 + * This is a string with default 1532 + */ 1533 + parameterStringWithDefault: string; 1534 + /** 1535 + * This is a string with empty default 1536 + */ 1537 + parameterStringWithEmptyDefault: string; 1538 + /** 1539 + * This is a string with no default 1540 + */ 1541 + parameterStringWithNoDefault: string; 1542 + /** 1543 + * This is a string that can be null with no default 1544 + */ 1545 + parameterStringNullableWithNoDefault?: string | null; 1546 + /** 1547 + * This is a string that can be null with default 1548 + */ 1549 + parameterStringNullableWithDefault?: string | null; 1550 + }; 1551 + url: '/api/v{api-version}/defaults'; 1552 + }; 1553 + 1554 + export type DuplicateNameData = { 1555 + body?: never; 1556 + path?: never; 1557 + query?: never; 1558 + url: '/api/v{api-version}/duplicate'; 1559 + }; 1560 + 1561 + export type DuplicateName2Data = { 1562 + body?: never; 1563 + path?: never; 1564 + query?: never; 1565 + url: '/api/v{api-version}/duplicate'; 1566 + }; 1567 + 1568 + export type DuplicateName3Data = { 1569 + body?: never; 1570 + path?: never; 1571 + query?: never; 1572 + url: '/api/v{api-version}/duplicate'; 1573 + }; 1574 + 1575 + export type DuplicateName4Data = { 1576 + body?: never; 1577 + path?: never; 1578 + query?: never; 1579 + url: '/api/v{api-version}/duplicate'; 1580 + }; 1581 + 1582 + export type CallWithNoContentResponseData = { 1583 + body?: never; 1584 + path?: never; 1585 + query?: never; 1586 + url: '/api/v{api-version}/no-content'; 1587 + }; 1588 + 1589 + export type CallWithNoContentResponseResponses = { 1590 + /** 1591 + * Success 1592 + */ 1593 + 204: void; 1594 + }; 1595 + 1596 + export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; 1597 + 1598 + export type CallWithResponseAndNoContentResponseData = { 1599 + body?: never; 1600 + path?: never; 1601 + query?: never; 1602 + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; 1603 + }; 1604 + 1605 + export type CallWithResponseAndNoContentResponseResponses = { 1606 + /** 1607 + * Response is a simple number 1608 + */ 1609 + 200: number; 1610 + /** 1611 + * Success 1612 + */ 1613 + 204: void; 1614 + }; 1615 + 1616 + export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; 1617 + 1618 + export type DummyAData = { 1619 + body?: never; 1620 + path?: never; 1621 + query?: never; 1622 + url: '/api/v{api-version}/multiple-tags/a'; 1623 + }; 1624 + 1625 + export type DummyAResponses = { 1626 + 200: _400; 1627 + }; 1628 + 1629 + export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; 1630 + 1631 + export type DummyBData = { 1632 + body?: never; 1633 + path?: never; 1634 + query?: never; 1635 + url: '/api/v{api-version}/multiple-tags/b'; 1636 + }; 1637 + 1638 + export type DummyBResponses = { 1639 + /** 1640 + * Success 1641 + */ 1642 + 204: void; 1643 + }; 1644 + 1645 + export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; 1646 + 1647 + export type CallWithResponseData = { 1648 + body?: never; 1649 + path?: never; 1650 + query?: never; 1651 + url: '/api/v{api-version}/response'; 1652 + }; 1653 + 1654 + export type CallWithResponseResponses = { 1655 + default: Import; 1656 + }; 1657 + 1658 + export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; 1659 + 1660 + export type CallWithDuplicateResponsesData = { 1661 + body?: never; 1662 + path?: never; 1663 + query?: never; 1664 + url: '/api/v{api-version}/response'; 1665 + }; 1666 + 1667 + export type CallWithDuplicateResponsesErrors = { 1668 + /** 1669 + * Message for 500 error 1670 + */ 1671 + 500: ModelWithStringError; 1672 + /** 1673 + * Message for 501 error 1674 + */ 1675 + 501: ModelWithStringError; 1676 + /** 1677 + * Message for 502 error 1678 + */ 1679 + 502: ModelWithStringError; 1680 + /** 1681 + * Message for 4XX errors 1682 + */ 1683 + '4XX': DictionaryWithArray; 1684 + /** 1685 + * Default error response 1686 + */ 1687 + default: ModelWithBoolean; 1688 + }; 1689 + 1690 + export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; 1691 + 1692 + export type CallWithDuplicateResponsesResponses = { 1693 + /** 1694 + * Message for 200 response 1695 + */ 1696 + 200: ModelWithBoolean & ModelWithInteger; 1697 + /** 1698 + * Message for 201 response 1699 + */ 1700 + 201: ModelWithString; 1701 + /** 1702 + * Message for 202 response 1703 + */ 1704 + 202: ModelWithString; 1705 + }; 1706 + 1707 + export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; 1708 + 1709 + export type CallWithResponsesData = { 1710 + body?: never; 1711 + path?: never; 1712 + query?: never; 1713 + url: '/api/v{api-version}/response'; 1714 + }; 1715 + 1716 + export type CallWithResponsesErrors = { 1717 + /** 1718 + * Message for 500 error 1719 + */ 1720 + 500: ModelWithStringError; 1721 + /** 1722 + * Message for 501 error 1723 + */ 1724 + 501: ModelWithStringError; 1725 + /** 1726 + * Message for 502 error 1727 + */ 1728 + 502: ModelWithStringError; 1729 + /** 1730 + * Message for default response 1731 + */ 1732 + default: ModelWithStringError; 1733 + }; 1734 + 1735 + export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; 1736 + 1737 + export type CallWithResponsesResponses = { 1738 + /** 1739 + * Message for 200 response 1740 + */ 1741 + 200: { 1742 + readonly '@namespace.string'?: string; 1743 + readonly '@namespace.integer'?: number; 1744 + readonly value?: Array<ModelWithString>; 1745 + }; 1746 + /** 1747 + * Message for 201 response 1748 + */ 1749 + 201: ModelThatExtends; 1750 + /** 1751 + * Message for 202 response 1752 + */ 1753 + 202: ModelThatExtendsExtends; 1754 + }; 1755 + 1756 + export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; 1757 + 1758 + export type CollectionFormatData = { 1759 + body?: never; 1760 + path?: never; 1761 + query: { 1762 + /** 1763 + * This is an array parameter that is sent as csv format (comma-separated values) 1764 + */ 1765 + parameterArrayCSV: Array<string> | null; 1766 + /** 1767 + * This is an array parameter that is sent as ssv format (space-separated values) 1768 + */ 1769 + parameterArraySSV: Array<string> | null; 1770 + /** 1771 + * This is an array parameter that is sent as tsv format (tab-separated values) 1772 + */ 1773 + parameterArrayTSV: Array<string> | null; 1774 + /** 1775 + * This is an array parameter that is sent as pipes format (pipe-separated values) 1776 + */ 1777 + parameterArrayPipes: Array<string> | null; 1778 + /** 1779 + * This is an array parameter that is sent as multi format (multiple parameter instances) 1780 + */ 1781 + parameterArrayMulti: Array<string> | null; 1782 + }; 1783 + url: '/api/v{api-version}/collectionFormat'; 1784 + }; 1785 + 1786 + export type TypesData = { 1787 + body?: never; 1788 + path?: { 1789 + /** 1790 + * This is a number parameter 1791 + */ 1792 + id?: number; 1793 + }; 1794 + query: { 1795 + /** 1796 + * This is a number parameter 1797 + */ 1798 + parameterNumber: number; 1799 + /** 1800 + * This is a string parameter 1801 + */ 1802 + parameterString: string | null; 1803 + /** 1804 + * This is a boolean parameter 1805 + */ 1806 + parameterBoolean: boolean | null; 1807 + /** 1808 + * This is an object parameter 1809 + */ 1810 + parameterObject: { 1811 + [key: string]: unknown; 1812 + } | null; 1813 + /** 1814 + * This is an array parameter 1815 + */ 1816 + parameterArray: Array<string> | null; 1817 + /** 1818 + * This is a dictionary parameter 1819 + */ 1820 + parameterDictionary: { 1821 + [key: string]: unknown; 1822 + } | null; 1823 + /** 1824 + * This is an enum parameter 1825 + */ 1826 + parameterEnum: 'Success' | 'Warning' | 'Error' | null; 1827 + }; 1828 + url: '/api/v{api-version}/types'; 1829 + }; 1830 + 1831 + export type TypesResponses = { 1832 + /** 1833 + * Response is a simple number 1834 + */ 1835 + 200: number; 1836 + /** 1837 + * Response is a simple string 1838 + */ 1839 + 201: string; 1840 + /** 1841 + * Response is a simple boolean 1842 + */ 1843 + 202: boolean; 1844 + /** 1845 + * Response is a simple object 1846 + */ 1847 + 203: { 1848 + [key: string]: unknown; 1849 + }; 1850 + }; 1851 + 1852 + export type TypesResponse = TypesResponses[keyof TypesResponses]; 1853 + 1854 + export type UploadFileData = { 1855 + body: Blob | File; 1856 + path: { 1857 + /** 1858 + * api-version should be required in standalone clients 1859 + */ 1860 + 'api-version': string | null; 1861 + }; 1862 + query?: never; 1863 + url: '/api/v{api-version}/upload'; 1864 + }; 1865 + 1866 + export type UploadFileResponses = { 1867 + 200: boolean; 1868 + }; 1869 + 1870 + export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; 1871 + 1872 + export type FileResponseData = { 1873 + body?: never; 1874 + path: { 1875 + id: string; 1876 + /** 1877 + * api-version should be required in standalone clients 1878 + */ 1879 + 'api-version': string; 1880 + }; 1881 + query?: never; 1882 + url: '/api/v{api-version}/file/{id}'; 1883 + }; 1884 + 1885 + export type FileResponseResponses = { 1886 + /** 1887 + * Success 1888 + */ 1889 + 200: Blob | File; 1890 + }; 1891 + 1892 + export type FileResponseResponse = FileResponseResponses[keyof FileResponseResponses]; 1893 + 1894 + export type ComplexTypesData = { 1895 + body?: never; 1896 + path?: never; 1897 + query: { 1898 + /** 1899 + * Parameter containing object 1900 + */ 1901 + parameterObject: { 1902 + first?: { 1903 + second?: { 1904 + third?: string; 1905 + }; 1906 + }; 1907 + }; 1908 + /** 1909 + * Parameter containing reference 1910 + */ 1911 + parameterReference: ModelWithString; 1912 + }; 1913 + url: '/api/v{api-version}/complex'; 1914 + }; 1915 + 1916 + export type ComplexTypesErrors = { 1917 + /** 1918 + * 400 `server` error 1919 + */ 1920 + 400: unknown; 1921 + /** 1922 + * 500 server error 1923 + */ 1924 + 500: unknown; 1925 + }; 1926 + 1927 + export type ComplexTypesResponses = { 1928 + /** 1929 + * Successful response 1930 + */ 1931 + 200: Array<ModelWithString>; 1932 + }; 1933 + 1934 + export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; 1935 + 1936 + export type MultipartResponseData = { 1937 + body?: never; 1938 + path?: never; 1939 + query?: never; 1940 + url: '/api/v{api-version}/multipart'; 1941 + }; 1942 + 1943 + export type MultipartResponseResponses = { 1944 + /** 1945 + * OK 1946 + */ 1947 + 200: { 1948 + file?: Blob | File; 1949 + metadata?: { 1950 + foo?: string; 1951 + bar?: string; 1952 + }; 1953 + }; 1954 + }; 1955 + 1956 + export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; 1957 + 1958 + export type MultipartRequestData = { 1959 + body?: { 1960 + content?: Blob | File; 1961 + data?: ModelWithString | null; 1962 + }; 1963 + path?: never; 1964 + query?: never; 1965 + url: '/api/v{api-version}/multipart'; 1966 + }; 1967 + 1968 + export type ComplexParamsData = { 1969 + body?: { 1970 + readonly key: string | null; 1971 + name: string | null; 1972 + enabled?: boolean; 1973 + type: 'Monkey' | 'Horse' | 'Bird'; 1974 + listOfModels?: Array<ModelWithString> | null; 1975 + listOfStrings?: Array<string> | null; 1976 + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 1977 + readonly user?: { 1978 + readonly id?: number; 1979 + readonly name?: string | null; 1980 + }; 1981 + }; 1982 + path: { 1983 + id: number; 1984 + /** 1985 + * api-version should be required in standalone clients 1986 + */ 1987 + 'api-version': string; 1988 + }; 1989 + query?: never; 1990 + url: '/api/v{api-version}/complex/{id}'; 1991 + }; 1992 + 1993 + export type ComplexParamsResponses = { 1994 + /** 1995 + * Success 1996 + */ 1997 + 200: ModelWithString; 1998 + }; 1999 + 2000 + export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; 2001 + 2002 + export type CallWithResultFromHeaderData = { 2003 + body?: never; 2004 + path?: never; 2005 + query?: never; 2006 + url: '/api/v{api-version}/header'; 2007 + }; 2008 + 2009 + export type CallWithResultFromHeaderErrors = { 2010 + /** 2011 + * 400 server error 2012 + */ 2013 + 400: unknown; 2014 + /** 2015 + * 500 server error 2016 + */ 2017 + 500: unknown; 2018 + }; 2019 + 2020 + export type CallWithResultFromHeaderResponses = { 2021 + /** 2022 + * Successful response 2023 + */ 2024 + 200: unknown; 2025 + }; 2026 + 2027 + export type TestErrorCodeData = { 2028 + body?: never; 2029 + path?: never; 2030 + query: { 2031 + /** 2032 + * Status code to return 2033 + */ 2034 + status: number; 2035 + }; 2036 + url: '/api/v{api-version}/error'; 2037 + }; 2038 + 2039 + export type TestErrorCodeErrors = { 2040 + /** 2041 + * Custom message: Internal Server Error 2042 + */ 2043 + 500: unknown; 2044 + /** 2045 + * Custom message: Not Implemented 2046 + */ 2047 + 501: unknown; 2048 + /** 2049 + * Custom message: Bad Gateway 2050 + */ 2051 + 502: unknown; 2052 + /** 2053 + * Custom message: Service Unavailable 2054 + */ 2055 + 503: unknown; 2056 + }; 2057 + 2058 + export type TestErrorCodeResponses = { 2059 + /** 2060 + * Custom message: Successful response 2061 + */ 2062 + 200: unknown; 2063 + }; 2064 + 2065 + export type NonAsciiæøåÆøÅöôêÊ字符串Data = { 2066 + body?: never; 2067 + path?: never; 2068 + query: { 2069 + /** 2070 + * Dummy input param 2071 + */ 2072 + nonAsciiParamæøåÆØÅöôêÊ: number; 2073 + }; 2074 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2075 + }; 2076 + 2077 + export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { 2078 + /** 2079 + * Successful response 2080 + */ 2081 + 200: Array<NonAsciiStringæøåÆøÅöôêÊ字符串>; 2082 + }; 2083 + 2084 + export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; 2085 + 2086 + export type PutWithFormUrlEncodedData = { 2087 + body: ArrayWithStrings; 2088 + path?: never; 2089 + query?: never; 2090 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2091 + };
+16
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { type ClientOptions, type Config, createClient, createConfig } from './client/index.js'; 4 + import type { ClientOptions as ClientOptions2 } from './types.gen.js'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 15 + 16 + export const client = createClient(createConfig<ClientOptions2>({ baseUrl: 'http://localhost:3000/base' }));
+301
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/client/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { createSseClient } from '../core/serverSentEvents.gen.js'; 4 + import type { HttpMethod } from '../core/types.gen.js'; 5 + import { getValidRequestBody } from '../core/utils.gen.js'; 6 + import type { 7 + Client, 8 + Config, 9 + RequestOptions, 10 + ResolvedRequestOptions, 11 + } from './types.gen.js'; 12 + import { 13 + buildUrl, 14 + createConfig, 15 + createInterceptors, 16 + getParseAs, 17 + mergeConfigs, 18 + mergeHeaders, 19 + setAuthParams, 20 + } from './utils.gen.js'; 21 + 22 + type ReqInit = Omit<RequestInit, 'body' | 'headers'> & { 23 + body?: any; 24 + headers: ReturnType<typeof mergeHeaders>; 25 + }; 26 + 27 + export const createClient = (config: Config = {}): Client => { 28 + let _config = mergeConfigs(createConfig(), config); 29 + 30 + const getConfig = (): Config => ({ ..._config }); 31 + 32 + const setConfig = (config: Config): Config => { 33 + _config = mergeConfigs(_config, config); 34 + return getConfig(); 35 + }; 36 + 37 + const interceptors = createInterceptors< 38 + Request, 39 + Response, 40 + unknown, 41 + ResolvedRequestOptions 42 + >(); 43 + 44 + const beforeRequest = async (options: RequestOptions) => { 45 + const opts = { 46 + ..._config, 47 + ...options, 48 + fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, 49 + headers: mergeHeaders(_config.headers, options.headers), 50 + serializedBody: undefined, 51 + }; 52 + 53 + if (opts.security) { 54 + await setAuthParams({ 55 + ...opts, 56 + security: opts.security, 57 + }); 58 + } 59 + 60 + if (opts.requestValidator) { 61 + await opts.requestValidator(opts); 62 + } 63 + 64 + if (opts.body !== undefined && opts.bodySerializer) { 65 + opts.serializedBody = opts.bodySerializer(opts.body); 66 + } 67 + 68 + // remove Content-Type header if body is empty to avoid sending invalid requests 69 + if (opts.body === undefined || opts.serializedBody === '') { 70 + opts.headers.delete('Content-Type'); 71 + } 72 + 73 + const url = buildUrl(opts); 74 + 75 + return { opts, url }; 76 + }; 77 + 78 + const request: Client['request'] = async (options) => { 79 + // @ts-expect-error 80 + const { opts, url } = await beforeRequest(options); 81 + const requestInit: ReqInit = { 82 + redirect: 'follow', 83 + ...opts, 84 + body: getValidRequestBody(opts), 85 + }; 86 + 87 + let request = new Request(url, requestInit); 88 + 89 + for (const fn of interceptors.request.fns) { 90 + if (fn) { 91 + request = await fn(request, opts); 92 + } 93 + } 94 + 95 + // fetch must be assigned here, otherwise it would throw the error: 96 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 + const _fetch = opts.fetch!; 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 132 + 133 + for (const fn of interceptors.response.fns) { 134 + if (fn) { 135 + response = await fn(response, request, opts); 136 + } 137 + } 138 + 139 + const result = { 140 + request, 141 + response, 142 + }; 143 + 144 + if (response.ok) { 145 + const parseAs = 146 + (opts.parseAs === 'auto' 147 + ? getParseAs(response.headers.get('Content-Type')) 148 + : opts.parseAs) ?? 'json'; 149 + 150 + if ( 151 + response.status === 204 || 152 + response.headers.get('Content-Length') === '0' 153 + ) { 154 + let emptyData: any; 155 + switch (parseAs) { 156 + case 'arrayBuffer': 157 + case 'blob': 158 + case 'text': 159 + emptyData = await response[parseAs](); 160 + break; 161 + case 'formData': 162 + emptyData = new FormData(); 163 + break; 164 + case 'stream': 165 + emptyData = response.body; 166 + break; 167 + case 'json': 168 + default: 169 + emptyData = {}; 170 + break; 171 + } 172 + return opts.responseStyle === 'data' 173 + ? emptyData 174 + : { 175 + data: emptyData, 176 + ...result, 177 + }; 178 + } 179 + 180 + let data: any; 181 + switch (parseAs) { 182 + case 'arrayBuffer': 183 + case 'blob': 184 + case 'formData': 185 + case 'json': 186 + case 'text': 187 + data = await response[parseAs](); 188 + break; 189 + case 'stream': 190 + return opts.responseStyle === 'data' 191 + ? response.body 192 + : { 193 + data: response.body, 194 + ...result, 195 + }; 196 + } 197 + 198 + if (parseAs === 'json') { 199 + if (opts.responseValidator) { 200 + await opts.responseValidator(data); 201 + } 202 + 203 + if (opts.responseTransformer) { 204 + data = await opts.responseTransformer(data); 205 + } 206 + } 207 + 208 + return opts.responseStyle === 'data' 209 + ? data 210 + : { 211 + data, 212 + ...result, 213 + }; 214 + } 215 + 216 + const textError = await response.text(); 217 + let jsonError: unknown; 218 + 219 + try { 220 + jsonError = JSON.parse(textError); 221 + } catch { 222 + // noop 223 + } 224 + 225 + const error = jsonError ?? textError; 226 + let finalError = error; 227 + 228 + for (const fn of interceptors.error.fns) { 229 + if (fn) { 230 + finalError = (await fn(error, response, request, opts)) as string; 231 + } 232 + } 233 + 234 + finalError = finalError || ({} as string); 235 + 236 + if (opts.throwOnError) { 237 + throw finalError; 238 + } 239 + 240 + // TODO: we probably want to return error and improve types 241 + return opts.responseStyle === 'data' 242 + ? undefined 243 + : { 244 + error: finalError, 245 + ...result, 246 + }; 247 + }; 248 + 249 + const makeMethodFn = 250 + (method: Uppercase<HttpMethod>) => (options: RequestOptions) => 251 + request({ ...options, method }); 252 + 253 + const makeSseFn = 254 + (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => { 255 + const { opts, url } = await beforeRequest(options); 256 + return createSseClient({ 257 + ...opts, 258 + body: opts.body as BodyInit | null | undefined, 259 + headers: opts.headers as unknown as Record<string, string>, 260 + method, 261 + onRequest: async (url, init) => { 262 + let request = new Request(url, init); 263 + for (const fn of interceptors.request.fns) { 264 + if (fn) { 265 + request = await fn(request, opts); 266 + } 267 + } 268 + return request; 269 + }, 270 + url, 271 + }); 272 + }; 273 + 274 + return { 275 + buildUrl, 276 + connect: makeMethodFn('CONNECT'), 277 + delete: makeMethodFn('DELETE'), 278 + get: makeMethodFn('GET'), 279 + getConfig, 280 + head: makeMethodFn('HEAD'), 281 + interceptors, 282 + options: makeMethodFn('OPTIONS'), 283 + patch: makeMethodFn('PATCH'), 284 + post: makeMethodFn('POST'), 285 + put: makeMethodFn('PUT'), 286 + request, 287 + setConfig, 288 + sse: { 289 + connect: makeSseFn('CONNECT'), 290 + delete: makeSseFn('DELETE'), 291 + get: makeSseFn('GET'), 292 + head: makeSseFn('HEAD'), 293 + options: makeSseFn('OPTIONS'), 294 + patch: makeSseFn('PATCH'), 295 + post: makeSseFn('POST'), 296 + put: makeSseFn('PUT'), 297 + trace: makeSseFn('TRACE'), 298 + }, 299 + trace: makeMethodFn('TRACE'), 300 + } as Client; 301 + };
+25
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/client/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type { Auth } from '../core/auth.gen.js'; 4 + export type { QuerySerializerOptions } from '../core/bodySerializer.gen.js'; 5 + export { 6 + formDataBodySerializer, 7 + jsonBodySerializer, 8 + urlSearchParamsBodySerializer, 9 + } from '../core/bodySerializer.gen.js'; 10 + export { buildClientParams } from '../core/params.gen.js'; 11 + export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen.js'; 12 + export { createClient } from './client.gen.js'; 13 + export type { 14 + Client, 15 + ClientOptions, 16 + Config, 17 + CreateClientConfig, 18 + Options, 19 + RequestOptions, 20 + RequestResult, 21 + ResolvedRequestOptions, 22 + ResponseStyle, 23 + TDataShape, 24 + } from './types.gen.js'; 25 + export { createConfig, mergeHeaders } from './utils.gen.js';
+241
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/client/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth } from '../core/auth.gen.js'; 4 + import type { 5 + ServerSentEventsOptions, 6 + ServerSentEventsResult, 7 + } from '../core/serverSentEvents.gen.js'; 8 + import type { 9 + Client as CoreClient, 10 + Config as CoreConfig, 11 + } from '../core/types.gen.js'; 12 + import type { Middleware } from './utils.gen.js'; 13 + 14 + export type ResponseStyle = 'data' | 'fields'; 15 + 16 + export interface Config<T extends ClientOptions = ClientOptions> 17 + extends Omit<RequestInit, 'body' | 'headers' | 'method'>, 18 + CoreConfig { 19 + /** 20 + * Base URL for all requests made by this client. 21 + */ 22 + baseUrl?: T['baseUrl']; 23 + /** 24 + * Fetch API implementation. You can use this option to provide a custom 25 + * fetch instance. 26 + * 27 + * @default globalThis.fetch 28 + */ 29 + fetch?: typeof fetch; 30 + /** 31 + * Please don't use the Fetch client for Next.js applications. The `next` 32 + * options won't have any effect. 33 + * 34 + * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead. 35 + */ 36 + next?: never; 37 + /** 38 + * Return the response data parsed in a specified format. By default, `auto` 39 + * will infer the appropriate method from the `Content-Type` response header. 40 + * You can override this behavior with any of the {@link Body} methods. 41 + * Select `stream` if you don't want to parse response data at all. 42 + * 43 + * @default 'auto' 44 + */ 45 + parseAs?: 46 + | 'arrayBuffer' 47 + | 'auto' 48 + | 'blob' 49 + | 'formData' 50 + | 'json' 51 + | 'stream' 52 + | 'text'; 53 + /** 54 + * Should we return only data or multiple fields (data, error, response, etc.)? 55 + * 56 + * @default 'fields' 57 + */ 58 + responseStyle?: ResponseStyle; 59 + /** 60 + * Throw an error instead of returning it in the response? 61 + * 62 + * @default false 63 + */ 64 + throwOnError?: T['throwOnError']; 65 + } 66 + 67 + export interface RequestOptions< 68 + TData = unknown, 69 + TResponseStyle extends ResponseStyle = 'fields', 70 + ThrowOnError extends boolean = boolean, 71 + Url extends string = string, 72 + > extends Config<{ 73 + responseStyle: TResponseStyle; 74 + throwOnError: ThrowOnError; 75 + }>, 76 + Pick< 77 + ServerSentEventsOptions<TData>, 78 + | 'onSseError' 79 + | 'onSseEvent' 80 + | 'sseDefaultRetryDelay' 81 + | 'sseMaxRetryAttempts' 82 + | 'sseMaxRetryDelay' 83 + > { 84 + /** 85 + * Any body that you want to add to your request. 86 + * 87 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} 88 + */ 89 + body?: unknown; 90 + path?: Record<string, unknown>; 91 + query?: Record<string, unknown>; 92 + /** 93 + * Security mechanism(s) to use for the request. 94 + */ 95 + security?: ReadonlyArray<Auth>; 96 + url: Url; 97 + } 98 + 99 + export interface ResolvedRequestOptions< 100 + TResponseStyle extends ResponseStyle = 'fields', 101 + ThrowOnError extends boolean = boolean, 102 + Url extends string = string, 103 + > extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> { 104 + serializedBody?: string; 105 + } 106 + 107 + export type RequestResult< 108 + TData = unknown, 109 + TError = unknown, 110 + ThrowOnError extends boolean = boolean, 111 + TResponseStyle extends ResponseStyle = 'fields', 112 + > = ThrowOnError extends true 113 + ? Promise< 114 + TResponseStyle extends 'data' 115 + ? TData extends Record<string, unknown> 116 + ? TData[keyof TData] 117 + : TData 118 + : { 119 + data: TData extends Record<string, unknown> 120 + ? TData[keyof TData] 121 + : TData; 122 + request: Request; 123 + response: Response; 124 + } 125 + > 126 + : Promise< 127 + TResponseStyle extends 'data' 128 + ? 129 + | (TData extends Record<string, unknown> 130 + ? TData[keyof TData] 131 + : TData) 132 + | undefined 133 + : ( 134 + | { 135 + data: TData extends Record<string, unknown> 136 + ? TData[keyof TData] 137 + : TData; 138 + error: undefined; 139 + } 140 + | { 141 + data: undefined; 142 + error: TError extends Record<string, unknown> 143 + ? TError[keyof TError] 144 + : TError; 145 + } 146 + ) & { 147 + request: Request; 148 + response: Response; 149 + } 150 + >; 151 + 152 + export interface ClientOptions { 153 + baseUrl?: string; 154 + responseStyle?: ResponseStyle; 155 + throwOnError?: boolean; 156 + } 157 + 158 + type MethodFn = < 159 + TData = unknown, 160 + TError = unknown, 161 + ThrowOnError extends boolean = false, 162 + TResponseStyle extends ResponseStyle = 'fields', 163 + >( 164 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>, 165 + ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>; 166 + 167 + type SseFn = < 168 + TData = unknown, 169 + TError = unknown, 170 + ThrowOnError extends boolean = false, 171 + TResponseStyle extends ResponseStyle = 'fields', 172 + >( 173 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>, 174 + ) => Promise<ServerSentEventsResult<TData, TError>>; 175 + 176 + type RequestFn = < 177 + TData = unknown, 178 + TError = unknown, 179 + ThrowOnError extends boolean = false, 180 + TResponseStyle extends ResponseStyle = 'fields', 181 + >( 182 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & 183 + Pick< 184 + Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 185 + 'method' 186 + >, 187 + ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>; 188 + 189 + type BuildUrlFn = < 190 + TData extends { 191 + body?: unknown; 192 + path?: Record<string, unknown>; 193 + query?: Record<string, unknown>; 194 + url: string; 195 + }, 196 + >( 197 + options: TData & Options<TData>, 198 + ) => string; 199 + 200 + export type Client = CoreClient< 201 + RequestFn, 202 + Config, 203 + MethodFn, 204 + BuildUrlFn, 205 + SseFn 206 + > & { 207 + interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>; 208 + }; 209 + 210 + /** 211 + * The `createClientConfig()` function will be called on client initialization 212 + * and the returned object will become the client's initial configuration. 213 + * 214 + * You may want to initialize your client this way instead of calling 215 + * `setConfig()`. This is useful for example if you're using Next.js 216 + * to ensure your client always has the correct values. 217 + */ 218 + export type CreateClientConfig<T extends ClientOptions = ClientOptions> = ( 219 + override?: Config<ClientOptions & T>, 220 + ) => Config<Required<ClientOptions> & T>; 221 + 222 + export interface TDataShape { 223 + body?: unknown; 224 + headers?: unknown; 225 + path?: unknown; 226 + query?: unknown; 227 + url: string; 228 + } 229 + 230 + type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>; 231 + 232 + export type Options< 233 + TData extends TDataShape = TDataShape, 234 + ThrowOnError extends boolean = boolean, 235 + TResponse = unknown, 236 + TResponseStyle extends ResponseStyle = 'fields', 237 + > = OmitKeys< 238 + RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 239 + 'body' | 'path' | 'query' | 'url' 240 + > & 241 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
+332
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/client/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { getAuthToken } from '../core/auth.gen.js'; 4 + import type { QuerySerializerOptions } from '../core/bodySerializer.gen.js'; 5 + import { jsonBodySerializer } from '../core/bodySerializer.gen.js'; 6 + import { 7 + serializeArrayParam, 8 + serializeObjectParam, 9 + serializePrimitiveParam, 10 + } from '../core/pathSerializer.gen.js'; 11 + import { getUrl } from '../core/utils.gen.js'; 12 + import type { Client, ClientOptions, Config, RequestOptions } from './types.gen.js'; 13 + 14 + export const createQuerySerializer = <T = unknown>({ 15 + parameters = {}, 16 + ...args 17 + }: QuerySerializerOptions = {}) => { 18 + const querySerializer = (queryParams: T) => { 19 + const search: string[] = []; 20 + if (queryParams && typeof queryParams === 'object') { 21 + for (const name in queryParams) { 22 + const value = queryParams[name]; 23 + 24 + if (value === undefined || value === null) { 25 + continue; 26 + } 27 + 28 + const options = parameters[name] || args; 29 + 30 + if (Array.isArray(value)) { 31 + const serializedArray = serializeArrayParam({ 32 + allowReserved: options.allowReserved, 33 + explode: true, 34 + name, 35 + style: 'form', 36 + value, 37 + ...options.array, 38 + }); 39 + if (serializedArray) search.push(serializedArray); 40 + } else if (typeof value === 'object') { 41 + const serializedObject = serializeObjectParam({ 42 + allowReserved: options.allowReserved, 43 + explode: true, 44 + name, 45 + style: 'deepObject', 46 + value: value as Record<string, unknown>, 47 + ...options.object, 48 + }); 49 + if (serializedObject) search.push(serializedObject); 50 + } else { 51 + const serializedPrimitive = serializePrimitiveParam({ 52 + allowReserved: options.allowReserved, 53 + name, 54 + value: value as string, 55 + }); 56 + if (serializedPrimitive) search.push(serializedPrimitive); 57 + } 58 + } 59 + } 60 + return search.join('&'); 61 + }; 62 + return querySerializer; 63 + }; 64 + 65 + /** 66 + * Infers parseAs value from provided Content-Type header. 67 + */ 68 + export const getParseAs = ( 69 + contentType: string | null, 70 + ): Exclude<Config['parseAs'], 'auto'> => { 71 + if (!contentType) { 72 + // If no Content-Type header is provided, the best we can do is return the raw response body, 73 + // which is effectively the same as the 'stream' option. 74 + return 'stream'; 75 + } 76 + 77 + const cleanContent = contentType.split(';')[0]?.trim(); 78 + 79 + if (!cleanContent) { 80 + return; 81 + } 82 + 83 + if ( 84 + cleanContent.startsWith('application/json') || 85 + cleanContent.endsWith('+json') 86 + ) { 87 + return 'json'; 88 + } 89 + 90 + if (cleanContent === 'multipart/form-data') { 91 + return 'formData'; 92 + } 93 + 94 + if ( 95 + ['application/', 'audio/', 'image/', 'video/'].some((type) => 96 + cleanContent.startsWith(type), 97 + ) 98 + ) { 99 + return 'blob'; 100 + } 101 + 102 + if (cleanContent.startsWith('text/')) { 103 + return 'text'; 104 + } 105 + 106 + return; 107 + }; 108 + 109 + const checkForExistence = ( 110 + options: Pick<RequestOptions, 'auth' | 'query'> & { 111 + headers: Headers; 112 + }, 113 + name?: string, 114 + ): boolean => { 115 + if (!name) { 116 + return false; 117 + } 118 + if ( 119 + options.headers.has(name) || 120 + options.query?.[name] || 121 + options.headers.get('Cookie')?.includes(`${name}=`) 122 + ) { 123 + return true; 124 + } 125 + return false; 126 + }; 127 + 128 + export const setAuthParams = async ({ 129 + security, 130 + ...options 131 + }: Pick<Required<RequestOptions>, 'security'> & 132 + Pick<RequestOptions, 'auth' | 'query'> & { 133 + headers: Headers; 134 + }) => { 135 + for (const auth of security) { 136 + if (checkForExistence(options, auth.name)) { 137 + continue; 138 + } 139 + 140 + const token = await getAuthToken(auth, options.auth); 141 + 142 + if (!token) { 143 + continue; 144 + } 145 + 146 + const name = auth.name ?? 'Authorization'; 147 + 148 + switch (auth.in) { 149 + case 'query': 150 + if (!options.query) { 151 + options.query = {}; 152 + } 153 + options.query[name] = token; 154 + break; 155 + case 'cookie': 156 + options.headers.append('Cookie', `${name}=${token}`); 157 + break; 158 + case 'header': 159 + default: 160 + options.headers.set(name, token); 161 + break; 162 + } 163 + } 164 + }; 165 + 166 + export const buildUrl: Client['buildUrl'] = (options) => 167 + getUrl({ 168 + baseUrl: options.baseUrl as string, 169 + path: options.path, 170 + query: options.query, 171 + querySerializer: 172 + typeof options.querySerializer === 'function' 173 + ? options.querySerializer 174 + : createQuerySerializer(options.querySerializer), 175 + url: options.url, 176 + }); 177 + 178 + export const mergeConfigs = (a: Config, b: Config): Config => { 179 + const config = { ...a, ...b }; 180 + if (config.baseUrl?.endsWith('/')) { 181 + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); 182 + } 183 + config.headers = mergeHeaders(a.headers, b.headers); 184 + return config; 185 + }; 186 + 187 + const headersEntries = (headers: Headers): Array<[string, string]> => { 188 + const entries: Array<[string, string]> = []; 189 + headers.forEach((value, key) => { 190 + entries.push([key, value]); 191 + }); 192 + return entries; 193 + }; 194 + 195 + export const mergeHeaders = ( 196 + ...headers: Array<Required<Config>['headers'] | undefined> 197 + ): Headers => { 198 + const mergedHeaders = new Headers(); 199 + for (const header of headers) { 200 + if (!header) { 201 + continue; 202 + } 203 + 204 + const iterator = 205 + header instanceof Headers 206 + ? headersEntries(header) 207 + : Object.entries(header); 208 + 209 + for (const [key, value] of iterator) { 210 + if (value === null) { 211 + mergedHeaders.delete(key); 212 + } else if (Array.isArray(value)) { 213 + for (const v of value) { 214 + mergedHeaders.append(key, v as string); 215 + } 216 + } else if (value !== undefined) { 217 + // assume object headers are meant to be JSON stringified, i.e. their 218 + // content value in OpenAPI specification is 'application/json' 219 + mergedHeaders.set( 220 + key, 221 + typeof value === 'object' ? JSON.stringify(value) : (value as string), 222 + ); 223 + } 224 + } 225 + } 226 + return mergedHeaders; 227 + }; 228 + 229 + type ErrInterceptor<Err, Res, Req, Options> = ( 230 + error: Err, 231 + response: Res, 232 + request: Req, 233 + options: Options, 234 + ) => Err | Promise<Err>; 235 + 236 + type ReqInterceptor<Req, Options> = ( 237 + request: Req, 238 + options: Options, 239 + ) => Req | Promise<Req>; 240 + 241 + type ResInterceptor<Res, Req, Options> = ( 242 + response: Res, 243 + request: Req, 244 + options: Options, 245 + ) => Res | Promise<Res>; 246 + 247 + class Interceptors<Interceptor> { 248 + fns: Array<Interceptor | null> = []; 249 + 250 + clear(): void { 251 + this.fns = []; 252 + } 253 + 254 + eject(id: number | Interceptor): void { 255 + const index = this.getInterceptorIndex(id); 256 + if (this.fns[index]) { 257 + this.fns[index] = null; 258 + } 259 + } 260 + 261 + exists(id: number | Interceptor): boolean { 262 + const index = this.getInterceptorIndex(id); 263 + return Boolean(this.fns[index]); 264 + } 265 + 266 + getInterceptorIndex(id: number | Interceptor): number { 267 + if (typeof id === 'number') { 268 + return this.fns[id] ? id : -1; 269 + } 270 + return this.fns.indexOf(id); 271 + } 272 + 273 + update( 274 + id: number | Interceptor, 275 + fn: Interceptor, 276 + ): number | Interceptor | false { 277 + const index = this.getInterceptorIndex(id); 278 + if (this.fns[index]) { 279 + this.fns[index] = fn; 280 + return id; 281 + } 282 + return false; 283 + } 284 + 285 + use(fn: Interceptor): number { 286 + this.fns.push(fn); 287 + return this.fns.length - 1; 288 + } 289 + } 290 + 291 + export interface Middleware<Req, Res, Err, Options> { 292 + error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>; 293 + request: Interceptors<ReqInterceptor<Req, Options>>; 294 + response: Interceptors<ResInterceptor<Res, Req, Options>>; 295 + } 296 + 297 + export const createInterceptors = <Req, Res, Err, Options>(): Middleware< 298 + Req, 299 + Res, 300 + Err, 301 + Options 302 + > => ({ 303 + error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(), 304 + request: new Interceptors<ReqInterceptor<Req, Options>>(), 305 + response: new Interceptors<ResInterceptor<Res, Req, Options>>(), 306 + }); 307 + 308 + const defaultQuerySerializer = createQuerySerializer({ 309 + allowReserved: false, 310 + array: { 311 + explode: true, 312 + style: 'form', 313 + }, 314 + object: { 315 + explode: true, 316 + style: 'deepObject', 317 + }, 318 + }); 319 + 320 + const defaultHeaders = { 321 + 'Content-Type': 'application/json', 322 + }; 323 + 324 + export const createConfig = <T extends ClientOptions = ClientOptions>( 325 + override: Config<Omit<ClientOptions, keyof T> & T> = {}, 326 + ): Config<Omit<ClientOptions, keyof T> & T> => ({ 327 + ...jsonBodySerializer, 328 + headers: defaultHeaders, 329 + parseAs: 'auto', 330 + querySerializer: defaultQuerySerializer, 331 + ...override, 332 + });
+42
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/core/auth.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type AuthToken = string | undefined; 4 + 5 + export interface Auth { 6 + /** 7 + * Which part of the request do we use to send the auth? 8 + * 9 + * @default 'header' 10 + */ 11 + in?: 'header' | 'query' | 'cookie'; 12 + /** 13 + * Header or query parameter name. 14 + * 15 + * @default 'Authorization' 16 + */ 17 + name?: string; 18 + scheme?: 'basic' | 'bearer'; 19 + type: 'apiKey' | 'http'; 20 + } 21 + 22 + export const getAuthToken = async ( 23 + auth: Auth, 24 + callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken, 25 + ): Promise<string | undefined> => { 26 + const token = 27 + typeof callback === 'function' ? await callback(auth) : callback; 28 + 29 + if (!token) { 30 + return; 31 + } 32 + 33 + if (auth.scheme === 'bearer') { 34 + return `Bearer ${token}`; 35 + } 36 + 37 + if (auth.scheme === 'basic') { 38 + return `Basic ${btoa(token)}`; 39 + } 40 + 41 + return token; 42 + };
+100
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/core/bodySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { 4 + ArrayStyle, 5 + ObjectStyle, 6 + SerializerOptions, 7 + } from './pathSerializer.gen.js'; 8 + 9 + export type QuerySerializer = (query: Record<string, unknown>) => string; 10 + 11 + export type BodySerializer = (body: any) => any; 12 + 13 + type QuerySerializerOptionsObject = { 14 + allowReserved?: boolean; 15 + array?: Partial<SerializerOptions<ArrayStyle>>; 16 + object?: Partial<SerializerOptions<ObjectStyle>>; 17 + }; 18 + 19 + export type QuerySerializerOptions = QuerySerializerOptionsObject & { 20 + /** 21 + * Per-parameter serialization overrides. When provided, these settings 22 + * override the global array/object settings for specific parameter names. 23 + */ 24 + parameters?: Record<string, QuerySerializerOptionsObject>; 25 + }; 26 + 27 + const serializeFormDataPair = ( 28 + data: FormData, 29 + key: string, 30 + value: unknown, 31 + ): void => { 32 + if (typeof value === 'string' || value instanceof Blob) { 33 + data.append(key, value); 34 + } else if (value instanceof Date) { 35 + data.append(key, value.toISOString()); 36 + } else { 37 + data.append(key, JSON.stringify(value)); 38 + } 39 + }; 40 + 41 + const serializeUrlSearchParamsPair = ( 42 + data: URLSearchParams, 43 + key: string, 44 + value: unknown, 45 + ): void => { 46 + if (typeof value === 'string') { 47 + data.append(key, value); 48 + } else { 49 + data.append(key, JSON.stringify(value)); 50 + } 51 + }; 52 + 53 + export const formDataBodySerializer = { 54 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 55 + body: T, 56 + ): FormData => { 57 + const data = new FormData(); 58 + 59 + Object.entries(body).forEach(([key, value]) => { 60 + if (value === undefined || value === null) { 61 + return; 62 + } 63 + if (Array.isArray(value)) { 64 + value.forEach((v) => serializeFormDataPair(data, key, v)); 65 + } else { 66 + serializeFormDataPair(data, key, value); 67 + } 68 + }); 69 + 70 + return data; 71 + }, 72 + }; 73 + 74 + export const jsonBodySerializer = { 75 + bodySerializer: <T>(body: T): string => 76 + JSON.stringify(body, (_key, value) => 77 + typeof value === 'bigint' ? value.toString() : value, 78 + ), 79 + }; 80 + 81 + export const urlSearchParamsBodySerializer = { 82 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 83 + body: T, 84 + ): string => { 85 + const data = new URLSearchParams(); 86 + 87 + Object.entries(body).forEach(([key, value]) => { 88 + if (value === undefined || value === null) { 89 + return; 90 + } 91 + if (Array.isArray(value)) { 92 + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); 93 + } else { 94 + serializeUrlSearchParamsPair(data, key, value); 95 + } 96 + }); 97 + 98 + return data.toString(); 99 + }, 100 + };
+176
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/core/params.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + type Slot = 'body' | 'headers' | 'path' | 'query'; 4 + 5 + export type Field = 6 + | { 7 + in: Exclude<Slot, 'body'>; 8 + /** 9 + * Field name. This is the name we want the user to see and use. 10 + */ 11 + key: string; 12 + /** 13 + * Field mapped name. This is the name we want to use in the request. 14 + * If omitted, we use the same value as `key`. 15 + */ 16 + map?: string; 17 + } 18 + | { 19 + in: Extract<Slot, 'body'>; 20 + /** 21 + * Key isn't required for bodies. 22 + */ 23 + key?: string; 24 + map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 36 + }; 37 + 38 + export interface Fields { 39 + allowExtra?: Partial<Record<Slot, boolean>>; 40 + args?: ReadonlyArray<Field>; 41 + } 42 + 43 + export type FieldsConfig = ReadonlyArray<Field | Fields>; 44 + 45 + const extraPrefixesMap: Record<string, Slot> = { 46 + $body_: 'body', 47 + $headers_: 'headers', 48 + $path_: 'path', 49 + $query_: 'query', 50 + }; 51 + const extraPrefixes = Object.entries(extraPrefixesMap); 52 + 53 + type KeyMap = Map< 54 + string, 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 63 + >; 64 + 65 + const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { 66 + if (!map) { 67 + map = new Map(); 68 + } 69 + 70 + for (const config of fields) { 71 + if ('in' in config) { 72 + if (config.key) { 73 + map.set(config.key, { 74 + in: config.in, 75 + map: config.map, 76 + }); 77 + } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 82 + } else if (config.args) { 83 + buildKeyMap(config.args, map); 84 + } 85 + } 86 + 87 + return map; 88 + }; 89 + 90 + interface Params { 91 + body: unknown; 92 + headers: Record<string, unknown>; 93 + path: Record<string, unknown>; 94 + query: Record<string, unknown>; 95 + } 96 + 97 + const stripEmptySlots = (params: Params) => { 98 + for (const [slot, value] of Object.entries(params)) { 99 + if (value && typeof value === 'object' && !Object.keys(value).length) { 100 + delete params[slot as Slot]; 101 + } 102 + } 103 + }; 104 + 105 + export const buildClientParams = ( 106 + args: ReadonlyArray<unknown>, 107 + fields: FieldsConfig, 108 + ) => { 109 + const params: Params = { 110 + body: {}, 111 + headers: {}, 112 + path: {}, 113 + query: {}, 114 + }; 115 + 116 + const map = buildKeyMap(fields); 117 + 118 + let config: FieldsConfig[number] | undefined; 119 + 120 + for (const [index, arg] of args.entries()) { 121 + if (fields[index]) { 122 + config = fields[index]; 123 + } 124 + 125 + if (!config) { 126 + continue; 127 + } 128 + 129 + if ('in' in config) { 130 + if (config.key) { 131 + const field = map.get(config.key)!; 132 + const name = field.map || config.key; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 136 + } else { 137 + params.body = arg; 138 + } 139 + } else { 140 + for (const [key, value] of Object.entries(arg ?? {})) { 141 + const field = map.get(key); 142 + 143 + if (field) { 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 150 + } else { 151 + const extra = extraPrefixes.find(([prefix]) => 152 + key.startsWith(prefix), 153 + ); 154 + 155 + if (extra) { 156 + const [prefix, slot] = extra; 157 + (params[slot] as Record<string, unknown>)[ 158 + key.slice(prefix.length) 159 + ] = value; 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 162 + if (allowed) { 163 + (params[slot as Slot] as Record<string, unknown>)[key] = value; 164 + break; 165 + } 166 + } 167 + } 168 + } 169 + } 170 + } 171 + } 172 + 173 + stripEmptySlots(params); 174 + 175 + return params; 176 + };
+181
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/core/pathSerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + interface SerializeOptions<T> 4 + extends SerializePrimitiveOptions, 5 + SerializerOptions<T> {} 6 + 7 + interface SerializePrimitiveOptions { 8 + allowReserved?: boolean; 9 + name: string; 10 + } 11 + 12 + export interface SerializerOptions<T> { 13 + /** 14 + * @default true 15 + */ 16 + explode: boolean; 17 + style: T; 18 + } 19 + 20 + export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; 21 + export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; 22 + type MatrixStyle = 'label' | 'matrix' | 'simple'; 23 + export type ObjectStyle = 'form' | 'deepObject'; 24 + type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; 25 + 26 + interface SerializePrimitiveParam extends SerializePrimitiveOptions { 27 + value: string; 28 + } 29 + 30 + export const separatorArrayExplode = (style: ArraySeparatorStyle) => { 31 + switch (style) { 32 + case 'label': 33 + return '.'; 34 + case 'matrix': 35 + return ';'; 36 + case 'simple': 37 + return ','; 38 + default: 39 + return '&'; 40 + } 41 + }; 42 + 43 + export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { 44 + switch (style) { 45 + case 'form': 46 + return ','; 47 + case 'pipeDelimited': 48 + return '|'; 49 + case 'spaceDelimited': 50 + return '%20'; 51 + default: 52 + return ','; 53 + } 54 + }; 55 + 56 + export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { 57 + switch (style) { 58 + case 'label': 59 + return '.'; 60 + case 'matrix': 61 + return ';'; 62 + case 'simple': 63 + return ','; 64 + default: 65 + return '&'; 66 + } 67 + }; 68 + 69 + export const serializeArrayParam = ({ 70 + allowReserved, 71 + explode, 72 + name, 73 + style, 74 + value, 75 + }: SerializeOptions<ArraySeparatorStyle> & { 76 + value: unknown[]; 77 + }) => { 78 + if (!explode) { 79 + const joinedValues = ( 80 + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) 81 + ).join(separatorArrayNoExplode(style)); 82 + switch (style) { 83 + case 'label': 84 + return `.${joinedValues}`; 85 + case 'matrix': 86 + return `;${name}=${joinedValues}`; 87 + case 'simple': 88 + return joinedValues; 89 + default: 90 + return `${name}=${joinedValues}`; 91 + } 92 + } 93 + 94 + const separator = separatorArrayExplode(style); 95 + const joinedValues = value 96 + .map((v) => { 97 + if (style === 'label' || style === 'simple') { 98 + return allowReserved ? v : encodeURIComponent(v as string); 99 + } 100 + 101 + return serializePrimitiveParam({ 102 + allowReserved, 103 + name, 104 + value: v as string, 105 + }); 106 + }) 107 + .join(separator); 108 + return style === 'label' || style === 'matrix' 109 + ? separator + joinedValues 110 + : joinedValues; 111 + }; 112 + 113 + export const serializePrimitiveParam = ({ 114 + allowReserved, 115 + name, 116 + value, 117 + }: SerializePrimitiveParam) => { 118 + if (value === undefined || value === null) { 119 + return ''; 120 + } 121 + 122 + if (typeof value === 'object') { 123 + throw new Error( 124 + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', 125 + ); 126 + } 127 + 128 + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; 129 + }; 130 + 131 + export const serializeObjectParam = ({ 132 + allowReserved, 133 + explode, 134 + name, 135 + style, 136 + value, 137 + valueOnly, 138 + }: SerializeOptions<ObjectSeparatorStyle> & { 139 + value: Record<string, unknown> | Date; 140 + valueOnly?: boolean; 141 + }) => { 142 + if (value instanceof Date) { 143 + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; 144 + } 145 + 146 + if (style !== 'deepObject' && !explode) { 147 + let values: string[] = []; 148 + Object.entries(value).forEach(([key, v]) => { 149 + values = [ 150 + ...values, 151 + key, 152 + allowReserved ? (v as string) : encodeURIComponent(v as string), 153 + ]; 154 + }); 155 + const joinedValues = values.join(','); 156 + switch (style) { 157 + case 'form': 158 + return `${name}=${joinedValues}`; 159 + case 'label': 160 + return `.${joinedValues}`; 161 + case 'matrix': 162 + return `;${name}=${joinedValues}`; 163 + default: 164 + return joinedValues; 165 + } 166 + } 167 + 168 + const separator = separatorObjectExplode(style); 169 + const joinedValues = Object.entries(value) 170 + .map(([key, v]) => 171 + serializePrimitiveParam({ 172 + allowReserved, 173 + name: style === 'deepObject' ? `${name}[${key}]` : key, 174 + value: v as string, 175 + }), 176 + ) 177 + .join(separator); 178 + return style === 'label' || style === 'matrix' 179 + ? separator + joinedValues 180 + : joinedValues; 181 + };
+136
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/core/queryKeySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + /** 4 + * JSON-friendly union that mirrors what Pinia Colada can hash. 5 + */ 6 + export type JsonValue = 7 + | null 8 + | string 9 + | number 10 + | boolean 11 + | JsonValue[] 12 + | { [key: string]: JsonValue }; 13 + 14 + /** 15 + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. 16 + */ 17 + export const queryKeyJsonReplacer = (_key: string, value: unknown) => { 18 + if ( 19 + value === undefined || 20 + typeof value === 'function' || 21 + typeof value === 'symbol' 22 + ) { 23 + return undefined; 24 + } 25 + if (typeof value === 'bigint') { 26 + return value.toString(); 27 + } 28 + if (value instanceof Date) { 29 + return value.toISOString(); 30 + } 31 + return value; 32 + }; 33 + 34 + /** 35 + * Safely stringifies a value and parses it back into a JsonValue. 36 + */ 37 + export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { 38 + try { 39 + const json = JSON.stringify(input, queryKeyJsonReplacer); 40 + if (json === undefined) { 41 + return undefined; 42 + } 43 + return JSON.parse(json) as JsonValue; 44 + } catch { 45 + return undefined; 46 + } 47 + }; 48 + 49 + /** 50 + * Detects plain objects (including objects with a null prototype). 51 + */ 52 + const isPlainObject = (value: unknown): value is Record<string, unknown> => { 53 + if (value === null || typeof value !== 'object') { 54 + return false; 55 + } 56 + const prototype = Object.getPrototypeOf(value as object); 57 + return prototype === Object.prototype || prototype === null; 58 + }; 59 + 60 + /** 61 + * Turns URLSearchParams into a sorted JSON object for deterministic keys. 62 + */ 63 + const serializeSearchParams = (params: URLSearchParams): JsonValue => { 64 + const entries = Array.from(params.entries()).sort(([a], [b]) => 65 + a.localeCompare(b), 66 + ); 67 + const result: Record<string, JsonValue> = {}; 68 + 69 + for (const [key, value] of entries) { 70 + const existing = result[key]; 71 + if (existing === undefined) { 72 + result[key] = value; 73 + continue; 74 + } 75 + 76 + if (Array.isArray(existing)) { 77 + (existing as string[]).push(value); 78 + } else { 79 + result[key] = [existing, value]; 80 + } 81 + } 82 + 83 + return result; 84 + }; 85 + 86 + /** 87 + * Normalizes any accepted value into a JSON-friendly shape for query keys. 88 + */ 89 + export const serializeQueryKeyValue = ( 90 + value: unknown, 91 + ): JsonValue | undefined => { 92 + if (value === null) { 93 + return null; 94 + } 95 + 96 + if ( 97 + typeof value === 'string' || 98 + typeof value === 'number' || 99 + typeof value === 'boolean' 100 + ) { 101 + return value; 102 + } 103 + 104 + if ( 105 + value === undefined || 106 + typeof value === 'function' || 107 + typeof value === 'symbol' 108 + ) { 109 + return undefined; 110 + } 111 + 112 + if (typeof value === 'bigint') { 113 + return value.toString(); 114 + } 115 + 116 + if (value instanceof Date) { 117 + return value.toISOString(); 118 + } 119 + 120 + if (Array.isArray(value)) { 121 + return stringifyToJsonValue(value); 122 + } 123 + 124 + if ( 125 + typeof URLSearchParams !== 'undefined' && 126 + value instanceof URLSearchParams 127 + ) { 128 + return serializeSearchParams(value); 129 + } 130 + 131 + if (isPlainObject(value)) { 132 + return stringifyToJsonValue(value); 133 + } 134 + 135 + return undefined; 136 + };
+266
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/core/serverSentEvents.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Config } from './types.gen.js'; 4 + 5 + export type ServerSentEventsOptions<TData = unknown> = Omit< 6 + RequestInit, 7 + 'method' 8 + > & 9 + Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & { 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 + * Implementing clients can call request interceptors inside this hook. 19 + */ 20 + onRequest?: (url: string, init: RequestInit) => Promise<Request>; 21 + /** 22 + * Callback invoked when a network or parsing error occurs during streaming. 23 + * 24 + * This option applies only if the endpoint returns a stream of events. 25 + * 26 + * @param error The error that occurred. 27 + */ 28 + onSseError?: (error: unknown) => void; 29 + /** 30 + * Callback invoked when an event is streamed from the server. 31 + * 32 + * This option applies only if the endpoint returns a stream of events. 33 + * 34 + * @param event Event streamed from the server. 35 + * @returns Nothing (void). 36 + */ 37 + onSseEvent?: (event: StreamEvent<TData>) => void; 38 + serializedBody?: RequestInit['body']; 39 + /** 40 + * Default retry delay in milliseconds. 41 + * 42 + * This option applies only if the endpoint returns a stream of events. 43 + * 44 + * @default 3000 45 + */ 46 + sseDefaultRetryDelay?: number; 47 + /** 48 + * Maximum number of retry attempts before giving up. 49 + */ 50 + sseMaxRetryAttempts?: number; 51 + /** 52 + * Maximum retry delay in milliseconds. 53 + * 54 + * Applies only when exponential backoff is used. 55 + * 56 + * This option applies only if the endpoint returns a stream of events. 57 + * 58 + * @default 30000 59 + */ 60 + sseMaxRetryDelay?: number; 61 + /** 62 + * Optional sleep function for retry backoff. 63 + * 64 + * Defaults to using `setTimeout`. 65 + */ 66 + sseSleepFn?: (ms: number) => Promise<void>; 67 + url: string; 68 + }; 69 + 70 + export interface StreamEvent<TData = unknown> { 71 + data: TData; 72 + event?: string; 73 + id?: string; 74 + retry?: number; 75 + } 76 + 77 + export type ServerSentEventsResult< 78 + TData = unknown, 79 + TReturn = void, 80 + TNext = unknown, 81 + > = { 82 + stream: AsyncGenerator< 83 + TData extends Record<string, unknown> ? TData[keyof TData] : TData, 84 + TReturn, 85 + TNext 86 + >; 87 + }; 88 + 89 + export const createSseClient = <TData = unknown>({ 90 + onRequest, 91 + onSseError, 92 + onSseEvent, 93 + responseTransformer, 94 + responseValidator, 95 + sseDefaultRetryDelay, 96 + sseMaxRetryAttempts, 97 + sseMaxRetryDelay, 98 + sseSleepFn, 99 + url, 100 + ...options 101 + }: ServerSentEventsOptions): ServerSentEventsResult<TData> => { 102 + let lastEventId: string | undefined; 103 + 104 + const sleep = 105 + sseSleepFn ?? 106 + ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); 107 + 108 + const createStream = async function* () { 109 + let retryDelay: number = sseDefaultRetryDelay ?? 3000; 110 + let attempt = 0; 111 + const signal = options.signal ?? new AbortController().signal; 112 + 113 + while (true) { 114 + if (signal.aborted) break; 115 + 116 + attempt++; 117 + 118 + const headers = 119 + options.headers instanceof Headers 120 + ? options.headers 121 + : new Headers(options.headers as Record<string, string> | undefined); 122 + 123 + if (lastEventId !== undefined) { 124 + headers.set('Last-Event-ID', lastEventId); 125 + } 126 + 127 + try { 128 + const requestInit: RequestInit = { 129 + redirect: 'follow', 130 + ...options, 131 + body: options.serializedBody, 132 + headers, 133 + signal, 134 + }; 135 + let request = new Request(url, requestInit); 136 + if (onRequest) { 137 + request = await onRequest(url, requestInit); 138 + } 139 + // fetch must be assigned here, otherwise it would throw the error: 140 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 141 + const _fetch = options.fetch ?? globalThis.fetch; 142 + const response = await _fetch(request); 143 + 144 + if (!response.ok) 145 + throw new Error( 146 + `SSE failed: ${response.status} ${response.statusText}`, 147 + ); 148 + 149 + if (!response.body) throw new Error('No body in SSE response'); 150 + 151 + const reader = response.body 152 + .pipeThrough(new TextDecoderStream()) 153 + .getReader(); 154 + 155 + let buffer = ''; 156 + 157 + const abortHandler = () => { 158 + try { 159 + reader.cancel(); 160 + } catch { 161 + // noop 162 + } 163 + }; 164 + 165 + signal.addEventListener('abort', abortHandler); 166 + 167 + try { 168 + while (true) { 169 + const { done, value } = await reader.read(); 170 + if (done) break; 171 + buffer += value; 172 + // Normalize line endings: CRLF -> LF, then CR -> LF 173 + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); 174 + 175 + const chunks = buffer.split('\n\n'); 176 + buffer = chunks.pop() ?? ''; 177 + 178 + for (const chunk of chunks) { 179 + const lines = chunk.split('\n'); 180 + const dataLines: Array<string> = []; 181 + let eventName: string | undefined; 182 + 183 + for (const line of lines) { 184 + if (line.startsWith('data:')) { 185 + dataLines.push(line.replace(/^data:\s*/, '')); 186 + } else if (line.startsWith('event:')) { 187 + eventName = line.replace(/^event:\s*/, ''); 188 + } else if (line.startsWith('id:')) { 189 + lastEventId = line.replace(/^id:\s*/, ''); 190 + } else if (line.startsWith('retry:')) { 191 + const parsed = Number.parseInt( 192 + line.replace(/^retry:\s*/, ''), 193 + 10, 194 + ); 195 + if (!Number.isNaN(parsed)) { 196 + retryDelay = parsed; 197 + } 198 + } 199 + } 200 + 201 + let data: unknown; 202 + let parsedJson = false; 203 + 204 + if (dataLines.length) { 205 + const rawData = dataLines.join('\n'); 206 + try { 207 + data = JSON.parse(rawData); 208 + parsedJson = true; 209 + } catch { 210 + data = rawData; 211 + } 212 + } 213 + 214 + if (parsedJson) { 215 + if (responseValidator) { 216 + await responseValidator(data); 217 + } 218 + 219 + if (responseTransformer) { 220 + data = await responseTransformer(data); 221 + } 222 + } 223 + 224 + onSseEvent?.({ 225 + data, 226 + event: eventName, 227 + id: lastEventId, 228 + retry: retryDelay, 229 + }); 230 + 231 + if (dataLines.length) { 232 + yield data as any; 233 + } 234 + } 235 + } 236 + } finally { 237 + signal.removeEventListener('abort', abortHandler); 238 + reader.releaseLock(); 239 + } 240 + 241 + break; // exit loop on normal completion 242 + } catch (error) { 243 + // connection failed or aborted; retry after delay 244 + onSseError?.(error); 245 + 246 + if ( 247 + sseMaxRetryAttempts !== undefined && 248 + attempt >= sseMaxRetryAttempts 249 + ) { 250 + break; // stop after firing error 251 + } 252 + 253 + // exponential backoff: double retry each attempt, cap at 30s 254 + const backoff = Math.min( 255 + retryDelay * 2 ** (attempt - 1), 256 + sseMaxRetryDelay ?? 30000, 257 + ); 258 + await sleep(backoff); 259 + } 260 + } 261 + }; 262 + 263 + const stream = createStream(); 264 + 265 + return { stream }; 266 + };
+118
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/core/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth, AuthToken } from './auth.gen.js'; 4 + import type { 5 + BodySerializer, 6 + QuerySerializer, 7 + QuerySerializerOptions, 8 + } from './bodySerializer.gen.js'; 9 + 10 + export type HttpMethod = 11 + | 'connect' 12 + | 'delete' 13 + | 'get' 14 + | 'head' 15 + | 'options' 16 + | 'patch' 17 + | 'post' 18 + | 'put' 19 + | 'trace'; 20 + 21 + export type Client< 22 + RequestFn = never, 23 + Config = unknown, 24 + MethodFn = never, 25 + BuildUrlFn = never, 26 + SseFn = never, 27 + > = { 28 + /** 29 + * Returns the final request URL. 30 + */ 31 + buildUrl: BuildUrlFn; 32 + getConfig: () => Config; 33 + request: RequestFn; 34 + setConfig: (config: Config) => Config; 35 + } & { 36 + [K in HttpMethod]: MethodFn; 37 + } & ([SseFn] extends [never] 38 + ? { sse?: never } 39 + : { sse: { [K in HttpMethod]: SseFn } }); 40 + 41 + export interface Config { 42 + /** 43 + * Auth token or a function returning auth token. The resolved value will be 44 + * added to the request payload as defined by its `security` array. 45 + */ 46 + auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken; 47 + /** 48 + * A function for serializing request body parameter. By default, 49 + * {@link JSON.stringify()} will be used. 50 + */ 51 + bodySerializer?: BodySerializer | null; 52 + /** 53 + * An object containing any HTTP headers that you want to pre-populate your 54 + * `Headers` object with. 55 + * 56 + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} 57 + */ 58 + headers?: 59 + | RequestInit['headers'] 60 + | Record< 61 + string, 62 + | string 63 + | number 64 + | boolean 65 + | (string | number | boolean)[] 66 + | null 67 + | undefined 68 + | unknown 69 + >; 70 + /** 71 + * The request method. 72 + * 73 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} 74 + */ 75 + method?: Uppercase<HttpMethod>; 76 + /** 77 + * A function for serializing request query parameters. By default, arrays 78 + * will be exploded in form style, objects will be exploded in deepObject 79 + * style, and reserved characters are percent-encoded. 80 + * 81 + * This method will have no effect if the native `paramsSerializer()` Axios 82 + * API function is used. 83 + * 84 + * {@link https://swagger.io/docs/specification/serialization/#query View examples} 85 + */ 86 + querySerializer?: QuerySerializer | QuerySerializerOptions; 87 + /** 88 + * A function validating request data. This is useful if you want to ensure 89 + * the request conforms to the desired shape, so it can be safely sent to 90 + * the server. 91 + */ 92 + requestValidator?: (data: unknown) => Promise<unknown>; 93 + /** 94 + * A function transforming response data before it's returned. This is useful 95 + * for post-processing data, e.g. converting ISO strings into Date objects. 96 + */ 97 + responseTransformer?: (data: unknown) => Promise<unknown>; 98 + /** 99 + * A function validating response data. This is useful if you want to ensure 100 + * the response conforms to the desired shape, so it can be safely passed to 101 + * the transformers and returned to the user. 102 + */ 103 + responseValidator?: (data: unknown) => Promise<unknown>; 104 + } 105 + 106 + type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 + ? true 108 + : [T] extends [never | undefined] 109 + ? [undefined] extends [T] 110 + ? false 111 + : true 112 + : false; 113 + 114 + export type OmitNever<T extends Record<string, unknown>> = { 115 + [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 + ? never 117 + : K]: T[K]; 118 + };
+143
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/core/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { BodySerializer, QuerySerializer } from './bodySerializer.gen.js'; 4 + import { 5 + type ArraySeparatorStyle, 6 + serializeArrayParam, 7 + serializeObjectParam, 8 + serializePrimitiveParam, 9 + } from './pathSerializer.gen.js'; 10 + 11 + export interface PathSerializer { 12 + path: Record<string, unknown>; 13 + url: string; 14 + } 15 + 16 + export const PATH_PARAM_RE = /\{[^{}]+\}/g; 17 + 18 + export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { 19 + let url = _url; 20 + const matches = _url.match(PATH_PARAM_RE); 21 + if (matches) { 22 + for (const match of matches) { 23 + let explode = false; 24 + let name = match.substring(1, match.length - 1); 25 + let style: ArraySeparatorStyle = 'simple'; 26 + 27 + if (name.endsWith('*')) { 28 + explode = true; 29 + name = name.substring(0, name.length - 1); 30 + } 31 + 32 + if (name.startsWith('.')) { 33 + name = name.substring(1); 34 + style = 'label'; 35 + } else if (name.startsWith(';')) { 36 + name = name.substring(1); 37 + style = 'matrix'; 38 + } 39 + 40 + const value = path[name]; 41 + 42 + if (value === undefined || value === null) { 43 + continue; 44 + } 45 + 46 + if (Array.isArray(value)) { 47 + url = url.replace( 48 + match, 49 + serializeArrayParam({ explode, name, style, value }), 50 + ); 51 + continue; 52 + } 53 + 54 + if (typeof value === 'object') { 55 + url = url.replace( 56 + match, 57 + serializeObjectParam({ 58 + explode, 59 + name, 60 + style, 61 + value: value as Record<string, unknown>, 62 + valueOnly: true, 63 + }), 64 + ); 65 + continue; 66 + } 67 + 68 + if (style === 'matrix') { 69 + url = url.replace( 70 + match, 71 + `;${serializePrimitiveParam({ 72 + name, 73 + value: value as string, 74 + })}`, 75 + ); 76 + continue; 77 + } 78 + 79 + const replaceValue = encodeURIComponent( 80 + style === 'label' ? `.${value as string}` : (value as string), 81 + ); 82 + url = url.replace(match, replaceValue); 83 + } 84 + } 85 + return url; 86 + }; 87 + 88 + export const getUrl = ({ 89 + baseUrl, 90 + path, 91 + query, 92 + querySerializer, 93 + url: _url, 94 + }: { 95 + baseUrl?: string; 96 + path?: Record<string, unknown>; 97 + query?: Record<string, unknown>; 98 + querySerializer: QuerySerializer; 99 + url: string; 100 + }) => { 101 + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; 102 + let url = (baseUrl ?? '') + pathUrl; 103 + if (path) { 104 + url = defaultPathSerializer({ path, url }); 105 + } 106 + let search = query ? querySerializer(query) : ''; 107 + if (search.startsWith('?')) { 108 + search = search.substring(1); 109 + } 110 + if (search) { 111 + url += `?${search}`; 112 + } 113 + return url; 114 + }; 115 + 116 + export function getValidRequestBody(options: { 117 + body?: unknown; 118 + bodySerializer?: BodySerializer | null; 119 + serializedBody?: unknown; 120 + }) { 121 + const hasBody = options.body !== undefined; 122 + const isSerializedBody = hasBody && options.bodySerializer; 123 + 124 + if (isSerializedBody) { 125 + if ('serializedBody' in options) { 126 + const hasSerializedBody = 127 + options.serializedBody !== undefined && options.serializedBody !== ''; 128 + 129 + return hasSerializedBody ? options.serializedBody : null; 130 + } 131 + 132 + // not all clients implement a serializedBody property (i.e. client-axios) 133 + return options.body !== '' ? options.body : null; 134 + } 135 + 136 + // plain/text body 137 + if (hasBody) { 138 + return options.body; 139 + } 140 + 141 + // no body was provided 142 + return undefined; 143 + }
+4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export { apiVVersionODataControllerCount, callToTestOrderOfParams, callWithDefaultOptionalParameters, callWithDefaultParameters, callWithDescriptions, callWithDuplicateResponses, callWithNoContentResponse, callWithParameters, callWithResponse, callWithResponseAndNoContentResponse, callWithResponses, callWithResultFromHeader, callWithWeirdParameterNames, collectionFormat, complexParams, complexTypes, deleteCallWithoutParametersAndResponse, deleteFoo, deprecatedCall, dummyA, dummyB, duplicateName, duplicateName2, duplicateName3, duplicateName4, export_, fileResponse, fooWow, getApiVbyApiVersionSimpleOperation, getCallWithOptionalParam, getCallWithoutParametersAndResponse, headCallWithoutParametersAndResponse, import_, multipartRequest, multipartResponse, nonAsciiæøåÆøÅöôêÊ字符串, type Options, optionsCallWithoutParametersAndResponse, patchApiVbyApiVersionNoTag, patchCallWithoutParametersAndResponse, postApiVbyApiVersionFormData, postApiVbyApiVersionRequestBody, postCallWithOptionalParam, postCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, putWithFormUrlEncoded, testErrorCode, types, uploadFile } from './sdk.gen.js'; 4 + export type { _3eNum1Период, _400, AdditionalPropertiesIntegerIssue, AdditionalPropertiesUnknownIssue, AdditionalPropertiesUnknownIssue2, AdditionalPropertiesUnknownIssue3, AdditionalPropertiesUnknownIssueWritable, AnyOfAnyAndNull, AnyOfArrays, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountResponses, ArrayWithAnyOfProperties, ArrayWithArray, ArrayWithBooleans, ArrayWithNumbers, ArrayWithProperties, ArrayWithReferences, ArrayWithStrings, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponse, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesError, CallWithResponsesErrors, CallWithResponsesResponse, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CamelCaseCommentWithBreaks, CharactersInDescription, ClientOptions, CollectionFormatData, CommentWithBackticks, CommentWithBackticksAndQuotes, CommentWithBreaks, CommentWithExpressionPlaceholders, CommentWithQuotes, CommentWithReservedCharacters, CommentWithSlashes, ComplexParamsData, ComplexParamsResponse, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponse, ComplexTypesResponses, CompositionBaseModel, CompositionExtendedModel, CompositionWithAllOfAndNullable, CompositionWithAnyOf, CompositionWithAnyOfAndNullable, CompositionWithAnyOfAnonymous, CompositionWithNestedAnyAndTypeNull, CompositionWithNestedAnyOfAndNull, CompositionWithOneOf, CompositionWithOneOfAndComplexArrayDictionary, CompositionWithOneOfAndNullable, CompositionWithOneOfAndProperties, CompositionWithOneOfAndSimpleArrayDictionary, CompositionWithOneOfAndSimpleDictionary, CompositionWithOneOfAnonymous, CompositionWithOneOfDiscriminator, ConstValue, Default, DeleteCallWithoutParametersAndResponseData, DeleteFooData, DeleteFooData2, DeleteFooData3, DeprecatedCallData, DeprecatedModel, DictionaryWithArray, DictionaryWithDictionary, DictionaryWithProperties, DictionaryWithPropertiesAndAdditionalProperties, DictionaryWithReference, DictionaryWithString, DummyAData, DummyAResponse, DummyAResponses, DummyBData, DummyBResponse, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, EnumFromDescription, EnumWithExtensions, EnumWithNumbers, EnumWithReplacedCharacters, EnumWithStrings, EnumWithXEnumNames, ExportData, ExternalRefA, ExternalRefB, ExternalSharedExternalSharedModel, File, FileResponseData, FileResponseResponse, FileResponseResponses, FileWritable, FooWowData, FooWowResponses, FreeFormObjectWithAdditionalPropertiesEqEmptyObject, FreeFormObjectWithAdditionalPropertiesEqTrue, FreeFormObjectWithoutAdditionalProperties, GenericSchemaDuplicateIssue1SystemBoolean, GenericSchemaDuplicateIssue1SystemBooleanWritable, GenericSchemaDuplicateIssue1SystemString, GenericSchemaDuplicateIssue1SystemStringWritable, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, Import, ImportData, ImportResponse, ImportResponses, IoK8sApimachineryPkgApisMetaV1DeleteOptions, IoK8sApimachineryPkgApisMetaV1Preconditions, ModelCircle, ModelFromZendesk, ModelSquare, ModelThatExtends, ModelThatExtendsExtends, ModelWithAdditionalPropertiesEqTrue, ModelWithAnyOfConstantSizeArray, ModelWithAnyOfConstantSizeArrayAndIntersect, ModelWithAnyOfConstantSizeArrayNullable, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable, ModelWithArray, ModelWithArrayReadOnlyAndWriteOnly, ModelWithArrayReadOnlyAndWriteOnlyWritable, ModelWithBackticksInDescription, ModelWithBoolean, ModelWithCircularReference, ModelWithConst, ModelWithConstantSizeArray, ModelWithDictionary, ModelWithDuplicateImports, ModelWithDuplicateProperties, ModelWithEnum, ModelWithEnumFromDescription, ModelWithEnumWithHyphen, ModelWithInteger, ModelWithNestedArrayEnums, ModelWithNestedArrayEnumsData, ModelWithNestedArrayEnumsDataBar, ModelWithNestedArrayEnumsDataFoo, ModelWithNestedCompositionEnums, ModelWithNestedEnums, ModelWithNestedProperties, ModelWithNullableObject, ModelWithNullableString, ModelWithNumericEnumUnion, ModelWithOneOfAndProperties, ModelWithOneOfEnum, ModelWithOrderedProperties, ModelWithPattern, ModelWithPatternWritable, ModelWithPrefixItemsConstantSizeArray, ModelWithProperties, ModelWithPropertiesWritable, ModelWithReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnlyWritable, ModelWithReference, ModelWithReferenceWritable, ModelWithString, ModelWithStringError, MultipartRequestData, MultipartResponseData, MultipartResponseResponse, MultipartResponseResponses, NestedAnyOfArraysNullable, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Responses, NonAsciiStringæøåÆøÅöôêÊ字符串, NullableObject, OneOfAllOfIssue, OneOfAllOfIssueWritable, OptionsCallWithoutParametersAndResponseData, Pageable, ParameterSimpleParameterUnused, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PostServiceWithEmptyTagResponse, PostServiceWithEmptyTagResponse2, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, SchemaWithFormRestrictedKeys, SimpleBoolean, SimpleFile, SimpleFormData, SimpleInteger, SimpleParameter, SimpleReference, SimpleRequestBody, SimpleString, SimpleStringWithPattern, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponse, TypesResponses, UploadFileData, UploadFileResponse, UploadFileResponses, XFooBar } from './types.gen.js';
+206
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/sdk.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { client } from './client.gen.js'; 4 + import { type Client, formDataBodySerializer, type Options as Options2, type TDataShape, urlSearchParamsBodySerializer } from './client/index.js'; 5 + import type { ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponses, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesErrors, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CollectionFormatData, ComplexParamsData, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponses, DeleteCallWithoutParametersAndResponseData, DeleteFooData3, DeprecatedCallData, DummyAData, DummyAResponses, DummyBData, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, ExportData, FileResponseData, FileResponseResponses, FooWowData, FooWowResponses, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, ImportData, ImportResponses, MultipartRequestData, MultipartResponseData, MultipartResponseResponses, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Responses, OptionsCallWithoutParametersAndResponseData, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponses, UploadFileData, UploadFileResponses } from './types.gen.js'; 6 + 7 + export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & { 8 + /** 9 + * You can provide a client instance returned by `createClient()` instead of 10 + * individual options. This might be also useful if you want to implement a 11 + * custom client. 12 + */ 13 + client?: Client; 14 + /** 15 + * You can pass arbitrary values through the `meta` object. This can be 16 + * used to access values that aren't defined as part of the SDK function. 17 + */ 18 + meta?: Record<string, unknown>; 19 + }; 20 + 21 + export const export_ = <ThrowOnError extends boolean = false>(options?: Options<ExportData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 22 + 23 + export const patchApiVbyApiVersionNoTag = <ThrowOnError extends boolean = false>(options?: Options<PatchApiVbyApiVersionNoTagData, ThrowOnError>) => (options?.client ?? client).patch<PatchApiVbyApiVersionNoTagResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 24 + 25 + export const import_ = <ThrowOnError extends boolean = false>(options: Options<ImportData, ThrowOnError>) => (options.client ?? client).post<ImportResponses, unknown, ThrowOnError>({ 26 + url: '/api/v{api-version}/no+tag', 27 + ...options, 28 + headers: { 29 + 'Content-Type': 'application/json', 30 + ...options.headers 31 + } 32 + }); 33 + 34 + export const fooWow = <ThrowOnError extends boolean = false>(options?: Options<FooWowData, ThrowOnError>) => (options?.client ?? client).put<FooWowResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 35 + 36 + export const apiVVersionODataControllerCount = <ThrowOnError extends boolean = false>(options?: Options<ApiVVersionODataControllerCountData, ThrowOnError>) => (options?.client ?? client).get<ApiVVersionODataControllerCountResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple/$count', ...options }); 37 + 38 + export const getApiVbyApiVersionSimpleOperation = <ThrowOnError extends boolean = false>(options: Options<GetApiVbyApiVersionSimpleOperationData, ThrowOnError>) => (options.client ?? client).get<GetApiVbyApiVersionSimpleOperationResponses, GetApiVbyApiVersionSimpleOperationErrors, ThrowOnError>({ url: '/api/v{api-version}/simple:operation', ...options }); 39 + 40 + export const deleteCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<DeleteCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 41 + 42 + export const getCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<GetCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 43 + 44 + export const headCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<HeadCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).head<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 45 + 46 + export const optionsCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<OptionsCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).options<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 47 + 48 + export const patchCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PatchCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).patch<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 49 + 50 + export const postCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PostCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 51 + 52 + export const putCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PutCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 53 + 54 + export const deleteFoo = <ThrowOnError extends boolean = false>(options: Options<DeleteFooData3, ThrowOnError>) => (options.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', ...options }); 55 + 56 + export const callWithDescriptions = <ThrowOnError extends boolean = false>(options?: Options<CallWithDescriptionsData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/descriptions', ...options }); 57 + 58 + /** 59 + * @deprecated 60 + */ 61 + export const deprecatedCall = <ThrowOnError extends boolean = false>(options: Options<DeprecatedCallData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/parameters/deprecated', ...options }); 62 + 63 + export const callWithParameters = <ThrowOnError extends boolean = false>(options: Options<CallWithParametersData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ 64 + url: '/api/v{api-version}/parameters/{parameterPath}', 65 + ...options, 66 + headers: { 67 + 'Content-Type': 'application/json', 68 + ...options.headers 69 + } 70 + }); 71 + 72 + export const callWithWeirdParameterNames = <ThrowOnError extends boolean = false>(options: Options<CallWithWeirdParameterNamesData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ 73 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', 74 + ...options, 75 + headers: { 76 + 'Content-Type': 'application/json', 77 + ...options.headers 78 + } 79 + }); 80 + 81 + export const getCallWithOptionalParam = <ThrowOnError extends boolean = false>(options: Options<GetCallWithOptionalParamData, ThrowOnError>) => (options.client ?? client).get<unknown, unknown, ThrowOnError>({ 82 + url: '/api/v{api-version}/parameters', 83 + ...options, 84 + headers: { 85 + 'Content-Type': 'application/json', 86 + ...options.headers 87 + } 88 + }); 89 + 90 + export const postCallWithOptionalParam = <ThrowOnError extends boolean = false>(options: Options<PostCallWithOptionalParamData, ThrowOnError>) => (options.client ?? client).post<PostCallWithOptionalParamResponses, unknown, ThrowOnError>({ 91 + url: '/api/v{api-version}/parameters', 92 + ...options, 93 + headers: { 94 + 'Content-Type': 'application/json', 95 + ...options.headers 96 + } 97 + }); 98 + 99 + export const postApiVbyApiVersionRequestBody = <ThrowOnError extends boolean = false>(options?: Options<PostApiVbyApiVersionRequestBodyData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 100 + url: '/api/v{api-version}/requestBody', 101 + ...options, 102 + headers: { 103 + 'Content-Type': 'application/json', 104 + ...options?.headers 105 + } 106 + }); 107 + 108 + export const postApiVbyApiVersionFormData = <ThrowOnError extends boolean = false>(options?: Options<PostApiVbyApiVersionFormDataData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 109 + ...formDataBodySerializer, 110 + url: '/api/v{api-version}/formData', 111 + ...options, 112 + headers: { 113 + 'Content-Type': null, 114 + ...options?.headers 115 + } 116 + }); 117 + 118 + export const callWithDefaultParameters = <ThrowOnError extends boolean = false>(options?: Options<CallWithDefaultParametersData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 119 + 120 + export const callWithDefaultOptionalParameters = <ThrowOnError extends boolean = false>(options?: Options<CallWithDefaultOptionalParametersData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 121 + 122 + export const callToTestOrderOfParams = <ThrowOnError extends boolean = false>(options: Options<CallToTestOrderOfParamsData, ThrowOnError>) => (options.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 123 + 124 + export const duplicateName = <ThrowOnError extends boolean = false>(options?: Options<DuplicateNameData, ThrowOnError>) => (options?.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 125 + 126 + export const duplicateName2 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName2Data, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 127 + 128 + export const duplicateName3 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName3Data, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 129 + 130 + export const duplicateName4 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName4Data, ThrowOnError>) => (options?.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 131 + 132 + export const callWithNoContentResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithNoContentResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithNoContentResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no-content', ...options }); 133 + 134 + export const callWithResponseAndNoContentResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponseAndNoContentResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithResponseAndNoContentResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/response-and-no-content', ...options }); 135 + 136 + export const dummyA = <ThrowOnError extends boolean = false>(options?: Options<DummyAData, ThrowOnError>) => (options?.client ?? client).get<DummyAResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/a', ...options }); 137 + 138 + export const dummyB = <ThrowOnError extends boolean = false>(options?: Options<DummyBData, ThrowOnError>) => (options?.client ?? client).get<DummyBResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/b', ...options }); 139 + 140 + export const callWithResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 141 + 142 + export const callWithDuplicateResponses = <ThrowOnError extends boolean = false>(options?: Options<CallWithDuplicateResponsesData, ThrowOnError>) => (options?.client ?? client).post<CallWithDuplicateResponsesResponses, CallWithDuplicateResponsesErrors, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 143 + 144 + export const callWithResponses = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponsesData, ThrowOnError>) => (options?.client ?? client).put<CallWithResponsesResponses, CallWithResponsesErrors, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 145 + 146 + export const collectionFormat = <ThrowOnError extends boolean = false>(options: Options<CollectionFormatData, ThrowOnError>) => (options.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/collectionFormat', ...options }); 147 + 148 + export const types = <ThrowOnError extends boolean = false>(options: Options<TypesData, ThrowOnError>) => (options.client ?? client).get<TypesResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/types', ...options }); 149 + 150 + export const uploadFile = <ThrowOnError extends boolean = false>(options: Options<UploadFileData, ThrowOnError>) => (options.client ?? client).post<UploadFileResponses, unknown, ThrowOnError>({ 151 + ...urlSearchParamsBodySerializer, 152 + url: '/api/v{api-version}/upload', 153 + ...options, 154 + headers: { 155 + 'Content-Type': 'application/x-www-form-urlencoded', 156 + ...options.headers 157 + } 158 + }); 159 + 160 + export const fileResponse = <ThrowOnError extends boolean = false>(options: Options<FileResponseData, ThrowOnError>) => (options.client ?? client).get<FileResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/file/{id}', ...options }); 161 + 162 + export const complexTypes = <ThrowOnError extends boolean = false>(options: Options<ComplexTypesData, ThrowOnError>) => (options.client ?? client).get<ComplexTypesResponses, ComplexTypesErrors, ThrowOnError>({ 163 + querySerializer: { parameters: { parameterObject: { object: { style: 'form' } } } }, 164 + url: '/api/v{api-version}/complex', 165 + ...options 166 + }); 167 + 168 + export const multipartResponse = <ThrowOnError extends boolean = false>(options?: Options<MultipartResponseData, ThrowOnError>) => (options?.client ?? client).get<MultipartResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multipart', ...options }); 169 + 170 + export const multipartRequest = <ThrowOnError extends boolean = false>(options?: Options<MultipartRequestData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 171 + ...formDataBodySerializer, 172 + url: '/api/v{api-version}/multipart', 173 + ...options, 174 + headers: { 175 + 'Content-Type': null, 176 + ...options?.headers 177 + } 178 + }); 179 + 180 + export const complexParams = <ThrowOnError extends boolean = false>(options: Options<ComplexParamsData, ThrowOnError>) => (options.client ?? client).put<ComplexParamsResponses, unknown, ThrowOnError>({ 181 + url: '/api/v{api-version}/complex/{id}', 182 + ...options, 183 + headers: { 184 + 'Content-Type': 'application/json-patch+json', 185 + ...options.headers 186 + } 187 + }); 188 + 189 + export const callWithResultFromHeader = <ThrowOnError extends boolean = false>(options?: Options<CallWithResultFromHeaderData, ThrowOnError>) => (options?.client ?? client).post<CallWithResultFromHeaderResponses, CallWithResultFromHeaderErrors, ThrowOnError>({ url: '/api/v{api-version}/header', ...options }); 190 + 191 + export const testErrorCode = <ThrowOnError extends boolean = false>(options: Options<TestErrorCodeData, ThrowOnError>) => (options.client ?? client).post<TestErrorCodeResponses, TestErrorCodeErrors, ThrowOnError>({ url: '/api/v{api-version}/error', ...options }); 192 + 193 + export const nonAsciiæøåÆøÅöôêÊ字符串 = <ThrowOnError extends boolean = false>(options: Options<NonAsciiæøåÆøÅöôêÊ字符串Data, ThrowOnError>) => (options.client ?? client).post<NonAsciiæøåÆøÅöôêÊ字符串Responses, unknown, ThrowOnError>({ url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', ...options }); 194 + 195 + /** 196 + * Login User 197 + */ 198 + export const putWithFormUrlEncoded = <ThrowOnError extends boolean = false>(options: Options<PutWithFormUrlEncodedData, ThrowOnError>) => (options.client ?? client).put<unknown, unknown, ThrowOnError>({ 199 + ...urlSearchParamsBodySerializer, 200 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', 201 + ...options, 202 + headers: { 203 + 'Content-Type': 'application/x-www-form-urlencoded', 204 + ...options.headers 205 + } 206 + });
+2091
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-node16-sdk/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type ClientOptions = { 4 + baseUrl: 'http://localhost:3000/base' | (string & {}); 5 + }; 6 + 7 + /** 8 + * Model with number-only name 9 + */ 10 + export type _400 = string; 11 + 12 + /** 13 + * External ref to shared model (A) 14 + */ 15 + export type ExternalRefA = ExternalSharedExternalSharedModel; 16 + 17 + /** 18 + * External ref to shared model (B) 19 + */ 20 + export type ExternalRefB = ExternalSharedExternalSharedModel; 21 + 22 + /** 23 + * Testing multiline comments in string: First line 24 + * Second line 25 + * 26 + * Fourth line 27 + */ 28 + export type CamelCaseCommentWithBreaks = number; 29 + 30 + /** 31 + * Testing multiline comments in string: First line 32 + * Second line 33 + * 34 + * Fourth line 35 + */ 36 + export type CommentWithBreaks = number; 37 + 38 + /** 39 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 40 + */ 41 + export type CommentWithBackticks = number; 42 + 43 + /** 44 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 45 + */ 46 + export type CommentWithBackticksAndQuotes = number; 47 + 48 + /** 49 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 50 + */ 51 + export type CommentWithSlashes = number; 52 + 53 + /** 54 + * Testing expression placeholders in string: ${expression} should work 55 + */ 56 + export type CommentWithExpressionPlaceholders = number; 57 + 58 + /** 59 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 60 + */ 61 + export type CommentWithQuotes = number; 62 + 63 + /** 64 + * Testing reserved characters in string: * inline * and ** inline ** should work 65 + */ 66 + export type CommentWithReservedCharacters = number; 67 + 68 + /** 69 + * This is a simple number 70 + */ 71 + export type SimpleInteger = number; 72 + 73 + /** 74 + * This is a simple boolean 75 + */ 76 + export type SimpleBoolean = boolean; 77 + 78 + /** 79 + * This is a simple string 80 + */ 81 + export type SimpleString = string; 82 + 83 + /** 84 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 85 + */ 86 + export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; 87 + 88 + /** 89 + * This is a simple file 90 + */ 91 + export type SimpleFile = Blob | File; 92 + 93 + /** 94 + * This is a simple reference 95 + */ 96 + export type SimpleReference = ModelWithString; 97 + 98 + /** 99 + * This is a simple string 100 + */ 101 + export type SimpleStringWithPattern = string | null; 102 + 103 + /** 104 + * This is a simple enum with strings 105 + */ 106 + export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | '\'Single Quote\'' | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; 107 + 108 + export type EnumWithReplacedCharacters = '\'Single Quote\'' | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; 109 + 110 + /** 111 + * This is a simple enum with numbers 112 + */ 113 + export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; 114 + 115 + /** 116 + * Success=1,Warning=2,Error=3 117 + */ 118 + export type EnumFromDescription = number; 119 + 120 + /** 121 + * This is a simple enum with numbers 122 + */ 123 + export type EnumWithExtensions = 200 | 400 | 500; 124 + 125 + export type EnumWithXEnumNames = 0 | 1 | 2; 126 + 127 + /** 128 + * This is a simple array with numbers 129 + */ 130 + export type ArrayWithNumbers = Array<number>; 131 + 132 + /** 133 + * This is a simple array with booleans 134 + */ 135 + export type ArrayWithBooleans = Array<boolean>; 136 + 137 + /** 138 + * This is a simple array with strings 139 + */ 140 + export type ArrayWithStrings = Array<string>; 141 + 142 + /** 143 + * This is a simple array with references 144 + */ 145 + export type ArrayWithReferences = Array<ModelWithString>; 146 + 147 + /** 148 + * This is a simple array containing an array 149 + */ 150 + export type ArrayWithArray = Array<Array<ModelWithString>>; 151 + 152 + /** 153 + * This is a simple array with properties 154 + */ 155 + export type ArrayWithProperties = Array<{ 156 + '16x16'?: CamelCaseCommentWithBreaks; 157 + bar?: string; 158 + }>; 159 + 160 + /** 161 + * This is a simple array with any of properties 162 + */ 163 + export type ArrayWithAnyOfProperties = Array<{ 164 + foo?: string; 165 + } | { 166 + bar?: string; 167 + }>; 168 + 169 + export type AnyOfAnyAndNull = { 170 + data?: unknown | null; 171 + }; 172 + 173 + /** 174 + * This is a simple array with any of properties 175 + */ 176 + export type AnyOfArrays = { 177 + results?: Array<{ 178 + foo?: string; 179 + } | { 180 + bar?: string; 181 + }>; 182 + }; 183 + 184 + /** 185 + * This is a string dictionary 186 + */ 187 + export type DictionaryWithString = { 188 + [key: string]: string; 189 + }; 190 + 191 + export type DictionaryWithPropertiesAndAdditionalProperties = { 192 + foo?: number; 193 + bar?: boolean; 194 + [key: string]: string | number | boolean | undefined; 195 + }; 196 + 197 + /** 198 + * This is a string reference 199 + */ 200 + export type DictionaryWithReference = { 201 + [key: string]: ModelWithString; 202 + }; 203 + 204 + /** 205 + * This is a complex dictionary 206 + */ 207 + export type DictionaryWithArray = { 208 + [key: string]: Array<ModelWithString>; 209 + }; 210 + 211 + /** 212 + * This is a string dictionary 213 + */ 214 + export type DictionaryWithDictionary = { 215 + [key: string]: { 216 + [key: string]: string; 217 + }; 218 + }; 219 + 220 + /** 221 + * This is a complex dictionary 222 + */ 223 + export type DictionaryWithProperties = { 224 + [key: string]: { 225 + foo?: string; 226 + bar?: string; 227 + }; 228 + }; 229 + 230 + /** 231 + * This is a model with one number property 232 + */ 233 + export type ModelWithInteger = { 234 + /** 235 + * This is a simple number property 236 + */ 237 + prop?: number; 238 + }; 239 + 240 + /** 241 + * This is a model with one boolean property 242 + */ 243 + export type ModelWithBoolean = { 244 + /** 245 + * This is a simple boolean property 246 + */ 247 + prop?: boolean; 248 + }; 249 + 250 + /** 251 + * This is a model with one string property 252 + */ 253 + export type ModelWithString = { 254 + /** 255 + * This is a simple string property 256 + */ 257 + prop?: string; 258 + }; 259 + 260 + /** 261 + * This is a model with one string property 262 + */ 263 + export type ModelWithStringError = { 264 + /** 265 + * This is a simple string property 266 + */ 267 + prop?: string; 268 + }; 269 + 270 + /** 271 + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) 272 + */ 273 + export type ModelFromZendesk = string; 274 + 275 + /** 276 + * This is a model with one string property 277 + */ 278 + export type ModelWithNullableString = { 279 + /** 280 + * This is a simple string property 281 + */ 282 + nullableProp1?: string | null; 283 + /** 284 + * This is a simple string property 285 + */ 286 + nullableRequiredProp1: string | null; 287 + /** 288 + * This is a simple string property 289 + */ 290 + nullableProp2?: string | null; 291 + /** 292 + * This is a simple string property 293 + */ 294 + nullableRequiredProp2: string | null; 295 + /** 296 + * This is a simple enum with strings 297 + */ 298 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 299 + }; 300 + 301 + /** 302 + * This is a model with one enum 303 + */ 304 + export type ModelWithEnum = { 305 + /** 306 + * This is a simple enum with strings 307 + */ 308 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 309 + /** 310 + * These are the HTTP error code enums 311 + */ 312 + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; 313 + /** 314 + * Simple boolean enum 315 + */ 316 + bool?: true; 317 + }; 318 + 319 + /** 320 + * This is a model with one enum with escaped name 321 + */ 322 + export type ModelWithEnumWithHyphen = { 323 + /** 324 + * Foo-Bar-Baz-Qux 325 + */ 326 + 'foo-bar-baz-qux'?: '3.0'; 327 + }; 328 + 329 + /** 330 + * This is a model with one enum 331 + */ 332 + export type ModelWithEnumFromDescription = { 333 + /** 334 + * Success=1,Warning=2,Error=3 335 + */ 336 + test?: number; 337 + }; 338 + 339 + /** 340 + * This is a model with nested enums 341 + */ 342 + export type ModelWithNestedEnums = { 343 + dictionaryWithEnum?: { 344 + [key: string]: 'Success' | 'Warning' | 'Error'; 345 + }; 346 + dictionaryWithEnumFromDescription?: { 347 + [key: string]: number; 348 + }; 349 + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; 350 + arrayWithDescription?: Array<number>; 351 + /** 352 + * This is a simple enum with strings 353 + */ 354 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 355 + }; 356 + 357 + /** 358 + * This is a model with one property containing a reference 359 + */ 360 + export type ModelWithReference = { 361 + prop?: ModelWithProperties; 362 + }; 363 + 364 + /** 365 + * This is a model with one property containing an array 366 + */ 367 + export type ModelWithArrayReadOnlyAndWriteOnly = { 368 + prop?: Array<ModelWithReadOnlyAndWriteOnly>; 369 + propWithFile?: Array<Blob | File>; 370 + propWithNumber?: Array<number>; 371 + }; 372 + 373 + /** 374 + * This is a model with one property containing an array 375 + */ 376 + export type ModelWithArray = { 377 + prop?: Array<ModelWithString>; 378 + propWithFile?: Array<Blob | File>; 379 + propWithNumber?: Array<number>; 380 + }; 381 + 382 + /** 383 + * This is a model with one property containing a dictionary 384 + */ 385 + export type ModelWithDictionary = { 386 + prop?: { 387 + [key: string]: string; 388 + }; 389 + }; 390 + 391 + /** 392 + * This is a deprecated model with a deprecated property 393 + * 394 + * @deprecated 395 + */ 396 + export type DeprecatedModel = { 397 + /** 398 + * This is a deprecated property 399 + * 400 + * @deprecated 401 + */ 402 + prop?: string; 403 + }; 404 + 405 + /** 406 + * This is a model with one property containing a circular reference 407 + */ 408 + export type ModelWithCircularReference = { 409 + prop?: ModelWithCircularReference; 410 + }; 411 + 412 + /** 413 + * This is a model with one property with a 'one of' relationship 414 + */ 415 + export type CompositionWithOneOf = { 416 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 417 + }; 418 + 419 + /** 420 + * This is a model with one property with a 'one of' relationship where the options are not $ref 421 + */ 422 + export type CompositionWithOneOfAnonymous = { 423 + propA?: { 424 + propA?: string; 425 + } | string | number; 426 + }; 427 + 428 + /** 429 + * Circle 430 + */ 431 + export type ModelCircle = { 432 + kind: string; 433 + radius?: number; 434 + }; 435 + 436 + /** 437 + * Square 438 + */ 439 + export type ModelSquare = { 440 + kind: string; 441 + sideLength?: number; 442 + }; 443 + 444 + /** 445 + * This is a model with one property with a 'one of' relationship where the options are not $ref 446 + */ 447 + export type CompositionWithOneOfDiscriminator = ({ 448 + kind: 'circle'; 449 + } & ModelCircle) | ({ 450 + kind: 'square'; 451 + } & ModelSquare); 452 + 453 + /** 454 + * This is a model with one property with a 'any of' relationship 455 + */ 456 + export type CompositionWithAnyOf = { 457 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 458 + }; 459 + 460 + /** 461 + * This is a model with one property with a 'any of' relationship where the options are not $ref 462 + */ 463 + export type CompositionWithAnyOfAnonymous = { 464 + propA?: { 465 + propA?: string; 466 + } | string | number; 467 + }; 468 + 469 + /** 470 + * This is a model with nested 'any of' property with a type null 471 + */ 472 + export type CompositionWithNestedAnyAndTypeNull = { 473 + propA?: Array<ModelWithDictionary | null> | Array<ModelWithArray | null>; 474 + }; 475 + 476 + export type _3eNum1Период = 'Bird' | 'Dog'; 477 + 478 + export type ConstValue = 'ConstValue'; 479 + 480 + /** 481 + * This is a model with one property with a 'any of' relationship where the options are not $ref 482 + */ 483 + export type CompositionWithNestedAnyOfAndNull = { 484 + /** 485 + * Scopes 486 + */ 487 + propA?: Array<_3eNum1Период | ConstValue> | null; 488 + }; 489 + 490 + /** 491 + * This is a model with one property with a 'one of' relationship 492 + */ 493 + export type CompositionWithOneOfAndNullable = { 494 + propA?: { 495 + boolean?: boolean; 496 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 497 + }; 498 + 499 + /** 500 + * This is a model that contains a simple dictionary within composition 501 + */ 502 + export type CompositionWithOneOfAndSimpleDictionary = { 503 + propA?: boolean | { 504 + [key: string]: number; 505 + }; 506 + }; 507 + 508 + /** 509 + * This is a model that contains a dictionary of simple arrays within composition 510 + */ 511 + export type CompositionWithOneOfAndSimpleArrayDictionary = { 512 + propA?: boolean | { 513 + [key: string]: Array<boolean>; 514 + }; 515 + }; 516 + 517 + /** 518 + * This is a model that contains a dictionary of complex arrays (composited) within composition 519 + */ 520 + export type CompositionWithOneOfAndComplexArrayDictionary = { 521 + propA?: boolean | { 522 + [key: string]: Array<number | string>; 523 + }; 524 + }; 525 + 526 + /** 527 + * This is a model with one property with a 'all of' relationship 528 + */ 529 + export type CompositionWithAllOfAndNullable = { 530 + propA?: ({ 531 + boolean?: boolean; 532 + } & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null; 533 + }; 534 + 535 + /** 536 + * This is a model with one property with a 'any of' relationship 537 + */ 538 + export type CompositionWithAnyOfAndNullable = { 539 + propA?: { 540 + boolean?: boolean; 541 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 542 + }; 543 + 544 + /** 545 + * This is a base model with two simple optional properties 546 + */ 547 + export type CompositionBaseModel = { 548 + firstName?: string; 549 + lastname?: string; 550 + }; 551 + 552 + /** 553 + * This is a model that extends the base model 554 + */ 555 + export type CompositionExtendedModel = CompositionBaseModel & { 556 + age: number; 557 + firstName: string; 558 + lastname: string; 559 + }; 560 + 561 + /** 562 + * This is a model with one nested property 563 + */ 564 + export type ModelWithProperties = { 565 + required: string; 566 + readonly requiredAndReadOnly: string; 567 + requiredAndNullable: string | null; 568 + string?: string; 569 + number?: number; 570 + boolean?: boolean; 571 + reference?: ModelWithString; 572 + 'property with space'?: string; 573 + default?: string; 574 + try?: string; 575 + readonly '@namespace.string'?: string; 576 + readonly '@namespace.integer'?: number; 577 + }; 578 + 579 + /** 580 + * This is a model with one nested property 581 + */ 582 + export type ModelWithNestedProperties = { 583 + readonly first: { 584 + readonly second: { 585 + readonly third: string | null; 586 + } | null; 587 + } | null; 588 + }; 589 + 590 + /** 591 + * This is a model with duplicated properties 592 + */ 593 + export type ModelWithDuplicateProperties = { 594 + prop?: ModelWithString; 595 + }; 596 + 597 + /** 598 + * This is a model with ordered properties 599 + */ 600 + export type ModelWithOrderedProperties = { 601 + zebra?: string; 602 + apple?: string; 603 + hawaii?: string; 604 + }; 605 + 606 + /** 607 + * This is a model with duplicated imports 608 + */ 609 + export type ModelWithDuplicateImports = { 610 + propA?: ModelWithString; 611 + propB?: ModelWithString; 612 + propC?: ModelWithString; 613 + }; 614 + 615 + /** 616 + * This is a model that extends another model 617 + */ 618 + export type ModelThatExtends = ModelWithString & { 619 + propExtendsA?: string; 620 + propExtendsB?: ModelWithString; 621 + }; 622 + 623 + /** 624 + * This is a model that extends another model 625 + */ 626 + export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { 627 + propExtendsC?: string; 628 + propExtendsD?: ModelWithString; 629 + }; 630 + 631 + /** 632 + * This is a model that contains a some patterns 633 + */ 634 + export type ModelWithPattern = { 635 + key: string; 636 + name: string; 637 + readonly enabled?: boolean; 638 + readonly modified?: string; 639 + id?: string; 640 + text?: string; 641 + patternWithSingleQuotes?: string; 642 + patternWithNewline?: string; 643 + patternWithBacktick?: string; 644 + }; 645 + 646 + export type File = { 647 + /** 648 + * Id 649 + */ 650 + readonly id?: string; 651 + /** 652 + * Updated at 653 + */ 654 + readonly updated_at?: string; 655 + /** 656 + * Created at 657 + */ 658 + readonly created_at?: string; 659 + /** 660 + * Mime 661 + */ 662 + mime: string; 663 + /** 664 + * File 665 + */ 666 + readonly file?: string; 667 + }; 668 + 669 + export type Default = { 670 + name?: string; 671 + }; 672 + 673 + export type Pageable = { 674 + page?: number; 675 + size?: number; 676 + sort?: Array<string>; 677 + }; 678 + 679 + /** 680 + * This is a free-form object without additionalProperties. 681 + */ 682 + export type FreeFormObjectWithoutAdditionalProperties = { 683 + [key: string]: unknown; 684 + }; 685 + 686 + /** 687 + * This is a free-form object with additionalProperties: true. 688 + */ 689 + export type FreeFormObjectWithAdditionalPropertiesEqTrue = { 690 + [key: string]: unknown; 691 + }; 692 + 693 + /** 694 + * This is a free-form object with additionalProperties: {}. 695 + */ 696 + export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { 697 + [key: string]: unknown; 698 + }; 699 + 700 + export type ModelWithConst = { 701 + String?: 'String'; 702 + number?: 0; 703 + null?: null; 704 + withType?: 'Some string'; 705 + }; 706 + 707 + /** 708 + * This is a model with one property and additionalProperties: true 709 + */ 710 + export type ModelWithAdditionalPropertiesEqTrue = { 711 + /** 712 + * This is a simple string property 713 + */ 714 + prop?: string; 715 + [key: string]: unknown | string | undefined; 716 + }; 717 + 718 + export type NestedAnyOfArraysNullable = { 719 + nullableArray?: Array<string | boolean> | null; 720 + }; 721 + 722 + export type CompositionWithOneOfAndProperties = ({ 723 + foo: SimpleParameter; 724 + } | { 725 + bar: NonAsciiStringæøåÆøÅöôêÊ字符串; 726 + }) & { 727 + baz: number | null; 728 + qux: number; 729 + }; 730 + 731 + /** 732 + * An object that can be null 733 + */ 734 + export type NullableObject = { 735 + foo?: string; 736 + } | null; 737 + 738 + /** 739 + * Some % character 740 + */ 741 + export type CharactersInDescription = string; 742 + 743 + export type ModelWithNullableObject = { 744 + data?: NullableObject; 745 + }; 746 + 747 + export type ModelWithOneOfEnum = { 748 + foo: 'Bar'; 749 + } | { 750 + foo: 'Baz'; 751 + } | { 752 + foo: 'Qux'; 753 + } | { 754 + content: string; 755 + foo: 'Quux'; 756 + } | { 757 + content: [ 758 + string, 759 + string 760 + ]; 761 + foo: 'Corge'; 762 + }; 763 + 764 + export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; 765 + 766 + export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; 767 + 768 + export type ModelWithNestedArrayEnumsData = { 769 + foo?: Array<ModelWithNestedArrayEnumsDataFoo>; 770 + bar?: Array<ModelWithNestedArrayEnumsDataBar>; 771 + }; 772 + 773 + export type ModelWithNestedArrayEnums = { 774 + array_strings?: Array<string>; 775 + data?: ModelWithNestedArrayEnumsData; 776 + }; 777 + 778 + export type ModelWithNestedCompositionEnums = { 779 + foo?: ModelWithNestedArrayEnumsDataFoo; 780 + }; 781 + 782 + export type ModelWithReadOnlyAndWriteOnly = { 783 + foo: string; 784 + readonly bar: string; 785 + }; 786 + 787 + export type ModelWithConstantSizeArray = [ 788 + number, 789 + number 790 + ]; 791 + 792 + export type ModelWithAnyOfConstantSizeArray = [ 793 + number | string, 794 + number | string, 795 + number | string 796 + ]; 797 + 798 + export type ModelWithPrefixItemsConstantSizeArray = [ 799 + ModelWithInteger, 800 + number | string, 801 + string 802 + ]; 803 + 804 + export type ModelWithAnyOfConstantSizeArrayNullable = [ 805 + number | null | string, 806 + number | null | string, 807 + number | null | string 808 + ]; 809 + 810 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ 811 + number | Import, 812 + number | Import 813 + ]; 814 + 815 + export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ 816 + number & string, 817 + number & string 818 + ]; 819 + 820 + export type ModelWithNumericEnumUnion = { 821 + /** 822 + * Период 823 + */ 824 + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; 825 + }; 826 + 827 + /** 828 + * Some description with `back ticks` 829 + */ 830 + export type ModelWithBackticksInDescription = { 831 + /** 832 + * The template `that` should be used for parsing and importing the contents of the CSV file. 833 + * 834 + * <br/><p>There is one placeholder currently supported:<ul> <li><b>${x}</b> - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)</li></ul><p>Example of a correct JSON template:</p> 835 + * <pre> 836 + * [ 837 + * { 838 + * "resourceType": "Asset", 839 + * "identifier": { 840 + * "name": "${1}", 841 + * "domain": { 842 + * "name": "${2}", 843 + * "community": { 844 + * "name": "Some Community" 845 + * } 846 + * } 847 + * }, 848 + * "attributes" : { 849 + * "00000000-0000-0000-0000-000000003115" : [ { 850 + * "value" : "${3}" 851 + * } ], 852 + * "00000000-0000-0000-0000-000000000222" : [ { 853 + * "value" : "${4}" 854 + * } ] 855 + * } 856 + * } 857 + * ] 858 + * </pre> 859 + */ 860 + template?: string; 861 + }; 862 + 863 + export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & { 864 + baz: number | null; 865 + qux: number; 866 + }; 867 + 868 + /** 869 + * Model used to test deduplication strategy (unused) 870 + */ 871 + export type ParameterSimpleParameterUnused = string; 872 + 873 + /** 874 + * Model used to test deduplication strategy 875 + */ 876 + export type PostServiceWithEmptyTagResponse = string; 877 + 878 + /** 879 + * Model used to test deduplication strategy 880 + */ 881 + export type PostServiceWithEmptyTagResponse2 = string; 882 + 883 + /** 884 + * Model used to test deduplication strategy 885 + */ 886 + export type DeleteFooData = string; 887 + 888 + /** 889 + * Model used to test deduplication strategy 890 + */ 891 + export type DeleteFooData2 = string; 892 + 893 + /** 894 + * Model with restricted keyword name 895 + */ 896 + export type Import = string; 897 + 898 + export type SchemaWithFormRestrictedKeys = { 899 + description?: string; 900 + 'x-enum-descriptions'?: string; 901 + 'x-enum-varnames'?: string; 902 + 'x-enumNames'?: string; 903 + title?: string; 904 + object?: { 905 + description?: string; 906 + 'x-enum-descriptions'?: string; 907 + 'x-enum-varnames'?: string; 908 + 'x-enumNames'?: string; 909 + title?: string; 910 + }; 911 + array?: Array<{ 912 + description?: string; 913 + 'x-enum-descriptions'?: string; 914 + 'x-enum-varnames'?: string; 915 + 'x-enumNames'?: string; 916 + title?: string; 917 + }>; 918 + }; 919 + 920 + /** 921 + * This schema was giving PascalCase transformations a hard time 922 + */ 923 + export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = { 924 + /** 925 + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. 926 + */ 927 + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; 928 + }; 929 + 930 + /** 931 + * This schema was giving PascalCase transformations a hard time 932 + */ 933 + export type IoK8sApimachineryPkgApisMetaV1Preconditions = { 934 + /** 935 + * Specifies the target ResourceVersion 936 + */ 937 + resourceVersion?: string; 938 + /** 939 + * Specifies the target UID. 940 + */ 941 + uid?: string; 942 + }; 943 + 944 + export type AdditionalPropertiesUnknownIssue = { 945 + [key: string]: string | number; 946 + }; 947 + 948 + export type AdditionalPropertiesUnknownIssue2 = { 949 + [key: string]: string | number; 950 + }; 951 + 952 + export type AdditionalPropertiesUnknownIssue3 = string & { 953 + entries: { 954 + [key: string]: AdditionalPropertiesUnknownIssue; 955 + }; 956 + }; 957 + 958 + export type AdditionalPropertiesIntegerIssue = { 959 + value: number; 960 + [key: string]: number; 961 + }; 962 + 963 + export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 964 + 965 + export type GenericSchemaDuplicateIssue1SystemBoolean = { 966 + item?: boolean; 967 + error?: string | null; 968 + readonly hasError?: boolean; 969 + data?: { 970 + [key: string]: never; 971 + }; 972 + }; 973 + 974 + export type GenericSchemaDuplicateIssue1SystemString = { 975 + item?: string | null; 976 + error?: string | null; 977 + readonly hasError?: boolean; 978 + }; 979 + 980 + export type ExternalSharedExternalSharedModel = { 981 + id: string; 982 + name?: string; 983 + }; 984 + 985 + /** 986 + * This is a model with one property containing a reference 987 + */ 988 + export type ModelWithReferenceWritable = { 989 + prop?: ModelWithPropertiesWritable; 990 + }; 991 + 992 + /** 993 + * This is a model with one property containing an array 994 + */ 995 + export type ModelWithArrayReadOnlyAndWriteOnlyWritable = { 996 + prop?: Array<ModelWithReadOnlyAndWriteOnlyWritable>; 997 + propWithFile?: Array<Blob | File>; 998 + propWithNumber?: Array<number>; 999 + }; 1000 + 1001 + /** 1002 + * This is a model with one nested property 1003 + */ 1004 + export type ModelWithPropertiesWritable = { 1005 + required: string; 1006 + requiredAndNullable: string | null; 1007 + string?: string; 1008 + number?: number; 1009 + boolean?: boolean; 1010 + reference?: ModelWithString; 1011 + 'property with space'?: string; 1012 + default?: string; 1013 + try?: string; 1014 + }; 1015 + 1016 + /** 1017 + * This is a model that contains a some patterns 1018 + */ 1019 + export type ModelWithPatternWritable = { 1020 + key: string; 1021 + name: string; 1022 + id?: string; 1023 + text?: string; 1024 + patternWithSingleQuotes?: string; 1025 + patternWithNewline?: string; 1026 + patternWithBacktick?: string; 1027 + }; 1028 + 1029 + export type FileWritable = { 1030 + /** 1031 + * Mime 1032 + */ 1033 + mime: string; 1034 + }; 1035 + 1036 + export type ModelWithReadOnlyAndWriteOnlyWritable = { 1037 + foo: string; 1038 + baz: string; 1039 + }; 1040 + 1041 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = [ 1042 + number | Import, 1043 + number | Import 1044 + ]; 1045 + 1046 + export type AdditionalPropertiesUnknownIssueWritable = { 1047 + [key: string]: string | number; 1048 + }; 1049 + 1050 + export type OneOfAllOfIssueWritable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 1051 + 1052 + export type GenericSchemaDuplicateIssue1SystemBooleanWritable = { 1053 + item?: boolean; 1054 + error?: string | null; 1055 + data?: { 1056 + [key: string]: never; 1057 + }; 1058 + }; 1059 + 1060 + export type GenericSchemaDuplicateIssue1SystemStringWritable = { 1061 + item?: string | null; 1062 + error?: string | null; 1063 + }; 1064 + 1065 + /** 1066 + * This is a reusable parameter 1067 + */ 1068 + export type SimpleParameter = string; 1069 + 1070 + /** 1071 + * Parameter with illegal characters 1072 + */ 1073 + export type XFooBar = ModelWithString; 1074 + 1075 + /** 1076 + * A reusable request body 1077 + */ 1078 + export type SimpleRequestBody = ModelWithString; 1079 + 1080 + /** 1081 + * A reusable request body 1082 + */ 1083 + export type SimpleFormData = ModelWithString; 1084 + 1085 + export type ExportData = { 1086 + body?: never; 1087 + path?: never; 1088 + query?: never; 1089 + url: '/api/v{api-version}/no+tag'; 1090 + }; 1091 + 1092 + export type PatchApiVbyApiVersionNoTagData = { 1093 + body?: never; 1094 + path?: never; 1095 + query?: never; 1096 + url: '/api/v{api-version}/no+tag'; 1097 + }; 1098 + 1099 + export type PatchApiVbyApiVersionNoTagResponses = { 1100 + /** 1101 + * OK 1102 + */ 1103 + default: unknown; 1104 + }; 1105 + 1106 + export type ImportData = { 1107 + body: ModelWithReadOnlyAndWriteOnlyWritable | ModelWithArrayReadOnlyAndWriteOnlyWritable; 1108 + path?: never; 1109 + query?: never; 1110 + url: '/api/v{api-version}/no+tag'; 1111 + }; 1112 + 1113 + export type ImportResponses = { 1114 + /** 1115 + * Success 1116 + */ 1117 + 200: ModelFromZendesk; 1118 + /** 1119 + * Default success response 1120 + */ 1121 + default: ModelWithReadOnlyAndWriteOnly; 1122 + }; 1123 + 1124 + export type ImportResponse = ImportResponses[keyof ImportResponses]; 1125 + 1126 + export type FooWowData = { 1127 + body?: never; 1128 + path?: never; 1129 + query?: never; 1130 + url: '/api/v{api-version}/no+tag'; 1131 + }; 1132 + 1133 + export type FooWowResponses = { 1134 + /** 1135 + * OK 1136 + */ 1137 + default: unknown; 1138 + }; 1139 + 1140 + export type ApiVVersionODataControllerCountData = { 1141 + body?: never; 1142 + path?: never; 1143 + query?: never; 1144 + url: '/api/v{api-version}/simple/$count'; 1145 + }; 1146 + 1147 + export type ApiVVersionODataControllerCountResponses = { 1148 + /** 1149 + * Success 1150 + */ 1151 + 200: ModelFromZendesk; 1152 + }; 1153 + 1154 + export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; 1155 + 1156 + export type GetApiVbyApiVersionSimpleOperationData = { 1157 + body?: never; 1158 + path: { 1159 + /** 1160 + * foo in method 1161 + */ 1162 + foo_param: string; 1163 + }; 1164 + query?: never; 1165 + url: '/api/v{api-version}/simple:operation'; 1166 + }; 1167 + 1168 + export type GetApiVbyApiVersionSimpleOperationErrors = { 1169 + /** 1170 + * Default error response 1171 + */ 1172 + default: ModelWithBoolean; 1173 + }; 1174 + 1175 + export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; 1176 + 1177 + export type GetApiVbyApiVersionSimpleOperationResponses = { 1178 + /** 1179 + * Response is a simple number 1180 + */ 1181 + 200: number; 1182 + }; 1183 + 1184 + export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; 1185 + 1186 + export type DeleteCallWithoutParametersAndResponseData = { 1187 + body?: never; 1188 + path?: never; 1189 + query?: never; 1190 + url: '/api/v{api-version}/simple'; 1191 + }; 1192 + 1193 + export type GetCallWithoutParametersAndResponseData = { 1194 + body?: never; 1195 + path?: never; 1196 + query?: never; 1197 + url: '/api/v{api-version}/simple'; 1198 + }; 1199 + 1200 + export type HeadCallWithoutParametersAndResponseData = { 1201 + body?: never; 1202 + path?: never; 1203 + query?: never; 1204 + url: '/api/v{api-version}/simple'; 1205 + }; 1206 + 1207 + export type OptionsCallWithoutParametersAndResponseData = { 1208 + body?: never; 1209 + path?: never; 1210 + query?: never; 1211 + url: '/api/v{api-version}/simple'; 1212 + }; 1213 + 1214 + export type PatchCallWithoutParametersAndResponseData = { 1215 + body?: never; 1216 + path?: never; 1217 + query?: never; 1218 + url: '/api/v{api-version}/simple'; 1219 + }; 1220 + 1221 + export type PostCallWithoutParametersAndResponseData = { 1222 + body?: never; 1223 + path?: never; 1224 + query?: never; 1225 + url: '/api/v{api-version}/simple'; 1226 + }; 1227 + 1228 + export type PutCallWithoutParametersAndResponseData = { 1229 + body?: never; 1230 + path?: never; 1231 + query?: never; 1232 + url: '/api/v{api-version}/simple'; 1233 + }; 1234 + 1235 + export type DeleteFooData3 = { 1236 + body?: never; 1237 + headers: { 1238 + /** 1239 + * Parameter with illegal characters 1240 + */ 1241 + 'x-Foo-Bar': ModelWithString; 1242 + }; 1243 + path: { 1244 + /** 1245 + * foo in method 1246 + */ 1247 + foo_param: string; 1248 + /** 1249 + * bar in method 1250 + */ 1251 + BarParam: string; 1252 + }; 1253 + query?: never; 1254 + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; 1255 + }; 1256 + 1257 + export type CallWithDescriptionsData = { 1258 + body?: never; 1259 + path?: never; 1260 + query?: { 1261 + /** 1262 + * Testing multiline comments in string: First line 1263 + * Second line 1264 + * 1265 + * Fourth line 1266 + */ 1267 + parameterWithBreaks?: string; 1268 + /** 1269 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1270 + */ 1271 + parameterWithBackticks?: string; 1272 + /** 1273 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1274 + */ 1275 + parameterWithSlashes?: string; 1276 + /** 1277 + * Testing expression placeholders in string: ${expression} should work 1278 + */ 1279 + parameterWithExpressionPlaceholders?: string; 1280 + /** 1281 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1282 + */ 1283 + parameterWithQuotes?: string; 1284 + /** 1285 + * Testing reserved characters in string: * inline * and ** inline ** should work 1286 + */ 1287 + parameterWithReservedCharacters?: string; 1288 + }; 1289 + url: '/api/v{api-version}/descriptions'; 1290 + }; 1291 + 1292 + export type DeprecatedCallData = { 1293 + body?: never; 1294 + headers: { 1295 + /** 1296 + * This parameter is deprecated 1297 + * 1298 + * @deprecated 1299 + */ 1300 + parameter: DeprecatedModel | null; 1301 + }; 1302 + path?: never; 1303 + query?: never; 1304 + url: '/api/v{api-version}/parameters/deprecated'; 1305 + }; 1306 + 1307 + export type CallWithParametersData = { 1308 + /** 1309 + * This is the parameter that goes into the body 1310 + */ 1311 + body: { 1312 + [key: string]: unknown; 1313 + } | null; 1314 + headers: { 1315 + /** 1316 + * This is the parameter that goes into the header 1317 + */ 1318 + parameterHeader: string | null; 1319 + }; 1320 + path: { 1321 + /** 1322 + * This is the parameter that goes into the path 1323 + */ 1324 + parameterPath: string | null; 1325 + /** 1326 + * api-version should be required in standalone clients 1327 + */ 1328 + 'api-version': string | null; 1329 + }; 1330 + query: { 1331 + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; 1332 + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; 1333 + /** 1334 + * This is the parameter that goes into the query params 1335 + */ 1336 + cursor: string | null; 1337 + }; 1338 + url: '/api/v{api-version}/parameters/{parameterPath}'; 1339 + }; 1340 + 1341 + export type CallWithWeirdParameterNamesData = { 1342 + /** 1343 + * This is the parameter that goes into the body 1344 + */ 1345 + body: ModelWithString | null; 1346 + headers: { 1347 + /** 1348 + * This is the parameter that goes into the request header 1349 + */ 1350 + 'parameter.header': string | null; 1351 + }; 1352 + path: { 1353 + /** 1354 + * This is the parameter that goes into the path 1355 + */ 1356 + 'parameter.path.1'?: string; 1357 + /** 1358 + * This is the parameter that goes into the path 1359 + */ 1360 + 'parameter-path-2'?: string; 1361 + /** 1362 + * This is the parameter that goes into the path 1363 + */ 1364 + 'PARAMETER-PATH-3'?: string; 1365 + /** 1366 + * api-version should be required in standalone clients 1367 + */ 1368 + 'api-version': string | null; 1369 + }; 1370 + query: { 1371 + /** 1372 + * This is the parameter with a reserved keyword 1373 + */ 1374 + default?: string; 1375 + /** 1376 + * This is the parameter that goes into the request query params 1377 + */ 1378 + 'parameter-query': string | null; 1379 + }; 1380 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; 1381 + }; 1382 + 1383 + export type GetCallWithOptionalParamData = { 1384 + /** 1385 + * This is a required parameter 1386 + */ 1387 + body: ModelWithOneOfEnum; 1388 + path?: never; 1389 + query?: { 1390 + /** 1391 + * This is an optional parameter 1392 + */ 1393 + page?: number; 1394 + }; 1395 + url: '/api/v{api-version}/parameters'; 1396 + }; 1397 + 1398 + export type PostCallWithOptionalParamData = { 1399 + /** 1400 + * This is an optional parameter 1401 + */ 1402 + body?: { 1403 + offset?: number | null; 1404 + }; 1405 + path?: never; 1406 + query: { 1407 + /** 1408 + * This is a required parameter 1409 + */ 1410 + parameter: Pageable; 1411 + }; 1412 + url: '/api/v{api-version}/parameters'; 1413 + }; 1414 + 1415 + export type PostCallWithOptionalParamResponses = { 1416 + /** 1417 + * Response is a simple number 1418 + */ 1419 + 200: number; 1420 + /** 1421 + * Success 1422 + */ 1423 + 204: void; 1424 + }; 1425 + 1426 + export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; 1427 + 1428 + export type PostApiVbyApiVersionRequestBodyData = { 1429 + /** 1430 + * A reusable request body 1431 + */ 1432 + body?: SimpleRequestBody; 1433 + path?: never; 1434 + query?: { 1435 + /** 1436 + * This is a reusable parameter 1437 + */ 1438 + parameter?: string; 1439 + }; 1440 + url: '/api/v{api-version}/requestBody'; 1441 + }; 1442 + 1443 + export type PostApiVbyApiVersionFormDataData = { 1444 + /** 1445 + * A reusable request body 1446 + */ 1447 + body?: SimpleFormData; 1448 + path?: never; 1449 + query?: { 1450 + /** 1451 + * This is a reusable parameter 1452 + */ 1453 + parameter?: string; 1454 + }; 1455 + url: '/api/v{api-version}/formData'; 1456 + }; 1457 + 1458 + export type CallWithDefaultParametersData = { 1459 + body?: never; 1460 + path?: never; 1461 + query?: { 1462 + /** 1463 + * This is a simple string with default value 1464 + */ 1465 + parameterString?: string | null; 1466 + /** 1467 + * This is a simple number with default value 1468 + */ 1469 + parameterNumber?: number | null; 1470 + /** 1471 + * This is a simple boolean with default value 1472 + */ 1473 + parameterBoolean?: boolean | null; 1474 + /** 1475 + * This is a simple enum with default value 1476 + */ 1477 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1478 + /** 1479 + * This is a simple model with default value 1480 + */ 1481 + parameterModel?: ModelWithString | null; 1482 + }; 1483 + url: '/api/v{api-version}/defaults'; 1484 + }; 1485 + 1486 + export type CallWithDefaultOptionalParametersData = { 1487 + body?: never; 1488 + path?: never; 1489 + query?: { 1490 + /** 1491 + * This is a simple string that is optional with default value 1492 + */ 1493 + parameterString?: string; 1494 + /** 1495 + * This is a simple number that is optional with default value 1496 + */ 1497 + parameterNumber?: number; 1498 + /** 1499 + * This is a simple boolean that is optional with default value 1500 + */ 1501 + parameterBoolean?: boolean; 1502 + /** 1503 + * This is a simple enum that is optional with default value 1504 + */ 1505 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1506 + /** 1507 + * This is a simple model that is optional with default value 1508 + */ 1509 + parameterModel?: ModelWithString; 1510 + }; 1511 + url: '/api/v{api-version}/defaults'; 1512 + }; 1513 + 1514 + export type CallToTestOrderOfParamsData = { 1515 + body?: never; 1516 + path?: never; 1517 + query: { 1518 + /** 1519 + * This is a optional string with default 1520 + */ 1521 + parameterOptionalStringWithDefault?: string; 1522 + /** 1523 + * This is a optional string with empty default 1524 + */ 1525 + parameterOptionalStringWithEmptyDefault?: string; 1526 + /** 1527 + * This is a optional string with no default 1528 + */ 1529 + parameterOptionalStringWithNoDefault?: string; 1530 + /** 1531 + * This is a string with default 1532 + */ 1533 + parameterStringWithDefault: string; 1534 + /** 1535 + * This is a string with empty default 1536 + */ 1537 + parameterStringWithEmptyDefault: string; 1538 + /** 1539 + * This is a string with no default 1540 + */ 1541 + parameterStringWithNoDefault: string; 1542 + /** 1543 + * This is a string that can be null with no default 1544 + */ 1545 + parameterStringNullableWithNoDefault?: string | null; 1546 + /** 1547 + * This is a string that can be null with default 1548 + */ 1549 + parameterStringNullableWithDefault?: string | null; 1550 + }; 1551 + url: '/api/v{api-version}/defaults'; 1552 + }; 1553 + 1554 + export type DuplicateNameData = { 1555 + body?: never; 1556 + path?: never; 1557 + query?: never; 1558 + url: '/api/v{api-version}/duplicate'; 1559 + }; 1560 + 1561 + export type DuplicateName2Data = { 1562 + body?: never; 1563 + path?: never; 1564 + query?: never; 1565 + url: '/api/v{api-version}/duplicate'; 1566 + }; 1567 + 1568 + export type DuplicateName3Data = { 1569 + body?: never; 1570 + path?: never; 1571 + query?: never; 1572 + url: '/api/v{api-version}/duplicate'; 1573 + }; 1574 + 1575 + export type DuplicateName4Data = { 1576 + body?: never; 1577 + path?: never; 1578 + query?: never; 1579 + url: '/api/v{api-version}/duplicate'; 1580 + }; 1581 + 1582 + export type CallWithNoContentResponseData = { 1583 + body?: never; 1584 + path?: never; 1585 + query?: never; 1586 + url: '/api/v{api-version}/no-content'; 1587 + }; 1588 + 1589 + export type CallWithNoContentResponseResponses = { 1590 + /** 1591 + * Success 1592 + */ 1593 + 204: void; 1594 + }; 1595 + 1596 + export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; 1597 + 1598 + export type CallWithResponseAndNoContentResponseData = { 1599 + body?: never; 1600 + path?: never; 1601 + query?: never; 1602 + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; 1603 + }; 1604 + 1605 + export type CallWithResponseAndNoContentResponseResponses = { 1606 + /** 1607 + * Response is a simple number 1608 + */ 1609 + 200: number; 1610 + /** 1611 + * Success 1612 + */ 1613 + 204: void; 1614 + }; 1615 + 1616 + export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; 1617 + 1618 + export type DummyAData = { 1619 + body?: never; 1620 + path?: never; 1621 + query?: never; 1622 + url: '/api/v{api-version}/multiple-tags/a'; 1623 + }; 1624 + 1625 + export type DummyAResponses = { 1626 + 200: _400; 1627 + }; 1628 + 1629 + export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; 1630 + 1631 + export type DummyBData = { 1632 + body?: never; 1633 + path?: never; 1634 + query?: never; 1635 + url: '/api/v{api-version}/multiple-tags/b'; 1636 + }; 1637 + 1638 + export type DummyBResponses = { 1639 + /** 1640 + * Success 1641 + */ 1642 + 204: void; 1643 + }; 1644 + 1645 + export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; 1646 + 1647 + export type CallWithResponseData = { 1648 + body?: never; 1649 + path?: never; 1650 + query?: never; 1651 + url: '/api/v{api-version}/response'; 1652 + }; 1653 + 1654 + export type CallWithResponseResponses = { 1655 + default: Import; 1656 + }; 1657 + 1658 + export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; 1659 + 1660 + export type CallWithDuplicateResponsesData = { 1661 + body?: never; 1662 + path?: never; 1663 + query?: never; 1664 + url: '/api/v{api-version}/response'; 1665 + }; 1666 + 1667 + export type CallWithDuplicateResponsesErrors = { 1668 + /** 1669 + * Message for 500 error 1670 + */ 1671 + 500: ModelWithStringError; 1672 + /** 1673 + * Message for 501 error 1674 + */ 1675 + 501: ModelWithStringError; 1676 + /** 1677 + * Message for 502 error 1678 + */ 1679 + 502: ModelWithStringError; 1680 + /** 1681 + * Message for 4XX errors 1682 + */ 1683 + '4XX': DictionaryWithArray; 1684 + /** 1685 + * Default error response 1686 + */ 1687 + default: ModelWithBoolean; 1688 + }; 1689 + 1690 + export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; 1691 + 1692 + export type CallWithDuplicateResponsesResponses = { 1693 + /** 1694 + * Message for 200 response 1695 + */ 1696 + 200: ModelWithBoolean & ModelWithInteger; 1697 + /** 1698 + * Message for 201 response 1699 + */ 1700 + 201: ModelWithString; 1701 + /** 1702 + * Message for 202 response 1703 + */ 1704 + 202: ModelWithString; 1705 + }; 1706 + 1707 + export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; 1708 + 1709 + export type CallWithResponsesData = { 1710 + body?: never; 1711 + path?: never; 1712 + query?: never; 1713 + url: '/api/v{api-version}/response'; 1714 + }; 1715 + 1716 + export type CallWithResponsesErrors = { 1717 + /** 1718 + * Message for 500 error 1719 + */ 1720 + 500: ModelWithStringError; 1721 + /** 1722 + * Message for 501 error 1723 + */ 1724 + 501: ModelWithStringError; 1725 + /** 1726 + * Message for 502 error 1727 + */ 1728 + 502: ModelWithStringError; 1729 + /** 1730 + * Message for default response 1731 + */ 1732 + default: ModelWithStringError; 1733 + }; 1734 + 1735 + export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; 1736 + 1737 + export type CallWithResponsesResponses = { 1738 + /** 1739 + * Message for 200 response 1740 + */ 1741 + 200: { 1742 + readonly '@namespace.string'?: string; 1743 + readonly '@namespace.integer'?: number; 1744 + readonly value?: Array<ModelWithString>; 1745 + }; 1746 + /** 1747 + * Message for 201 response 1748 + */ 1749 + 201: ModelThatExtends; 1750 + /** 1751 + * Message for 202 response 1752 + */ 1753 + 202: ModelThatExtendsExtends; 1754 + }; 1755 + 1756 + export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; 1757 + 1758 + export type CollectionFormatData = { 1759 + body?: never; 1760 + path?: never; 1761 + query: { 1762 + /** 1763 + * This is an array parameter that is sent as csv format (comma-separated values) 1764 + */ 1765 + parameterArrayCSV: Array<string> | null; 1766 + /** 1767 + * This is an array parameter that is sent as ssv format (space-separated values) 1768 + */ 1769 + parameterArraySSV: Array<string> | null; 1770 + /** 1771 + * This is an array parameter that is sent as tsv format (tab-separated values) 1772 + */ 1773 + parameterArrayTSV: Array<string> | null; 1774 + /** 1775 + * This is an array parameter that is sent as pipes format (pipe-separated values) 1776 + */ 1777 + parameterArrayPipes: Array<string> | null; 1778 + /** 1779 + * This is an array parameter that is sent as multi format (multiple parameter instances) 1780 + */ 1781 + parameterArrayMulti: Array<string> | null; 1782 + }; 1783 + url: '/api/v{api-version}/collectionFormat'; 1784 + }; 1785 + 1786 + export type TypesData = { 1787 + body?: never; 1788 + path?: { 1789 + /** 1790 + * This is a number parameter 1791 + */ 1792 + id?: number; 1793 + }; 1794 + query: { 1795 + /** 1796 + * This is a number parameter 1797 + */ 1798 + parameterNumber: number; 1799 + /** 1800 + * This is a string parameter 1801 + */ 1802 + parameterString: string | null; 1803 + /** 1804 + * This is a boolean parameter 1805 + */ 1806 + parameterBoolean: boolean | null; 1807 + /** 1808 + * This is an object parameter 1809 + */ 1810 + parameterObject: { 1811 + [key: string]: unknown; 1812 + } | null; 1813 + /** 1814 + * This is an array parameter 1815 + */ 1816 + parameterArray: Array<string> | null; 1817 + /** 1818 + * This is a dictionary parameter 1819 + */ 1820 + parameterDictionary: { 1821 + [key: string]: unknown; 1822 + } | null; 1823 + /** 1824 + * This is an enum parameter 1825 + */ 1826 + parameterEnum: 'Success' | 'Warning' | 'Error' | null; 1827 + }; 1828 + url: '/api/v{api-version}/types'; 1829 + }; 1830 + 1831 + export type TypesResponses = { 1832 + /** 1833 + * Response is a simple number 1834 + */ 1835 + 200: number; 1836 + /** 1837 + * Response is a simple string 1838 + */ 1839 + 201: string; 1840 + /** 1841 + * Response is a simple boolean 1842 + */ 1843 + 202: boolean; 1844 + /** 1845 + * Response is a simple object 1846 + */ 1847 + 203: { 1848 + [key: string]: unknown; 1849 + }; 1850 + }; 1851 + 1852 + export type TypesResponse = TypesResponses[keyof TypesResponses]; 1853 + 1854 + export type UploadFileData = { 1855 + body: Blob | File; 1856 + path: { 1857 + /** 1858 + * api-version should be required in standalone clients 1859 + */ 1860 + 'api-version': string | null; 1861 + }; 1862 + query?: never; 1863 + url: '/api/v{api-version}/upload'; 1864 + }; 1865 + 1866 + export type UploadFileResponses = { 1867 + 200: boolean; 1868 + }; 1869 + 1870 + export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; 1871 + 1872 + export type FileResponseData = { 1873 + body?: never; 1874 + path: { 1875 + id: string; 1876 + /** 1877 + * api-version should be required in standalone clients 1878 + */ 1879 + 'api-version': string; 1880 + }; 1881 + query?: never; 1882 + url: '/api/v{api-version}/file/{id}'; 1883 + }; 1884 + 1885 + export type FileResponseResponses = { 1886 + /** 1887 + * Success 1888 + */ 1889 + 200: Blob | File; 1890 + }; 1891 + 1892 + export type FileResponseResponse = FileResponseResponses[keyof FileResponseResponses]; 1893 + 1894 + export type ComplexTypesData = { 1895 + body?: never; 1896 + path?: never; 1897 + query: { 1898 + /** 1899 + * Parameter containing object 1900 + */ 1901 + parameterObject: { 1902 + first?: { 1903 + second?: { 1904 + third?: string; 1905 + }; 1906 + }; 1907 + }; 1908 + /** 1909 + * Parameter containing reference 1910 + */ 1911 + parameterReference: ModelWithString; 1912 + }; 1913 + url: '/api/v{api-version}/complex'; 1914 + }; 1915 + 1916 + export type ComplexTypesErrors = { 1917 + /** 1918 + * 400 `server` error 1919 + */ 1920 + 400: unknown; 1921 + /** 1922 + * 500 server error 1923 + */ 1924 + 500: unknown; 1925 + }; 1926 + 1927 + export type ComplexTypesResponses = { 1928 + /** 1929 + * Successful response 1930 + */ 1931 + 200: Array<ModelWithString>; 1932 + }; 1933 + 1934 + export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; 1935 + 1936 + export type MultipartResponseData = { 1937 + body?: never; 1938 + path?: never; 1939 + query?: never; 1940 + url: '/api/v{api-version}/multipart'; 1941 + }; 1942 + 1943 + export type MultipartResponseResponses = { 1944 + /** 1945 + * OK 1946 + */ 1947 + 200: { 1948 + file?: Blob | File; 1949 + metadata?: { 1950 + foo?: string; 1951 + bar?: string; 1952 + }; 1953 + }; 1954 + }; 1955 + 1956 + export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; 1957 + 1958 + export type MultipartRequestData = { 1959 + body?: { 1960 + content?: Blob | File; 1961 + data?: ModelWithString | null; 1962 + }; 1963 + path?: never; 1964 + query?: never; 1965 + url: '/api/v{api-version}/multipart'; 1966 + }; 1967 + 1968 + export type ComplexParamsData = { 1969 + body?: { 1970 + readonly key: string | null; 1971 + name: string | null; 1972 + enabled?: boolean; 1973 + type: 'Monkey' | 'Horse' | 'Bird'; 1974 + listOfModels?: Array<ModelWithString> | null; 1975 + listOfStrings?: Array<string> | null; 1976 + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 1977 + readonly user?: { 1978 + readonly id?: number; 1979 + readonly name?: string | null; 1980 + }; 1981 + }; 1982 + path: { 1983 + id: number; 1984 + /** 1985 + * api-version should be required in standalone clients 1986 + */ 1987 + 'api-version': string; 1988 + }; 1989 + query?: never; 1990 + url: '/api/v{api-version}/complex/{id}'; 1991 + }; 1992 + 1993 + export type ComplexParamsResponses = { 1994 + /** 1995 + * Success 1996 + */ 1997 + 200: ModelWithString; 1998 + }; 1999 + 2000 + export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; 2001 + 2002 + export type CallWithResultFromHeaderData = { 2003 + body?: never; 2004 + path?: never; 2005 + query?: never; 2006 + url: '/api/v{api-version}/header'; 2007 + }; 2008 + 2009 + export type CallWithResultFromHeaderErrors = { 2010 + /** 2011 + * 400 server error 2012 + */ 2013 + 400: unknown; 2014 + /** 2015 + * 500 server error 2016 + */ 2017 + 500: unknown; 2018 + }; 2019 + 2020 + export type CallWithResultFromHeaderResponses = { 2021 + /** 2022 + * Successful response 2023 + */ 2024 + 200: unknown; 2025 + }; 2026 + 2027 + export type TestErrorCodeData = { 2028 + body?: never; 2029 + path?: never; 2030 + query: { 2031 + /** 2032 + * Status code to return 2033 + */ 2034 + status: number; 2035 + }; 2036 + url: '/api/v{api-version}/error'; 2037 + }; 2038 + 2039 + export type TestErrorCodeErrors = { 2040 + /** 2041 + * Custom message: Internal Server Error 2042 + */ 2043 + 500: unknown; 2044 + /** 2045 + * Custom message: Not Implemented 2046 + */ 2047 + 501: unknown; 2048 + /** 2049 + * Custom message: Bad Gateway 2050 + */ 2051 + 502: unknown; 2052 + /** 2053 + * Custom message: Service Unavailable 2054 + */ 2055 + 503: unknown; 2056 + }; 2057 + 2058 + export type TestErrorCodeResponses = { 2059 + /** 2060 + * Custom message: Successful response 2061 + */ 2062 + 200: unknown; 2063 + }; 2064 + 2065 + export type NonAsciiæøåÆøÅöôêÊ字符串Data = { 2066 + body?: never; 2067 + path?: never; 2068 + query: { 2069 + /** 2070 + * Dummy input param 2071 + */ 2072 + nonAsciiParamæøåÆØÅöôêÊ: number; 2073 + }; 2074 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2075 + }; 2076 + 2077 + export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { 2078 + /** 2079 + * Successful response 2080 + */ 2081 + 200: Array<NonAsciiStringæøåÆøÅöôêÊ字符串>; 2082 + }; 2083 + 2084 + export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; 2085 + 2086 + export type PutWithFormUrlEncodedData = { 2087 + body: ArrayWithStrings; 2088 + path?: never; 2089 + query?: never; 2090 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2091 + };
+16
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { type ClientOptions, type Config, createClient, createConfig } from './client/index.js'; 4 + import type { ClientOptions as ClientOptions2 } from './types.gen.js'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 15 + 16 + export const client = createClient(createConfig<ClientOptions2>({ baseUrl: 'http://localhost:3000/base' }));
+341
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/client/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { HTTPError, Options as KyOptions } from 'ky'; 4 + import ky from 'ky'; 5 + 6 + import { createSseClient } from '../core/serverSentEvents.gen.js'; 7 + import type { HttpMethod } from '../core/types.gen.js'; 8 + import { getValidRequestBody } from '../core/utils.gen.js'; 9 + import type { 10 + Client, 11 + Config, 12 + RequestOptions, 13 + ResolvedRequestOptions, 14 + RetryOptions, 15 + } from './types.gen.js'; 16 + import type { Middleware } from './utils.gen.js'; 17 + import { 18 + buildUrl, 19 + createConfig, 20 + createInterceptors, 21 + getParseAs, 22 + mergeConfigs, 23 + mergeHeaders, 24 + setAuthParams, 25 + } from './utils.gen.js'; 26 + 27 + export const createClient = (config: Config = {}): Client => { 28 + let _config = mergeConfigs(createConfig(), config); 29 + 30 + const getConfig = (): Config => ({ ..._config }); 31 + 32 + const setConfig = (config: Config): Config => { 33 + _config = mergeConfigs(_config, config); 34 + return getConfig(); 35 + }; 36 + 37 + const interceptors = createInterceptors< 38 + Request, 39 + Response, 40 + unknown, 41 + ResolvedRequestOptions 42 + >(); 43 + 44 + const beforeRequest = async (options: RequestOptions) => { 45 + const opts = { 46 + ..._config, 47 + ...options, 48 + headers: mergeHeaders(_config.headers, options.headers), 49 + ky: options.ky ?? _config.ky ?? ky, 50 + serializedBody: undefined, 51 + }; 52 + 53 + if (opts.security) { 54 + await setAuthParams({ 55 + ...opts, 56 + security: opts.security, 57 + }); 58 + } 59 + 60 + if (opts.requestValidator) { 61 + await opts.requestValidator(opts); 62 + } 63 + 64 + if (opts.body !== undefined && opts.bodySerializer) { 65 + opts.serializedBody = opts.bodySerializer(opts.body); 66 + } 67 + 68 + if (opts.body === undefined || opts.serializedBody === '') { 69 + opts.headers.delete('Content-Type'); 70 + } 71 + 72 + const url = buildUrl(opts); 73 + 74 + return { opts, url }; 75 + }; 76 + 77 + const parseErrorResponse = async ( 78 + response: Response, 79 + request: Request, 80 + opts: ResolvedRequestOptions, 81 + interceptorsMiddleware: Middleware< 82 + Request, 83 + Response, 84 + unknown, 85 + ResolvedRequestOptions 86 + >, 87 + ) => { 88 + const result = { 89 + request, 90 + response, 91 + }; 92 + 93 + const textError = await response.text(); 94 + let jsonError: unknown; 95 + 96 + try { 97 + jsonError = JSON.parse(textError); 98 + } catch { 99 + jsonError = undefined; 100 + } 101 + 102 + const error = jsonError ?? textError; 103 + let finalError = error; 104 + 105 + for (const fn of interceptorsMiddleware.error.fns) { 106 + if (fn) { 107 + finalError = (await fn(error, response, request, opts)) as string; 108 + } 109 + } 110 + 111 + finalError = finalError || ({} as string); 112 + 113 + if (opts.throwOnError) { 114 + throw finalError; 115 + } 116 + 117 + return opts.responseStyle === 'data' 118 + ? undefined 119 + : { 120 + error: finalError, 121 + ...result, 122 + }; 123 + }; 124 + 125 + const request: Client['request'] = async (options) => { 126 + // @ts-expect-error 127 + const { opts, url } = await beforeRequest(options); 128 + 129 + const kyInstance = opts.ky!; 130 + 131 + const validBody = getValidRequestBody(opts); 132 + 133 + const kyOptions: KyOptions = { 134 + body: validBody as BodyInit, 135 + cache: opts.cache, 136 + credentials: opts.credentials, 137 + headers: opts.headers, 138 + integrity: opts.integrity, 139 + keepalive: opts.keepalive, 140 + method: opts.method as KyOptions['method'], 141 + mode: opts.mode, 142 + redirect: 'follow', 143 + referrer: opts.referrer, 144 + referrerPolicy: opts.referrerPolicy, 145 + signal: opts.signal, 146 + throwHttpErrors: opts.throwOnError ?? false, 147 + timeout: opts.timeout, 148 + ...opts.kyOptions, 149 + }; 150 + 151 + if (opts.retry && typeof opts.retry === 'object') { 152 + const retryOpts = opts.retry as RetryOptions; 153 + kyOptions.retry = { 154 + limit: retryOpts.limit ?? 2, 155 + methods: retryOpts.methods as Array< 156 + | 'get' 157 + | 'post' 158 + | 'put' 159 + | 'patch' 160 + | 'head' 161 + | 'delete' 162 + | 'options' 163 + | 'trace' 164 + >, 165 + statusCodes: retryOpts.statusCodes, 166 + }; 167 + } 168 + 169 + let request = new Request(url, { 170 + body: kyOptions.body as BodyInit, 171 + headers: kyOptions.headers as HeadersInit, 172 + method: kyOptions.method, 173 + }); 174 + 175 + for (const fn of interceptors.request.fns) { 176 + if (fn) { 177 + request = await fn(request, opts); 178 + } 179 + } 180 + 181 + let response: Response; 182 + 183 + try { 184 + response = await kyInstance(request, kyOptions); 185 + } catch (error) { 186 + if (error && typeof error === 'object' && 'response' in error) { 187 + const httpError = error as HTTPError; 188 + response = httpError.response; 189 + 190 + for (const fn of interceptors.response.fns) { 191 + if (fn) { 192 + response = await fn(response, request, opts); 193 + } 194 + } 195 + 196 + return parseErrorResponse(response, request, opts, interceptors); 197 + } 198 + 199 + throw error; 200 + } 201 + 202 + for (const fn of interceptors.response.fns) { 203 + if (fn) { 204 + response = await fn(response, request, opts); 205 + } 206 + } 207 + 208 + const result = { 209 + request, 210 + response, 211 + }; 212 + 213 + if (response.ok) { 214 + const parseAs = 215 + (opts.parseAs === 'auto' 216 + ? getParseAs(response.headers.get('Content-Type')) 217 + : opts.parseAs) ?? 'json'; 218 + 219 + if ( 220 + response.status === 204 || 221 + response.headers.get('Content-Length') === '0' 222 + ) { 223 + let emptyData: any; 224 + switch (parseAs) { 225 + case 'arrayBuffer': 226 + case 'blob': 227 + case 'text': 228 + emptyData = await response[parseAs](); 229 + break; 230 + case 'formData': 231 + emptyData = new FormData(); 232 + break; 233 + case 'stream': 234 + emptyData = response.body; 235 + break; 236 + case 'json': 237 + default: 238 + emptyData = {}; 239 + break; 240 + } 241 + return opts.responseStyle === 'data' 242 + ? emptyData 243 + : { 244 + data: emptyData, 245 + ...result, 246 + }; 247 + } 248 + 249 + let data: any; 250 + switch (parseAs) { 251 + case 'arrayBuffer': 252 + case 'blob': 253 + case 'formData': 254 + case 'json': 255 + case 'text': 256 + data = await response[parseAs](); 257 + break; 258 + case 'stream': 259 + return opts.responseStyle === 'data' 260 + ? response.body 261 + : { 262 + data: response.body, 263 + ...result, 264 + }; 265 + } 266 + 267 + if (parseAs === 'json') { 268 + if (opts.responseValidator) { 269 + await opts.responseValidator(data); 270 + } 271 + 272 + if (opts.responseTransformer) { 273 + data = await opts.responseTransformer(data); 274 + } 275 + } 276 + 277 + return opts.responseStyle === 'data' 278 + ? data 279 + : { 280 + data, 281 + ...result, 282 + }; 283 + } 284 + 285 + return parseErrorResponse(response, request, opts, interceptors); 286 + }; 287 + 288 + const makeMethodFn = 289 + (method: Uppercase<HttpMethod>) => (options: RequestOptions) => 290 + request({ ...options, method }); 291 + 292 + const makeSseFn = 293 + (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => { 294 + const { opts, url } = await beforeRequest(options); 295 + return createSseClient({ 296 + ...opts, 297 + body: opts.body as BodyInit | null | undefined, 298 + fetch: globalThis.fetch, 299 + headers: opts.headers as unknown as Record<string, string>, 300 + method, 301 + onRequest: async (url, init) => { 302 + let request = new Request(url, init); 303 + for (const fn of interceptors.request.fns) { 304 + if (fn) { 305 + request = await fn(request, opts); 306 + } 307 + } 308 + return request; 309 + }, 310 + url, 311 + }); 312 + }; 313 + 314 + return { 315 + buildUrl, 316 + connect: makeMethodFn('CONNECT'), 317 + delete: makeMethodFn('DELETE'), 318 + get: makeMethodFn('GET'), 319 + getConfig, 320 + head: makeMethodFn('HEAD'), 321 + interceptors, 322 + options: makeMethodFn('OPTIONS'), 323 + patch: makeMethodFn('PATCH'), 324 + post: makeMethodFn('POST'), 325 + put: makeMethodFn('PUT'), 326 + request, 327 + setConfig, 328 + sse: { 329 + connect: makeSseFn('CONNECT'), 330 + delete: makeSseFn('DELETE'), 331 + get: makeSseFn('GET'), 332 + head: makeSseFn('HEAD'), 333 + options: makeSseFn('OPTIONS'), 334 + patch: makeSseFn('PATCH'), 335 + post: makeSseFn('POST'), 336 + put: makeSseFn('PUT'), 337 + trace: makeSseFn('TRACE'), 338 + }, 339 + trace: makeMethodFn('TRACE'), 340 + } as Client; 341 + };
+26
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/client/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type { Auth } from '../core/auth.gen.js'; 4 + export type { QuerySerializerOptions } from '../core/bodySerializer.gen.js'; 5 + export { 6 + formDataBodySerializer, 7 + jsonBodySerializer, 8 + urlSearchParamsBodySerializer, 9 + } from '../core/bodySerializer.gen.js'; 10 + export { buildClientParams } from '../core/params.gen.js'; 11 + export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen.js'; 12 + export { createClient } from './client.gen.js'; 13 + export type { 14 + Client, 15 + ClientOptions, 16 + Config, 17 + CreateClientConfig, 18 + Options, 19 + RequestOptions, 20 + RequestResult, 21 + ResolvedRequestOptions, 22 + ResponseStyle, 23 + RetryOptions, 24 + TDataShape, 25 + } from './types.gen.js'; 26 + export { createConfig, mergeHeaders } from './utils.gen.js';
+273
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/client/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth } from '../core/auth.gen.js'; 4 + import type { 5 + ServerSentEventsOptions, 6 + ServerSentEventsResult, 7 + } from '../core/serverSentEvents.gen.js'; 8 + import type { 9 + Client as CoreClient, 10 + Config as CoreConfig, 11 + } from '../core/types.gen.js'; 12 + import type { Middleware } from './utils.gen.js'; 13 + 14 + export type ResponseStyle = 'data' | 'fields'; 15 + 16 + export interface RetryOptions { 17 + /** 18 + * Maximum number of retry attempts 19 + * 20 + * @default 2 21 + */ 22 + limit?: number; 23 + /** 24 + * HTTP methods to retry 25 + * 26 + * @default ['get', 'put', 'head', 'delete', 'options', 'trace'] 27 + */ 28 + methods?: Array< 29 + 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options' | 'trace' 30 + >; 31 + /** 32 + * HTTP status codes to retry 33 + * 34 + * @default [408, 413, 429, 500, 502, 503, 504] 35 + */ 36 + statusCodes?: number[]; 37 + } 38 + 39 + export interface Config<T extends ClientOptions = ClientOptions> 40 + extends Omit< 41 + import('ky').Options, 42 + 'body' | 'headers' | 'method' | 'prefixUrl' | 'retry' | 'throwHttpErrors' 43 + >, 44 + CoreConfig { 45 + /** 46 + * Base URL for all requests made by this client. 47 + */ 48 + baseUrl?: T['baseUrl']; 49 + /** 50 + * Ky instance to use. You can use this option to provide a custom 51 + * ky instance. 52 + */ 53 + ky?: typeof import('ky').default; 54 + /** 55 + * Additional ky-specific options that will be passed directly to ky. 56 + * This allows you to use any ky option not explicitly exposed in the config. 57 + */ 58 + kyOptions?: Omit<import('ky').Options, 'method' | 'prefixUrl'>; 59 + /** 60 + * Return the response data parsed in a specified format. By default, `auto` 61 + * will infer the appropriate method from the `Content-Type` response header. 62 + * You can override this behavior with any of the {@link Body} methods. 63 + * Select `stream` if you don't want to parse response data at all. 64 + * 65 + * @default 'auto' 66 + */ 67 + parseAs?: 68 + | 'arrayBuffer' 69 + | 'auto' 70 + | 'blob' 71 + | 'formData' 72 + | 'json' 73 + | 'stream' 74 + | 'text'; 75 + /** 76 + * Should we return only data or multiple fields (data, error, response, etc.)? 77 + * 78 + * @default 'fields' 79 + */ 80 + responseStyle?: ResponseStyle; 81 + /** 82 + * Retry configuration 83 + */ 84 + retry?: RetryOptions; 85 + /** 86 + * Throw an error instead of returning it in the response? 87 + * 88 + * @default false 89 + */ 90 + throwOnError?: T['throwOnError']; 91 + /** 92 + * Request timeout in milliseconds 93 + * 94 + * @default 10000 95 + */ 96 + timeout?: number; 97 + } 98 + 99 + export interface RequestOptions< 100 + TData = unknown, 101 + TResponseStyle extends ResponseStyle = 'fields', 102 + ThrowOnError extends boolean = boolean, 103 + Url extends string = string, 104 + > extends Config<{ 105 + responseStyle: TResponseStyle; 106 + throwOnError: ThrowOnError; 107 + }>, 108 + Pick< 109 + ServerSentEventsOptions<TData>, 110 + | 'onSseError' 111 + | 'onSseEvent' 112 + | 'sseDefaultRetryDelay' 113 + | 'sseMaxRetryAttempts' 114 + | 'sseMaxRetryDelay' 115 + > { 116 + /** 117 + * Any body that you want to add to your request. 118 + * 119 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} 120 + */ 121 + body?: unknown; 122 + path?: Record<string, unknown>; 123 + query?: Record<string, unknown>; 124 + /** 125 + * Security mechanism(s) to use for the request. 126 + */ 127 + security?: ReadonlyArray<Auth>; 128 + url: Url; 129 + } 130 + 131 + export interface ResolvedRequestOptions< 132 + TResponseStyle extends ResponseStyle = 'fields', 133 + ThrowOnError extends boolean = boolean, 134 + Url extends string = string, 135 + > extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> { 136 + serializedBody?: string; 137 + } 138 + 139 + export type RequestResult< 140 + TData = unknown, 141 + TError = unknown, 142 + ThrowOnError extends boolean = boolean, 143 + TResponseStyle extends ResponseStyle = 'fields', 144 + > = ThrowOnError extends true 145 + ? Promise< 146 + TResponseStyle extends 'data' 147 + ? TData extends Record<string, unknown> 148 + ? TData[keyof TData] 149 + : TData 150 + : { 151 + data: TData extends Record<string, unknown> 152 + ? TData[keyof TData] 153 + : TData; 154 + request: Request; 155 + response: Response; 156 + } 157 + > 158 + : Promise< 159 + TResponseStyle extends 'data' 160 + ? 161 + | (TData extends Record<string, unknown> 162 + ? TData[keyof TData] 163 + : TData) 164 + | undefined 165 + : ( 166 + | { 167 + data: TData extends Record<string, unknown> 168 + ? TData[keyof TData] 169 + : TData; 170 + error: undefined; 171 + } 172 + | { 173 + data: undefined; 174 + error: TError extends Record<string, unknown> 175 + ? TError[keyof TError] 176 + : TError; 177 + } 178 + ) & { 179 + request: Request; 180 + response: Response; 181 + } 182 + >; 183 + 184 + export interface ClientOptions { 185 + baseUrl?: string; 186 + responseStyle?: ResponseStyle; 187 + throwOnError?: boolean; 188 + } 189 + 190 + type MethodFn = < 191 + TData = unknown, 192 + TError = unknown, 193 + ThrowOnError extends boolean = false, 194 + TResponseStyle extends ResponseStyle = 'fields', 195 + >( 196 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>, 197 + ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>; 198 + 199 + type SseFn = < 200 + TData = unknown, 201 + TError = unknown, 202 + ThrowOnError extends boolean = false, 203 + TResponseStyle extends ResponseStyle = 'fields', 204 + >( 205 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>, 206 + ) => Promise<ServerSentEventsResult<TData, TError>>; 207 + 208 + type RequestFn = < 209 + TData = unknown, 210 + TError = unknown, 211 + ThrowOnError extends boolean = false, 212 + TResponseStyle extends ResponseStyle = 'fields', 213 + >( 214 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & 215 + Pick< 216 + Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 217 + 'method' 218 + >, 219 + ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>; 220 + 221 + type BuildUrlFn = < 222 + TData extends { 223 + body?: unknown; 224 + path?: Record<string, unknown>; 225 + query?: Record<string, unknown>; 226 + url: string; 227 + }, 228 + >( 229 + options: TData & Options<TData>, 230 + ) => string; 231 + 232 + export type Client = CoreClient< 233 + RequestFn, 234 + Config, 235 + MethodFn, 236 + BuildUrlFn, 237 + SseFn 238 + > & { 239 + interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>; 240 + }; 241 + 242 + /** 243 + * The `createClientConfig()` function will be called on client initialization 244 + * and the returned object will become the client's initial configuration. 245 + * 246 + * You may want to initialize your client this way instead of calling 247 + * `setConfig()`. This is useful for example if you're using Next.js 248 + * to ensure your client always has the correct values. 249 + */ 250 + export type CreateClientConfig<T extends ClientOptions = ClientOptions> = ( 251 + override?: Config<ClientOptions & T>, 252 + ) => Config<Required<ClientOptions> & T>; 253 + 254 + export interface TDataShape { 255 + body?: unknown; 256 + headers?: unknown; 257 + path?: unknown; 258 + query?: unknown; 259 + url: string; 260 + } 261 + 262 + type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>; 263 + 264 + export type Options< 265 + TData extends TDataShape = TDataShape, 266 + ThrowOnError extends boolean = boolean, 267 + TResponse = unknown, 268 + TResponseStyle extends ResponseStyle = 'fields', 269 + > = OmitKeys< 270 + RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 271 + 'body' | 'path' | 'query' | 'url' 272 + > & 273 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
+330
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/client/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { getAuthToken } from '../core/auth.gen.js'; 4 + import type { QuerySerializerOptions } from '../core/bodySerializer.gen.js'; 5 + import { jsonBodySerializer } from '../core/bodySerializer.gen.js'; 6 + import { 7 + serializeArrayParam, 8 + serializeObjectParam, 9 + serializePrimitiveParam, 10 + } from '../core/pathSerializer.gen.js'; 11 + import { getUrl } from '../core/utils.gen.js'; 12 + import type { Client, ClientOptions, Config, RequestOptions } from './types.gen.js'; 13 + 14 + export const createQuerySerializer = <T = unknown>({ 15 + parameters = {}, 16 + ...args 17 + }: QuerySerializerOptions = {}) => { 18 + const querySerializer = (queryParams: T) => { 19 + const search: string[] = []; 20 + if (queryParams && typeof queryParams === 'object') { 21 + for (const name in queryParams) { 22 + const value = queryParams[name]; 23 + 24 + if (value === undefined || value === null) { 25 + continue; 26 + } 27 + 28 + const options = parameters[name] || args; 29 + 30 + if (Array.isArray(value)) { 31 + const serializedArray = serializeArrayParam({ 32 + allowReserved: options.allowReserved, 33 + explode: true, 34 + name, 35 + style: 'form', 36 + value, 37 + ...options.array, 38 + }); 39 + if (serializedArray) search.push(serializedArray); 40 + } else if (typeof value === 'object') { 41 + const serializedObject = serializeObjectParam({ 42 + allowReserved: options.allowReserved, 43 + explode: true, 44 + name, 45 + style: 'deepObject', 46 + value: value as Record<string, unknown>, 47 + ...options.object, 48 + }); 49 + if (serializedObject) search.push(serializedObject); 50 + } else { 51 + const serializedPrimitive = serializePrimitiveParam({ 52 + allowReserved: options.allowReserved, 53 + name, 54 + value: value as string, 55 + }); 56 + if (serializedPrimitive) search.push(serializedPrimitive); 57 + } 58 + } 59 + } 60 + return search.join('&'); 61 + }; 62 + return querySerializer; 63 + }; 64 + 65 + /** 66 + * Infers parseAs value from provided Content-Type header. 67 + */ 68 + export const getParseAs = ( 69 + contentType: string | null, 70 + ): Exclude<Config['parseAs'], 'auto'> => { 71 + if (!contentType) { 72 + return 'stream'; 73 + } 74 + 75 + const cleanContent = contentType.split(';')[0]?.trim(); 76 + 77 + if (!cleanContent) { 78 + return; 79 + } 80 + 81 + if ( 82 + cleanContent.startsWith('application/json') || 83 + cleanContent.endsWith('+json') 84 + ) { 85 + return 'json'; 86 + } 87 + 88 + if (cleanContent === 'multipart/form-data') { 89 + return 'formData'; 90 + } 91 + 92 + if ( 93 + ['application/', 'audio/', 'image/', 'video/'].some((type) => 94 + cleanContent.startsWith(type), 95 + ) 96 + ) { 97 + return 'blob'; 98 + } 99 + 100 + if (cleanContent.startsWith('text/')) { 101 + return 'text'; 102 + } 103 + 104 + return; 105 + }; 106 + 107 + const checkForExistence = ( 108 + options: Pick<RequestOptions, 'auth' | 'query'> & { 109 + headers: Headers; 110 + }, 111 + name?: string, 112 + ): boolean => { 113 + if (!name) { 114 + return false; 115 + } 116 + if ( 117 + options.headers.has(name) || 118 + options.query?.[name] || 119 + options.headers.get('Cookie')?.includes(`${name}=`) 120 + ) { 121 + return true; 122 + } 123 + return false; 124 + }; 125 + 126 + export const setAuthParams = async ({ 127 + security, 128 + ...options 129 + }: Pick<Required<RequestOptions>, 'security'> & 130 + Pick<RequestOptions, 'auth' | 'query'> & { 131 + headers: Headers; 132 + }) => { 133 + for (const auth of security) { 134 + if (checkForExistence(options, auth.name)) { 135 + continue; 136 + } 137 + 138 + const token = await getAuthToken(auth, options.auth); 139 + 140 + if (!token) { 141 + continue; 142 + } 143 + 144 + const name = auth.name ?? 'Authorization'; 145 + 146 + switch (auth.in) { 147 + case 'query': 148 + if (!options.query) { 149 + options.query = {}; 150 + } 151 + options.query[name] = token; 152 + break; 153 + case 'cookie': 154 + options.headers.append('Cookie', `${name}=${token}`); 155 + break; 156 + case 'header': 157 + default: 158 + options.headers.set(name, token); 159 + break; 160 + } 161 + } 162 + }; 163 + 164 + export const buildUrl: Client['buildUrl'] = (options) => 165 + getUrl({ 166 + baseUrl: options.baseUrl as string, 167 + path: options.path, 168 + query: options.query, 169 + querySerializer: 170 + typeof options.querySerializer === 'function' 171 + ? options.querySerializer 172 + : createQuerySerializer(options.querySerializer), 173 + url: options.url, 174 + }); 175 + 176 + export const mergeConfigs = (a: Config, b: Config): Config => { 177 + const config = { ...a, ...b }; 178 + if (config.baseUrl?.endsWith('/')) { 179 + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); 180 + } 181 + config.headers = mergeHeaders(a.headers, b.headers); 182 + return config; 183 + }; 184 + 185 + const headersEntries = (headers: Headers): Array<[string, string]> => { 186 + const entries: Array<[string, string]> = []; 187 + headers.forEach((value, key) => { 188 + entries.push([key, value]); 189 + }); 190 + return entries; 191 + }; 192 + 193 + export const mergeHeaders = ( 194 + ...headers: Array<Required<Config>['headers'] | undefined> 195 + ): Headers => { 196 + const mergedHeaders = new Headers(); 197 + for (const header of headers) { 198 + if (!header) { 199 + continue; 200 + } 201 + 202 + const iterator = 203 + header instanceof Headers 204 + ? headersEntries(header) 205 + : Object.entries(header); 206 + 207 + for (const [key, value] of iterator) { 208 + if (value === null) { 209 + mergedHeaders.delete(key); 210 + } else if (Array.isArray(value)) { 211 + for (const v of value) { 212 + mergedHeaders.append(key, v as string); 213 + } 214 + } else if (value !== undefined) { 215 + mergedHeaders.set( 216 + key, 217 + typeof value === 'object' ? JSON.stringify(value) : (value as string), 218 + ); 219 + } 220 + } 221 + } 222 + return mergedHeaders; 223 + }; 224 + 225 + type ErrInterceptor<Err, Res, Req, Options> = ( 226 + error: Err, 227 + response: Res, 228 + request: Req, 229 + options: Options, 230 + ) => Err | Promise<Err>; 231 + 232 + type ReqInterceptor<Req, Options> = ( 233 + request: Req, 234 + options: Options, 235 + ) => Req | Promise<Req>; 236 + 237 + type ResInterceptor<Res, Req, Options> = ( 238 + response: Res, 239 + request: Req, 240 + options: Options, 241 + ) => Res | Promise<Res>; 242 + 243 + class Interceptors<Interceptor> { 244 + fns: Array<Interceptor | null> = []; 245 + 246 + clear(): void { 247 + this.fns = []; 248 + } 249 + 250 + eject(id: number | Interceptor): void { 251 + const index = this.getInterceptorIndex(id); 252 + if (this.fns[index]) { 253 + this.fns[index] = null; 254 + } 255 + } 256 + 257 + exists(id: number | Interceptor): boolean { 258 + const index = this.getInterceptorIndex(id); 259 + return Boolean(this.fns[index]); 260 + } 261 + 262 + getInterceptorIndex(id: number | Interceptor): number { 263 + if (typeof id === 'number') { 264 + return this.fns[id] ? id : -1; 265 + } 266 + return this.fns.indexOf(id); 267 + } 268 + 269 + update( 270 + id: number | Interceptor, 271 + fn: Interceptor, 272 + ): number | Interceptor | false { 273 + const index = this.getInterceptorIndex(id); 274 + if (this.fns[index]) { 275 + this.fns[index] = fn; 276 + return id; 277 + } 278 + return false; 279 + } 280 + 281 + use(fn: Interceptor): number { 282 + this.fns.push(fn); 283 + return this.fns.length - 1; 284 + } 285 + } 286 + 287 + export interface Middleware<Req, Res, Err, Options> { 288 + error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>; 289 + request: Interceptors<ReqInterceptor<Req, Options>>; 290 + response: Interceptors<ResInterceptor<Res, Req, Options>>; 291 + } 292 + 293 + export const createInterceptors = <Req, Res, Err, Options>(): Middleware< 294 + Req, 295 + Res, 296 + Err, 297 + Options 298 + > => ({ 299 + error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(), 300 + request: new Interceptors<ReqInterceptor<Req, Options>>(), 301 + response: new Interceptors<ResInterceptor<Res, Req, Options>>(), 302 + }); 303 + 304 + const defaultQuerySerializer = createQuerySerializer({ 305 + allowReserved: false, 306 + array: { 307 + explode: true, 308 + style: 'form', 309 + }, 310 + object: { 311 + explode: true, 312 + style: 'deepObject', 313 + }, 314 + }); 315 + 316 + const defaultHeaders = { 317 + 'Content-Type': 'application/json', 318 + }; 319 + 320 + export const createConfig = <T extends ClientOptions = ClientOptions>( 321 + override: Config<Omit<ClientOptions, keyof T> & T> = {}, 322 + ): Config<Omit<ClientOptions, keyof T> & T> => ({ 323 + ...jsonBodySerializer, 324 + headers: defaultHeaders, 325 + parseAs: 'auto', 326 + querySerializer: defaultQuerySerializer, 327 + throwOnError: false, 328 + timeout: 10000, 329 + ...override, 330 + });
+42
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/core/auth.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type AuthToken = string | undefined; 4 + 5 + export interface Auth { 6 + /** 7 + * Which part of the request do we use to send the auth? 8 + * 9 + * @default 'header' 10 + */ 11 + in?: 'header' | 'query' | 'cookie'; 12 + /** 13 + * Header or query parameter name. 14 + * 15 + * @default 'Authorization' 16 + */ 17 + name?: string; 18 + scheme?: 'basic' | 'bearer'; 19 + type: 'apiKey' | 'http'; 20 + } 21 + 22 + export const getAuthToken = async ( 23 + auth: Auth, 24 + callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken, 25 + ): Promise<string | undefined> => { 26 + const token = 27 + typeof callback === 'function' ? await callback(auth) : callback; 28 + 29 + if (!token) { 30 + return; 31 + } 32 + 33 + if (auth.scheme === 'bearer') { 34 + return `Bearer ${token}`; 35 + } 36 + 37 + if (auth.scheme === 'basic') { 38 + return `Basic ${btoa(token)}`; 39 + } 40 + 41 + return token; 42 + };
+100
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/core/bodySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { 4 + ArrayStyle, 5 + ObjectStyle, 6 + SerializerOptions, 7 + } from './pathSerializer.gen.js'; 8 + 9 + export type QuerySerializer = (query: Record<string, unknown>) => string; 10 + 11 + export type BodySerializer = (body: any) => any; 12 + 13 + type QuerySerializerOptionsObject = { 14 + allowReserved?: boolean; 15 + array?: Partial<SerializerOptions<ArrayStyle>>; 16 + object?: Partial<SerializerOptions<ObjectStyle>>; 17 + }; 18 + 19 + export type QuerySerializerOptions = QuerySerializerOptionsObject & { 20 + /** 21 + * Per-parameter serialization overrides. When provided, these settings 22 + * override the global array/object settings for specific parameter names. 23 + */ 24 + parameters?: Record<string, QuerySerializerOptionsObject>; 25 + }; 26 + 27 + const serializeFormDataPair = ( 28 + data: FormData, 29 + key: string, 30 + value: unknown, 31 + ): void => { 32 + if (typeof value === 'string' || value instanceof Blob) { 33 + data.append(key, value); 34 + } else if (value instanceof Date) { 35 + data.append(key, value.toISOString()); 36 + } else { 37 + data.append(key, JSON.stringify(value)); 38 + } 39 + }; 40 + 41 + const serializeUrlSearchParamsPair = ( 42 + data: URLSearchParams, 43 + key: string, 44 + value: unknown, 45 + ): void => { 46 + if (typeof value === 'string') { 47 + data.append(key, value); 48 + } else { 49 + data.append(key, JSON.stringify(value)); 50 + } 51 + }; 52 + 53 + export const formDataBodySerializer = { 54 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 55 + body: T, 56 + ): FormData => { 57 + const data = new FormData(); 58 + 59 + Object.entries(body).forEach(([key, value]) => { 60 + if (value === undefined || value === null) { 61 + return; 62 + } 63 + if (Array.isArray(value)) { 64 + value.forEach((v) => serializeFormDataPair(data, key, v)); 65 + } else { 66 + serializeFormDataPair(data, key, value); 67 + } 68 + }); 69 + 70 + return data; 71 + }, 72 + }; 73 + 74 + export const jsonBodySerializer = { 75 + bodySerializer: <T>(body: T): string => 76 + JSON.stringify(body, (_key, value) => 77 + typeof value === 'bigint' ? value.toString() : value, 78 + ), 79 + }; 80 + 81 + export const urlSearchParamsBodySerializer = { 82 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 83 + body: T, 84 + ): string => { 85 + const data = new URLSearchParams(); 86 + 87 + Object.entries(body).forEach(([key, value]) => { 88 + if (value === undefined || value === null) { 89 + return; 90 + } 91 + if (Array.isArray(value)) { 92 + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); 93 + } else { 94 + serializeUrlSearchParamsPair(data, key, value); 95 + } 96 + }); 97 + 98 + return data.toString(); 99 + }, 100 + };
+176
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/core/params.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + type Slot = 'body' | 'headers' | 'path' | 'query'; 4 + 5 + export type Field = 6 + | { 7 + in: Exclude<Slot, 'body'>; 8 + /** 9 + * Field name. This is the name we want the user to see and use. 10 + */ 11 + key: string; 12 + /** 13 + * Field mapped name. This is the name we want to use in the request. 14 + * If omitted, we use the same value as `key`. 15 + */ 16 + map?: string; 17 + } 18 + | { 19 + in: Extract<Slot, 'body'>; 20 + /** 21 + * Key isn't required for bodies. 22 + */ 23 + key?: string; 24 + map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 36 + }; 37 + 38 + export interface Fields { 39 + allowExtra?: Partial<Record<Slot, boolean>>; 40 + args?: ReadonlyArray<Field>; 41 + } 42 + 43 + export type FieldsConfig = ReadonlyArray<Field | Fields>; 44 + 45 + const extraPrefixesMap: Record<string, Slot> = { 46 + $body_: 'body', 47 + $headers_: 'headers', 48 + $path_: 'path', 49 + $query_: 'query', 50 + }; 51 + const extraPrefixes = Object.entries(extraPrefixesMap); 52 + 53 + type KeyMap = Map< 54 + string, 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 63 + >; 64 + 65 + const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { 66 + if (!map) { 67 + map = new Map(); 68 + } 69 + 70 + for (const config of fields) { 71 + if ('in' in config) { 72 + if (config.key) { 73 + map.set(config.key, { 74 + in: config.in, 75 + map: config.map, 76 + }); 77 + } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 82 + } else if (config.args) { 83 + buildKeyMap(config.args, map); 84 + } 85 + } 86 + 87 + return map; 88 + }; 89 + 90 + interface Params { 91 + body: unknown; 92 + headers: Record<string, unknown>; 93 + path: Record<string, unknown>; 94 + query: Record<string, unknown>; 95 + } 96 + 97 + const stripEmptySlots = (params: Params) => { 98 + for (const [slot, value] of Object.entries(params)) { 99 + if (value && typeof value === 'object' && !Object.keys(value).length) { 100 + delete params[slot as Slot]; 101 + } 102 + } 103 + }; 104 + 105 + export const buildClientParams = ( 106 + args: ReadonlyArray<unknown>, 107 + fields: FieldsConfig, 108 + ) => { 109 + const params: Params = { 110 + body: {}, 111 + headers: {}, 112 + path: {}, 113 + query: {}, 114 + }; 115 + 116 + const map = buildKeyMap(fields); 117 + 118 + let config: FieldsConfig[number] | undefined; 119 + 120 + for (const [index, arg] of args.entries()) { 121 + if (fields[index]) { 122 + config = fields[index]; 123 + } 124 + 125 + if (!config) { 126 + continue; 127 + } 128 + 129 + if ('in' in config) { 130 + if (config.key) { 131 + const field = map.get(config.key)!; 132 + const name = field.map || config.key; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 136 + } else { 137 + params.body = arg; 138 + } 139 + } else { 140 + for (const [key, value] of Object.entries(arg ?? {})) { 141 + const field = map.get(key); 142 + 143 + if (field) { 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 150 + } else { 151 + const extra = extraPrefixes.find(([prefix]) => 152 + key.startsWith(prefix), 153 + ); 154 + 155 + if (extra) { 156 + const [prefix, slot] = extra; 157 + (params[slot] as Record<string, unknown>)[ 158 + key.slice(prefix.length) 159 + ] = value; 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 162 + if (allowed) { 163 + (params[slot as Slot] as Record<string, unknown>)[key] = value; 164 + break; 165 + } 166 + } 167 + } 168 + } 169 + } 170 + } 171 + } 172 + 173 + stripEmptySlots(params); 174 + 175 + return params; 176 + };
+181
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/core/pathSerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + interface SerializeOptions<T> 4 + extends SerializePrimitiveOptions, 5 + SerializerOptions<T> {} 6 + 7 + interface SerializePrimitiveOptions { 8 + allowReserved?: boolean; 9 + name: string; 10 + } 11 + 12 + export interface SerializerOptions<T> { 13 + /** 14 + * @default true 15 + */ 16 + explode: boolean; 17 + style: T; 18 + } 19 + 20 + export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; 21 + export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; 22 + type MatrixStyle = 'label' | 'matrix' | 'simple'; 23 + export type ObjectStyle = 'form' | 'deepObject'; 24 + type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; 25 + 26 + interface SerializePrimitiveParam extends SerializePrimitiveOptions { 27 + value: string; 28 + } 29 + 30 + export const separatorArrayExplode = (style: ArraySeparatorStyle) => { 31 + switch (style) { 32 + case 'label': 33 + return '.'; 34 + case 'matrix': 35 + return ';'; 36 + case 'simple': 37 + return ','; 38 + default: 39 + return '&'; 40 + } 41 + }; 42 + 43 + export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { 44 + switch (style) { 45 + case 'form': 46 + return ','; 47 + case 'pipeDelimited': 48 + return '|'; 49 + case 'spaceDelimited': 50 + return '%20'; 51 + default: 52 + return ','; 53 + } 54 + }; 55 + 56 + export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { 57 + switch (style) { 58 + case 'label': 59 + return '.'; 60 + case 'matrix': 61 + return ';'; 62 + case 'simple': 63 + return ','; 64 + default: 65 + return '&'; 66 + } 67 + }; 68 + 69 + export const serializeArrayParam = ({ 70 + allowReserved, 71 + explode, 72 + name, 73 + style, 74 + value, 75 + }: SerializeOptions<ArraySeparatorStyle> & { 76 + value: unknown[]; 77 + }) => { 78 + if (!explode) { 79 + const joinedValues = ( 80 + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) 81 + ).join(separatorArrayNoExplode(style)); 82 + switch (style) { 83 + case 'label': 84 + return `.${joinedValues}`; 85 + case 'matrix': 86 + return `;${name}=${joinedValues}`; 87 + case 'simple': 88 + return joinedValues; 89 + default: 90 + return `${name}=${joinedValues}`; 91 + } 92 + } 93 + 94 + const separator = separatorArrayExplode(style); 95 + const joinedValues = value 96 + .map((v) => { 97 + if (style === 'label' || style === 'simple') { 98 + return allowReserved ? v : encodeURIComponent(v as string); 99 + } 100 + 101 + return serializePrimitiveParam({ 102 + allowReserved, 103 + name, 104 + value: v as string, 105 + }); 106 + }) 107 + .join(separator); 108 + return style === 'label' || style === 'matrix' 109 + ? separator + joinedValues 110 + : joinedValues; 111 + }; 112 + 113 + export const serializePrimitiveParam = ({ 114 + allowReserved, 115 + name, 116 + value, 117 + }: SerializePrimitiveParam) => { 118 + if (value === undefined || value === null) { 119 + return ''; 120 + } 121 + 122 + if (typeof value === 'object') { 123 + throw new Error( 124 + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', 125 + ); 126 + } 127 + 128 + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; 129 + }; 130 + 131 + export const serializeObjectParam = ({ 132 + allowReserved, 133 + explode, 134 + name, 135 + style, 136 + value, 137 + valueOnly, 138 + }: SerializeOptions<ObjectSeparatorStyle> & { 139 + value: Record<string, unknown> | Date; 140 + valueOnly?: boolean; 141 + }) => { 142 + if (value instanceof Date) { 143 + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; 144 + } 145 + 146 + if (style !== 'deepObject' && !explode) { 147 + let values: string[] = []; 148 + Object.entries(value).forEach(([key, v]) => { 149 + values = [ 150 + ...values, 151 + key, 152 + allowReserved ? (v as string) : encodeURIComponent(v as string), 153 + ]; 154 + }); 155 + const joinedValues = values.join(','); 156 + switch (style) { 157 + case 'form': 158 + return `${name}=${joinedValues}`; 159 + case 'label': 160 + return `.${joinedValues}`; 161 + case 'matrix': 162 + return `;${name}=${joinedValues}`; 163 + default: 164 + return joinedValues; 165 + } 166 + } 167 + 168 + const separator = separatorObjectExplode(style); 169 + const joinedValues = Object.entries(value) 170 + .map(([key, v]) => 171 + serializePrimitiveParam({ 172 + allowReserved, 173 + name: style === 'deepObject' ? `${name}[${key}]` : key, 174 + value: v as string, 175 + }), 176 + ) 177 + .join(separator); 178 + return style === 'label' || style === 'matrix' 179 + ? separator + joinedValues 180 + : joinedValues; 181 + };
+136
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/core/queryKeySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + /** 4 + * JSON-friendly union that mirrors what Pinia Colada can hash. 5 + */ 6 + export type JsonValue = 7 + | null 8 + | string 9 + | number 10 + | boolean 11 + | JsonValue[] 12 + | { [key: string]: JsonValue }; 13 + 14 + /** 15 + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. 16 + */ 17 + export const queryKeyJsonReplacer = (_key: string, value: unknown) => { 18 + if ( 19 + value === undefined || 20 + typeof value === 'function' || 21 + typeof value === 'symbol' 22 + ) { 23 + return undefined; 24 + } 25 + if (typeof value === 'bigint') { 26 + return value.toString(); 27 + } 28 + if (value instanceof Date) { 29 + return value.toISOString(); 30 + } 31 + return value; 32 + }; 33 + 34 + /** 35 + * Safely stringifies a value and parses it back into a JsonValue. 36 + */ 37 + export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { 38 + try { 39 + const json = JSON.stringify(input, queryKeyJsonReplacer); 40 + if (json === undefined) { 41 + return undefined; 42 + } 43 + return JSON.parse(json) as JsonValue; 44 + } catch { 45 + return undefined; 46 + } 47 + }; 48 + 49 + /** 50 + * Detects plain objects (including objects with a null prototype). 51 + */ 52 + const isPlainObject = (value: unknown): value is Record<string, unknown> => { 53 + if (value === null || typeof value !== 'object') { 54 + return false; 55 + } 56 + const prototype = Object.getPrototypeOf(value as object); 57 + return prototype === Object.prototype || prototype === null; 58 + }; 59 + 60 + /** 61 + * Turns URLSearchParams into a sorted JSON object for deterministic keys. 62 + */ 63 + const serializeSearchParams = (params: URLSearchParams): JsonValue => { 64 + const entries = Array.from(params.entries()).sort(([a], [b]) => 65 + a.localeCompare(b), 66 + ); 67 + const result: Record<string, JsonValue> = {}; 68 + 69 + for (const [key, value] of entries) { 70 + const existing = result[key]; 71 + if (existing === undefined) { 72 + result[key] = value; 73 + continue; 74 + } 75 + 76 + if (Array.isArray(existing)) { 77 + (existing as string[]).push(value); 78 + } else { 79 + result[key] = [existing, value]; 80 + } 81 + } 82 + 83 + return result; 84 + }; 85 + 86 + /** 87 + * Normalizes any accepted value into a JSON-friendly shape for query keys. 88 + */ 89 + export const serializeQueryKeyValue = ( 90 + value: unknown, 91 + ): JsonValue | undefined => { 92 + if (value === null) { 93 + return null; 94 + } 95 + 96 + if ( 97 + typeof value === 'string' || 98 + typeof value === 'number' || 99 + typeof value === 'boolean' 100 + ) { 101 + return value; 102 + } 103 + 104 + if ( 105 + value === undefined || 106 + typeof value === 'function' || 107 + typeof value === 'symbol' 108 + ) { 109 + return undefined; 110 + } 111 + 112 + if (typeof value === 'bigint') { 113 + return value.toString(); 114 + } 115 + 116 + if (value instanceof Date) { 117 + return value.toISOString(); 118 + } 119 + 120 + if (Array.isArray(value)) { 121 + return stringifyToJsonValue(value); 122 + } 123 + 124 + if ( 125 + typeof URLSearchParams !== 'undefined' && 126 + value instanceof URLSearchParams 127 + ) { 128 + return serializeSearchParams(value); 129 + } 130 + 131 + if (isPlainObject(value)) { 132 + return stringifyToJsonValue(value); 133 + } 134 + 135 + return undefined; 136 + };
+266
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/core/serverSentEvents.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Config } from './types.gen.js'; 4 + 5 + export type ServerSentEventsOptions<TData = unknown> = Omit< 6 + RequestInit, 7 + 'method' 8 + > & 9 + Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & { 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 + * Implementing clients can call request interceptors inside this hook. 19 + */ 20 + onRequest?: (url: string, init: RequestInit) => Promise<Request>; 21 + /** 22 + * Callback invoked when a network or parsing error occurs during streaming. 23 + * 24 + * This option applies only if the endpoint returns a stream of events. 25 + * 26 + * @param error The error that occurred. 27 + */ 28 + onSseError?: (error: unknown) => void; 29 + /** 30 + * Callback invoked when an event is streamed from the server. 31 + * 32 + * This option applies only if the endpoint returns a stream of events. 33 + * 34 + * @param event Event streamed from the server. 35 + * @returns Nothing (void). 36 + */ 37 + onSseEvent?: (event: StreamEvent<TData>) => void; 38 + serializedBody?: RequestInit['body']; 39 + /** 40 + * Default retry delay in milliseconds. 41 + * 42 + * This option applies only if the endpoint returns a stream of events. 43 + * 44 + * @default 3000 45 + */ 46 + sseDefaultRetryDelay?: number; 47 + /** 48 + * Maximum number of retry attempts before giving up. 49 + */ 50 + sseMaxRetryAttempts?: number; 51 + /** 52 + * Maximum retry delay in milliseconds. 53 + * 54 + * Applies only when exponential backoff is used. 55 + * 56 + * This option applies only if the endpoint returns a stream of events. 57 + * 58 + * @default 30000 59 + */ 60 + sseMaxRetryDelay?: number; 61 + /** 62 + * Optional sleep function for retry backoff. 63 + * 64 + * Defaults to using `setTimeout`. 65 + */ 66 + sseSleepFn?: (ms: number) => Promise<void>; 67 + url: string; 68 + }; 69 + 70 + export interface StreamEvent<TData = unknown> { 71 + data: TData; 72 + event?: string; 73 + id?: string; 74 + retry?: number; 75 + } 76 + 77 + export type ServerSentEventsResult< 78 + TData = unknown, 79 + TReturn = void, 80 + TNext = unknown, 81 + > = { 82 + stream: AsyncGenerator< 83 + TData extends Record<string, unknown> ? TData[keyof TData] : TData, 84 + TReturn, 85 + TNext 86 + >; 87 + }; 88 + 89 + export const createSseClient = <TData = unknown>({ 90 + onRequest, 91 + onSseError, 92 + onSseEvent, 93 + responseTransformer, 94 + responseValidator, 95 + sseDefaultRetryDelay, 96 + sseMaxRetryAttempts, 97 + sseMaxRetryDelay, 98 + sseSleepFn, 99 + url, 100 + ...options 101 + }: ServerSentEventsOptions): ServerSentEventsResult<TData> => { 102 + let lastEventId: string | undefined; 103 + 104 + const sleep = 105 + sseSleepFn ?? 106 + ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); 107 + 108 + const createStream = async function* () { 109 + let retryDelay: number = sseDefaultRetryDelay ?? 3000; 110 + let attempt = 0; 111 + const signal = options.signal ?? new AbortController().signal; 112 + 113 + while (true) { 114 + if (signal.aborted) break; 115 + 116 + attempt++; 117 + 118 + const headers = 119 + options.headers instanceof Headers 120 + ? options.headers 121 + : new Headers(options.headers as Record<string, string> | undefined); 122 + 123 + if (lastEventId !== undefined) { 124 + headers.set('Last-Event-ID', lastEventId); 125 + } 126 + 127 + try { 128 + const requestInit: RequestInit = { 129 + redirect: 'follow', 130 + ...options, 131 + body: options.serializedBody, 132 + headers, 133 + signal, 134 + }; 135 + let request = new Request(url, requestInit); 136 + if (onRequest) { 137 + request = await onRequest(url, requestInit); 138 + } 139 + // fetch must be assigned here, otherwise it would throw the error: 140 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 141 + const _fetch = options.fetch ?? globalThis.fetch; 142 + const response = await _fetch(request); 143 + 144 + if (!response.ok) 145 + throw new Error( 146 + `SSE failed: ${response.status} ${response.statusText}`, 147 + ); 148 + 149 + if (!response.body) throw new Error('No body in SSE response'); 150 + 151 + const reader = response.body 152 + .pipeThrough(new TextDecoderStream()) 153 + .getReader(); 154 + 155 + let buffer = ''; 156 + 157 + const abortHandler = () => { 158 + try { 159 + reader.cancel(); 160 + } catch { 161 + // noop 162 + } 163 + }; 164 + 165 + signal.addEventListener('abort', abortHandler); 166 + 167 + try { 168 + while (true) { 169 + const { done, value } = await reader.read(); 170 + if (done) break; 171 + buffer += value; 172 + // Normalize line endings: CRLF -> LF, then CR -> LF 173 + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); 174 + 175 + const chunks = buffer.split('\n\n'); 176 + buffer = chunks.pop() ?? ''; 177 + 178 + for (const chunk of chunks) { 179 + const lines = chunk.split('\n'); 180 + const dataLines: Array<string> = []; 181 + let eventName: string | undefined; 182 + 183 + for (const line of lines) { 184 + if (line.startsWith('data:')) { 185 + dataLines.push(line.replace(/^data:\s*/, '')); 186 + } else if (line.startsWith('event:')) { 187 + eventName = line.replace(/^event:\s*/, ''); 188 + } else if (line.startsWith('id:')) { 189 + lastEventId = line.replace(/^id:\s*/, ''); 190 + } else if (line.startsWith('retry:')) { 191 + const parsed = Number.parseInt( 192 + line.replace(/^retry:\s*/, ''), 193 + 10, 194 + ); 195 + if (!Number.isNaN(parsed)) { 196 + retryDelay = parsed; 197 + } 198 + } 199 + } 200 + 201 + let data: unknown; 202 + let parsedJson = false; 203 + 204 + if (dataLines.length) { 205 + const rawData = dataLines.join('\n'); 206 + try { 207 + data = JSON.parse(rawData); 208 + parsedJson = true; 209 + } catch { 210 + data = rawData; 211 + } 212 + } 213 + 214 + if (parsedJson) { 215 + if (responseValidator) { 216 + await responseValidator(data); 217 + } 218 + 219 + if (responseTransformer) { 220 + data = await responseTransformer(data); 221 + } 222 + } 223 + 224 + onSseEvent?.({ 225 + data, 226 + event: eventName, 227 + id: lastEventId, 228 + retry: retryDelay, 229 + }); 230 + 231 + if (dataLines.length) { 232 + yield data as any; 233 + } 234 + } 235 + } 236 + } finally { 237 + signal.removeEventListener('abort', abortHandler); 238 + reader.releaseLock(); 239 + } 240 + 241 + break; // exit loop on normal completion 242 + } catch (error) { 243 + // connection failed or aborted; retry after delay 244 + onSseError?.(error); 245 + 246 + if ( 247 + sseMaxRetryAttempts !== undefined && 248 + attempt >= sseMaxRetryAttempts 249 + ) { 250 + break; // stop after firing error 251 + } 252 + 253 + // exponential backoff: double retry each attempt, cap at 30s 254 + const backoff = Math.min( 255 + retryDelay * 2 ** (attempt - 1), 256 + sseMaxRetryDelay ?? 30000, 257 + ); 258 + await sleep(backoff); 259 + } 260 + } 261 + }; 262 + 263 + const stream = createStream(); 264 + 265 + return { stream }; 266 + };
+118
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/core/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth, AuthToken } from './auth.gen.js'; 4 + import type { 5 + BodySerializer, 6 + QuerySerializer, 7 + QuerySerializerOptions, 8 + } from './bodySerializer.gen.js'; 9 + 10 + export type HttpMethod = 11 + | 'connect' 12 + | 'delete' 13 + | 'get' 14 + | 'head' 15 + | 'options' 16 + | 'patch' 17 + | 'post' 18 + | 'put' 19 + | 'trace'; 20 + 21 + export type Client< 22 + RequestFn = never, 23 + Config = unknown, 24 + MethodFn = never, 25 + BuildUrlFn = never, 26 + SseFn = never, 27 + > = { 28 + /** 29 + * Returns the final request URL. 30 + */ 31 + buildUrl: BuildUrlFn; 32 + getConfig: () => Config; 33 + request: RequestFn; 34 + setConfig: (config: Config) => Config; 35 + } & { 36 + [K in HttpMethod]: MethodFn; 37 + } & ([SseFn] extends [never] 38 + ? { sse?: never } 39 + : { sse: { [K in HttpMethod]: SseFn } }); 40 + 41 + export interface Config { 42 + /** 43 + * Auth token or a function returning auth token. The resolved value will be 44 + * added to the request payload as defined by its `security` array. 45 + */ 46 + auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken; 47 + /** 48 + * A function for serializing request body parameter. By default, 49 + * {@link JSON.stringify()} will be used. 50 + */ 51 + bodySerializer?: BodySerializer | null; 52 + /** 53 + * An object containing any HTTP headers that you want to pre-populate your 54 + * `Headers` object with. 55 + * 56 + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} 57 + */ 58 + headers?: 59 + | RequestInit['headers'] 60 + | Record< 61 + string, 62 + | string 63 + | number 64 + | boolean 65 + | (string | number | boolean)[] 66 + | null 67 + | undefined 68 + | unknown 69 + >; 70 + /** 71 + * The request method. 72 + * 73 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} 74 + */ 75 + method?: Uppercase<HttpMethod>; 76 + /** 77 + * A function for serializing request query parameters. By default, arrays 78 + * will be exploded in form style, objects will be exploded in deepObject 79 + * style, and reserved characters are percent-encoded. 80 + * 81 + * This method will have no effect if the native `paramsSerializer()` Axios 82 + * API function is used. 83 + * 84 + * {@link https://swagger.io/docs/specification/serialization/#query View examples} 85 + */ 86 + querySerializer?: QuerySerializer | QuerySerializerOptions; 87 + /** 88 + * A function validating request data. This is useful if you want to ensure 89 + * the request conforms to the desired shape, so it can be safely sent to 90 + * the server. 91 + */ 92 + requestValidator?: (data: unknown) => Promise<unknown>; 93 + /** 94 + * A function transforming response data before it's returned. This is useful 95 + * for post-processing data, e.g. converting ISO strings into Date objects. 96 + */ 97 + responseTransformer?: (data: unknown) => Promise<unknown>; 98 + /** 99 + * A function validating response data. This is useful if you want to ensure 100 + * the response conforms to the desired shape, so it can be safely passed to 101 + * the transformers and returned to the user. 102 + */ 103 + responseValidator?: (data: unknown) => Promise<unknown>; 104 + } 105 + 106 + type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 + ? true 108 + : [T] extends [never | undefined] 109 + ? [undefined] extends [T] 110 + ? false 111 + : true 112 + : false; 113 + 114 + export type OmitNever<T extends Record<string, unknown>> = { 115 + [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 + ? never 117 + : K]: T[K]; 118 + };
+143
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/core/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { BodySerializer, QuerySerializer } from './bodySerializer.gen.js'; 4 + import { 5 + type ArraySeparatorStyle, 6 + serializeArrayParam, 7 + serializeObjectParam, 8 + serializePrimitiveParam, 9 + } from './pathSerializer.gen.js'; 10 + 11 + export interface PathSerializer { 12 + path: Record<string, unknown>; 13 + url: string; 14 + } 15 + 16 + export const PATH_PARAM_RE = /\{[^{}]+\}/g; 17 + 18 + export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { 19 + let url = _url; 20 + const matches = _url.match(PATH_PARAM_RE); 21 + if (matches) { 22 + for (const match of matches) { 23 + let explode = false; 24 + let name = match.substring(1, match.length - 1); 25 + let style: ArraySeparatorStyle = 'simple'; 26 + 27 + if (name.endsWith('*')) { 28 + explode = true; 29 + name = name.substring(0, name.length - 1); 30 + } 31 + 32 + if (name.startsWith('.')) { 33 + name = name.substring(1); 34 + style = 'label'; 35 + } else if (name.startsWith(';')) { 36 + name = name.substring(1); 37 + style = 'matrix'; 38 + } 39 + 40 + const value = path[name]; 41 + 42 + if (value === undefined || value === null) { 43 + continue; 44 + } 45 + 46 + if (Array.isArray(value)) { 47 + url = url.replace( 48 + match, 49 + serializeArrayParam({ explode, name, style, value }), 50 + ); 51 + continue; 52 + } 53 + 54 + if (typeof value === 'object') { 55 + url = url.replace( 56 + match, 57 + serializeObjectParam({ 58 + explode, 59 + name, 60 + style, 61 + value: value as Record<string, unknown>, 62 + valueOnly: true, 63 + }), 64 + ); 65 + continue; 66 + } 67 + 68 + if (style === 'matrix') { 69 + url = url.replace( 70 + match, 71 + `;${serializePrimitiveParam({ 72 + name, 73 + value: value as string, 74 + })}`, 75 + ); 76 + continue; 77 + } 78 + 79 + const replaceValue = encodeURIComponent( 80 + style === 'label' ? `.${value as string}` : (value as string), 81 + ); 82 + url = url.replace(match, replaceValue); 83 + } 84 + } 85 + return url; 86 + }; 87 + 88 + export const getUrl = ({ 89 + baseUrl, 90 + path, 91 + query, 92 + querySerializer, 93 + url: _url, 94 + }: { 95 + baseUrl?: string; 96 + path?: Record<string, unknown>; 97 + query?: Record<string, unknown>; 98 + querySerializer: QuerySerializer; 99 + url: string; 100 + }) => { 101 + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; 102 + let url = (baseUrl ?? '') + pathUrl; 103 + if (path) { 104 + url = defaultPathSerializer({ path, url }); 105 + } 106 + let search = query ? querySerializer(query) : ''; 107 + if (search.startsWith('?')) { 108 + search = search.substring(1); 109 + } 110 + if (search) { 111 + url += `?${search}`; 112 + } 113 + return url; 114 + }; 115 + 116 + export function getValidRequestBody(options: { 117 + body?: unknown; 118 + bodySerializer?: BodySerializer | null; 119 + serializedBody?: unknown; 120 + }) { 121 + const hasBody = options.body !== undefined; 122 + const isSerializedBody = hasBody && options.bodySerializer; 123 + 124 + if (isSerializedBody) { 125 + if ('serializedBody' in options) { 126 + const hasSerializedBody = 127 + options.serializedBody !== undefined && options.serializedBody !== ''; 128 + 129 + return hasSerializedBody ? options.serializedBody : null; 130 + } 131 + 132 + // not all clients implement a serializedBody property (i.e. client-axios) 133 + return options.body !== '' ? options.body : null; 134 + } 135 + 136 + // plain/text body 137 + if (hasBody) { 138 + return options.body; 139 + } 140 + 141 + // no body was provided 142 + return undefined; 143 + }
+4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export { apiVVersionODataControllerCount, callToTestOrderOfParams, callWithDefaultOptionalParameters, callWithDefaultParameters, callWithDescriptions, callWithDuplicateResponses, callWithNoContentResponse, callWithParameters, callWithResponse, callWithResponseAndNoContentResponse, callWithResponses, callWithResultFromHeader, callWithWeirdParameterNames, collectionFormat, complexParams, complexTypes, deleteCallWithoutParametersAndResponse, deleteFoo, deprecatedCall, dummyA, dummyB, duplicateName, duplicateName2, duplicateName3, duplicateName4, export_, fileResponse, fooWow, getApiVbyApiVersionSimpleOperation, getCallWithOptionalParam, getCallWithoutParametersAndResponse, headCallWithoutParametersAndResponse, import_, multipartRequest, multipartResponse, nonAsciiæøåÆøÅöôêÊ字符串, type Options, optionsCallWithoutParametersAndResponse, patchApiVbyApiVersionNoTag, patchCallWithoutParametersAndResponse, postApiVbyApiVersionFormData, postApiVbyApiVersionRequestBody, postCallWithOptionalParam, postCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, putWithFormUrlEncoded, testErrorCode, types, uploadFile } from './sdk.gen.js'; 4 + export type { _3eNum1Период, _400, AdditionalPropertiesIntegerIssue, AdditionalPropertiesUnknownIssue, AdditionalPropertiesUnknownIssue2, AdditionalPropertiesUnknownIssue3, AdditionalPropertiesUnknownIssueWritable, AnyOfAnyAndNull, AnyOfArrays, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountResponses, ArrayWithAnyOfProperties, ArrayWithArray, ArrayWithBooleans, ArrayWithNumbers, ArrayWithProperties, ArrayWithReferences, ArrayWithStrings, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponse, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesError, CallWithResponsesErrors, CallWithResponsesResponse, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CamelCaseCommentWithBreaks, CharactersInDescription, ClientOptions, CollectionFormatData, CommentWithBackticks, CommentWithBackticksAndQuotes, CommentWithBreaks, CommentWithExpressionPlaceholders, CommentWithQuotes, CommentWithReservedCharacters, CommentWithSlashes, ComplexParamsData, ComplexParamsResponse, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponse, ComplexTypesResponses, CompositionBaseModel, CompositionExtendedModel, CompositionWithAllOfAndNullable, CompositionWithAnyOf, CompositionWithAnyOfAndNullable, CompositionWithAnyOfAnonymous, CompositionWithNestedAnyAndTypeNull, CompositionWithNestedAnyOfAndNull, CompositionWithOneOf, CompositionWithOneOfAndComplexArrayDictionary, CompositionWithOneOfAndNullable, CompositionWithOneOfAndProperties, CompositionWithOneOfAndSimpleArrayDictionary, CompositionWithOneOfAndSimpleDictionary, CompositionWithOneOfAnonymous, CompositionWithOneOfDiscriminator, ConstValue, Default, DeleteCallWithoutParametersAndResponseData, DeleteFooData, DeleteFooData2, DeleteFooData3, DeprecatedCallData, DeprecatedModel, DictionaryWithArray, DictionaryWithDictionary, DictionaryWithProperties, DictionaryWithPropertiesAndAdditionalProperties, DictionaryWithReference, DictionaryWithString, DummyAData, DummyAResponse, DummyAResponses, DummyBData, DummyBResponse, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, EnumFromDescription, EnumWithExtensions, EnumWithNumbers, EnumWithReplacedCharacters, EnumWithStrings, EnumWithXEnumNames, ExportData, ExternalRefA, ExternalRefB, ExternalSharedExternalSharedModel, File, FileResponseData, FileResponseResponse, FileResponseResponses, FileWritable, FooWowData, FooWowResponses, FreeFormObjectWithAdditionalPropertiesEqEmptyObject, FreeFormObjectWithAdditionalPropertiesEqTrue, FreeFormObjectWithoutAdditionalProperties, GenericSchemaDuplicateIssue1SystemBoolean, GenericSchemaDuplicateIssue1SystemBooleanWritable, GenericSchemaDuplicateIssue1SystemString, GenericSchemaDuplicateIssue1SystemStringWritable, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, Import, ImportData, ImportResponse, ImportResponses, IoK8sApimachineryPkgApisMetaV1DeleteOptions, IoK8sApimachineryPkgApisMetaV1Preconditions, ModelCircle, ModelFromZendesk, ModelSquare, ModelThatExtends, ModelThatExtendsExtends, ModelWithAdditionalPropertiesEqTrue, ModelWithAnyOfConstantSizeArray, ModelWithAnyOfConstantSizeArrayAndIntersect, ModelWithAnyOfConstantSizeArrayNullable, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable, ModelWithArray, ModelWithArrayReadOnlyAndWriteOnly, ModelWithArrayReadOnlyAndWriteOnlyWritable, ModelWithBackticksInDescription, ModelWithBoolean, ModelWithCircularReference, ModelWithConst, ModelWithConstantSizeArray, ModelWithDictionary, ModelWithDuplicateImports, ModelWithDuplicateProperties, ModelWithEnum, ModelWithEnumFromDescription, ModelWithEnumWithHyphen, ModelWithInteger, ModelWithNestedArrayEnums, ModelWithNestedArrayEnumsData, ModelWithNestedArrayEnumsDataBar, ModelWithNestedArrayEnumsDataFoo, ModelWithNestedCompositionEnums, ModelWithNestedEnums, ModelWithNestedProperties, ModelWithNullableObject, ModelWithNullableString, ModelWithNumericEnumUnion, ModelWithOneOfAndProperties, ModelWithOneOfEnum, ModelWithOrderedProperties, ModelWithPattern, ModelWithPatternWritable, ModelWithPrefixItemsConstantSizeArray, ModelWithProperties, ModelWithPropertiesWritable, ModelWithReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnlyWritable, ModelWithReference, ModelWithReferenceWritable, ModelWithString, ModelWithStringError, MultipartRequestData, MultipartResponseData, MultipartResponseResponse, MultipartResponseResponses, NestedAnyOfArraysNullable, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Responses, NonAsciiStringæøåÆøÅöôêÊ字符串, NullableObject, OneOfAllOfIssue, OneOfAllOfIssueWritable, OptionsCallWithoutParametersAndResponseData, Pageable, ParameterSimpleParameterUnused, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PostServiceWithEmptyTagResponse, PostServiceWithEmptyTagResponse2, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, SchemaWithFormRestrictedKeys, SimpleBoolean, SimpleFile, SimpleFormData, SimpleInteger, SimpleParameter, SimpleReference, SimpleRequestBody, SimpleString, SimpleStringWithPattern, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponse, TypesResponses, UploadFileData, UploadFileResponse, UploadFileResponses, XFooBar } from './types.gen.js';
+206
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/sdk.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { client } from './client.gen.js'; 4 + import { type Client, formDataBodySerializer, type Options as Options2, type TDataShape, urlSearchParamsBodySerializer } from './client/index.js'; 5 + import type { ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponses, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesErrors, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CollectionFormatData, ComplexParamsData, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponses, DeleteCallWithoutParametersAndResponseData, DeleteFooData3, DeprecatedCallData, DummyAData, DummyAResponses, DummyBData, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, ExportData, FileResponseData, FileResponseResponses, FooWowData, FooWowResponses, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, ImportData, ImportResponses, MultipartRequestData, MultipartResponseData, MultipartResponseResponses, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Responses, OptionsCallWithoutParametersAndResponseData, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponses, UploadFileData, UploadFileResponses } from './types.gen.js'; 6 + 7 + export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & { 8 + /** 9 + * You can provide a client instance returned by `createClient()` instead of 10 + * individual options. This might be also useful if you want to implement a 11 + * custom client. 12 + */ 13 + client?: Client; 14 + /** 15 + * You can pass arbitrary values through the `meta` object. This can be 16 + * used to access values that aren't defined as part of the SDK function. 17 + */ 18 + meta?: Record<string, unknown>; 19 + }; 20 + 21 + export const export_ = <ThrowOnError extends boolean = false>(options?: Options<ExportData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 22 + 23 + export const patchApiVbyApiVersionNoTag = <ThrowOnError extends boolean = false>(options?: Options<PatchApiVbyApiVersionNoTagData, ThrowOnError>) => (options?.client ?? client).patch<PatchApiVbyApiVersionNoTagResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 24 + 25 + export const import_ = <ThrowOnError extends boolean = false>(options: Options<ImportData, ThrowOnError>) => (options.client ?? client).post<ImportResponses, unknown, ThrowOnError>({ 26 + url: '/api/v{api-version}/no+tag', 27 + ...options, 28 + headers: { 29 + 'Content-Type': 'application/json', 30 + ...options.headers 31 + } 32 + }); 33 + 34 + export const fooWow = <ThrowOnError extends boolean = false>(options?: Options<FooWowData, ThrowOnError>) => (options?.client ?? client).put<FooWowResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 35 + 36 + export const apiVVersionODataControllerCount = <ThrowOnError extends boolean = false>(options?: Options<ApiVVersionODataControllerCountData, ThrowOnError>) => (options?.client ?? client).get<ApiVVersionODataControllerCountResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple/$count', ...options }); 37 + 38 + export const getApiVbyApiVersionSimpleOperation = <ThrowOnError extends boolean = false>(options: Options<GetApiVbyApiVersionSimpleOperationData, ThrowOnError>) => (options.client ?? client).get<GetApiVbyApiVersionSimpleOperationResponses, GetApiVbyApiVersionSimpleOperationErrors, ThrowOnError>({ url: '/api/v{api-version}/simple:operation', ...options }); 39 + 40 + export const deleteCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<DeleteCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 41 + 42 + export const getCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<GetCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 43 + 44 + export const headCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<HeadCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).head<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 45 + 46 + export const optionsCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<OptionsCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).options<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 47 + 48 + export const patchCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PatchCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).patch<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 49 + 50 + export const postCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PostCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 51 + 52 + export const putCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PutCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 53 + 54 + export const deleteFoo = <ThrowOnError extends boolean = false>(options: Options<DeleteFooData3, ThrowOnError>) => (options.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', ...options }); 55 + 56 + export const callWithDescriptions = <ThrowOnError extends boolean = false>(options?: Options<CallWithDescriptionsData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/descriptions', ...options }); 57 + 58 + /** 59 + * @deprecated 60 + */ 61 + export const deprecatedCall = <ThrowOnError extends boolean = false>(options: Options<DeprecatedCallData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/parameters/deprecated', ...options }); 62 + 63 + export const callWithParameters = <ThrowOnError extends boolean = false>(options: Options<CallWithParametersData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ 64 + url: '/api/v{api-version}/parameters/{parameterPath}', 65 + ...options, 66 + headers: { 67 + 'Content-Type': 'application/json', 68 + ...options.headers 69 + } 70 + }); 71 + 72 + export const callWithWeirdParameterNames = <ThrowOnError extends boolean = false>(options: Options<CallWithWeirdParameterNamesData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ 73 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', 74 + ...options, 75 + headers: { 76 + 'Content-Type': 'application/json', 77 + ...options.headers 78 + } 79 + }); 80 + 81 + export const getCallWithOptionalParam = <ThrowOnError extends boolean = false>(options: Options<GetCallWithOptionalParamData, ThrowOnError>) => (options.client ?? client).get<unknown, unknown, ThrowOnError>({ 82 + url: '/api/v{api-version}/parameters', 83 + ...options, 84 + headers: { 85 + 'Content-Type': 'application/json', 86 + ...options.headers 87 + } 88 + }); 89 + 90 + export const postCallWithOptionalParam = <ThrowOnError extends boolean = false>(options: Options<PostCallWithOptionalParamData, ThrowOnError>) => (options.client ?? client).post<PostCallWithOptionalParamResponses, unknown, ThrowOnError>({ 91 + url: '/api/v{api-version}/parameters', 92 + ...options, 93 + headers: { 94 + 'Content-Type': 'application/json', 95 + ...options.headers 96 + } 97 + }); 98 + 99 + export const postApiVbyApiVersionRequestBody = <ThrowOnError extends boolean = false>(options?: Options<PostApiVbyApiVersionRequestBodyData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 100 + url: '/api/v{api-version}/requestBody', 101 + ...options, 102 + headers: { 103 + 'Content-Type': 'application/json', 104 + ...options?.headers 105 + } 106 + }); 107 + 108 + export const postApiVbyApiVersionFormData = <ThrowOnError extends boolean = false>(options?: Options<PostApiVbyApiVersionFormDataData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 109 + ...formDataBodySerializer, 110 + url: '/api/v{api-version}/formData', 111 + ...options, 112 + headers: { 113 + 'Content-Type': null, 114 + ...options?.headers 115 + } 116 + }); 117 + 118 + export const callWithDefaultParameters = <ThrowOnError extends boolean = false>(options?: Options<CallWithDefaultParametersData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 119 + 120 + export const callWithDefaultOptionalParameters = <ThrowOnError extends boolean = false>(options?: Options<CallWithDefaultOptionalParametersData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 121 + 122 + export const callToTestOrderOfParams = <ThrowOnError extends boolean = false>(options: Options<CallToTestOrderOfParamsData, ThrowOnError>) => (options.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 123 + 124 + export const duplicateName = <ThrowOnError extends boolean = false>(options?: Options<DuplicateNameData, ThrowOnError>) => (options?.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 125 + 126 + export const duplicateName2 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName2Data, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 127 + 128 + export const duplicateName3 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName3Data, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 129 + 130 + export const duplicateName4 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName4Data, ThrowOnError>) => (options?.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 131 + 132 + export const callWithNoContentResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithNoContentResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithNoContentResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no-content', ...options }); 133 + 134 + export const callWithResponseAndNoContentResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponseAndNoContentResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithResponseAndNoContentResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/response-and-no-content', ...options }); 135 + 136 + export const dummyA = <ThrowOnError extends boolean = false>(options?: Options<DummyAData, ThrowOnError>) => (options?.client ?? client).get<DummyAResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/a', ...options }); 137 + 138 + export const dummyB = <ThrowOnError extends boolean = false>(options?: Options<DummyBData, ThrowOnError>) => (options?.client ?? client).get<DummyBResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/b', ...options }); 139 + 140 + export const callWithResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 141 + 142 + export const callWithDuplicateResponses = <ThrowOnError extends boolean = false>(options?: Options<CallWithDuplicateResponsesData, ThrowOnError>) => (options?.client ?? client).post<CallWithDuplicateResponsesResponses, CallWithDuplicateResponsesErrors, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 143 + 144 + export const callWithResponses = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponsesData, ThrowOnError>) => (options?.client ?? client).put<CallWithResponsesResponses, CallWithResponsesErrors, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 145 + 146 + export const collectionFormat = <ThrowOnError extends boolean = false>(options: Options<CollectionFormatData, ThrowOnError>) => (options.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/collectionFormat', ...options }); 147 + 148 + export const types = <ThrowOnError extends boolean = false>(options: Options<TypesData, ThrowOnError>) => (options.client ?? client).get<TypesResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/types', ...options }); 149 + 150 + export const uploadFile = <ThrowOnError extends boolean = false>(options: Options<UploadFileData, ThrowOnError>) => (options.client ?? client).post<UploadFileResponses, unknown, ThrowOnError>({ 151 + ...urlSearchParamsBodySerializer, 152 + url: '/api/v{api-version}/upload', 153 + ...options, 154 + headers: { 155 + 'Content-Type': 'application/x-www-form-urlencoded', 156 + ...options.headers 157 + } 158 + }); 159 + 160 + export const fileResponse = <ThrowOnError extends boolean = false>(options: Options<FileResponseData, ThrowOnError>) => (options.client ?? client).get<FileResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/file/{id}', ...options }); 161 + 162 + export const complexTypes = <ThrowOnError extends boolean = false>(options: Options<ComplexTypesData, ThrowOnError>) => (options.client ?? client).get<ComplexTypesResponses, ComplexTypesErrors, ThrowOnError>({ 163 + querySerializer: { parameters: { parameterObject: { object: { style: 'form' } } } }, 164 + url: '/api/v{api-version}/complex', 165 + ...options 166 + }); 167 + 168 + export const multipartResponse = <ThrowOnError extends boolean = false>(options?: Options<MultipartResponseData, ThrowOnError>) => (options?.client ?? client).get<MultipartResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multipart', ...options }); 169 + 170 + export const multipartRequest = <ThrowOnError extends boolean = false>(options?: Options<MultipartRequestData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 171 + ...formDataBodySerializer, 172 + url: '/api/v{api-version}/multipart', 173 + ...options, 174 + headers: { 175 + 'Content-Type': null, 176 + ...options?.headers 177 + } 178 + }); 179 + 180 + export const complexParams = <ThrowOnError extends boolean = false>(options: Options<ComplexParamsData, ThrowOnError>) => (options.client ?? client).put<ComplexParamsResponses, unknown, ThrowOnError>({ 181 + url: '/api/v{api-version}/complex/{id}', 182 + ...options, 183 + headers: { 184 + 'Content-Type': 'application/json-patch+json', 185 + ...options.headers 186 + } 187 + }); 188 + 189 + export const callWithResultFromHeader = <ThrowOnError extends boolean = false>(options?: Options<CallWithResultFromHeaderData, ThrowOnError>) => (options?.client ?? client).post<CallWithResultFromHeaderResponses, CallWithResultFromHeaderErrors, ThrowOnError>({ url: '/api/v{api-version}/header', ...options }); 190 + 191 + export const testErrorCode = <ThrowOnError extends boolean = false>(options: Options<TestErrorCodeData, ThrowOnError>) => (options.client ?? client).post<TestErrorCodeResponses, TestErrorCodeErrors, ThrowOnError>({ url: '/api/v{api-version}/error', ...options }); 192 + 193 + export const nonAsciiæøåÆøÅöôêÊ字符串 = <ThrowOnError extends boolean = false>(options: Options<NonAsciiæøåÆøÅöôêÊ字符串Data, ThrowOnError>) => (options.client ?? client).post<NonAsciiæøåÆøÅöôêÊ字符串Responses, unknown, ThrowOnError>({ url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', ...options }); 194 + 195 + /** 196 + * Login User 197 + */ 198 + export const putWithFormUrlEncoded = <ThrowOnError extends boolean = false>(options: Options<PutWithFormUrlEncodedData, ThrowOnError>) => (options.client ?? client).put<unknown, unknown, ThrowOnError>({ 199 + ...urlSearchParamsBodySerializer, 200 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', 201 + ...options, 202 + headers: { 203 + 'Content-Type': 'application/x-www-form-urlencoded', 204 + ...options.headers 205 + } 206 + });
+2091
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ky/tsconfig-node16-sdk/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type ClientOptions = { 4 + baseUrl: 'http://localhost:3000/base' | (string & {}); 5 + }; 6 + 7 + /** 8 + * Model with number-only name 9 + */ 10 + export type _400 = string; 11 + 12 + /** 13 + * External ref to shared model (A) 14 + */ 15 + export type ExternalRefA = ExternalSharedExternalSharedModel; 16 + 17 + /** 18 + * External ref to shared model (B) 19 + */ 20 + export type ExternalRefB = ExternalSharedExternalSharedModel; 21 + 22 + /** 23 + * Testing multiline comments in string: First line 24 + * Second line 25 + * 26 + * Fourth line 27 + */ 28 + export type CamelCaseCommentWithBreaks = number; 29 + 30 + /** 31 + * Testing multiline comments in string: First line 32 + * Second line 33 + * 34 + * Fourth line 35 + */ 36 + export type CommentWithBreaks = number; 37 + 38 + /** 39 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 40 + */ 41 + export type CommentWithBackticks = number; 42 + 43 + /** 44 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 45 + */ 46 + export type CommentWithBackticksAndQuotes = number; 47 + 48 + /** 49 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 50 + */ 51 + export type CommentWithSlashes = number; 52 + 53 + /** 54 + * Testing expression placeholders in string: ${expression} should work 55 + */ 56 + export type CommentWithExpressionPlaceholders = number; 57 + 58 + /** 59 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 60 + */ 61 + export type CommentWithQuotes = number; 62 + 63 + /** 64 + * Testing reserved characters in string: * inline * and ** inline ** should work 65 + */ 66 + export type CommentWithReservedCharacters = number; 67 + 68 + /** 69 + * This is a simple number 70 + */ 71 + export type SimpleInteger = number; 72 + 73 + /** 74 + * This is a simple boolean 75 + */ 76 + export type SimpleBoolean = boolean; 77 + 78 + /** 79 + * This is a simple string 80 + */ 81 + export type SimpleString = string; 82 + 83 + /** 84 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 85 + */ 86 + export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; 87 + 88 + /** 89 + * This is a simple file 90 + */ 91 + export type SimpleFile = Blob | File; 92 + 93 + /** 94 + * This is a simple reference 95 + */ 96 + export type SimpleReference = ModelWithString; 97 + 98 + /** 99 + * This is a simple string 100 + */ 101 + export type SimpleStringWithPattern = string | null; 102 + 103 + /** 104 + * This is a simple enum with strings 105 + */ 106 + export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | '\'Single Quote\'' | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; 107 + 108 + export type EnumWithReplacedCharacters = '\'Single Quote\'' | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; 109 + 110 + /** 111 + * This is a simple enum with numbers 112 + */ 113 + export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; 114 + 115 + /** 116 + * Success=1,Warning=2,Error=3 117 + */ 118 + export type EnumFromDescription = number; 119 + 120 + /** 121 + * This is a simple enum with numbers 122 + */ 123 + export type EnumWithExtensions = 200 | 400 | 500; 124 + 125 + export type EnumWithXEnumNames = 0 | 1 | 2; 126 + 127 + /** 128 + * This is a simple array with numbers 129 + */ 130 + export type ArrayWithNumbers = Array<number>; 131 + 132 + /** 133 + * This is a simple array with booleans 134 + */ 135 + export type ArrayWithBooleans = Array<boolean>; 136 + 137 + /** 138 + * This is a simple array with strings 139 + */ 140 + export type ArrayWithStrings = Array<string>; 141 + 142 + /** 143 + * This is a simple array with references 144 + */ 145 + export type ArrayWithReferences = Array<ModelWithString>; 146 + 147 + /** 148 + * This is a simple array containing an array 149 + */ 150 + export type ArrayWithArray = Array<Array<ModelWithString>>; 151 + 152 + /** 153 + * This is a simple array with properties 154 + */ 155 + export type ArrayWithProperties = Array<{ 156 + '16x16'?: CamelCaseCommentWithBreaks; 157 + bar?: string; 158 + }>; 159 + 160 + /** 161 + * This is a simple array with any of properties 162 + */ 163 + export type ArrayWithAnyOfProperties = Array<{ 164 + foo?: string; 165 + } | { 166 + bar?: string; 167 + }>; 168 + 169 + export type AnyOfAnyAndNull = { 170 + data?: unknown | null; 171 + }; 172 + 173 + /** 174 + * This is a simple array with any of properties 175 + */ 176 + export type AnyOfArrays = { 177 + results?: Array<{ 178 + foo?: string; 179 + } | { 180 + bar?: string; 181 + }>; 182 + }; 183 + 184 + /** 185 + * This is a string dictionary 186 + */ 187 + export type DictionaryWithString = { 188 + [key: string]: string; 189 + }; 190 + 191 + export type DictionaryWithPropertiesAndAdditionalProperties = { 192 + foo?: number; 193 + bar?: boolean; 194 + [key: string]: string | number | boolean | undefined; 195 + }; 196 + 197 + /** 198 + * This is a string reference 199 + */ 200 + export type DictionaryWithReference = { 201 + [key: string]: ModelWithString; 202 + }; 203 + 204 + /** 205 + * This is a complex dictionary 206 + */ 207 + export type DictionaryWithArray = { 208 + [key: string]: Array<ModelWithString>; 209 + }; 210 + 211 + /** 212 + * This is a string dictionary 213 + */ 214 + export type DictionaryWithDictionary = { 215 + [key: string]: { 216 + [key: string]: string; 217 + }; 218 + }; 219 + 220 + /** 221 + * This is a complex dictionary 222 + */ 223 + export type DictionaryWithProperties = { 224 + [key: string]: { 225 + foo?: string; 226 + bar?: string; 227 + }; 228 + }; 229 + 230 + /** 231 + * This is a model with one number property 232 + */ 233 + export type ModelWithInteger = { 234 + /** 235 + * This is a simple number property 236 + */ 237 + prop?: number; 238 + }; 239 + 240 + /** 241 + * This is a model with one boolean property 242 + */ 243 + export type ModelWithBoolean = { 244 + /** 245 + * This is a simple boolean property 246 + */ 247 + prop?: boolean; 248 + }; 249 + 250 + /** 251 + * This is a model with one string property 252 + */ 253 + export type ModelWithString = { 254 + /** 255 + * This is a simple string property 256 + */ 257 + prop?: string; 258 + }; 259 + 260 + /** 261 + * This is a model with one string property 262 + */ 263 + export type ModelWithStringError = { 264 + /** 265 + * This is a simple string property 266 + */ 267 + prop?: string; 268 + }; 269 + 270 + /** 271 + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) 272 + */ 273 + export type ModelFromZendesk = string; 274 + 275 + /** 276 + * This is a model with one string property 277 + */ 278 + export type ModelWithNullableString = { 279 + /** 280 + * This is a simple string property 281 + */ 282 + nullableProp1?: string | null; 283 + /** 284 + * This is a simple string property 285 + */ 286 + nullableRequiredProp1: string | null; 287 + /** 288 + * This is a simple string property 289 + */ 290 + nullableProp2?: string | null; 291 + /** 292 + * This is a simple string property 293 + */ 294 + nullableRequiredProp2: string | null; 295 + /** 296 + * This is a simple enum with strings 297 + */ 298 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 299 + }; 300 + 301 + /** 302 + * This is a model with one enum 303 + */ 304 + export type ModelWithEnum = { 305 + /** 306 + * This is a simple enum with strings 307 + */ 308 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 309 + /** 310 + * These are the HTTP error code enums 311 + */ 312 + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; 313 + /** 314 + * Simple boolean enum 315 + */ 316 + bool?: true; 317 + }; 318 + 319 + /** 320 + * This is a model with one enum with escaped name 321 + */ 322 + export type ModelWithEnumWithHyphen = { 323 + /** 324 + * Foo-Bar-Baz-Qux 325 + */ 326 + 'foo-bar-baz-qux'?: '3.0'; 327 + }; 328 + 329 + /** 330 + * This is a model with one enum 331 + */ 332 + export type ModelWithEnumFromDescription = { 333 + /** 334 + * Success=1,Warning=2,Error=3 335 + */ 336 + test?: number; 337 + }; 338 + 339 + /** 340 + * This is a model with nested enums 341 + */ 342 + export type ModelWithNestedEnums = { 343 + dictionaryWithEnum?: { 344 + [key: string]: 'Success' | 'Warning' | 'Error'; 345 + }; 346 + dictionaryWithEnumFromDescription?: { 347 + [key: string]: number; 348 + }; 349 + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; 350 + arrayWithDescription?: Array<number>; 351 + /** 352 + * This is a simple enum with strings 353 + */ 354 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 355 + }; 356 + 357 + /** 358 + * This is a model with one property containing a reference 359 + */ 360 + export type ModelWithReference = { 361 + prop?: ModelWithProperties; 362 + }; 363 + 364 + /** 365 + * This is a model with one property containing an array 366 + */ 367 + export type ModelWithArrayReadOnlyAndWriteOnly = { 368 + prop?: Array<ModelWithReadOnlyAndWriteOnly>; 369 + propWithFile?: Array<Blob | File>; 370 + propWithNumber?: Array<number>; 371 + }; 372 + 373 + /** 374 + * This is a model with one property containing an array 375 + */ 376 + export type ModelWithArray = { 377 + prop?: Array<ModelWithString>; 378 + propWithFile?: Array<Blob | File>; 379 + propWithNumber?: Array<number>; 380 + }; 381 + 382 + /** 383 + * This is a model with one property containing a dictionary 384 + */ 385 + export type ModelWithDictionary = { 386 + prop?: { 387 + [key: string]: string; 388 + }; 389 + }; 390 + 391 + /** 392 + * This is a deprecated model with a deprecated property 393 + * 394 + * @deprecated 395 + */ 396 + export type DeprecatedModel = { 397 + /** 398 + * This is a deprecated property 399 + * 400 + * @deprecated 401 + */ 402 + prop?: string; 403 + }; 404 + 405 + /** 406 + * This is a model with one property containing a circular reference 407 + */ 408 + export type ModelWithCircularReference = { 409 + prop?: ModelWithCircularReference; 410 + }; 411 + 412 + /** 413 + * This is a model with one property with a 'one of' relationship 414 + */ 415 + export type CompositionWithOneOf = { 416 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 417 + }; 418 + 419 + /** 420 + * This is a model with one property with a 'one of' relationship where the options are not $ref 421 + */ 422 + export type CompositionWithOneOfAnonymous = { 423 + propA?: { 424 + propA?: string; 425 + } | string | number; 426 + }; 427 + 428 + /** 429 + * Circle 430 + */ 431 + export type ModelCircle = { 432 + kind: string; 433 + radius?: number; 434 + }; 435 + 436 + /** 437 + * Square 438 + */ 439 + export type ModelSquare = { 440 + kind: string; 441 + sideLength?: number; 442 + }; 443 + 444 + /** 445 + * This is a model with one property with a 'one of' relationship where the options are not $ref 446 + */ 447 + export type CompositionWithOneOfDiscriminator = ({ 448 + kind: 'circle'; 449 + } & ModelCircle) | ({ 450 + kind: 'square'; 451 + } & ModelSquare); 452 + 453 + /** 454 + * This is a model with one property with a 'any of' relationship 455 + */ 456 + export type CompositionWithAnyOf = { 457 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 458 + }; 459 + 460 + /** 461 + * This is a model with one property with a 'any of' relationship where the options are not $ref 462 + */ 463 + export type CompositionWithAnyOfAnonymous = { 464 + propA?: { 465 + propA?: string; 466 + } | string | number; 467 + }; 468 + 469 + /** 470 + * This is a model with nested 'any of' property with a type null 471 + */ 472 + export type CompositionWithNestedAnyAndTypeNull = { 473 + propA?: Array<ModelWithDictionary | null> | Array<ModelWithArray | null>; 474 + }; 475 + 476 + export type _3eNum1Период = 'Bird' | 'Dog'; 477 + 478 + export type ConstValue = 'ConstValue'; 479 + 480 + /** 481 + * This is a model with one property with a 'any of' relationship where the options are not $ref 482 + */ 483 + export type CompositionWithNestedAnyOfAndNull = { 484 + /** 485 + * Scopes 486 + */ 487 + propA?: Array<_3eNum1Период | ConstValue> | null; 488 + }; 489 + 490 + /** 491 + * This is a model with one property with a 'one of' relationship 492 + */ 493 + export type CompositionWithOneOfAndNullable = { 494 + propA?: { 495 + boolean?: boolean; 496 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 497 + }; 498 + 499 + /** 500 + * This is a model that contains a simple dictionary within composition 501 + */ 502 + export type CompositionWithOneOfAndSimpleDictionary = { 503 + propA?: boolean | { 504 + [key: string]: number; 505 + }; 506 + }; 507 + 508 + /** 509 + * This is a model that contains a dictionary of simple arrays within composition 510 + */ 511 + export type CompositionWithOneOfAndSimpleArrayDictionary = { 512 + propA?: boolean | { 513 + [key: string]: Array<boolean>; 514 + }; 515 + }; 516 + 517 + /** 518 + * This is a model that contains a dictionary of complex arrays (composited) within composition 519 + */ 520 + export type CompositionWithOneOfAndComplexArrayDictionary = { 521 + propA?: boolean | { 522 + [key: string]: Array<number | string>; 523 + }; 524 + }; 525 + 526 + /** 527 + * This is a model with one property with a 'all of' relationship 528 + */ 529 + export type CompositionWithAllOfAndNullable = { 530 + propA?: ({ 531 + boolean?: boolean; 532 + } & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null; 533 + }; 534 + 535 + /** 536 + * This is a model with one property with a 'any of' relationship 537 + */ 538 + export type CompositionWithAnyOfAndNullable = { 539 + propA?: { 540 + boolean?: boolean; 541 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 542 + }; 543 + 544 + /** 545 + * This is a base model with two simple optional properties 546 + */ 547 + export type CompositionBaseModel = { 548 + firstName?: string; 549 + lastname?: string; 550 + }; 551 + 552 + /** 553 + * This is a model that extends the base model 554 + */ 555 + export type CompositionExtendedModel = CompositionBaseModel & { 556 + age: number; 557 + firstName: string; 558 + lastname: string; 559 + }; 560 + 561 + /** 562 + * This is a model with one nested property 563 + */ 564 + export type ModelWithProperties = { 565 + required: string; 566 + readonly requiredAndReadOnly: string; 567 + requiredAndNullable: string | null; 568 + string?: string; 569 + number?: number; 570 + boolean?: boolean; 571 + reference?: ModelWithString; 572 + 'property with space'?: string; 573 + default?: string; 574 + try?: string; 575 + readonly '@namespace.string'?: string; 576 + readonly '@namespace.integer'?: number; 577 + }; 578 + 579 + /** 580 + * This is a model with one nested property 581 + */ 582 + export type ModelWithNestedProperties = { 583 + readonly first: { 584 + readonly second: { 585 + readonly third: string | null; 586 + } | null; 587 + } | null; 588 + }; 589 + 590 + /** 591 + * This is a model with duplicated properties 592 + */ 593 + export type ModelWithDuplicateProperties = { 594 + prop?: ModelWithString; 595 + }; 596 + 597 + /** 598 + * This is a model with ordered properties 599 + */ 600 + export type ModelWithOrderedProperties = { 601 + zebra?: string; 602 + apple?: string; 603 + hawaii?: string; 604 + }; 605 + 606 + /** 607 + * This is a model with duplicated imports 608 + */ 609 + export type ModelWithDuplicateImports = { 610 + propA?: ModelWithString; 611 + propB?: ModelWithString; 612 + propC?: ModelWithString; 613 + }; 614 + 615 + /** 616 + * This is a model that extends another model 617 + */ 618 + export type ModelThatExtends = ModelWithString & { 619 + propExtendsA?: string; 620 + propExtendsB?: ModelWithString; 621 + }; 622 + 623 + /** 624 + * This is a model that extends another model 625 + */ 626 + export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { 627 + propExtendsC?: string; 628 + propExtendsD?: ModelWithString; 629 + }; 630 + 631 + /** 632 + * This is a model that contains a some patterns 633 + */ 634 + export type ModelWithPattern = { 635 + key: string; 636 + name: string; 637 + readonly enabled?: boolean; 638 + readonly modified?: string; 639 + id?: string; 640 + text?: string; 641 + patternWithSingleQuotes?: string; 642 + patternWithNewline?: string; 643 + patternWithBacktick?: string; 644 + }; 645 + 646 + export type File = { 647 + /** 648 + * Id 649 + */ 650 + readonly id?: string; 651 + /** 652 + * Updated at 653 + */ 654 + readonly updated_at?: string; 655 + /** 656 + * Created at 657 + */ 658 + readonly created_at?: string; 659 + /** 660 + * Mime 661 + */ 662 + mime: string; 663 + /** 664 + * File 665 + */ 666 + readonly file?: string; 667 + }; 668 + 669 + export type Default = { 670 + name?: string; 671 + }; 672 + 673 + export type Pageable = { 674 + page?: number; 675 + size?: number; 676 + sort?: Array<string>; 677 + }; 678 + 679 + /** 680 + * This is a free-form object without additionalProperties. 681 + */ 682 + export type FreeFormObjectWithoutAdditionalProperties = { 683 + [key: string]: unknown; 684 + }; 685 + 686 + /** 687 + * This is a free-form object with additionalProperties: true. 688 + */ 689 + export type FreeFormObjectWithAdditionalPropertiesEqTrue = { 690 + [key: string]: unknown; 691 + }; 692 + 693 + /** 694 + * This is a free-form object with additionalProperties: {}. 695 + */ 696 + export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { 697 + [key: string]: unknown; 698 + }; 699 + 700 + export type ModelWithConst = { 701 + String?: 'String'; 702 + number?: 0; 703 + null?: null; 704 + withType?: 'Some string'; 705 + }; 706 + 707 + /** 708 + * This is a model with one property and additionalProperties: true 709 + */ 710 + export type ModelWithAdditionalPropertiesEqTrue = { 711 + /** 712 + * This is a simple string property 713 + */ 714 + prop?: string; 715 + [key: string]: unknown | string | undefined; 716 + }; 717 + 718 + export type NestedAnyOfArraysNullable = { 719 + nullableArray?: Array<string | boolean> | null; 720 + }; 721 + 722 + export type CompositionWithOneOfAndProperties = ({ 723 + foo: SimpleParameter; 724 + } | { 725 + bar: NonAsciiStringæøåÆøÅöôêÊ字符串; 726 + }) & { 727 + baz: number | null; 728 + qux: number; 729 + }; 730 + 731 + /** 732 + * An object that can be null 733 + */ 734 + export type NullableObject = { 735 + foo?: string; 736 + } | null; 737 + 738 + /** 739 + * Some % character 740 + */ 741 + export type CharactersInDescription = string; 742 + 743 + export type ModelWithNullableObject = { 744 + data?: NullableObject; 745 + }; 746 + 747 + export type ModelWithOneOfEnum = { 748 + foo: 'Bar'; 749 + } | { 750 + foo: 'Baz'; 751 + } | { 752 + foo: 'Qux'; 753 + } | { 754 + content: string; 755 + foo: 'Quux'; 756 + } | { 757 + content: [ 758 + string, 759 + string 760 + ]; 761 + foo: 'Corge'; 762 + }; 763 + 764 + export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; 765 + 766 + export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; 767 + 768 + export type ModelWithNestedArrayEnumsData = { 769 + foo?: Array<ModelWithNestedArrayEnumsDataFoo>; 770 + bar?: Array<ModelWithNestedArrayEnumsDataBar>; 771 + }; 772 + 773 + export type ModelWithNestedArrayEnums = { 774 + array_strings?: Array<string>; 775 + data?: ModelWithNestedArrayEnumsData; 776 + }; 777 + 778 + export type ModelWithNestedCompositionEnums = { 779 + foo?: ModelWithNestedArrayEnumsDataFoo; 780 + }; 781 + 782 + export type ModelWithReadOnlyAndWriteOnly = { 783 + foo: string; 784 + readonly bar: string; 785 + }; 786 + 787 + export type ModelWithConstantSizeArray = [ 788 + number, 789 + number 790 + ]; 791 + 792 + export type ModelWithAnyOfConstantSizeArray = [ 793 + number | string, 794 + number | string, 795 + number | string 796 + ]; 797 + 798 + export type ModelWithPrefixItemsConstantSizeArray = [ 799 + ModelWithInteger, 800 + number | string, 801 + string 802 + ]; 803 + 804 + export type ModelWithAnyOfConstantSizeArrayNullable = [ 805 + number | null | string, 806 + number | null | string, 807 + number | null | string 808 + ]; 809 + 810 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ 811 + number | Import, 812 + number | Import 813 + ]; 814 + 815 + export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ 816 + number & string, 817 + number & string 818 + ]; 819 + 820 + export type ModelWithNumericEnumUnion = { 821 + /** 822 + * Период 823 + */ 824 + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; 825 + }; 826 + 827 + /** 828 + * Some description with `back ticks` 829 + */ 830 + export type ModelWithBackticksInDescription = { 831 + /** 832 + * The template `that` should be used for parsing and importing the contents of the CSV file. 833 + * 834 + * <br/><p>There is one placeholder currently supported:<ul> <li><b>${x}</b> - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)</li></ul><p>Example of a correct JSON template:</p> 835 + * <pre> 836 + * [ 837 + * { 838 + * "resourceType": "Asset", 839 + * "identifier": { 840 + * "name": "${1}", 841 + * "domain": { 842 + * "name": "${2}", 843 + * "community": { 844 + * "name": "Some Community" 845 + * } 846 + * } 847 + * }, 848 + * "attributes" : { 849 + * "00000000-0000-0000-0000-000000003115" : [ { 850 + * "value" : "${3}" 851 + * } ], 852 + * "00000000-0000-0000-0000-000000000222" : [ { 853 + * "value" : "${4}" 854 + * } ] 855 + * } 856 + * } 857 + * ] 858 + * </pre> 859 + */ 860 + template?: string; 861 + }; 862 + 863 + export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & { 864 + baz: number | null; 865 + qux: number; 866 + }; 867 + 868 + /** 869 + * Model used to test deduplication strategy (unused) 870 + */ 871 + export type ParameterSimpleParameterUnused = string; 872 + 873 + /** 874 + * Model used to test deduplication strategy 875 + */ 876 + export type PostServiceWithEmptyTagResponse = string; 877 + 878 + /** 879 + * Model used to test deduplication strategy 880 + */ 881 + export type PostServiceWithEmptyTagResponse2 = string; 882 + 883 + /** 884 + * Model used to test deduplication strategy 885 + */ 886 + export type DeleteFooData = string; 887 + 888 + /** 889 + * Model used to test deduplication strategy 890 + */ 891 + export type DeleteFooData2 = string; 892 + 893 + /** 894 + * Model with restricted keyword name 895 + */ 896 + export type Import = string; 897 + 898 + export type SchemaWithFormRestrictedKeys = { 899 + description?: string; 900 + 'x-enum-descriptions'?: string; 901 + 'x-enum-varnames'?: string; 902 + 'x-enumNames'?: string; 903 + title?: string; 904 + object?: { 905 + description?: string; 906 + 'x-enum-descriptions'?: string; 907 + 'x-enum-varnames'?: string; 908 + 'x-enumNames'?: string; 909 + title?: string; 910 + }; 911 + array?: Array<{ 912 + description?: string; 913 + 'x-enum-descriptions'?: string; 914 + 'x-enum-varnames'?: string; 915 + 'x-enumNames'?: string; 916 + title?: string; 917 + }>; 918 + }; 919 + 920 + /** 921 + * This schema was giving PascalCase transformations a hard time 922 + */ 923 + export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = { 924 + /** 925 + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. 926 + */ 927 + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; 928 + }; 929 + 930 + /** 931 + * This schema was giving PascalCase transformations a hard time 932 + */ 933 + export type IoK8sApimachineryPkgApisMetaV1Preconditions = { 934 + /** 935 + * Specifies the target ResourceVersion 936 + */ 937 + resourceVersion?: string; 938 + /** 939 + * Specifies the target UID. 940 + */ 941 + uid?: string; 942 + }; 943 + 944 + export type AdditionalPropertiesUnknownIssue = { 945 + [key: string]: string | number; 946 + }; 947 + 948 + export type AdditionalPropertiesUnknownIssue2 = { 949 + [key: string]: string | number; 950 + }; 951 + 952 + export type AdditionalPropertiesUnknownIssue3 = string & { 953 + entries: { 954 + [key: string]: AdditionalPropertiesUnknownIssue; 955 + }; 956 + }; 957 + 958 + export type AdditionalPropertiesIntegerIssue = { 959 + value: number; 960 + [key: string]: number; 961 + }; 962 + 963 + export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 964 + 965 + export type GenericSchemaDuplicateIssue1SystemBoolean = { 966 + item?: boolean; 967 + error?: string | null; 968 + readonly hasError?: boolean; 969 + data?: { 970 + [key: string]: never; 971 + }; 972 + }; 973 + 974 + export type GenericSchemaDuplicateIssue1SystemString = { 975 + item?: string | null; 976 + error?: string | null; 977 + readonly hasError?: boolean; 978 + }; 979 + 980 + export type ExternalSharedExternalSharedModel = { 981 + id: string; 982 + name?: string; 983 + }; 984 + 985 + /** 986 + * This is a model with one property containing a reference 987 + */ 988 + export type ModelWithReferenceWritable = { 989 + prop?: ModelWithPropertiesWritable; 990 + }; 991 + 992 + /** 993 + * This is a model with one property containing an array 994 + */ 995 + export type ModelWithArrayReadOnlyAndWriteOnlyWritable = { 996 + prop?: Array<ModelWithReadOnlyAndWriteOnlyWritable>; 997 + propWithFile?: Array<Blob | File>; 998 + propWithNumber?: Array<number>; 999 + }; 1000 + 1001 + /** 1002 + * This is a model with one nested property 1003 + */ 1004 + export type ModelWithPropertiesWritable = { 1005 + required: string; 1006 + requiredAndNullable: string | null; 1007 + string?: string; 1008 + number?: number; 1009 + boolean?: boolean; 1010 + reference?: ModelWithString; 1011 + 'property with space'?: string; 1012 + default?: string; 1013 + try?: string; 1014 + }; 1015 + 1016 + /** 1017 + * This is a model that contains a some patterns 1018 + */ 1019 + export type ModelWithPatternWritable = { 1020 + key: string; 1021 + name: string; 1022 + id?: string; 1023 + text?: string; 1024 + patternWithSingleQuotes?: string; 1025 + patternWithNewline?: string; 1026 + patternWithBacktick?: string; 1027 + }; 1028 + 1029 + export type FileWritable = { 1030 + /** 1031 + * Mime 1032 + */ 1033 + mime: string; 1034 + }; 1035 + 1036 + export type ModelWithReadOnlyAndWriteOnlyWritable = { 1037 + foo: string; 1038 + baz: string; 1039 + }; 1040 + 1041 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = [ 1042 + number | Import, 1043 + number | Import 1044 + ]; 1045 + 1046 + export type AdditionalPropertiesUnknownIssueWritable = { 1047 + [key: string]: string | number; 1048 + }; 1049 + 1050 + export type OneOfAllOfIssueWritable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 1051 + 1052 + export type GenericSchemaDuplicateIssue1SystemBooleanWritable = { 1053 + item?: boolean; 1054 + error?: string | null; 1055 + data?: { 1056 + [key: string]: never; 1057 + }; 1058 + }; 1059 + 1060 + export type GenericSchemaDuplicateIssue1SystemStringWritable = { 1061 + item?: string | null; 1062 + error?: string | null; 1063 + }; 1064 + 1065 + /** 1066 + * This is a reusable parameter 1067 + */ 1068 + export type SimpleParameter = string; 1069 + 1070 + /** 1071 + * Parameter with illegal characters 1072 + */ 1073 + export type XFooBar = ModelWithString; 1074 + 1075 + /** 1076 + * A reusable request body 1077 + */ 1078 + export type SimpleRequestBody = ModelWithString; 1079 + 1080 + /** 1081 + * A reusable request body 1082 + */ 1083 + export type SimpleFormData = ModelWithString; 1084 + 1085 + export type ExportData = { 1086 + body?: never; 1087 + path?: never; 1088 + query?: never; 1089 + url: '/api/v{api-version}/no+tag'; 1090 + }; 1091 + 1092 + export type PatchApiVbyApiVersionNoTagData = { 1093 + body?: never; 1094 + path?: never; 1095 + query?: never; 1096 + url: '/api/v{api-version}/no+tag'; 1097 + }; 1098 + 1099 + export type PatchApiVbyApiVersionNoTagResponses = { 1100 + /** 1101 + * OK 1102 + */ 1103 + default: unknown; 1104 + }; 1105 + 1106 + export type ImportData = { 1107 + body: ModelWithReadOnlyAndWriteOnlyWritable | ModelWithArrayReadOnlyAndWriteOnlyWritable; 1108 + path?: never; 1109 + query?: never; 1110 + url: '/api/v{api-version}/no+tag'; 1111 + }; 1112 + 1113 + export type ImportResponses = { 1114 + /** 1115 + * Success 1116 + */ 1117 + 200: ModelFromZendesk; 1118 + /** 1119 + * Default success response 1120 + */ 1121 + default: ModelWithReadOnlyAndWriteOnly; 1122 + }; 1123 + 1124 + export type ImportResponse = ImportResponses[keyof ImportResponses]; 1125 + 1126 + export type FooWowData = { 1127 + body?: never; 1128 + path?: never; 1129 + query?: never; 1130 + url: '/api/v{api-version}/no+tag'; 1131 + }; 1132 + 1133 + export type FooWowResponses = { 1134 + /** 1135 + * OK 1136 + */ 1137 + default: unknown; 1138 + }; 1139 + 1140 + export type ApiVVersionODataControllerCountData = { 1141 + body?: never; 1142 + path?: never; 1143 + query?: never; 1144 + url: '/api/v{api-version}/simple/$count'; 1145 + }; 1146 + 1147 + export type ApiVVersionODataControllerCountResponses = { 1148 + /** 1149 + * Success 1150 + */ 1151 + 200: ModelFromZendesk; 1152 + }; 1153 + 1154 + export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; 1155 + 1156 + export type GetApiVbyApiVersionSimpleOperationData = { 1157 + body?: never; 1158 + path: { 1159 + /** 1160 + * foo in method 1161 + */ 1162 + foo_param: string; 1163 + }; 1164 + query?: never; 1165 + url: '/api/v{api-version}/simple:operation'; 1166 + }; 1167 + 1168 + export type GetApiVbyApiVersionSimpleOperationErrors = { 1169 + /** 1170 + * Default error response 1171 + */ 1172 + default: ModelWithBoolean; 1173 + }; 1174 + 1175 + export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; 1176 + 1177 + export type GetApiVbyApiVersionSimpleOperationResponses = { 1178 + /** 1179 + * Response is a simple number 1180 + */ 1181 + 200: number; 1182 + }; 1183 + 1184 + export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; 1185 + 1186 + export type DeleteCallWithoutParametersAndResponseData = { 1187 + body?: never; 1188 + path?: never; 1189 + query?: never; 1190 + url: '/api/v{api-version}/simple'; 1191 + }; 1192 + 1193 + export type GetCallWithoutParametersAndResponseData = { 1194 + body?: never; 1195 + path?: never; 1196 + query?: never; 1197 + url: '/api/v{api-version}/simple'; 1198 + }; 1199 + 1200 + export type HeadCallWithoutParametersAndResponseData = { 1201 + body?: never; 1202 + path?: never; 1203 + query?: never; 1204 + url: '/api/v{api-version}/simple'; 1205 + }; 1206 + 1207 + export type OptionsCallWithoutParametersAndResponseData = { 1208 + body?: never; 1209 + path?: never; 1210 + query?: never; 1211 + url: '/api/v{api-version}/simple'; 1212 + }; 1213 + 1214 + export type PatchCallWithoutParametersAndResponseData = { 1215 + body?: never; 1216 + path?: never; 1217 + query?: never; 1218 + url: '/api/v{api-version}/simple'; 1219 + }; 1220 + 1221 + export type PostCallWithoutParametersAndResponseData = { 1222 + body?: never; 1223 + path?: never; 1224 + query?: never; 1225 + url: '/api/v{api-version}/simple'; 1226 + }; 1227 + 1228 + export type PutCallWithoutParametersAndResponseData = { 1229 + body?: never; 1230 + path?: never; 1231 + query?: never; 1232 + url: '/api/v{api-version}/simple'; 1233 + }; 1234 + 1235 + export type DeleteFooData3 = { 1236 + body?: never; 1237 + headers: { 1238 + /** 1239 + * Parameter with illegal characters 1240 + */ 1241 + 'x-Foo-Bar': ModelWithString; 1242 + }; 1243 + path: { 1244 + /** 1245 + * foo in method 1246 + */ 1247 + foo_param: string; 1248 + /** 1249 + * bar in method 1250 + */ 1251 + BarParam: string; 1252 + }; 1253 + query?: never; 1254 + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; 1255 + }; 1256 + 1257 + export type CallWithDescriptionsData = { 1258 + body?: never; 1259 + path?: never; 1260 + query?: { 1261 + /** 1262 + * Testing multiline comments in string: First line 1263 + * Second line 1264 + * 1265 + * Fourth line 1266 + */ 1267 + parameterWithBreaks?: string; 1268 + /** 1269 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1270 + */ 1271 + parameterWithBackticks?: string; 1272 + /** 1273 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1274 + */ 1275 + parameterWithSlashes?: string; 1276 + /** 1277 + * Testing expression placeholders in string: ${expression} should work 1278 + */ 1279 + parameterWithExpressionPlaceholders?: string; 1280 + /** 1281 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1282 + */ 1283 + parameterWithQuotes?: string; 1284 + /** 1285 + * Testing reserved characters in string: * inline * and ** inline ** should work 1286 + */ 1287 + parameterWithReservedCharacters?: string; 1288 + }; 1289 + url: '/api/v{api-version}/descriptions'; 1290 + }; 1291 + 1292 + export type DeprecatedCallData = { 1293 + body?: never; 1294 + headers: { 1295 + /** 1296 + * This parameter is deprecated 1297 + * 1298 + * @deprecated 1299 + */ 1300 + parameter: DeprecatedModel | null; 1301 + }; 1302 + path?: never; 1303 + query?: never; 1304 + url: '/api/v{api-version}/parameters/deprecated'; 1305 + }; 1306 + 1307 + export type CallWithParametersData = { 1308 + /** 1309 + * This is the parameter that goes into the body 1310 + */ 1311 + body: { 1312 + [key: string]: unknown; 1313 + } | null; 1314 + headers: { 1315 + /** 1316 + * This is the parameter that goes into the header 1317 + */ 1318 + parameterHeader: string | null; 1319 + }; 1320 + path: { 1321 + /** 1322 + * This is the parameter that goes into the path 1323 + */ 1324 + parameterPath: string | null; 1325 + /** 1326 + * api-version should be required in standalone clients 1327 + */ 1328 + 'api-version': string | null; 1329 + }; 1330 + query: { 1331 + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; 1332 + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; 1333 + /** 1334 + * This is the parameter that goes into the query params 1335 + */ 1336 + cursor: string | null; 1337 + }; 1338 + url: '/api/v{api-version}/parameters/{parameterPath}'; 1339 + }; 1340 + 1341 + export type CallWithWeirdParameterNamesData = { 1342 + /** 1343 + * This is the parameter that goes into the body 1344 + */ 1345 + body: ModelWithString | null; 1346 + headers: { 1347 + /** 1348 + * This is the parameter that goes into the request header 1349 + */ 1350 + 'parameter.header': string | null; 1351 + }; 1352 + path: { 1353 + /** 1354 + * This is the parameter that goes into the path 1355 + */ 1356 + 'parameter.path.1'?: string; 1357 + /** 1358 + * This is the parameter that goes into the path 1359 + */ 1360 + 'parameter-path-2'?: string; 1361 + /** 1362 + * This is the parameter that goes into the path 1363 + */ 1364 + 'PARAMETER-PATH-3'?: string; 1365 + /** 1366 + * api-version should be required in standalone clients 1367 + */ 1368 + 'api-version': string | null; 1369 + }; 1370 + query: { 1371 + /** 1372 + * This is the parameter with a reserved keyword 1373 + */ 1374 + default?: string; 1375 + /** 1376 + * This is the parameter that goes into the request query params 1377 + */ 1378 + 'parameter-query': string | null; 1379 + }; 1380 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; 1381 + }; 1382 + 1383 + export type GetCallWithOptionalParamData = { 1384 + /** 1385 + * This is a required parameter 1386 + */ 1387 + body: ModelWithOneOfEnum; 1388 + path?: never; 1389 + query?: { 1390 + /** 1391 + * This is an optional parameter 1392 + */ 1393 + page?: number; 1394 + }; 1395 + url: '/api/v{api-version}/parameters'; 1396 + }; 1397 + 1398 + export type PostCallWithOptionalParamData = { 1399 + /** 1400 + * This is an optional parameter 1401 + */ 1402 + body?: { 1403 + offset?: number | null; 1404 + }; 1405 + path?: never; 1406 + query: { 1407 + /** 1408 + * This is a required parameter 1409 + */ 1410 + parameter: Pageable; 1411 + }; 1412 + url: '/api/v{api-version}/parameters'; 1413 + }; 1414 + 1415 + export type PostCallWithOptionalParamResponses = { 1416 + /** 1417 + * Response is a simple number 1418 + */ 1419 + 200: number; 1420 + /** 1421 + * Success 1422 + */ 1423 + 204: void; 1424 + }; 1425 + 1426 + export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; 1427 + 1428 + export type PostApiVbyApiVersionRequestBodyData = { 1429 + /** 1430 + * A reusable request body 1431 + */ 1432 + body?: SimpleRequestBody; 1433 + path?: never; 1434 + query?: { 1435 + /** 1436 + * This is a reusable parameter 1437 + */ 1438 + parameter?: string; 1439 + }; 1440 + url: '/api/v{api-version}/requestBody'; 1441 + }; 1442 + 1443 + export type PostApiVbyApiVersionFormDataData = { 1444 + /** 1445 + * A reusable request body 1446 + */ 1447 + body?: SimpleFormData; 1448 + path?: never; 1449 + query?: { 1450 + /** 1451 + * This is a reusable parameter 1452 + */ 1453 + parameter?: string; 1454 + }; 1455 + url: '/api/v{api-version}/formData'; 1456 + }; 1457 + 1458 + export type CallWithDefaultParametersData = { 1459 + body?: never; 1460 + path?: never; 1461 + query?: { 1462 + /** 1463 + * This is a simple string with default value 1464 + */ 1465 + parameterString?: string | null; 1466 + /** 1467 + * This is a simple number with default value 1468 + */ 1469 + parameterNumber?: number | null; 1470 + /** 1471 + * This is a simple boolean with default value 1472 + */ 1473 + parameterBoolean?: boolean | null; 1474 + /** 1475 + * This is a simple enum with default value 1476 + */ 1477 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1478 + /** 1479 + * This is a simple model with default value 1480 + */ 1481 + parameterModel?: ModelWithString | null; 1482 + }; 1483 + url: '/api/v{api-version}/defaults'; 1484 + }; 1485 + 1486 + export type CallWithDefaultOptionalParametersData = { 1487 + body?: never; 1488 + path?: never; 1489 + query?: { 1490 + /** 1491 + * This is a simple string that is optional with default value 1492 + */ 1493 + parameterString?: string; 1494 + /** 1495 + * This is a simple number that is optional with default value 1496 + */ 1497 + parameterNumber?: number; 1498 + /** 1499 + * This is a simple boolean that is optional with default value 1500 + */ 1501 + parameterBoolean?: boolean; 1502 + /** 1503 + * This is a simple enum that is optional with default value 1504 + */ 1505 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1506 + /** 1507 + * This is a simple model that is optional with default value 1508 + */ 1509 + parameterModel?: ModelWithString; 1510 + }; 1511 + url: '/api/v{api-version}/defaults'; 1512 + }; 1513 + 1514 + export type CallToTestOrderOfParamsData = { 1515 + body?: never; 1516 + path?: never; 1517 + query: { 1518 + /** 1519 + * This is a optional string with default 1520 + */ 1521 + parameterOptionalStringWithDefault?: string; 1522 + /** 1523 + * This is a optional string with empty default 1524 + */ 1525 + parameterOptionalStringWithEmptyDefault?: string; 1526 + /** 1527 + * This is a optional string with no default 1528 + */ 1529 + parameterOptionalStringWithNoDefault?: string; 1530 + /** 1531 + * This is a string with default 1532 + */ 1533 + parameterStringWithDefault: string; 1534 + /** 1535 + * This is a string with empty default 1536 + */ 1537 + parameterStringWithEmptyDefault: string; 1538 + /** 1539 + * This is a string with no default 1540 + */ 1541 + parameterStringWithNoDefault: string; 1542 + /** 1543 + * This is a string that can be null with no default 1544 + */ 1545 + parameterStringNullableWithNoDefault?: string | null; 1546 + /** 1547 + * This is a string that can be null with default 1548 + */ 1549 + parameterStringNullableWithDefault?: string | null; 1550 + }; 1551 + url: '/api/v{api-version}/defaults'; 1552 + }; 1553 + 1554 + export type DuplicateNameData = { 1555 + body?: never; 1556 + path?: never; 1557 + query?: never; 1558 + url: '/api/v{api-version}/duplicate'; 1559 + }; 1560 + 1561 + export type DuplicateName2Data = { 1562 + body?: never; 1563 + path?: never; 1564 + query?: never; 1565 + url: '/api/v{api-version}/duplicate'; 1566 + }; 1567 + 1568 + export type DuplicateName3Data = { 1569 + body?: never; 1570 + path?: never; 1571 + query?: never; 1572 + url: '/api/v{api-version}/duplicate'; 1573 + }; 1574 + 1575 + export type DuplicateName4Data = { 1576 + body?: never; 1577 + path?: never; 1578 + query?: never; 1579 + url: '/api/v{api-version}/duplicate'; 1580 + }; 1581 + 1582 + export type CallWithNoContentResponseData = { 1583 + body?: never; 1584 + path?: never; 1585 + query?: never; 1586 + url: '/api/v{api-version}/no-content'; 1587 + }; 1588 + 1589 + export type CallWithNoContentResponseResponses = { 1590 + /** 1591 + * Success 1592 + */ 1593 + 204: void; 1594 + }; 1595 + 1596 + export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; 1597 + 1598 + export type CallWithResponseAndNoContentResponseData = { 1599 + body?: never; 1600 + path?: never; 1601 + query?: never; 1602 + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; 1603 + }; 1604 + 1605 + export type CallWithResponseAndNoContentResponseResponses = { 1606 + /** 1607 + * Response is a simple number 1608 + */ 1609 + 200: number; 1610 + /** 1611 + * Success 1612 + */ 1613 + 204: void; 1614 + }; 1615 + 1616 + export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; 1617 + 1618 + export type DummyAData = { 1619 + body?: never; 1620 + path?: never; 1621 + query?: never; 1622 + url: '/api/v{api-version}/multiple-tags/a'; 1623 + }; 1624 + 1625 + export type DummyAResponses = { 1626 + 200: _400; 1627 + }; 1628 + 1629 + export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; 1630 + 1631 + export type DummyBData = { 1632 + body?: never; 1633 + path?: never; 1634 + query?: never; 1635 + url: '/api/v{api-version}/multiple-tags/b'; 1636 + }; 1637 + 1638 + export type DummyBResponses = { 1639 + /** 1640 + * Success 1641 + */ 1642 + 204: void; 1643 + }; 1644 + 1645 + export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; 1646 + 1647 + export type CallWithResponseData = { 1648 + body?: never; 1649 + path?: never; 1650 + query?: never; 1651 + url: '/api/v{api-version}/response'; 1652 + }; 1653 + 1654 + export type CallWithResponseResponses = { 1655 + default: Import; 1656 + }; 1657 + 1658 + export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; 1659 + 1660 + export type CallWithDuplicateResponsesData = { 1661 + body?: never; 1662 + path?: never; 1663 + query?: never; 1664 + url: '/api/v{api-version}/response'; 1665 + }; 1666 + 1667 + export type CallWithDuplicateResponsesErrors = { 1668 + /** 1669 + * Message for 500 error 1670 + */ 1671 + 500: ModelWithStringError; 1672 + /** 1673 + * Message for 501 error 1674 + */ 1675 + 501: ModelWithStringError; 1676 + /** 1677 + * Message for 502 error 1678 + */ 1679 + 502: ModelWithStringError; 1680 + /** 1681 + * Message for 4XX errors 1682 + */ 1683 + '4XX': DictionaryWithArray; 1684 + /** 1685 + * Default error response 1686 + */ 1687 + default: ModelWithBoolean; 1688 + }; 1689 + 1690 + export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; 1691 + 1692 + export type CallWithDuplicateResponsesResponses = { 1693 + /** 1694 + * Message for 200 response 1695 + */ 1696 + 200: ModelWithBoolean & ModelWithInteger; 1697 + /** 1698 + * Message for 201 response 1699 + */ 1700 + 201: ModelWithString; 1701 + /** 1702 + * Message for 202 response 1703 + */ 1704 + 202: ModelWithString; 1705 + }; 1706 + 1707 + export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; 1708 + 1709 + export type CallWithResponsesData = { 1710 + body?: never; 1711 + path?: never; 1712 + query?: never; 1713 + url: '/api/v{api-version}/response'; 1714 + }; 1715 + 1716 + export type CallWithResponsesErrors = { 1717 + /** 1718 + * Message for 500 error 1719 + */ 1720 + 500: ModelWithStringError; 1721 + /** 1722 + * Message for 501 error 1723 + */ 1724 + 501: ModelWithStringError; 1725 + /** 1726 + * Message for 502 error 1727 + */ 1728 + 502: ModelWithStringError; 1729 + /** 1730 + * Message for default response 1731 + */ 1732 + default: ModelWithStringError; 1733 + }; 1734 + 1735 + export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; 1736 + 1737 + export type CallWithResponsesResponses = { 1738 + /** 1739 + * Message for 200 response 1740 + */ 1741 + 200: { 1742 + readonly '@namespace.string'?: string; 1743 + readonly '@namespace.integer'?: number; 1744 + readonly value?: Array<ModelWithString>; 1745 + }; 1746 + /** 1747 + * Message for 201 response 1748 + */ 1749 + 201: ModelThatExtends; 1750 + /** 1751 + * Message for 202 response 1752 + */ 1753 + 202: ModelThatExtendsExtends; 1754 + }; 1755 + 1756 + export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; 1757 + 1758 + export type CollectionFormatData = { 1759 + body?: never; 1760 + path?: never; 1761 + query: { 1762 + /** 1763 + * This is an array parameter that is sent as csv format (comma-separated values) 1764 + */ 1765 + parameterArrayCSV: Array<string> | null; 1766 + /** 1767 + * This is an array parameter that is sent as ssv format (space-separated values) 1768 + */ 1769 + parameterArraySSV: Array<string> | null; 1770 + /** 1771 + * This is an array parameter that is sent as tsv format (tab-separated values) 1772 + */ 1773 + parameterArrayTSV: Array<string> | null; 1774 + /** 1775 + * This is an array parameter that is sent as pipes format (pipe-separated values) 1776 + */ 1777 + parameterArrayPipes: Array<string> | null; 1778 + /** 1779 + * This is an array parameter that is sent as multi format (multiple parameter instances) 1780 + */ 1781 + parameterArrayMulti: Array<string> | null; 1782 + }; 1783 + url: '/api/v{api-version}/collectionFormat'; 1784 + }; 1785 + 1786 + export type TypesData = { 1787 + body?: never; 1788 + path?: { 1789 + /** 1790 + * This is a number parameter 1791 + */ 1792 + id?: number; 1793 + }; 1794 + query: { 1795 + /** 1796 + * This is a number parameter 1797 + */ 1798 + parameterNumber: number; 1799 + /** 1800 + * This is a string parameter 1801 + */ 1802 + parameterString: string | null; 1803 + /** 1804 + * This is a boolean parameter 1805 + */ 1806 + parameterBoolean: boolean | null; 1807 + /** 1808 + * This is an object parameter 1809 + */ 1810 + parameterObject: { 1811 + [key: string]: unknown; 1812 + } | null; 1813 + /** 1814 + * This is an array parameter 1815 + */ 1816 + parameterArray: Array<string> | null; 1817 + /** 1818 + * This is a dictionary parameter 1819 + */ 1820 + parameterDictionary: { 1821 + [key: string]: unknown; 1822 + } | null; 1823 + /** 1824 + * This is an enum parameter 1825 + */ 1826 + parameterEnum: 'Success' | 'Warning' | 'Error' | null; 1827 + }; 1828 + url: '/api/v{api-version}/types'; 1829 + }; 1830 + 1831 + export type TypesResponses = { 1832 + /** 1833 + * Response is a simple number 1834 + */ 1835 + 200: number; 1836 + /** 1837 + * Response is a simple string 1838 + */ 1839 + 201: string; 1840 + /** 1841 + * Response is a simple boolean 1842 + */ 1843 + 202: boolean; 1844 + /** 1845 + * Response is a simple object 1846 + */ 1847 + 203: { 1848 + [key: string]: unknown; 1849 + }; 1850 + }; 1851 + 1852 + export type TypesResponse = TypesResponses[keyof TypesResponses]; 1853 + 1854 + export type UploadFileData = { 1855 + body: Blob | File; 1856 + path: { 1857 + /** 1858 + * api-version should be required in standalone clients 1859 + */ 1860 + 'api-version': string | null; 1861 + }; 1862 + query?: never; 1863 + url: '/api/v{api-version}/upload'; 1864 + }; 1865 + 1866 + export type UploadFileResponses = { 1867 + 200: boolean; 1868 + }; 1869 + 1870 + export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; 1871 + 1872 + export type FileResponseData = { 1873 + body?: never; 1874 + path: { 1875 + id: string; 1876 + /** 1877 + * api-version should be required in standalone clients 1878 + */ 1879 + 'api-version': string; 1880 + }; 1881 + query?: never; 1882 + url: '/api/v{api-version}/file/{id}'; 1883 + }; 1884 + 1885 + export type FileResponseResponses = { 1886 + /** 1887 + * Success 1888 + */ 1889 + 200: Blob | File; 1890 + }; 1891 + 1892 + export type FileResponseResponse = FileResponseResponses[keyof FileResponseResponses]; 1893 + 1894 + export type ComplexTypesData = { 1895 + body?: never; 1896 + path?: never; 1897 + query: { 1898 + /** 1899 + * Parameter containing object 1900 + */ 1901 + parameterObject: { 1902 + first?: { 1903 + second?: { 1904 + third?: string; 1905 + }; 1906 + }; 1907 + }; 1908 + /** 1909 + * Parameter containing reference 1910 + */ 1911 + parameterReference: ModelWithString; 1912 + }; 1913 + url: '/api/v{api-version}/complex'; 1914 + }; 1915 + 1916 + export type ComplexTypesErrors = { 1917 + /** 1918 + * 400 `server` error 1919 + */ 1920 + 400: unknown; 1921 + /** 1922 + * 500 server error 1923 + */ 1924 + 500: unknown; 1925 + }; 1926 + 1927 + export type ComplexTypesResponses = { 1928 + /** 1929 + * Successful response 1930 + */ 1931 + 200: Array<ModelWithString>; 1932 + }; 1933 + 1934 + export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; 1935 + 1936 + export type MultipartResponseData = { 1937 + body?: never; 1938 + path?: never; 1939 + query?: never; 1940 + url: '/api/v{api-version}/multipart'; 1941 + }; 1942 + 1943 + export type MultipartResponseResponses = { 1944 + /** 1945 + * OK 1946 + */ 1947 + 200: { 1948 + file?: Blob | File; 1949 + metadata?: { 1950 + foo?: string; 1951 + bar?: string; 1952 + }; 1953 + }; 1954 + }; 1955 + 1956 + export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; 1957 + 1958 + export type MultipartRequestData = { 1959 + body?: { 1960 + content?: Blob | File; 1961 + data?: ModelWithString | null; 1962 + }; 1963 + path?: never; 1964 + query?: never; 1965 + url: '/api/v{api-version}/multipart'; 1966 + }; 1967 + 1968 + export type ComplexParamsData = { 1969 + body?: { 1970 + readonly key: string | null; 1971 + name: string | null; 1972 + enabled?: boolean; 1973 + type: 'Monkey' | 'Horse' | 'Bird'; 1974 + listOfModels?: Array<ModelWithString> | null; 1975 + listOfStrings?: Array<string> | null; 1976 + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 1977 + readonly user?: { 1978 + readonly id?: number; 1979 + readonly name?: string | null; 1980 + }; 1981 + }; 1982 + path: { 1983 + id: number; 1984 + /** 1985 + * api-version should be required in standalone clients 1986 + */ 1987 + 'api-version': string; 1988 + }; 1989 + query?: never; 1990 + url: '/api/v{api-version}/complex/{id}'; 1991 + }; 1992 + 1993 + export type ComplexParamsResponses = { 1994 + /** 1995 + * Success 1996 + */ 1997 + 200: ModelWithString; 1998 + }; 1999 + 2000 + export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; 2001 + 2002 + export type CallWithResultFromHeaderData = { 2003 + body?: never; 2004 + path?: never; 2005 + query?: never; 2006 + url: '/api/v{api-version}/header'; 2007 + }; 2008 + 2009 + export type CallWithResultFromHeaderErrors = { 2010 + /** 2011 + * 400 server error 2012 + */ 2013 + 400: unknown; 2014 + /** 2015 + * 500 server error 2016 + */ 2017 + 500: unknown; 2018 + }; 2019 + 2020 + export type CallWithResultFromHeaderResponses = { 2021 + /** 2022 + * Successful response 2023 + */ 2024 + 200: unknown; 2025 + }; 2026 + 2027 + export type TestErrorCodeData = { 2028 + body?: never; 2029 + path?: never; 2030 + query: { 2031 + /** 2032 + * Status code to return 2033 + */ 2034 + status: number; 2035 + }; 2036 + url: '/api/v{api-version}/error'; 2037 + }; 2038 + 2039 + export type TestErrorCodeErrors = { 2040 + /** 2041 + * Custom message: Internal Server Error 2042 + */ 2043 + 500: unknown; 2044 + /** 2045 + * Custom message: Not Implemented 2046 + */ 2047 + 501: unknown; 2048 + /** 2049 + * Custom message: Bad Gateway 2050 + */ 2051 + 502: unknown; 2052 + /** 2053 + * Custom message: Service Unavailable 2054 + */ 2055 + 503: unknown; 2056 + }; 2057 + 2058 + export type TestErrorCodeResponses = { 2059 + /** 2060 + * Custom message: Successful response 2061 + */ 2062 + 200: unknown; 2063 + }; 2064 + 2065 + export type NonAsciiæøåÆøÅöôêÊ字符串Data = { 2066 + body?: never; 2067 + path?: never; 2068 + query: { 2069 + /** 2070 + * Dummy input param 2071 + */ 2072 + nonAsciiParamæøåÆØÅöôêÊ: number; 2073 + }; 2074 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2075 + }; 2076 + 2077 + export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { 2078 + /** 2079 + * Successful response 2080 + */ 2081 + 200: Array<NonAsciiStringæøåÆøÅöôêÊ字符串>; 2082 + }; 2083 + 2084 + export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; 2085 + 2086 + export type PutWithFormUrlEncodedData = { 2087 + body: ArrayWithStrings; 2088 + path?: never; 2089 + query?: never; 2090 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2091 + };
+16
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { type ClientOptions, type Config, createClient, createConfig } from './client/index.js'; 4 + import type { ClientOptions as ClientOptions2 } from './types.gen.js'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 15 + 16 + export const client = createClient(createConfig<ClientOptions2>({ baseUrl: 'http://localhost:3000/base' }));
+262
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/client/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { createSseClient } from '../core/serverSentEvents.gen.js'; 4 + import type { HttpMethod } from '../core/types.gen.js'; 5 + import { getValidRequestBody } from '../core/utils.gen.js'; 6 + import type { 7 + Client, 8 + Config, 9 + RequestOptions, 10 + ResolvedRequestOptions, 11 + } from './types.gen.js'; 12 + import { 13 + buildUrl, 14 + createConfig, 15 + createInterceptors, 16 + getParseAs, 17 + mergeConfigs, 18 + mergeHeaders, 19 + setAuthParams, 20 + } from './utils.gen.js'; 21 + 22 + type ReqInit = Omit<RequestInit, 'body' | 'headers'> & { 23 + body?: any; 24 + headers: ReturnType<typeof mergeHeaders>; 25 + }; 26 + 27 + export const createClient = (config: Config = {}): Client => { 28 + let _config = mergeConfigs(createConfig(), config); 29 + 30 + const getConfig = (): Config => ({ ..._config }); 31 + 32 + const setConfig = (config: Config): Config => { 33 + _config = mergeConfigs(_config, config); 34 + return getConfig(); 35 + }; 36 + 37 + const interceptors = createInterceptors< 38 + Response, 39 + unknown, 40 + ResolvedRequestOptions 41 + >(); 42 + 43 + const beforeRequest = async (options: RequestOptions) => { 44 + const opts = { 45 + ..._config, 46 + ...options, 47 + fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, 48 + headers: mergeHeaders(_config.headers, options.headers), 49 + serializedBody: undefined, 50 + }; 51 + 52 + if (opts.security) { 53 + await setAuthParams({ 54 + ...opts, 55 + security: opts.security, 56 + }); 57 + } 58 + 59 + if (opts.requestValidator) { 60 + await opts.requestValidator(opts); 61 + } 62 + 63 + if (opts.body !== undefined && opts.bodySerializer) { 64 + opts.serializedBody = opts.bodySerializer(opts.body); 65 + } 66 + 67 + // remove Content-Type header if body is empty to avoid sending invalid requests 68 + if (opts.body === undefined || opts.serializedBody === '') { 69 + opts.headers.delete('Content-Type'); 70 + } 71 + 72 + const url = buildUrl(opts); 73 + 74 + return { opts, url }; 75 + }; 76 + 77 + // @ts-expect-error 78 + const request: Client['request'] = async (options) => { 79 + // @ts-expect-error 80 + const { opts, url } = await beforeRequest(options); 81 + 82 + for (const fn of interceptors.request.fns) { 83 + if (fn) { 84 + await fn(opts); 85 + } 86 + } 87 + 88 + // fetch must be assigned here, otherwise it would throw the error: 89 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 90 + const _fetch = opts.fetch!; 91 + const requestInit: ReqInit = { 92 + ...opts, 93 + body: getValidRequestBody(opts), 94 + }; 95 + 96 + let response = await _fetch(url, requestInit); 97 + 98 + for (const fn of interceptors.response.fns) { 99 + if (fn) { 100 + response = await fn(response, opts); 101 + } 102 + } 103 + 104 + const result = { 105 + response, 106 + }; 107 + 108 + if (response.ok) { 109 + const parseAs = 110 + (opts.parseAs === 'auto' 111 + ? getParseAs(response.headers.get('Content-Type')) 112 + : opts.parseAs) ?? 'json'; 113 + 114 + if ( 115 + response.status === 204 || 116 + response.headers.get('Content-Length') === '0' 117 + ) { 118 + let emptyData: any; 119 + switch (parseAs) { 120 + case 'arrayBuffer': 121 + case 'blob': 122 + case 'text': 123 + emptyData = await response[parseAs](); 124 + break; 125 + case 'formData': 126 + emptyData = new FormData(); 127 + break; 128 + case 'stream': 129 + emptyData = response.body; 130 + break; 131 + case 'json': 132 + default: 133 + emptyData = {}; 134 + break; 135 + } 136 + return { 137 + data: emptyData, 138 + ...result, 139 + }; 140 + } 141 + 142 + let data: any; 143 + switch (parseAs) { 144 + case 'arrayBuffer': 145 + case 'blob': 146 + case 'formData': 147 + case 'json': 148 + case 'text': 149 + data = await response[parseAs](); 150 + break; 151 + case 'stream': 152 + return { 153 + data: response.body, 154 + ...result, 155 + }; 156 + } 157 + 158 + if (parseAs === 'json') { 159 + if (opts.responseValidator) { 160 + await opts.responseValidator(data); 161 + } 162 + 163 + if (opts.responseTransformer) { 164 + data = await opts.responseTransformer(data); 165 + } 166 + } 167 + 168 + return { 169 + data, 170 + ...result, 171 + }; 172 + } 173 + 174 + const textError = await response.text(); 175 + let jsonError: unknown; 176 + 177 + try { 178 + jsonError = JSON.parse(textError); 179 + } catch { 180 + // noop 181 + } 182 + 183 + const error = jsonError ?? textError; 184 + let finalError = error; 185 + 186 + for (const fn of interceptors.error.fns) { 187 + if (fn) { 188 + finalError = (await fn(error, response, opts)) as string; 189 + } 190 + } 191 + 192 + finalError = finalError || ({} as string); 193 + 194 + if (opts.throwOnError) { 195 + throw finalError; 196 + } 197 + 198 + return { 199 + error: finalError, 200 + ...result, 201 + }; 202 + }; 203 + 204 + const makeMethodFn = 205 + (method: Uppercase<HttpMethod>) => (options: RequestOptions) => 206 + request({ ...options, method }); 207 + 208 + const makeSseFn = 209 + (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => { 210 + const { opts, url } = await beforeRequest(options); 211 + return createSseClient({ 212 + ...opts, 213 + body: opts.body as BodyInit | null | undefined, 214 + headers: opts.headers as unknown as Record<string, string>, 215 + method, 216 + onRequest: async (url, init) => { 217 + let request = new Request(url, init); 218 + const requestInit = { 219 + ...init, 220 + method: init.method as Config['method'], 221 + url, 222 + }; 223 + for (const fn of interceptors.request.fns) { 224 + if (fn) { 225 + await fn(requestInit); 226 + request = new Request(requestInit.url, requestInit); 227 + } 228 + } 229 + return request; 230 + }, 231 + url, 232 + }); 233 + }; 234 + 235 + return { 236 + buildUrl, 237 + connect: makeMethodFn('CONNECT'), 238 + delete: makeMethodFn('DELETE'), 239 + get: makeMethodFn('GET'), 240 + getConfig, 241 + head: makeMethodFn('HEAD'), 242 + interceptors, 243 + options: makeMethodFn('OPTIONS'), 244 + patch: makeMethodFn('PATCH'), 245 + post: makeMethodFn('POST'), 246 + put: makeMethodFn('PUT'), 247 + request, 248 + setConfig, 249 + sse: { 250 + connect: makeSseFn('CONNECT'), 251 + delete: makeSseFn('DELETE'), 252 + get: makeSseFn('GET'), 253 + head: makeSseFn('HEAD'), 254 + options: makeSseFn('OPTIONS'), 255 + patch: makeSseFn('PATCH'), 256 + post: makeSseFn('POST'), 257 + put: makeSseFn('PUT'), 258 + trace: makeSseFn('TRACE'), 259 + }, 260 + trace: makeMethodFn('TRACE'), 261 + } as Client; 262 + };
+23
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/client/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type { Auth } from '../core/auth.gen.js'; 4 + export type { QuerySerializerOptions } from '../core/bodySerializer.gen.js'; 5 + export { 6 + formDataBodySerializer, 7 + jsonBodySerializer, 8 + urlSearchParamsBodySerializer, 9 + } from '../core/bodySerializer.gen.js'; 10 + export { buildClientParams } from '../core/params.gen.js'; 11 + export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen.js'; 12 + export { createClient } from './client.gen.js'; 13 + export type { 14 + Client, 15 + ClientOptions, 16 + Config, 17 + CreateClientConfig, 18 + Options, 19 + RequestOptions, 20 + RequestResult, 21 + TDataShape, 22 + } from './types.gen.js'; 23 + export { createConfig } from './utils.gen.js';
+198
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/client/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth } from '../core/auth.gen.js'; 4 + import type { 5 + ServerSentEventsOptions, 6 + ServerSentEventsResult, 7 + } from '../core/serverSentEvents.gen.js'; 8 + import type { 9 + Client as CoreClient, 10 + Config as CoreConfig, 11 + } from '../core/types.gen.js'; 12 + import type { Middleware } from './utils.gen.js'; 13 + 14 + export interface Config<T extends ClientOptions = ClientOptions> 15 + extends Omit<RequestInit, 'body' | 'headers' | 'method'>, 16 + CoreConfig { 17 + /** 18 + * Base URL for all requests made by this client. 19 + */ 20 + baseUrl?: T['baseUrl']; 21 + /** 22 + * Fetch API implementation. You can use this option to provide a custom 23 + * fetch instance. 24 + * 25 + * @default globalThis.fetch 26 + */ 27 + fetch?: typeof fetch; 28 + /** 29 + * Return the response data parsed in a specified format. By default, `auto` 30 + * will infer the appropriate method from the `Content-Type` response header. 31 + * You can override this behavior with any of the {@link Body} methods. 32 + * Select `stream` if you don't want to parse response data at all. 33 + * 34 + * @default 'auto' 35 + */ 36 + parseAs?: 37 + | 'arrayBuffer' 38 + | 'auto' 39 + | 'blob' 40 + | 'formData' 41 + | 'json' 42 + | 'stream' 43 + | 'text'; 44 + /** 45 + * Throw an error instead of returning it in the response? 46 + * 47 + * @default false 48 + */ 49 + throwOnError?: T['throwOnError']; 50 + } 51 + 52 + export interface RequestOptions< 53 + TData = unknown, 54 + ThrowOnError extends boolean = boolean, 55 + Url extends string = string, 56 + > extends Config<{ 57 + throwOnError: ThrowOnError; 58 + }>, 59 + Pick< 60 + ServerSentEventsOptions<TData>, 61 + | 'onSseError' 62 + | 'onSseEvent' 63 + | 'sseDefaultRetryDelay' 64 + | 'sseMaxRetryAttempts' 65 + | 'sseMaxRetryDelay' 66 + > { 67 + /** 68 + * Any body that you want to add to your request. 69 + * 70 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} 71 + */ 72 + body?: unknown; 73 + path?: Record<string, unknown>; 74 + query?: Record<string, unknown>; 75 + /** 76 + * Security mechanism(s) to use for the request. 77 + */ 78 + security?: ReadonlyArray<Auth>; 79 + url: Url; 80 + } 81 + 82 + export interface ResolvedRequestOptions< 83 + ThrowOnError extends boolean = boolean, 84 + Url extends string = string, 85 + > extends RequestOptions<unknown, ThrowOnError, Url> { 86 + serializedBody?: string; 87 + } 88 + 89 + export type RequestResult< 90 + TData = unknown, 91 + TError = unknown, 92 + ThrowOnError extends boolean = boolean, 93 + > = ThrowOnError extends true 94 + ? Promise<{ 95 + data: TData extends Record<string, unknown> ? TData[keyof TData] : TData; 96 + response: Response; 97 + }> 98 + : Promise< 99 + ( 100 + | { 101 + data: TData extends Record<string, unknown> 102 + ? TData[keyof TData] 103 + : TData; 104 + error: undefined; 105 + } 106 + | { 107 + data: undefined; 108 + error: TError extends Record<string, unknown> 109 + ? TError[keyof TError] 110 + : TError; 111 + } 112 + ) & { 113 + response: Response; 114 + } 115 + >; 116 + 117 + export interface ClientOptions { 118 + baseUrl?: string; 119 + throwOnError?: boolean; 120 + } 121 + 122 + type MethodFn = < 123 + TData = unknown, 124 + TError = unknown, 125 + ThrowOnError extends boolean = false, 126 + >( 127 + options: Omit<RequestOptions<TData, ThrowOnError>, 'method'>, 128 + ) => RequestResult<TData, TError, ThrowOnError>; 129 + 130 + type SseFn = < 131 + TData = unknown, 132 + TError = unknown, 133 + ThrowOnError extends boolean = false, 134 + >( 135 + options: Omit<RequestOptions<TData, ThrowOnError>, 'method'>, 136 + ) => Promise<ServerSentEventsResult<TData, TError>>; 137 + 138 + type RequestFn = < 139 + TData = unknown, 140 + TError = unknown, 141 + ThrowOnError extends boolean = false, 142 + >( 143 + options: Omit<RequestOptions<TData, ThrowOnError>, 'method'> & 144 + Pick<Required<RequestOptions<TData, ThrowOnError>>, 'method'>, 145 + ) => RequestResult<TData, TError, ThrowOnError>; 146 + 147 + type BuildUrlFn = < 148 + TData extends { 149 + body?: unknown; 150 + path?: Record<string, unknown>; 151 + query?: Record<string, unknown>; 152 + url: string; 153 + }, 154 + >( 155 + options: TData & Options<TData>, 156 + ) => string; 157 + 158 + export type Client = CoreClient< 159 + RequestFn, 160 + Config, 161 + MethodFn, 162 + BuildUrlFn, 163 + SseFn 164 + > & { 165 + interceptors: Middleware<Response, unknown, ResolvedRequestOptions>; 166 + }; 167 + 168 + /** 169 + * The `createClientConfig()` function will be called on client initialization 170 + * and the returned object will become the client's initial configuration. 171 + * 172 + * You may want to initialize your client this way instead of calling 173 + * `setConfig()`. This is useful for example if you're using Next.js 174 + * to ensure your client always has the correct values. 175 + */ 176 + export type CreateClientConfig<T extends ClientOptions = ClientOptions> = ( 177 + override?: Config<ClientOptions & T>, 178 + ) => Config<Required<ClientOptions> & T>; 179 + 180 + export interface TDataShape { 181 + body?: unknown; 182 + headers?: unknown; 183 + path?: unknown; 184 + query?: unknown; 185 + url: string; 186 + } 187 + 188 + type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>; 189 + 190 + export type Options< 191 + TData extends TDataShape = TDataShape, 192 + ThrowOnError extends boolean = boolean, 193 + TResponse = unknown, 194 + > = OmitKeys< 195 + RequestOptions<TResponse, ThrowOnError>, 196 + 'body' | 'path' | 'query' | 'url' 197 + > & 198 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
+438
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/client/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { getAuthToken } from '../core/auth.gen.js'; 4 + import type { 5 + QuerySerializer, 6 + QuerySerializerOptions, 7 + } from '../core/bodySerializer.gen.js'; 8 + import { jsonBodySerializer } from '../core/bodySerializer.gen.js'; 9 + import { 10 + serializeArrayParam, 11 + serializeObjectParam, 12 + serializePrimitiveParam, 13 + } from '../core/pathSerializer.gen.js'; 14 + import type { Client, ClientOptions, Config, RequestOptions } from './types.gen.js'; 15 + 16 + interface PathSerializer { 17 + path: Record<string, unknown>; 18 + url: string; 19 + } 20 + 21 + const PATH_PARAM_RE = /\{[^{}]+\}/g; 22 + 23 + type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; 24 + type MatrixStyle = 'label' | 'matrix' | 'simple'; 25 + type ArraySeparatorStyle = ArrayStyle | MatrixStyle; 26 + 27 + const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { 28 + let url = _url; 29 + const matches = _url.match(PATH_PARAM_RE); 30 + if (matches) { 31 + for (const match of matches) { 32 + let explode = false; 33 + let name = match.substring(1, match.length - 1); 34 + let style: ArraySeparatorStyle = 'simple'; 35 + 36 + if (name.endsWith('*')) { 37 + explode = true; 38 + name = name.substring(0, name.length - 1); 39 + } 40 + 41 + if (name.startsWith('.')) { 42 + name = name.substring(1); 43 + style = 'label'; 44 + } else if (name.startsWith(';')) { 45 + name = name.substring(1); 46 + style = 'matrix'; 47 + } 48 + 49 + const value = path[name]; 50 + 51 + if (value === undefined || value === null) { 52 + continue; 53 + } 54 + 55 + if (Array.isArray(value)) { 56 + url = url.replace( 57 + match, 58 + serializeArrayParam({ explode, name, style, value }), 59 + ); 60 + continue; 61 + } 62 + 63 + if (typeof value === 'object') { 64 + url = url.replace( 65 + match, 66 + serializeObjectParam({ 67 + explode, 68 + name, 69 + style, 70 + value: value as Record<string, unknown>, 71 + valueOnly: true, 72 + }), 73 + ); 74 + continue; 75 + } 76 + 77 + if (style === 'matrix') { 78 + url = url.replace( 79 + match, 80 + `;${serializePrimitiveParam({ 81 + name, 82 + value: value as string, 83 + })}`, 84 + ); 85 + continue; 86 + } 87 + 88 + const replaceValue = encodeURIComponent( 89 + style === 'label' ? `.${value as string}` : (value as string), 90 + ); 91 + url = url.replace(match, replaceValue); 92 + } 93 + } 94 + return url; 95 + }; 96 + 97 + export const createQuerySerializer = <T = unknown>({ 98 + parameters = {}, 99 + ...args 100 + }: QuerySerializerOptions = {}) => { 101 + const querySerializer = (queryParams: T) => { 102 + const search: string[] = []; 103 + if (queryParams && typeof queryParams === 'object') { 104 + for (const name in queryParams) { 105 + const value = queryParams[name]; 106 + 107 + if (value === undefined || value === null) { 108 + continue; 109 + } 110 + 111 + const options = parameters[name] || args; 112 + 113 + if (Array.isArray(value)) { 114 + const serializedArray = serializeArrayParam({ 115 + allowReserved: options.allowReserved, 116 + explode: true, 117 + name, 118 + style: 'form', 119 + value, 120 + ...options.array, 121 + }); 122 + if (serializedArray) search.push(serializedArray); 123 + } else if (typeof value === 'object') { 124 + const serializedObject = serializeObjectParam({ 125 + allowReserved: options.allowReserved, 126 + explode: true, 127 + name, 128 + style: 'deepObject', 129 + value: value as Record<string, unknown>, 130 + ...options.object, 131 + }); 132 + if (serializedObject) search.push(serializedObject); 133 + } else { 134 + const serializedPrimitive = serializePrimitiveParam({ 135 + allowReserved: options.allowReserved, 136 + name, 137 + value: value as string, 138 + }); 139 + if (serializedPrimitive) search.push(serializedPrimitive); 140 + } 141 + } 142 + } 143 + return search.join('&'); 144 + }; 145 + return querySerializer; 146 + }; 147 + 148 + /** 149 + * Infers parseAs value from provided Content-Type header. 150 + */ 151 + export const getParseAs = ( 152 + contentType: string | null, 153 + ): Exclude<Config['parseAs'], 'auto'> => { 154 + if (!contentType) { 155 + // If no Content-Type header is provided, the best we can do is return the raw response body, 156 + // which is effectively the same as the 'stream' option. 157 + return 'stream'; 158 + } 159 + 160 + const cleanContent = contentType.split(';')[0]?.trim(); 161 + 162 + if (!cleanContent) { 163 + return; 164 + } 165 + 166 + if ( 167 + cleanContent.startsWith('application/json') || 168 + cleanContent.endsWith('+json') 169 + ) { 170 + return 'json'; 171 + } 172 + 173 + if (cleanContent === 'multipart/form-data') { 174 + return 'formData'; 175 + } 176 + 177 + if ( 178 + ['application/', 'audio/', 'image/', 'video/'].some((type) => 179 + cleanContent.startsWith(type), 180 + ) 181 + ) { 182 + return 'blob'; 183 + } 184 + 185 + if (cleanContent.startsWith('text/')) { 186 + return 'text'; 187 + } 188 + 189 + return; 190 + }; 191 + 192 + const checkForExistence = ( 193 + options: Pick<RequestOptions, 'auth' | 'query'> & { 194 + headers: Headers; 195 + }, 196 + name?: string, 197 + ): boolean => { 198 + if (!name) { 199 + return false; 200 + } 201 + if ( 202 + options.headers.has(name) || 203 + options.query?.[name] || 204 + options.headers.get('Cookie')?.includes(`${name}=`) 205 + ) { 206 + return true; 207 + } 208 + return false; 209 + }; 210 + 211 + export const setAuthParams = async ({ 212 + security, 213 + ...options 214 + }: Pick<Required<RequestOptions>, 'security'> & 215 + Pick<RequestOptions, 'auth' | 'query'> & { 216 + headers: Headers; 217 + }) => { 218 + for (const auth of security) { 219 + if (checkForExistence(options, auth.name)) { 220 + continue; 221 + } 222 + const token = await getAuthToken(auth, options.auth); 223 + 224 + if (!token) { 225 + continue; 226 + } 227 + 228 + const name = auth.name ?? 'Authorization'; 229 + 230 + switch (auth.in) { 231 + case 'query': 232 + if (!options.query) { 233 + options.query = {}; 234 + } 235 + options.query[name] = token; 236 + break; 237 + case 'cookie': 238 + options.headers.append('Cookie', `${name}=${token}`); 239 + break; 240 + case 'header': 241 + default: 242 + options.headers.set(name, token); 243 + break; 244 + } 245 + } 246 + }; 247 + 248 + export const buildUrl: Client['buildUrl'] = (options) => { 249 + const url = getUrl({ 250 + baseUrl: options.baseUrl as string, 251 + path: options.path, 252 + query: options.query, 253 + querySerializer: 254 + typeof options.querySerializer === 'function' 255 + ? options.querySerializer 256 + : createQuerySerializer(options.querySerializer), 257 + url: options.url, 258 + }); 259 + return url; 260 + }; 261 + 262 + export const getUrl = ({ 263 + baseUrl, 264 + path, 265 + query, 266 + querySerializer, 267 + url: _url, 268 + }: { 269 + baseUrl?: string; 270 + path?: Record<string, unknown>; 271 + query?: Record<string, unknown>; 272 + querySerializer: QuerySerializer; 273 + url: string; 274 + }) => { 275 + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; 276 + let url = (baseUrl ?? '') + pathUrl; 277 + if (path) { 278 + url = defaultPathSerializer({ path, url }); 279 + } 280 + let search = query ? querySerializer(query) : ''; 281 + if (search.startsWith('?')) { 282 + search = search.substring(1); 283 + } 284 + if (search) { 285 + url += `?${search}`; 286 + } 287 + return url; 288 + }; 289 + 290 + export const mergeConfigs = (a: Config, b: Config): Config => { 291 + const config = { ...a, ...b }; 292 + if (config.baseUrl?.endsWith('/')) { 293 + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); 294 + } 295 + config.headers = mergeHeaders(a.headers, b.headers); 296 + return config; 297 + }; 298 + 299 + const headersEntries = (headers: Headers): Array<[string, string]> => { 300 + const entries: Array<[string, string]> = []; 301 + headers.forEach((value, key) => { 302 + entries.push([key, value]); 303 + }); 304 + return entries; 305 + }; 306 + 307 + export const mergeHeaders = ( 308 + ...headers: Array<Required<Config>['headers'] | undefined> 309 + ): Headers => { 310 + const mergedHeaders = new Headers(); 311 + for (const header of headers) { 312 + if (!header || typeof header !== 'object') { 313 + continue; 314 + } 315 + 316 + const iterator = 317 + header instanceof Headers 318 + ? headersEntries(header) 319 + : Object.entries(header); 320 + 321 + for (const [key, value] of iterator) { 322 + if (value === null) { 323 + mergedHeaders.delete(key); 324 + } else if (Array.isArray(value)) { 325 + for (const v of value) { 326 + mergedHeaders.append(key, v as string); 327 + } 328 + } else if (value !== undefined) { 329 + // assume object headers are meant to be JSON stringified, i.e. their 330 + // content value in OpenAPI specification is 'application/json' 331 + mergedHeaders.set( 332 + key, 333 + typeof value === 'object' ? JSON.stringify(value) : (value as string), 334 + ); 335 + } 336 + } 337 + } 338 + return mergedHeaders; 339 + }; 340 + 341 + type ErrInterceptor<Err, Res, Options> = ( 342 + error: Err, 343 + response: Res, 344 + options: Options, 345 + ) => Err | Promise<Err>; 346 + 347 + type ReqInterceptor<Options> = (options: Options) => void | Promise<void>; 348 + 349 + type ResInterceptor<Res, Options> = ( 350 + response: Res, 351 + options: Options, 352 + ) => Res | Promise<Res>; 353 + 354 + class Interceptors<Interceptor> { 355 + fns: Array<Interceptor | null> = []; 356 + 357 + clear(): void { 358 + this.fns = []; 359 + } 360 + 361 + eject(id: number | Interceptor): void { 362 + const index = this.getInterceptorIndex(id); 363 + if (this.fns[index]) { 364 + this.fns[index] = null; 365 + } 366 + } 367 + 368 + exists(id: number | Interceptor): boolean { 369 + const index = this.getInterceptorIndex(id); 370 + return Boolean(this.fns[index]); 371 + } 372 + 373 + getInterceptorIndex(id: number | Interceptor): number { 374 + if (typeof id === 'number') { 375 + return this.fns[id] ? id : -1; 376 + } 377 + return this.fns.indexOf(id); 378 + } 379 + 380 + update( 381 + id: number | Interceptor, 382 + fn: Interceptor, 383 + ): number | Interceptor | false { 384 + const index = this.getInterceptorIndex(id); 385 + if (this.fns[index]) { 386 + this.fns[index] = fn; 387 + return id; 388 + } 389 + return false; 390 + } 391 + 392 + use(fn: Interceptor): number { 393 + this.fns.push(fn); 394 + return this.fns.length - 1; 395 + } 396 + } 397 + 398 + export interface Middleware<Res, Err, Options> { 399 + error: Interceptors<ErrInterceptor<Err, Res, Options>>; 400 + request: Interceptors<ReqInterceptor<Options>>; 401 + response: Interceptors<ResInterceptor<Res, Options>>; 402 + } 403 + 404 + export const createInterceptors = <Res, Err, Options>(): Middleware< 405 + Res, 406 + Err, 407 + Options 408 + > => ({ 409 + error: new Interceptors<ErrInterceptor<Err, Res, Options>>(), 410 + request: new Interceptors<ReqInterceptor<Options>>(), 411 + response: new Interceptors<ResInterceptor<Res, Options>>(), 412 + }); 413 + 414 + const defaultQuerySerializer = createQuerySerializer({ 415 + allowReserved: false, 416 + array: { 417 + explode: true, 418 + style: 'form', 419 + }, 420 + object: { 421 + explode: true, 422 + style: 'deepObject', 423 + }, 424 + }); 425 + 426 + const defaultHeaders = { 427 + 'Content-Type': 'application/json', 428 + }; 429 + 430 + export const createConfig = <T extends ClientOptions = ClientOptions>( 431 + override: Config<Omit<ClientOptions, keyof T> & T> = {}, 432 + ): Config<Omit<ClientOptions, keyof T> & T> => ({ 433 + ...jsonBodySerializer, 434 + headers: defaultHeaders, 435 + parseAs: 'auto', 436 + querySerializer: defaultQuerySerializer, 437 + ...override, 438 + });
+42
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/core/auth.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type AuthToken = string | undefined; 4 + 5 + export interface Auth { 6 + /** 7 + * Which part of the request do we use to send the auth? 8 + * 9 + * @default 'header' 10 + */ 11 + in?: 'header' | 'query' | 'cookie'; 12 + /** 13 + * Header or query parameter name. 14 + * 15 + * @default 'Authorization' 16 + */ 17 + name?: string; 18 + scheme?: 'basic' | 'bearer'; 19 + type: 'apiKey' | 'http'; 20 + } 21 + 22 + export const getAuthToken = async ( 23 + auth: Auth, 24 + callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken, 25 + ): Promise<string | undefined> => { 26 + const token = 27 + typeof callback === 'function' ? await callback(auth) : callback; 28 + 29 + if (!token) { 30 + return; 31 + } 32 + 33 + if (auth.scheme === 'bearer') { 34 + return `Bearer ${token}`; 35 + } 36 + 37 + if (auth.scheme === 'basic') { 38 + return `Basic ${btoa(token)}`; 39 + } 40 + 41 + return token; 42 + };
+100
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/core/bodySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { 4 + ArrayStyle, 5 + ObjectStyle, 6 + SerializerOptions, 7 + } from './pathSerializer.gen.js'; 8 + 9 + export type QuerySerializer = (query: Record<string, unknown>) => string; 10 + 11 + export type BodySerializer = (body: any) => any; 12 + 13 + type QuerySerializerOptionsObject = { 14 + allowReserved?: boolean; 15 + array?: Partial<SerializerOptions<ArrayStyle>>; 16 + object?: Partial<SerializerOptions<ObjectStyle>>; 17 + }; 18 + 19 + export type QuerySerializerOptions = QuerySerializerOptionsObject & { 20 + /** 21 + * Per-parameter serialization overrides. When provided, these settings 22 + * override the global array/object settings for specific parameter names. 23 + */ 24 + parameters?: Record<string, QuerySerializerOptionsObject>; 25 + }; 26 + 27 + const serializeFormDataPair = ( 28 + data: FormData, 29 + key: string, 30 + value: unknown, 31 + ): void => { 32 + if (typeof value === 'string' || value instanceof Blob) { 33 + data.append(key, value); 34 + } else if (value instanceof Date) { 35 + data.append(key, value.toISOString()); 36 + } else { 37 + data.append(key, JSON.stringify(value)); 38 + } 39 + }; 40 + 41 + const serializeUrlSearchParamsPair = ( 42 + data: URLSearchParams, 43 + key: string, 44 + value: unknown, 45 + ): void => { 46 + if (typeof value === 'string') { 47 + data.append(key, value); 48 + } else { 49 + data.append(key, JSON.stringify(value)); 50 + } 51 + }; 52 + 53 + export const formDataBodySerializer = { 54 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 55 + body: T, 56 + ): FormData => { 57 + const data = new FormData(); 58 + 59 + Object.entries(body).forEach(([key, value]) => { 60 + if (value === undefined || value === null) { 61 + return; 62 + } 63 + if (Array.isArray(value)) { 64 + value.forEach((v) => serializeFormDataPair(data, key, v)); 65 + } else { 66 + serializeFormDataPair(data, key, value); 67 + } 68 + }); 69 + 70 + return data; 71 + }, 72 + }; 73 + 74 + export const jsonBodySerializer = { 75 + bodySerializer: <T>(body: T): string => 76 + JSON.stringify(body, (_key, value) => 77 + typeof value === 'bigint' ? value.toString() : value, 78 + ), 79 + }; 80 + 81 + export const urlSearchParamsBodySerializer = { 82 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 83 + body: T, 84 + ): string => { 85 + const data = new URLSearchParams(); 86 + 87 + Object.entries(body).forEach(([key, value]) => { 88 + if (value === undefined || value === null) { 89 + return; 90 + } 91 + if (Array.isArray(value)) { 92 + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); 93 + } else { 94 + serializeUrlSearchParamsPair(data, key, value); 95 + } 96 + }); 97 + 98 + return data.toString(); 99 + }, 100 + };
+176
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/core/params.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + type Slot = 'body' | 'headers' | 'path' | 'query'; 4 + 5 + export type Field = 6 + | { 7 + in: Exclude<Slot, 'body'>; 8 + /** 9 + * Field name. This is the name we want the user to see and use. 10 + */ 11 + key: string; 12 + /** 13 + * Field mapped name. This is the name we want to use in the request. 14 + * If omitted, we use the same value as `key`. 15 + */ 16 + map?: string; 17 + } 18 + | { 19 + in: Extract<Slot, 'body'>; 20 + /** 21 + * Key isn't required for bodies. 22 + */ 23 + key?: string; 24 + map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 36 + }; 37 + 38 + export interface Fields { 39 + allowExtra?: Partial<Record<Slot, boolean>>; 40 + args?: ReadonlyArray<Field>; 41 + } 42 + 43 + export type FieldsConfig = ReadonlyArray<Field | Fields>; 44 + 45 + const extraPrefixesMap: Record<string, Slot> = { 46 + $body_: 'body', 47 + $headers_: 'headers', 48 + $path_: 'path', 49 + $query_: 'query', 50 + }; 51 + const extraPrefixes = Object.entries(extraPrefixesMap); 52 + 53 + type KeyMap = Map< 54 + string, 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 63 + >; 64 + 65 + const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { 66 + if (!map) { 67 + map = new Map(); 68 + } 69 + 70 + for (const config of fields) { 71 + if ('in' in config) { 72 + if (config.key) { 73 + map.set(config.key, { 74 + in: config.in, 75 + map: config.map, 76 + }); 77 + } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 82 + } else if (config.args) { 83 + buildKeyMap(config.args, map); 84 + } 85 + } 86 + 87 + return map; 88 + }; 89 + 90 + interface Params { 91 + body: unknown; 92 + headers: Record<string, unknown>; 93 + path: Record<string, unknown>; 94 + query: Record<string, unknown>; 95 + } 96 + 97 + const stripEmptySlots = (params: Params) => { 98 + for (const [slot, value] of Object.entries(params)) { 99 + if (value && typeof value === 'object' && !Object.keys(value).length) { 100 + delete params[slot as Slot]; 101 + } 102 + } 103 + }; 104 + 105 + export const buildClientParams = ( 106 + args: ReadonlyArray<unknown>, 107 + fields: FieldsConfig, 108 + ) => { 109 + const params: Params = { 110 + body: {}, 111 + headers: {}, 112 + path: {}, 113 + query: {}, 114 + }; 115 + 116 + const map = buildKeyMap(fields); 117 + 118 + let config: FieldsConfig[number] | undefined; 119 + 120 + for (const [index, arg] of args.entries()) { 121 + if (fields[index]) { 122 + config = fields[index]; 123 + } 124 + 125 + if (!config) { 126 + continue; 127 + } 128 + 129 + if ('in' in config) { 130 + if (config.key) { 131 + const field = map.get(config.key)!; 132 + const name = field.map || config.key; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 136 + } else { 137 + params.body = arg; 138 + } 139 + } else { 140 + for (const [key, value] of Object.entries(arg ?? {})) { 141 + const field = map.get(key); 142 + 143 + if (field) { 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 150 + } else { 151 + const extra = extraPrefixes.find(([prefix]) => 152 + key.startsWith(prefix), 153 + ); 154 + 155 + if (extra) { 156 + const [prefix, slot] = extra; 157 + (params[slot] as Record<string, unknown>)[ 158 + key.slice(prefix.length) 159 + ] = value; 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 162 + if (allowed) { 163 + (params[slot as Slot] as Record<string, unknown>)[key] = value; 164 + break; 165 + } 166 + } 167 + } 168 + } 169 + } 170 + } 171 + } 172 + 173 + stripEmptySlots(params); 174 + 175 + return params; 176 + };
+181
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/core/pathSerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + interface SerializeOptions<T> 4 + extends SerializePrimitiveOptions, 5 + SerializerOptions<T> {} 6 + 7 + interface SerializePrimitiveOptions { 8 + allowReserved?: boolean; 9 + name: string; 10 + } 11 + 12 + export interface SerializerOptions<T> { 13 + /** 14 + * @default true 15 + */ 16 + explode: boolean; 17 + style: T; 18 + } 19 + 20 + export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; 21 + export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; 22 + type MatrixStyle = 'label' | 'matrix' | 'simple'; 23 + export type ObjectStyle = 'form' | 'deepObject'; 24 + type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; 25 + 26 + interface SerializePrimitiveParam extends SerializePrimitiveOptions { 27 + value: string; 28 + } 29 + 30 + export const separatorArrayExplode = (style: ArraySeparatorStyle) => { 31 + switch (style) { 32 + case 'label': 33 + return '.'; 34 + case 'matrix': 35 + return ';'; 36 + case 'simple': 37 + return ','; 38 + default: 39 + return '&'; 40 + } 41 + }; 42 + 43 + export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { 44 + switch (style) { 45 + case 'form': 46 + return ','; 47 + case 'pipeDelimited': 48 + return '|'; 49 + case 'spaceDelimited': 50 + return '%20'; 51 + default: 52 + return ','; 53 + } 54 + }; 55 + 56 + export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { 57 + switch (style) { 58 + case 'label': 59 + return '.'; 60 + case 'matrix': 61 + return ';'; 62 + case 'simple': 63 + return ','; 64 + default: 65 + return '&'; 66 + } 67 + }; 68 + 69 + export const serializeArrayParam = ({ 70 + allowReserved, 71 + explode, 72 + name, 73 + style, 74 + value, 75 + }: SerializeOptions<ArraySeparatorStyle> & { 76 + value: unknown[]; 77 + }) => { 78 + if (!explode) { 79 + const joinedValues = ( 80 + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) 81 + ).join(separatorArrayNoExplode(style)); 82 + switch (style) { 83 + case 'label': 84 + return `.${joinedValues}`; 85 + case 'matrix': 86 + return `;${name}=${joinedValues}`; 87 + case 'simple': 88 + return joinedValues; 89 + default: 90 + return `${name}=${joinedValues}`; 91 + } 92 + } 93 + 94 + const separator = separatorArrayExplode(style); 95 + const joinedValues = value 96 + .map((v) => { 97 + if (style === 'label' || style === 'simple') { 98 + return allowReserved ? v : encodeURIComponent(v as string); 99 + } 100 + 101 + return serializePrimitiveParam({ 102 + allowReserved, 103 + name, 104 + value: v as string, 105 + }); 106 + }) 107 + .join(separator); 108 + return style === 'label' || style === 'matrix' 109 + ? separator + joinedValues 110 + : joinedValues; 111 + }; 112 + 113 + export const serializePrimitiveParam = ({ 114 + allowReserved, 115 + name, 116 + value, 117 + }: SerializePrimitiveParam) => { 118 + if (value === undefined || value === null) { 119 + return ''; 120 + } 121 + 122 + if (typeof value === 'object') { 123 + throw new Error( 124 + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', 125 + ); 126 + } 127 + 128 + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; 129 + }; 130 + 131 + export const serializeObjectParam = ({ 132 + allowReserved, 133 + explode, 134 + name, 135 + style, 136 + value, 137 + valueOnly, 138 + }: SerializeOptions<ObjectSeparatorStyle> & { 139 + value: Record<string, unknown> | Date; 140 + valueOnly?: boolean; 141 + }) => { 142 + if (value instanceof Date) { 143 + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; 144 + } 145 + 146 + if (style !== 'deepObject' && !explode) { 147 + let values: string[] = []; 148 + Object.entries(value).forEach(([key, v]) => { 149 + values = [ 150 + ...values, 151 + key, 152 + allowReserved ? (v as string) : encodeURIComponent(v as string), 153 + ]; 154 + }); 155 + const joinedValues = values.join(','); 156 + switch (style) { 157 + case 'form': 158 + return `${name}=${joinedValues}`; 159 + case 'label': 160 + return `.${joinedValues}`; 161 + case 'matrix': 162 + return `;${name}=${joinedValues}`; 163 + default: 164 + return joinedValues; 165 + } 166 + } 167 + 168 + const separator = separatorObjectExplode(style); 169 + const joinedValues = Object.entries(value) 170 + .map(([key, v]) => 171 + serializePrimitiveParam({ 172 + allowReserved, 173 + name: style === 'deepObject' ? `${name}[${key}]` : key, 174 + value: v as string, 175 + }), 176 + ) 177 + .join(separator); 178 + return style === 'label' || style === 'matrix' 179 + ? separator + joinedValues 180 + : joinedValues; 181 + };
+136
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/core/queryKeySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + /** 4 + * JSON-friendly union that mirrors what Pinia Colada can hash. 5 + */ 6 + export type JsonValue = 7 + | null 8 + | string 9 + | number 10 + | boolean 11 + | JsonValue[] 12 + | { [key: string]: JsonValue }; 13 + 14 + /** 15 + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. 16 + */ 17 + export const queryKeyJsonReplacer = (_key: string, value: unknown) => { 18 + if ( 19 + value === undefined || 20 + typeof value === 'function' || 21 + typeof value === 'symbol' 22 + ) { 23 + return undefined; 24 + } 25 + if (typeof value === 'bigint') { 26 + return value.toString(); 27 + } 28 + if (value instanceof Date) { 29 + return value.toISOString(); 30 + } 31 + return value; 32 + }; 33 + 34 + /** 35 + * Safely stringifies a value and parses it back into a JsonValue. 36 + */ 37 + export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { 38 + try { 39 + const json = JSON.stringify(input, queryKeyJsonReplacer); 40 + if (json === undefined) { 41 + return undefined; 42 + } 43 + return JSON.parse(json) as JsonValue; 44 + } catch { 45 + return undefined; 46 + } 47 + }; 48 + 49 + /** 50 + * Detects plain objects (including objects with a null prototype). 51 + */ 52 + const isPlainObject = (value: unknown): value is Record<string, unknown> => { 53 + if (value === null || typeof value !== 'object') { 54 + return false; 55 + } 56 + const prototype = Object.getPrototypeOf(value as object); 57 + return prototype === Object.prototype || prototype === null; 58 + }; 59 + 60 + /** 61 + * Turns URLSearchParams into a sorted JSON object for deterministic keys. 62 + */ 63 + const serializeSearchParams = (params: URLSearchParams): JsonValue => { 64 + const entries = Array.from(params.entries()).sort(([a], [b]) => 65 + a.localeCompare(b), 66 + ); 67 + const result: Record<string, JsonValue> = {}; 68 + 69 + for (const [key, value] of entries) { 70 + const existing = result[key]; 71 + if (existing === undefined) { 72 + result[key] = value; 73 + continue; 74 + } 75 + 76 + if (Array.isArray(existing)) { 77 + (existing as string[]).push(value); 78 + } else { 79 + result[key] = [existing, value]; 80 + } 81 + } 82 + 83 + return result; 84 + }; 85 + 86 + /** 87 + * Normalizes any accepted value into a JSON-friendly shape for query keys. 88 + */ 89 + export const serializeQueryKeyValue = ( 90 + value: unknown, 91 + ): JsonValue | undefined => { 92 + if (value === null) { 93 + return null; 94 + } 95 + 96 + if ( 97 + typeof value === 'string' || 98 + typeof value === 'number' || 99 + typeof value === 'boolean' 100 + ) { 101 + return value; 102 + } 103 + 104 + if ( 105 + value === undefined || 106 + typeof value === 'function' || 107 + typeof value === 'symbol' 108 + ) { 109 + return undefined; 110 + } 111 + 112 + if (typeof value === 'bigint') { 113 + return value.toString(); 114 + } 115 + 116 + if (value instanceof Date) { 117 + return value.toISOString(); 118 + } 119 + 120 + if (Array.isArray(value)) { 121 + return stringifyToJsonValue(value); 122 + } 123 + 124 + if ( 125 + typeof URLSearchParams !== 'undefined' && 126 + value instanceof URLSearchParams 127 + ) { 128 + return serializeSearchParams(value); 129 + } 130 + 131 + if (isPlainObject(value)) { 132 + return stringifyToJsonValue(value); 133 + } 134 + 135 + return undefined; 136 + };
+266
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/core/serverSentEvents.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Config } from './types.gen.js'; 4 + 5 + export type ServerSentEventsOptions<TData = unknown> = Omit< 6 + RequestInit, 7 + 'method' 8 + > & 9 + Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & { 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 + * Implementing clients can call request interceptors inside this hook. 19 + */ 20 + onRequest?: (url: string, init: RequestInit) => Promise<Request>; 21 + /** 22 + * Callback invoked when a network or parsing error occurs during streaming. 23 + * 24 + * This option applies only if the endpoint returns a stream of events. 25 + * 26 + * @param error The error that occurred. 27 + */ 28 + onSseError?: (error: unknown) => void; 29 + /** 30 + * Callback invoked when an event is streamed from the server. 31 + * 32 + * This option applies only if the endpoint returns a stream of events. 33 + * 34 + * @param event Event streamed from the server. 35 + * @returns Nothing (void). 36 + */ 37 + onSseEvent?: (event: StreamEvent<TData>) => void; 38 + serializedBody?: RequestInit['body']; 39 + /** 40 + * Default retry delay in milliseconds. 41 + * 42 + * This option applies only if the endpoint returns a stream of events. 43 + * 44 + * @default 3000 45 + */ 46 + sseDefaultRetryDelay?: number; 47 + /** 48 + * Maximum number of retry attempts before giving up. 49 + */ 50 + sseMaxRetryAttempts?: number; 51 + /** 52 + * Maximum retry delay in milliseconds. 53 + * 54 + * Applies only when exponential backoff is used. 55 + * 56 + * This option applies only if the endpoint returns a stream of events. 57 + * 58 + * @default 30000 59 + */ 60 + sseMaxRetryDelay?: number; 61 + /** 62 + * Optional sleep function for retry backoff. 63 + * 64 + * Defaults to using `setTimeout`. 65 + */ 66 + sseSleepFn?: (ms: number) => Promise<void>; 67 + url: string; 68 + }; 69 + 70 + export interface StreamEvent<TData = unknown> { 71 + data: TData; 72 + event?: string; 73 + id?: string; 74 + retry?: number; 75 + } 76 + 77 + export type ServerSentEventsResult< 78 + TData = unknown, 79 + TReturn = void, 80 + TNext = unknown, 81 + > = { 82 + stream: AsyncGenerator< 83 + TData extends Record<string, unknown> ? TData[keyof TData] : TData, 84 + TReturn, 85 + TNext 86 + >; 87 + }; 88 + 89 + export const createSseClient = <TData = unknown>({ 90 + onRequest, 91 + onSseError, 92 + onSseEvent, 93 + responseTransformer, 94 + responseValidator, 95 + sseDefaultRetryDelay, 96 + sseMaxRetryAttempts, 97 + sseMaxRetryDelay, 98 + sseSleepFn, 99 + url, 100 + ...options 101 + }: ServerSentEventsOptions): ServerSentEventsResult<TData> => { 102 + let lastEventId: string | undefined; 103 + 104 + const sleep = 105 + sseSleepFn ?? 106 + ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); 107 + 108 + const createStream = async function* () { 109 + let retryDelay: number = sseDefaultRetryDelay ?? 3000; 110 + let attempt = 0; 111 + const signal = options.signal ?? new AbortController().signal; 112 + 113 + while (true) { 114 + if (signal.aborted) break; 115 + 116 + attempt++; 117 + 118 + const headers = 119 + options.headers instanceof Headers 120 + ? options.headers 121 + : new Headers(options.headers as Record<string, string> | undefined); 122 + 123 + if (lastEventId !== undefined) { 124 + headers.set('Last-Event-ID', lastEventId); 125 + } 126 + 127 + try { 128 + const requestInit: RequestInit = { 129 + redirect: 'follow', 130 + ...options, 131 + body: options.serializedBody, 132 + headers, 133 + signal, 134 + }; 135 + let request = new Request(url, requestInit); 136 + if (onRequest) { 137 + request = await onRequest(url, requestInit); 138 + } 139 + // fetch must be assigned here, otherwise it would throw the error: 140 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 141 + const _fetch = options.fetch ?? globalThis.fetch; 142 + const response = await _fetch(request); 143 + 144 + if (!response.ok) 145 + throw new Error( 146 + `SSE failed: ${response.status} ${response.statusText}`, 147 + ); 148 + 149 + if (!response.body) throw new Error('No body in SSE response'); 150 + 151 + const reader = response.body 152 + .pipeThrough(new TextDecoderStream()) 153 + .getReader(); 154 + 155 + let buffer = ''; 156 + 157 + const abortHandler = () => { 158 + try { 159 + reader.cancel(); 160 + } catch { 161 + // noop 162 + } 163 + }; 164 + 165 + signal.addEventListener('abort', abortHandler); 166 + 167 + try { 168 + while (true) { 169 + const { done, value } = await reader.read(); 170 + if (done) break; 171 + buffer += value; 172 + // Normalize line endings: CRLF -> LF, then CR -> LF 173 + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); 174 + 175 + const chunks = buffer.split('\n\n'); 176 + buffer = chunks.pop() ?? ''; 177 + 178 + for (const chunk of chunks) { 179 + const lines = chunk.split('\n'); 180 + const dataLines: Array<string> = []; 181 + let eventName: string | undefined; 182 + 183 + for (const line of lines) { 184 + if (line.startsWith('data:')) { 185 + dataLines.push(line.replace(/^data:\s*/, '')); 186 + } else if (line.startsWith('event:')) { 187 + eventName = line.replace(/^event:\s*/, ''); 188 + } else if (line.startsWith('id:')) { 189 + lastEventId = line.replace(/^id:\s*/, ''); 190 + } else if (line.startsWith('retry:')) { 191 + const parsed = Number.parseInt( 192 + line.replace(/^retry:\s*/, ''), 193 + 10, 194 + ); 195 + if (!Number.isNaN(parsed)) { 196 + retryDelay = parsed; 197 + } 198 + } 199 + } 200 + 201 + let data: unknown; 202 + let parsedJson = false; 203 + 204 + if (dataLines.length) { 205 + const rawData = dataLines.join('\n'); 206 + try { 207 + data = JSON.parse(rawData); 208 + parsedJson = true; 209 + } catch { 210 + data = rawData; 211 + } 212 + } 213 + 214 + if (parsedJson) { 215 + if (responseValidator) { 216 + await responseValidator(data); 217 + } 218 + 219 + if (responseTransformer) { 220 + data = await responseTransformer(data); 221 + } 222 + } 223 + 224 + onSseEvent?.({ 225 + data, 226 + event: eventName, 227 + id: lastEventId, 228 + retry: retryDelay, 229 + }); 230 + 231 + if (dataLines.length) { 232 + yield data as any; 233 + } 234 + } 235 + } 236 + } finally { 237 + signal.removeEventListener('abort', abortHandler); 238 + reader.releaseLock(); 239 + } 240 + 241 + break; // exit loop on normal completion 242 + } catch (error) { 243 + // connection failed or aborted; retry after delay 244 + onSseError?.(error); 245 + 246 + if ( 247 + sseMaxRetryAttempts !== undefined && 248 + attempt >= sseMaxRetryAttempts 249 + ) { 250 + break; // stop after firing error 251 + } 252 + 253 + // exponential backoff: double retry each attempt, cap at 30s 254 + const backoff = Math.min( 255 + retryDelay * 2 ** (attempt - 1), 256 + sseMaxRetryDelay ?? 30000, 257 + ); 258 + await sleep(backoff); 259 + } 260 + } 261 + }; 262 + 263 + const stream = createStream(); 264 + 265 + return { stream }; 266 + };
+118
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/core/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth, AuthToken } from './auth.gen.js'; 4 + import type { 5 + BodySerializer, 6 + QuerySerializer, 7 + QuerySerializerOptions, 8 + } from './bodySerializer.gen.js'; 9 + 10 + export type HttpMethod = 11 + | 'connect' 12 + | 'delete' 13 + | 'get' 14 + | 'head' 15 + | 'options' 16 + | 'patch' 17 + | 'post' 18 + | 'put' 19 + | 'trace'; 20 + 21 + export type Client< 22 + RequestFn = never, 23 + Config = unknown, 24 + MethodFn = never, 25 + BuildUrlFn = never, 26 + SseFn = never, 27 + > = { 28 + /** 29 + * Returns the final request URL. 30 + */ 31 + buildUrl: BuildUrlFn; 32 + getConfig: () => Config; 33 + request: RequestFn; 34 + setConfig: (config: Config) => Config; 35 + } & { 36 + [K in HttpMethod]: MethodFn; 37 + } & ([SseFn] extends [never] 38 + ? { sse?: never } 39 + : { sse: { [K in HttpMethod]: SseFn } }); 40 + 41 + export interface Config { 42 + /** 43 + * Auth token or a function returning auth token. The resolved value will be 44 + * added to the request payload as defined by its `security` array. 45 + */ 46 + auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken; 47 + /** 48 + * A function for serializing request body parameter. By default, 49 + * {@link JSON.stringify()} will be used. 50 + */ 51 + bodySerializer?: BodySerializer | null; 52 + /** 53 + * An object containing any HTTP headers that you want to pre-populate your 54 + * `Headers` object with. 55 + * 56 + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} 57 + */ 58 + headers?: 59 + | RequestInit['headers'] 60 + | Record< 61 + string, 62 + | string 63 + | number 64 + | boolean 65 + | (string | number | boolean)[] 66 + | null 67 + | undefined 68 + | unknown 69 + >; 70 + /** 71 + * The request method. 72 + * 73 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} 74 + */ 75 + method?: Uppercase<HttpMethod>; 76 + /** 77 + * A function for serializing request query parameters. By default, arrays 78 + * will be exploded in form style, objects will be exploded in deepObject 79 + * style, and reserved characters are percent-encoded. 80 + * 81 + * This method will have no effect if the native `paramsSerializer()` Axios 82 + * API function is used. 83 + * 84 + * {@link https://swagger.io/docs/specification/serialization/#query View examples} 85 + */ 86 + querySerializer?: QuerySerializer | QuerySerializerOptions; 87 + /** 88 + * A function validating request data. This is useful if you want to ensure 89 + * the request conforms to the desired shape, so it can be safely sent to 90 + * the server. 91 + */ 92 + requestValidator?: (data: unknown) => Promise<unknown>; 93 + /** 94 + * A function transforming response data before it's returned. This is useful 95 + * for post-processing data, e.g. converting ISO strings into Date objects. 96 + */ 97 + responseTransformer?: (data: unknown) => Promise<unknown>; 98 + /** 99 + * A function validating response data. This is useful if you want to ensure 100 + * the response conforms to the desired shape, so it can be safely passed to 101 + * the transformers and returned to the user. 102 + */ 103 + responseValidator?: (data: unknown) => Promise<unknown>; 104 + } 105 + 106 + type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 + ? true 108 + : [T] extends [never | undefined] 109 + ? [undefined] extends [T] 110 + ? false 111 + : true 112 + : false; 113 + 114 + export type OmitNever<T extends Record<string, unknown>> = { 115 + [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 + ? never 117 + : K]: T[K]; 118 + };
+143
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/core/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { BodySerializer, QuerySerializer } from './bodySerializer.gen.js'; 4 + import { 5 + type ArraySeparatorStyle, 6 + serializeArrayParam, 7 + serializeObjectParam, 8 + serializePrimitiveParam, 9 + } from './pathSerializer.gen.js'; 10 + 11 + export interface PathSerializer { 12 + path: Record<string, unknown>; 13 + url: string; 14 + } 15 + 16 + export const PATH_PARAM_RE = /\{[^{}]+\}/g; 17 + 18 + export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { 19 + let url = _url; 20 + const matches = _url.match(PATH_PARAM_RE); 21 + if (matches) { 22 + for (const match of matches) { 23 + let explode = false; 24 + let name = match.substring(1, match.length - 1); 25 + let style: ArraySeparatorStyle = 'simple'; 26 + 27 + if (name.endsWith('*')) { 28 + explode = true; 29 + name = name.substring(0, name.length - 1); 30 + } 31 + 32 + if (name.startsWith('.')) { 33 + name = name.substring(1); 34 + style = 'label'; 35 + } else if (name.startsWith(';')) { 36 + name = name.substring(1); 37 + style = 'matrix'; 38 + } 39 + 40 + const value = path[name]; 41 + 42 + if (value === undefined || value === null) { 43 + continue; 44 + } 45 + 46 + if (Array.isArray(value)) { 47 + url = url.replace( 48 + match, 49 + serializeArrayParam({ explode, name, style, value }), 50 + ); 51 + continue; 52 + } 53 + 54 + if (typeof value === 'object') { 55 + url = url.replace( 56 + match, 57 + serializeObjectParam({ 58 + explode, 59 + name, 60 + style, 61 + value: value as Record<string, unknown>, 62 + valueOnly: true, 63 + }), 64 + ); 65 + continue; 66 + } 67 + 68 + if (style === 'matrix') { 69 + url = url.replace( 70 + match, 71 + `;${serializePrimitiveParam({ 72 + name, 73 + value: value as string, 74 + })}`, 75 + ); 76 + continue; 77 + } 78 + 79 + const replaceValue = encodeURIComponent( 80 + style === 'label' ? `.${value as string}` : (value as string), 81 + ); 82 + url = url.replace(match, replaceValue); 83 + } 84 + } 85 + return url; 86 + }; 87 + 88 + export const getUrl = ({ 89 + baseUrl, 90 + path, 91 + query, 92 + querySerializer, 93 + url: _url, 94 + }: { 95 + baseUrl?: string; 96 + path?: Record<string, unknown>; 97 + query?: Record<string, unknown>; 98 + querySerializer: QuerySerializer; 99 + url: string; 100 + }) => { 101 + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; 102 + let url = (baseUrl ?? '') + pathUrl; 103 + if (path) { 104 + url = defaultPathSerializer({ path, url }); 105 + } 106 + let search = query ? querySerializer(query) : ''; 107 + if (search.startsWith('?')) { 108 + search = search.substring(1); 109 + } 110 + if (search) { 111 + url += `?${search}`; 112 + } 113 + return url; 114 + }; 115 + 116 + export function getValidRequestBody(options: { 117 + body?: unknown; 118 + bodySerializer?: BodySerializer | null; 119 + serializedBody?: unknown; 120 + }) { 121 + const hasBody = options.body !== undefined; 122 + const isSerializedBody = hasBody && options.bodySerializer; 123 + 124 + if (isSerializedBody) { 125 + if ('serializedBody' in options) { 126 + const hasSerializedBody = 127 + options.serializedBody !== undefined && options.serializedBody !== ''; 128 + 129 + return hasSerializedBody ? options.serializedBody : null; 130 + } 131 + 132 + // not all clients implement a serializedBody property (i.e. client-axios) 133 + return options.body !== '' ? options.body : null; 134 + } 135 + 136 + // plain/text body 137 + if (hasBody) { 138 + return options.body; 139 + } 140 + 141 + // no body was provided 142 + return undefined; 143 + }
+4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export { apiVVersionODataControllerCount, callToTestOrderOfParams, callWithDefaultOptionalParameters, callWithDefaultParameters, callWithDescriptions, callWithDuplicateResponses, callWithNoContentResponse, callWithParameters, callWithResponse, callWithResponseAndNoContentResponse, callWithResponses, callWithResultFromHeader, callWithWeirdParameterNames, collectionFormat, complexParams, complexTypes, deleteCallWithoutParametersAndResponse, deleteFoo, deprecatedCall, dummyA, dummyB, duplicateName, duplicateName2, duplicateName3, duplicateName4, export_, fileResponse, fooWow, getApiVbyApiVersionSimpleOperation, getCallWithOptionalParam, getCallWithoutParametersAndResponse, headCallWithoutParametersAndResponse, import_, multipartRequest, multipartResponse, nonAsciiæøåÆøÅöôêÊ字符串, type Options, optionsCallWithoutParametersAndResponse, patchApiVbyApiVersionNoTag, patchCallWithoutParametersAndResponse, postApiVbyApiVersionFormData, postApiVbyApiVersionRequestBody, postCallWithOptionalParam, postCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, putWithFormUrlEncoded, testErrorCode, types, uploadFile } from './sdk.gen.js'; 4 + export type { _3eNum1Период, _400, AdditionalPropertiesIntegerIssue, AdditionalPropertiesUnknownIssue, AdditionalPropertiesUnknownIssue2, AdditionalPropertiesUnknownIssue3, AdditionalPropertiesUnknownIssueWritable, AnyOfAnyAndNull, AnyOfArrays, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountResponses, ArrayWithAnyOfProperties, ArrayWithArray, ArrayWithBooleans, ArrayWithNumbers, ArrayWithProperties, ArrayWithReferences, ArrayWithStrings, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponse, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesError, CallWithResponsesErrors, CallWithResponsesResponse, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CamelCaseCommentWithBreaks, CharactersInDescription, ClientOptions, CollectionFormatData, CommentWithBackticks, CommentWithBackticksAndQuotes, CommentWithBreaks, CommentWithExpressionPlaceholders, CommentWithQuotes, CommentWithReservedCharacters, CommentWithSlashes, ComplexParamsData, ComplexParamsResponse, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponse, ComplexTypesResponses, CompositionBaseModel, CompositionExtendedModel, CompositionWithAllOfAndNullable, CompositionWithAnyOf, CompositionWithAnyOfAndNullable, CompositionWithAnyOfAnonymous, CompositionWithNestedAnyAndTypeNull, CompositionWithNestedAnyOfAndNull, CompositionWithOneOf, CompositionWithOneOfAndComplexArrayDictionary, CompositionWithOneOfAndNullable, CompositionWithOneOfAndProperties, CompositionWithOneOfAndSimpleArrayDictionary, CompositionWithOneOfAndSimpleDictionary, CompositionWithOneOfAnonymous, CompositionWithOneOfDiscriminator, ConstValue, Default, DeleteCallWithoutParametersAndResponseData, DeleteFooData, DeleteFooData2, DeleteFooData3, DeprecatedCallData, DeprecatedModel, DictionaryWithArray, DictionaryWithDictionary, DictionaryWithProperties, DictionaryWithPropertiesAndAdditionalProperties, DictionaryWithReference, DictionaryWithString, DummyAData, DummyAResponse, DummyAResponses, DummyBData, DummyBResponse, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, EnumFromDescription, EnumWithExtensions, EnumWithNumbers, EnumWithReplacedCharacters, EnumWithStrings, EnumWithXEnumNames, ExportData, ExternalRefA, ExternalRefB, ExternalSharedExternalSharedModel, File, FileResponseData, FileResponseResponse, FileResponseResponses, FileWritable, FooWowData, FooWowResponses, FreeFormObjectWithAdditionalPropertiesEqEmptyObject, FreeFormObjectWithAdditionalPropertiesEqTrue, FreeFormObjectWithoutAdditionalProperties, GenericSchemaDuplicateIssue1SystemBoolean, GenericSchemaDuplicateIssue1SystemBooleanWritable, GenericSchemaDuplicateIssue1SystemString, GenericSchemaDuplicateIssue1SystemStringWritable, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, Import, ImportData, ImportResponse, ImportResponses, IoK8sApimachineryPkgApisMetaV1DeleteOptions, IoK8sApimachineryPkgApisMetaV1Preconditions, ModelCircle, ModelFromZendesk, ModelSquare, ModelThatExtends, ModelThatExtendsExtends, ModelWithAdditionalPropertiesEqTrue, ModelWithAnyOfConstantSizeArray, ModelWithAnyOfConstantSizeArrayAndIntersect, ModelWithAnyOfConstantSizeArrayNullable, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable, ModelWithArray, ModelWithArrayReadOnlyAndWriteOnly, ModelWithArrayReadOnlyAndWriteOnlyWritable, ModelWithBackticksInDescription, ModelWithBoolean, ModelWithCircularReference, ModelWithConst, ModelWithConstantSizeArray, ModelWithDictionary, ModelWithDuplicateImports, ModelWithDuplicateProperties, ModelWithEnum, ModelWithEnumFromDescription, ModelWithEnumWithHyphen, ModelWithInteger, ModelWithNestedArrayEnums, ModelWithNestedArrayEnumsData, ModelWithNestedArrayEnumsDataBar, ModelWithNestedArrayEnumsDataFoo, ModelWithNestedCompositionEnums, ModelWithNestedEnums, ModelWithNestedProperties, ModelWithNullableObject, ModelWithNullableString, ModelWithNumericEnumUnion, ModelWithOneOfAndProperties, ModelWithOneOfEnum, ModelWithOrderedProperties, ModelWithPattern, ModelWithPatternWritable, ModelWithPrefixItemsConstantSizeArray, ModelWithProperties, ModelWithPropertiesWritable, ModelWithReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnlyWritable, ModelWithReference, ModelWithReferenceWritable, ModelWithString, ModelWithStringError, MultipartRequestData, MultipartResponseData, MultipartResponseResponse, MultipartResponseResponses, NestedAnyOfArraysNullable, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Responses, NonAsciiStringæøåÆøÅöôêÊ字符串, NullableObject, OneOfAllOfIssue, OneOfAllOfIssueWritable, OptionsCallWithoutParametersAndResponseData, Pageable, ParameterSimpleParameterUnused, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PostServiceWithEmptyTagResponse, PostServiceWithEmptyTagResponse2, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, SchemaWithFormRestrictedKeys, SimpleBoolean, SimpleFile, SimpleFormData, SimpleInteger, SimpleParameter, SimpleReference, SimpleRequestBody, SimpleString, SimpleStringWithPattern, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponse, TypesResponses, UploadFileData, UploadFileResponse, UploadFileResponses, XFooBar } from './types.gen.js';
+206
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/sdk.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { client } from './client.gen.js'; 4 + import { type Client, formDataBodySerializer, type Options as Options2, type TDataShape, urlSearchParamsBodySerializer } from './client/index.js'; 5 + import type { ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponses, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesErrors, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CollectionFormatData, ComplexParamsData, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponses, DeleteCallWithoutParametersAndResponseData, DeleteFooData3, DeprecatedCallData, DummyAData, DummyAResponses, DummyBData, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, ExportData, FileResponseData, FileResponseResponses, FooWowData, FooWowResponses, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, ImportData, ImportResponses, MultipartRequestData, MultipartResponseData, MultipartResponseResponses, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Responses, OptionsCallWithoutParametersAndResponseData, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponses, UploadFileData, UploadFileResponses } from './types.gen.js'; 6 + 7 + export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & { 8 + /** 9 + * You can provide a client instance returned by `createClient()` instead of 10 + * individual options. This might be also useful if you want to implement a 11 + * custom client. 12 + */ 13 + client?: Client; 14 + /** 15 + * You can pass arbitrary values through the `meta` object. This can be 16 + * used to access values that aren't defined as part of the SDK function. 17 + */ 18 + meta?: Record<string, unknown>; 19 + }; 20 + 21 + export const export_ = <ThrowOnError extends boolean = false>(options?: Options<ExportData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 22 + 23 + export const patchApiVbyApiVersionNoTag = <ThrowOnError extends boolean = false>(options?: Options<PatchApiVbyApiVersionNoTagData, ThrowOnError>) => (options?.client ?? client).patch<PatchApiVbyApiVersionNoTagResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 24 + 25 + export const import_ = <ThrowOnError extends boolean = false>(options: Options<ImportData, ThrowOnError>) => (options.client ?? client).post<ImportResponses, unknown, ThrowOnError>({ 26 + url: '/api/v{api-version}/no+tag', 27 + ...options, 28 + headers: { 29 + 'Content-Type': 'application/json', 30 + ...options.headers 31 + } 32 + }); 33 + 34 + export const fooWow = <ThrowOnError extends boolean = false>(options?: Options<FooWowData, ThrowOnError>) => (options?.client ?? client).put<FooWowResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 35 + 36 + export const apiVVersionODataControllerCount = <ThrowOnError extends boolean = false>(options?: Options<ApiVVersionODataControllerCountData, ThrowOnError>) => (options?.client ?? client).get<ApiVVersionODataControllerCountResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple/$count', ...options }); 37 + 38 + export const getApiVbyApiVersionSimpleOperation = <ThrowOnError extends boolean = false>(options: Options<GetApiVbyApiVersionSimpleOperationData, ThrowOnError>) => (options.client ?? client).get<GetApiVbyApiVersionSimpleOperationResponses, GetApiVbyApiVersionSimpleOperationErrors, ThrowOnError>({ url: '/api/v{api-version}/simple:operation', ...options }); 39 + 40 + export const deleteCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<DeleteCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 41 + 42 + export const getCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<GetCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 43 + 44 + export const headCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<HeadCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).head<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 45 + 46 + export const optionsCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<OptionsCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).options<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 47 + 48 + export const patchCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PatchCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).patch<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 49 + 50 + export const postCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PostCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 51 + 52 + export const putCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PutCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 53 + 54 + export const deleteFoo = <ThrowOnError extends boolean = false>(options: Options<DeleteFooData3, ThrowOnError>) => (options.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', ...options }); 55 + 56 + export const callWithDescriptions = <ThrowOnError extends boolean = false>(options?: Options<CallWithDescriptionsData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/descriptions', ...options }); 57 + 58 + /** 59 + * @deprecated 60 + */ 61 + export const deprecatedCall = <ThrowOnError extends boolean = false>(options: Options<DeprecatedCallData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/parameters/deprecated', ...options }); 62 + 63 + export const callWithParameters = <ThrowOnError extends boolean = false>(options: Options<CallWithParametersData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ 64 + url: '/api/v{api-version}/parameters/{parameterPath}', 65 + ...options, 66 + headers: { 67 + 'Content-Type': 'application/json', 68 + ...options.headers 69 + } 70 + }); 71 + 72 + export const callWithWeirdParameterNames = <ThrowOnError extends boolean = false>(options: Options<CallWithWeirdParameterNamesData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ 73 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', 74 + ...options, 75 + headers: { 76 + 'Content-Type': 'application/json', 77 + ...options.headers 78 + } 79 + }); 80 + 81 + export const getCallWithOptionalParam = <ThrowOnError extends boolean = false>(options: Options<GetCallWithOptionalParamData, ThrowOnError>) => (options.client ?? client).get<unknown, unknown, ThrowOnError>({ 82 + url: '/api/v{api-version}/parameters', 83 + ...options, 84 + headers: { 85 + 'Content-Type': 'application/json', 86 + ...options.headers 87 + } 88 + }); 89 + 90 + export const postCallWithOptionalParam = <ThrowOnError extends boolean = false>(options: Options<PostCallWithOptionalParamData, ThrowOnError>) => (options.client ?? client).post<PostCallWithOptionalParamResponses, unknown, ThrowOnError>({ 91 + url: '/api/v{api-version}/parameters', 92 + ...options, 93 + headers: { 94 + 'Content-Type': 'application/json', 95 + ...options.headers 96 + } 97 + }); 98 + 99 + export const postApiVbyApiVersionRequestBody = <ThrowOnError extends boolean = false>(options?: Options<PostApiVbyApiVersionRequestBodyData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 100 + url: '/api/v{api-version}/requestBody', 101 + ...options, 102 + headers: { 103 + 'Content-Type': 'application/json', 104 + ...options?.headers 105 + } 106 + }); 107 + 108 + export const postApiVbyApiVersionFormData = <ThrowOnError extends boolean = false>(options?: Options<PostApiVbyApiVersionFormDataData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 109 + ...formDataBodySerializer, 110 + url: '/api/v{api-version}/formData', 111 + ...options, 112 + headers: { 113 + 'Content-Type': null, 114 + ...options?.headers 115 + } 116 + }); 117 + 118 + export const callWithDefaultParameters = <ThrowOnError extends boolean = false>(options?: Options<CallWithDefaultParametersData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 119 + 120 + export const callWithDefaultOptionalParameters = <ThrowOnError extends boolean = false>(options?: Options<CallWithDefaultOptionalParametersData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 121 + 122 + export const callToTestOrderOfParams = <ThrowOnError extends boolean = false>(options: Options<CallToTestOrderOfParamsData, ThrowOnError>) => (options.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 123 + 124 + export const duplicateName = <ThrowOnError extends boolean = false>(options?: Options<DuplicateNameData, ThrowOnError>) => (options?.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 125 + 126 + export const duplicateName2 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName2Data, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 127 + 128 + export const duplicateName3 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName3Data, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 129 + 130 + export const duplicateName4 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName4Data, ThrowOnError>) => (options?.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 131 + 132 + export const callWithNoContentResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithNoContentResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithNoContentResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no-content', ...options }); 133 + 134 + export const callWithResponseAndNoContentResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponseAndNoContentResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithResponseAndNoContentResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/response-and-no-content', ...options }); 135 + 136 + export const dummyA = <ThrowOnError extends boolean = false>(options?: Options<DummyAData, ThrowOnError>) => (options?.client ?? client).get<DummyAResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/a', ...options }); 137 + 138 + export const dummyB = <ThrowOnError extends boolean = false>(options?: Options<DummyBData, ThrowOnError>) => (options?.client ?? client).get<DummyBResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/b', ...options }); 139 + 140 + export const callWithResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 141 + 142 + export const callWithDuplicateResponses = <ThrowOnError extends boolean = false>(options?: Options<CallWithDuplicateResponsesData, ThrowOnError>) => (options?.client ?? client).post<CallWithDuplicateResponsesResponses, CallWithDuplicateResponsesErrors, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 143 + 144 + export const callWithResponses = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponsesData, ThrowOnError>) => (options?.client ?? client).put<CallWithResponsesResponses, CallWithResponsesErrors, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 145 + 146 + export const collectionFormat = <ThrowOnError extends boolean = false>(options: Options<CollectionFormatData, ThrowOnError>) => (options.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/collectionFormat', ...options }); 147 + 148 + export const types = <ThrowOnError extends boolean = false>(options: Options<TypesData, ThrowOnError>) => (options.client ?? client).get<TypesResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/types', ...options }); 149 + 150 + export const uploadFile = <ThrowOnError extends boolean = false>(options: Options<UploadFileData, ThrowOnError>) => (options.client ?? client).post<UploadFileResponses, unknown, ThrowOnError>({ 151 + ...urlSearchParamsBodySerializer, 152 + url: '/api/v{api-version}/upload', 153 + ...options, 154 + headers: { 155 + 'Content-Type': 'application/x-www-form-urlencoded', 156 + ...options.headers 157 + } 158 + }); 159 + 160 + export const fileResponse = <ThrowOnError extends boolean = false>(options: Options<FileResponseData, ThrowOnError>) => (options.client ?? client).get<FileResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/file/{id}', ...options }); 161 + 162 + export const complexTypes = <ThrowOnError extends boolean = false>(options: Options<ComplexTypesData, ThrowOnError>) => (options.client ?? client).get<ComplexTypesResponses, ComplexTypesErrors, ThrowOnError>({ 163 + querySerializer: { parameters: { parameterObject: { object: { style: 'form' } } } }, 164 + url: '/api/v{api-version}/complex', 165 + ...options 166 + }); 167 + 168 + export const multipartResponse = <ThrowOnError extends boolean = false>(options?: Options<MultipartResponseData, ThrowOnError>) => (options?.client ?? client).get<MultipartResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multipart', ...options }); 169 + 170 + export const multipartRequest = <ThrowOnError extends boolean = false>(options?: Options<MultipartRequestData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 171 + ...formDataBodySerializer, 172 + url: '/api/v{api-version}/multipart', 173 + ...options, 174 + headers: { 175 + 'Content-Type': null, 176 + ...options?.headers 177 + } 178 + }); 179 + 180 + export const complexParams = <ThrowOnError extends boolean = false>(options: Options<ComplexParamsData, ThrowOnError>) => (options.client ?? client).put<ComplexParamsResponses, unknown, ThrowOnError>({ 181 + url: '/api/v{api-version}/complex/{id}', 182 + ...options, 183 + headers: { 184 + 'Content-Type': 'application/json-patch+json', 185 + ...options.headers 186 + } 187 + }); 188 + 189 + export const callWithResultFromHeader = <ThrowOnError extends boolean = false>(options?: Options<CallWithResultFromHeaderData, ThrowOnError>) => (options?.client ?? client).post<CallWithResultFromHeaderResponses, CallWithResultFromHeaderErrors, ThrowOnError>({ url: '/api/v{api-version}/header', ...options }); 190 + 191 + export const testErrorCode = <ThrowOnError extends boolean = false>(options: Options<TestErrorCodeData, ThrowOnError>) => (options.client ?? client).post<TestErrorCodeResponses, TestErrorCodeErrors, ThrowOnError>({ url: '/api/v{api-version}/error', ...options }); 192 + 193 + export const nonAsciiæøåÆøÅöôêÊ字符串 = <ThrowOnError extends boolean = false>(options: Options<NonAsciiæøåÆøÅöôêÊ字符串Data, ThrowOnError>) => (options.client ?? client).post<NonAsciiæøåÆøÅöôêÊ字符串Responses, unknown, ThrowOnError>({ url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', ...options }); 194 + 195 + /** 196 + * Login User 197 + */ 198 + export const putWithFormUrlEncoded = <ThrowOnError extends boolean = false>(options: Options<PutWithFormUrlEncodedData, ThrowOnError>) => (options.client ?? client).put<unknown, unknown, ThrowOnError>({ 199 + ...urlSearchParamsBodySerializer, 200 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', 201 + ...options, 202 + headers: { 203 + 'Content-Type': 'application/x-www-form-urlencoded', 204 + ...options.headers 205 + } 206 + });
+2091
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-node16-sdk/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type ClientOptions = { 4 + baseUrl: 'http://localhost:3000/base' | (string & {}); 5 + }; 6 + 7 + /** 8 + * Model with number-only name 9 + */ 10 + export type _400 = string; 11 + 12 + /** 13 + * External ref to shared model (A) 14 + */ 15 + export type ExternalRefA = ExternalSharedExternalSharedModel; 16 + 17 + /** 18 + * External ref to shared model (B) 19 + */ 20 + export type ExternalRefB = ExternalSharedExternalSharedModel; 21 + 22 + /** 23 + * Testing multiline comments in string: First line 24 + * Second line 25 + * 26 + * Fourth line 27 + */ 28 + export type CamelCaseCommentWithBreaks = number; 29 + 30 + /** 31 + * Testing multiline comments in string: First line 32 + * Second line 33 + * 34 + * Fourth line 35 + */ 36 + export type CommentWithBreaks = number; 37 + 38 + /** 39 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 40 + */ 41 + export type CommentWithBackticks = number; 42 + 43 + /** 44 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 45 + */ 46 + export type CommentWithBackticksAndQuotes = number; 47 + 48 + /** 49 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 50 + */ 51 + export type CommentWithSlashes = number; 52 + 53 + /** 54 + * Testing expression placeholders in string: ${expression} should work 55 + */ 56 + export type CommentWithExpressionPlaceholders = number; 57 + 58 + /** 59 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 60 + */ 61 + export type CommentWithQuotes = number; 62 + 63 + /** 64 + * Testing reserved characters in string: * inline * and ** inline ** should work 65 + */ 66 + export type CommentWithReservedCharacters = number; 67 + 68 + /** 69 + * This is a simple number 70 + */ 71 + export type SimpleInteger = number; 72 + 73 + /** 74 + * This is a simple boolean 75 + */ 76 + export type SimpleBoolean = boolean; 77 + 78 + /** 79 + * This is a simple string 80 + */ 81 + export type SimpleString = string; 82 + 83 + /** 84 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 85 + */ 86 + export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; 87 + 88 + /** 89 + * This is a simple file 90 + */ 91 + export type SimpleFile = Blob | File; 92 + 93 + /** 94 + * This is a simple reference 95 + */ 96 + export type SimpleReference = ModelWithString; 97 + 98 + /** 99 + * This is a simple string 100 + */ 101 + export type SimpleStringWithPattern = string | null; 102 + 103 + /** 104 + * This is a simple enum with strings 105 + */ 106 + export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | '\'Single Quote\'' | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; 107 + 108 + export type EnumWithReplacedCharacters = '\'Single Quote\'' | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; 109 + 110 + /** 111 + * This is a simple enum with numbers 112 + */ 113 + export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; 114 + 115 + /** 116 + * Success=1,Warning=2,Error=3 117 + */ 118 + export type EnumFromDescription = number; 119 + 120 + /** 121 + * This is a simple enum with numbers 122 + */ 123 + export type EnumWithExtensions = 200 | 400 | 500; 124 + 125 + export type EnumWithXEnumNames = 0 | 1 | 2; 126 + 127 + /** 128 + * This is a simple array with numbers 129 + */ 130 + export type ArrayWithNumbers = Array<number>; 131 + 132 + /** 133 + * This is a simple array with booleans 134 + */ 135 + export type ArrayWithBooleans = Array<boolean>; 136 + 137 + /** 138 + * This is a simple array with strings 139 + */ 140 + export type ArrayWithStrings = Array<string>; 141 + 142 + /** 143 + * This is a simple array with references 144 + */ 145 + export type ArrayWithReferences = Array<ModelWithString>; 146 + 147 + /** 148 + * This is a simple array containing an array 149 + */ 150 + export type ArrayWithArray = Array<Array<ModelWithString>>; 151 + 152 + /** 153 + * This is a simple array with properties 154 + */ 155 + export type ArrayWithProperties = Array<{ 156 + '16x16'?: CamelCaseCommentWithBreaks; 157 + bar?: string; 158 + }>; 159 + 160 + /** 161 + * This is a simple array with any of properties 162 + */ 163 + export type ArrayWithAnyOfProperties = Array<{ 164 + foo?: string; 165 + } | { 166 + bar?: string; 167 + }>; 168 + 169 + export type AnyOfAnyAndNull = { 170 + data?: unknown | null; 171 + }; 172 + 173 + /** 174 + * This is a simple array with any of properties 175 + */ 176 + export type AnyOfArrays = { 177 + results?: Array<{ 178 + foo?: string; 179 + } | { 180 + bar?: string; 181 + }>; 182 + }; 183 + 184 + /** 185 + * This is a string dictionary 186 + */ 187 + export type DictionaryWithString = { 188 + [key: string]: string; 189 + }; 190 + 191 + export type DictionaryWithPropertiesAndAdditionalProperties = { 192 + foo?: number; 193 + bar?: boolean; 194 + [key: string]: string | number | boolean | undefined; 195 + }; 196 + 197 + /** 198 + * This is a string reference 199 + */ 200 + export type DictionaryWithReference = { 201 + [key: string]: ModelWithString; 202 + }; 203 + 204 + /** 205 + * This is a complex dictionary 206 + */ 207 + export type DictionaryWithArray = { 208 + [key: string]: Array<ModelWithString>; 209 + }; 210 + 211 + /** 212 + * This is a string dictionary 213 + */ 214 + export type DictionaryWithDictionary = { 215 + [key: string]: { 216 + [key: string]: string; 217 + }; 218 + }; 219 + 220 + /** 221 + * This is a complex dictionary 222 + */ 223 + export type DictionaryWithProperties = { 224 + [key: string]: { 225 + foo?: string; 226 + bar?: string; 227 + }; 228 + }; 229 + 230 + /** 231 + * This is a model with one number property 232 + */ 233 + export type ModelWithInteger = { 234 + /** 235 + * This is a simple number property 236 + */ 237 + prop?: number; 238 + }; 239 + 240 + /** 241 + * This is a model with one boolean property 242 + */ 243 + export type ModelWithBoolean = { 244 + /** 245 + * This is a simple boolean property 246 + */ 247 + prop?: boolean; 248 + }; 249 + 250 + /** 251 + * This is a model with one string property 252 + */ 253 + export type ModelWithString = { 254 + /** 255 + * This is a simple string property 256 + */ 257 + prop?: string; 258 + }; 259 + 260 + /** 261 + * This is a model with one string property 262 + */ 263 + export type ModelWithStringError = { 264 + /** 265 + * This is a simple string property 266 + */ 267 + prop?: string; 268 + }; 269 + 270 + /** 271 + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) 272 + */ 273 + export type ModelFromZendesk = string; 274 + 275 + /** 276 + * This is a model with one string property 277 + */ 278 + export type ModelWithNullableString = { 279 + /** 280 + * This is a simple string property 281 + */ 282 + nullableProp1?: string | null; 283 + /** 284 + * This is a simple string property 285 + */ 286 + nullableRequiredProp1: string | null; 287 + /** 288 + * This is a simple string property 289 + */ 290 + nullableProp2?: string | null; 291 + /** 292 + * This is a simple string property 293 + */ 294 + nullableRequiredProp2: string | null; 295 + /** 296 + * This is a simple enum with strings 297 + */ 298 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 299 + }; 300 + 301 + /** 302 + * This is a model with one enum 303 + */ 304 + export type ModelWithEnum = { 305 + /** 306 + * This is a simple enum with strings 307 + */ 308 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 309 + /** 310 + * These are the HTTP error code enums 311 + */ 312 + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; 313 + /** 314 + * Simple boolean enum 315 + */ 316 + bool?: true; 317 + }; 318 + 319 + /** 320 + * This is a model with one enum with escaped name 321 + */ 322 + export type ModelWithEnumWithHyphen = { 323 + /** 324 + * Foo-Bar-Baz-Qux 325 + */ 326 + 'foo-bar-baz-qux'?: '3.0'; 327 + }; 328 + 329 + /** 330 + * This is a model with one enum 331 + */ 332 + export type ModelWithEnumFromDescription = { 333 + /** 334 + * Success=1,Warning=2,Error=3 335 + */ 336 + test?: number; 337 + }; 338 + 339 + /** 340 + * This is a model with nested enums 341 + */ 342 + export type ModelWithNestedEnums = { 343 + dictionaryWithEnum?: { 344 + [key: string]: 'Success' | 'Warning' | 'Error'; 345 + }; 346 + dictionaryWithEnumFromDescription?: { 347 + [key: string]: number; 348 + }; 349 + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; 350 + arrayWithDescription?: Array<number>; 351 + /** 352 + * This is a simple enum with strings 353 + */ 354 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 355 + }; 356 + 357 + /** 358 + * This is a model with one property containing a reference 359 + */ 360 + export type ModelWithReference = { 361 + prop?: ModelWithProperties; 362 + }; 363 + 364 + /** 365 + * This is a model with one property containing an array 366 + */ 367 + export type ModelWithArrayReadOnlyAndWriteOnly = { 368 + prop?: Array<ModelWithReadOnlyAndWriteOnly>; 369 + propWithFile?: Array<Blob | File>; 370 + propWithNumber?: Array<number>; 371 + }; 372 + 373 + /** 374 + * This is a model with one property containing an array 375 + */ 376 + export type ModelWithArray = { 377 + prop?: Array<ModelWithString>; 378 + propWithFile?: Array<Blob | File>; 379 + propWithNumber?: Array<number>; 380 + }; 381 + 382 + /** 383 + * This is a model with one property containing a dictionary 384 + */ 385 + export type ModelWithDictionary = { 386 + prop?: { 387 + [key: string]: string; 388 + }; 389 + }; 390 + 391 + /** 392 + * This is a deprecated model with a deprecated property 393 + * 394 + * @deprecated 395 + */ 396 + export type DeprecatedModel = { 397 + /** 398 + * This is a deprecated property 399 + * 400 + * @deprecated 401 + */ 402 + prop?: string; 403 + }; 404 + 405 + /** 406 + * This is a model with one property containing a circular reference 407 + */ 408 + export type ModelWithCircularReference = { 409 + prop?: ModelWithCircularReference; 410 + }; 411 + 412 + /** 413 + * This is a model with one property with a 'one of' relationship 414 + */ 415 + export type CompositionWithOneOf = { 416 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 417 + }; 418 + 419 + /** 420 + * This is a model with one property with a 'one of' relationship where the options are not $ref 421 + */ 422 + export type CompositionWithOneOfAnonymous = { 423 + propA?: { 424 + propA?: string; 425 + } | string | number; 426 + }; 427 + 428 + /** 429 + * Circle 430 + */ 431 + export type ModelCircle = { 432 + kind: string; 433 + radius?: number; 434 + }; 435 + 436 + /** 437 + * Square 438 + */ 439 + export type ModelSquare = { 440 + kind: string; 441 + sideLength?: number; 442 + }; 443 + 444 + /** 445 + * This is a model with one property with a 'one of' relationship where the options are not $ref 446 + */ 447 + export type CompositionWithOneOfDiscriminator = ({ 448 + kind: 'circle'; 449 + } & ModelCircle) | ({ 450 + kind: 'square'; 451 + } & ModelSquare); 452 + 453 + /** 454 + * This is a model with one property with a 'any of' relationship 455 + */ 456 + export type CompositionWithAnyOf = { 457 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 458 + }; 459 + 460 + /** 461 + * This is a model with one property with a 'any of' relationship where the options are not $ref 462 + */ 463 + export type CompositionWithAnyOfAnonymous = { 464 + propA?: { 465 + propA?: string; 466 + } | string | number; 467 + }; 468 + 469 + /** 470 + * This is a model with nested 'any of' property with a type null 471 + */ 472 + export type CompositionWithNestedAnyAndTypeNull = { 473 + propA?: Array<ModelWithDictionary | null> | Array<ModelWithArray | null>; 474 + }; 475 + 476 + export type _3eNum1Период = 'Bird' | 'Dog'; 477 + 478 + export type ConstValue = 'ConstValue'; 479 + 480 + /** 481 + * This is a model with one property with a 'any of' relationship where the options are not $ref 482 + */ 483 + export type CompositionWithNestedAnyOfAndNull = { 484 + /** 485 + * Scopes 486 + */ 487 + propA?: Array<_3eNum1Период | ConstValue> | null; 488 + }; 489 + 490 + /** 491 + * This is a model with one property with a 'one of' relationship 492 + */ 493 + export type CompositionWithOneOfAndNullable = { 494 + propA?: { 495 + boolean?: boolean; 496 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 497 + }; 498 + 499 + /** 500 + * This is a model that contains a simple dictionary within composition 501 + */ 502 + export type CompositionWithOneOfAndSimpleDictionary = { 503 + propA?: boolean | { 504 + [key: string]: number; 505 + }; 506 + }; 507 + 508 + /** 509 + * This is a model that contains a dictionary of simple arrays within composition 510 + */ 511 + export type CompositionWithOneOfAndSimpleArrayDictionary = { 512 + propA?: boolean | { 513 + [key: string]: Array<boolean>; 514 + }; 515 + }; 516 + 517 + /** 518 + * This is a model that contains a dictionary of complex arrays (composited) within composition 519 + */ 520 + export type CompositionWithOneOfAndComplexArrayDictionary = { 521 + propA?: boolean | { 522 + [key: string]: Array<number | string>; 523 + }; 524 + }; 525 + 526 + /** 527 + * This is a model with one property with a 'all of' relationship 528 + */ 529 + export type CompositionWithAllOfAndNullable = { 530 + propA?: ({ 531 + boolean?: boolean; 532 + } & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null; 533 + }; 534 + 535 + /** 536 + * This is a model with one property with a 'any of' relationship 537 + */ 538 + export type CompositionWithAnyOfAndNullable = { 539 + propA?: { 540 + boolean?: boolean; 541 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 542 + }; 543 + 544 + /** 545 + * This is a base model with two simple optional properties 546 + */ 547 + export type CompositionBaseModel = { 548 + firstName?: string; 549 + lastname?: string; 550 + }; 551 + 552 + /** 553 + * This is a model that extends the base model 554 + */ 555 + export type CompositionExtendedModel = CompositionBaseModel & { 556 + age: number; 557 + firstName: string; 558 + lastname: string; 559 + }; 560 + 561 + /** 562 + * This is a model with one nested property 563 + */ 564 + export type ModelWithProperties = { 565 + required: string; 566 + readonly requiredAndReadOnly: string; 567 + requiredAndNullable: string | null; 568 + string?: string; 569 + number?: number; 570 + boolean?: boolean; 571 + reference?: ModelWithString; 572 + 'property with space'?: string; 573 + default?: string; 574 + try?: string; 575 + readonly '@namespace.string'?: string; 576 + readonly '@namespace.integer'?: number; 577 + }; 578 + 579 + /** 580 + * This is a model with one nested property 581 + */ 582 + export type ModelWithNestedProperties = { 583 + readonly first: { 584 + readonly second: { 585 + readonly third: string | null; 586 + } | null; 587 + } | null; 588 + }; 589 + 590 + /** 591 + * This is a model with duplicated properties 592 + */ 593 + export type ModelWithDuplicateProperties = { 594 + prop?: ModelWithString; 595 + }; 596 + 597 + /** 598 + * This is a model with ordered properties 599 + */ 600 + export type ModelWithOrderedProperties = { 601 + zebra?: string; 602 + apple?: string; 603 + hawaii?: string; 604 + }; 605 + 606 + /** 607 + * This is a model with duplicated imports 608 + */ 609 + export type ModelWithDuplicateImports = { 610 + propA?: ModelWithString; 611 + propB?: ModelWithString; 612 + propC?: ModelWithString; 613 + }; 614 + 615 + /** 616 + * This is a model that extends another model 617 + */ 618 + export type ModelThatExtends = ModelWithString & { 619 + propExtendsA?: string; 620 + propExtendsB?: ModelWithString; 621 + }; 622 + 623 + /** 624 + * This is a model that extends another model 625 + */ 626 + export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { 627 + propExtendsC?: string; 628 + propExtendsD?: ModelWithString; 629 + }; 630 + 631 + /** 632 + * This is a model that contains a some patterns 633 + */ 634 + export type ModelWithPattern = { 635 + key: string; 636 + name: string; 637 + readonly enabled?: boolean; 638 + readonly modified?: string; 639 + id?: string; 640 + text?: string; 641 + patternWithSingleQuotes?: string; 642 + patternWithNewline?: string; 643 + patternWithBacktick?: string; 644 + }; 645 + 646 + export type File = { 647 + /** 648 + * Id 649 + */ 650 + readonly id?: string; 651 + /** 652 + * Updated at 653 + */ 654 + readonly updated_at?: string; 655 + /** 656 + * Created at 657 + */ 658 + readonly created_at?: string; 659 + /** 660 + * Mime 661 + */ 662 + mime: string; 663 + /** 664 + * File 665 + */ 666 + readonly file?: string; 667 + }; 668 + 669 + export type Default = { 670 + name?: string; 671 + }; 672 + 673 + export type Pageable = { 674 + page?: number; 675 + size?: number; 676 + sort?: Array<string>; 677 + }; 678 + 679 + /** 680 + * This is a free-form object without additionalProperties. 681 + */ 682 + export type FreeFormObjectWithoutAdditionalProperties = { 683 + [key: string]: unknown; 684 + }; 685 + 686 + /** 687 + * This is a free-form object with additionalProperties: true. 688 + */ 689 + export type FreeFormObjectWithAdditionalPropertiesEqTrue = { 690 + [key: string]: unknown; 691 + }; 692 + 693 + /** 694 + * This is a free-form object with additionalProperties: {}. 695 + */ 696 + export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { 697 + [key: string]: unknown; 698 + }; 699 + 700 + export type ModelWithConst = { 701 + String?: 'String'; 702 + number?: 0; 703 + null?: null; 704 + withType?: 'Some string'; 705 + }; 706 + 707 + /** 708 + * This is a model with one property and additionalProperties: true 709 + */ 710 + export type ModelWithAdditionalPropertiesEqTrue = { 711 + /** 712 + * This is a simple string property 713 + */ 714 + prop?: string; 715 + [key: string]: unknown | string | undefined; 716 + }; 717 + 718 + export type NestedAnyOfArraysNullable = { 719 + nullableArray?: Array<string | boolean> | null; 720 + }; 721 + 722 + export type CompositionWithOneOfAndProperties = ({ 723 + foo: SimpleParameter; 724 + } | { 725 + bar: NonAsciiStringæøåÆøÅöôêÊ字符串; 726 + }) & { 727 + baz: number | null; 728 + qux: number; 729 + }; 730 + 731 + /** 732 + * An object that can be null 733 + */ 734 + export type NullableObject = { 735 + foo?: string; 736 + } | null; 737 + 738 + /** 739 + * Some % character 740 + */ 741 + export type CharactersInDescription = string; 742 + 743 + export type ModelWithNullableObject = { 744 + data?: NullableObject; 745 + }; 746 + 747 + export type ModelWithOneOfEnum = { 748 + foo: 'Bar'; 749 + } | { 750 + foo: 'Baz'; 751 + } | { 752 + foo: 'Qux'; 753 + } | { 754 + content: string; 755 + foo: 'Quux'; 756 + } | { 757 + content: [ 758 + string, 759 + string 760 + ]; 761 + foo: 'Corge'; 762 + }; 763 + 764 + export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; 765 + 766 + export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; 767 + 768 + export type ModelWithNestedArrayEnumsData = { 769 + foo?: Array<ModelWithNestedArrayEnumsDataFoo>; 770 + bar?: Array<ModelWithNestedArrayEnumsDataBar>; 771 + }; 772 + 773 + export type ModelWithNestedArrayEnums = { 774 + array_strings?: Array<string>; 775 + data?: ModelWithNestedArrayEnumsData; 776 + }; 777 + 778 + export type ModelWithNestedCompositionEnums = { 779 + foo?: ModelWithNestedArrayEnumsDataFoo; 780 + }; 781 + 782 + export type ModelWithReadOnlyAndWriteOnly = { 783 + foo: string; 784 + readonly bar: string; 785 + }; 786 + 787 + export type ModelWithConstantSizeArray = [ 788 + number, 789 + number 790 + ]; 791 + 792 + export type ModelWithAnyOfConstantSizeArray = [ 793 + number | string, 794 + number | string, 795 + number | string 796 + ]; 797 + 798 + export type ModelWithPrefixItemsConstantSizeArray = [ 799 + ModelWithInteger, 800 + number | string, 801 + string 802 + ]; 803 + 804 + export type ModelWithAnyOfConstantSizeArrayNullable = [ 805 + number | null | string, 806 + number | null | string, 807 + number | null | string 808 + ]; 809 + 810 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ 811 + number | Import, 812 + number | Import 813 + ]; 814 + 815 + export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ 816 + number & string, 817 + number & string 818 + ]; 819 + 820 + export type ModelWithNumericEnumUnion = { 821 + /** 822 + * Период 823 + */ 824 + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; 825 + }; 826 + 827 + /** 828 + * Some description with `back ticks` 829 + */ 830 + export type ModelWithBackticksInDescription = { 831 + /** 832 + * The template `that` should be used for parsing and importing the contents of the CSV file. 833 + * 834 + * <br/><p>There is one placeholder currently supported:<ul> <li><b>${x}</b> - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)</li></ul><p>Example of a correct JSON template:</p> 835 + * <pre> 836 + * [ 837 + * { 838 + * "resourceType": "Asset", 839 + * "identifier": { 840 + * "name": "${1}", 841 + * "domain": { 842 + * "name": "${2}", 843 + * "community": { 844 + * "name": "Some Community" 845 + * } 846 + * } 847 + * }, 848 + * "attributes" : { 849 + * "00000000-0000-0000-0000-000000003115" : [ { 850 + * "value" : "${3}" 851 + * } ], 852 + * "00000000-0000-0000-0000-000000000222" : [ { 853 + * "value" : "${4}" 854 + * } ] 855 + * } 856 + * } 857 + * ] 858 + * </pre> 859 + */ 860 + template?: string; 861 + }; 862 + 863 + export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & { 864 + baz: number | null; 865 + qux: number; 866 + }; 867 + 868 + /** 869 + * Model used to test deduplication strategy (unused) 870 + */ 871 + export type ParameterSimpleParameterUnused = string; 872 + 873 + /** 874 + * Model used to test deduplication strategy 875 + */ 876 + export type PostServiceWithEmptyTagResponse = string; 877 + 878 + /** 879 + * Model used to test deduplication strategy 880 + */ 881 + export type PostServiceWithEmptyTagResponse2 = string; 882 + 883 + /** 884 + * Model used to test deduplication strategy 885 + */ 886 + export type DeleteFooData = string; 887 + 888 + /** 889 + * Model used to test deduplication strategy 890 + */ 891 + export type DeleteFooData2 = string; 892 + 893 + /** 894 + * Model with restricted keyword name 895 + */ 896 + export type Import = string; 897 + 898 + export type SchemaWithFormRestrictedKeys = { 899 + description?: string; 900 + 'x-enum-descriptions'?: string; 901 + 'x-enum-varnames'?: string; 902 + 'x-enumNames'?: string; 903 + title?: string; 904 + object?: { 905 + description?: string; 906 + 'x-enum-descriptions'?: string; 907 + 'x-enum-varnames'?: string; 908 + 'x-enumNames'?: string; 909 + title?: string; 910 + }; 911 + array?: Array<{ 912 + description?: string; 913 + 'x-enum-descriptions'?: string; 914 + 'x-enum-varnames'?: string; 915 + 'x-enumNames'?: string; 916 + title?: string; 917 + }>; 918 + }; 919 + 920 + /** 921 + * This schema was giving PascalCase transformations a hard time 922 + */ 923 + export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = { 924 + /** 925 + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. 926 + */ 927 + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; 928 + }; 929 + 930 + /** 931 + * This schema was giving PascalCase transformations a hard time 932 + */ 933 + export type IoK8sApimachineryPkgApisMetaV1Preconditions = { 934 + /** 935 + * Specifies the target ResourceVersion 936 + */ 937 + resourceVersion?: string; 938 + /** 939 + * Specifies the target UID. 940 + */ 941 + uid?: string; 942 + }; 943 + 944 + export type AdditionalPropertiesUnknownIssue = { 945 + [key: string]: string | number; 946 + }; 947 + 948 + export type AdditionalPropertiesUnknownIssue2 = { 949 + [key: string]: string | number; 950 + }; 951 + 952 + export type AdditionalPropertiesUnknownIssue3 = string & { 953 + entries: { 954 + [key: string]: AdditionalPropertiesUnknownIssue; 955 + }; 956 + }; 957 + 958 + export type AdditionalPropertiesIntegerIssue = { 959 + value: number; 960 + [key: string]: number; 961 + }; 962 + 963 + export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 964 + 965 + export type GenericSchemaDuplicateIssue1SystemBoolean = { 966 + item?: boolean; 967 + error?: string | null; 968 + readonly hasError?: boolean; 969 + data?: { 970 + [key: string]: never; 971 + }; 972 + }; 973 + 974 + export type GenericSchemaDuplicateIssue1SystemString = { 975 + item?: string | null; 976 + error?: string | null; 977 + readonly hasError?: boolean; 978 + }; 979 + 980 + export type ExternalSharedExternalSharedModel = { 981 + id: string; 982 + name?: string; 983 + }; 984 + 985 + /** 986 + * This is a model with one property containing a reference 987 + */ 988 + export type ModelWithReferenceWritable = { 989 + prop?: ModelWithPropertiesWritable; 990 + }; 991 + 992 + /** 993 + * This is a model with one property containing an array 994 + */ 995 + export type ModelWithArrayReadOnlyAndWriteOnlyWritable = { 996 + prop?: Array<ModelWithReadOnlyAndWriteOnlyWritable>; 997 + propWithFile?: Array<Blob | File>; 998 + propWithNumber?: Array<number>; 999 + }; 1000 + 1001 + /** 1002 + * This is a model with one nested property 1003 + */ 1004 + export type ModelWithPropertiesWritable = { 1005 + required: string; 1006 + requiredAndNullable: string | null; 1007 + string?: string; 1008 + number?: number; 1009 + boolean?: boolean; 1010 + reference?: ModelWithString; 1011 + 'property with space'?: string; 1012 + default?: string; 1013 + try?: string; 1014 + }; 1015 + 1016 + /** 1017 + * This is a model that contains a some patterns 1018 + */ 1019 + export type ModelWithPatternWritable = { 1020 + key: string; 1021 + name: string; 1022 + id?: string; 1023 + text?: string; 1024 + patternWithSingleQuotes?: string; 1025 + patternWithNewline?: string; 1026 + patternWithBacktick?: string; 1027 + }; 1028 + 1029 + export type FileWritable = { 1030 + /** 1031 + * Mime 1032 + */ 1033 + mime: string; 1034 + }; 1035 + 1036 + export type ModelWithReadOnlyAndWriteOnlyWritable = { 1037 + foo: string; 1038 + baz: string; 1039 + }; 1040 + 1041 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = [ 1042 + number | Import, 1043 + number | Import 1044 + ]; 1045 + 1046 + export type AdditionalPropertiesUnknownIssueWritable = { 1047 + [key: string]: string | number; 1048 + }; 1049 + 1050 + export type OneOfAllOfIssueWritable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 1051 + 1052 + export type GenericSchemaDuplicateIssue1SystemBooleanWritable = { 1053 + item?: boolean; 1054 + error?: string | null; 1055 + data?: { 1056 + [key: string]: never; 1057 + }; 1058 + }; 1059 + 1060 + export type GenericSchemaDuplicateIssue1SystemStringWritable = { 1061 + item?: string | null; 1062 + error?: string | null; 1063 + }; 1064 + 1065 + /** 1066 + * This is a reusable parameter 1067 + */ 1068 + export type SimpleParameter = string; 1069 + 1070 + /** 1071 + * Parameter with illegal characters 1072 + */ 1073 + export type XFooBar = ModelWithString; 1074 + 1075 + /** 1076 + * A reusable request body 1077 + */ 1078 + export type SimpleRequestBody = ModelWithString; 1079 + 1080 + /** 1081 + * A reusable request body 1082 + */ 1083 + export type SimpleFormData = ModelWithString; 1084 + 1085 + export type ExportData = { 1086 + body?: never; 1087 + path?: never; 1088 + query?: never; 1089 + url: '/api/v{api-version}/no+tag'; 1090 + }; 1091 + 1092 + export type PatchApiVbyApiVersionNoTagData = { 1093 + body?: never; 1094 + path?: never; 1095 + query?: never; 1096 + url: '/api/v{api-version}/no+tag'; 1097 + }; 1098 + 1099 + export type PatchApiVbyApiVersionNoTagResponses = { 1100 + /** 1101 + * OK 1102 + */ 1103 + default: unknown; 1104 + }; 1105 + 1106 + export type ImportData = { 1107 + body: ModelWithReadOnlyAndWriteOnlyWritable | ModelWithArrayReadOnlyAndWriteOnlyWritable; 1108 + path?: never; 1109 + query?: never; 1110 + url: '/api/v{api-version}/no+tag'; 1111 + }; 1112 + 1113 + export type ImportResponses = { 1114 + /** 1115 + * Success 1116 + */ 1117 + 200: ModelFromZendesk; 1118 + /** 1119 + * Default success response 1120 + */ 1121 + default: ModelWithReadOnlyAndWriteOnly; 1122 + }; 1123 + 1124 + export type ImportResponse = ImportResponses[keyof ImportResponses]; 1125 + 1126 + export type FooWowData = { 1127 + body?: never; 1128 + path?: never; 1129 + query?: never; 1130 + url: '/api/v{api-version}/no+tag'; 1131 + }; 1132 + 1133 + export type FooWowResponses = { 1134 + /** 1135 + * OK 1136 + */ 1137 + default: unknown; 1138 + }; 1139 + 1140 + export type ApiVVersionODataControllerCountData = { 1141 + body?: never; 1142 + path?: never; 1143 + query?: never; 1144 + url: '/api/v{api-version}/simple/$count'; 1145 + }; 1146 + 1147 + export type ApiVVersionODataControllerCountResponses = { 1148 + /** 1149 + * Success 1150 + */ 1151 + 200: ModelFromZendesk; 1152 + }; 1153 + 1154 + export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; 1155 + 1156 + export type GetApiVbyApiVersionSimpleOperationData = { 1157 + body?: never; 1158 + path: { 1159 + /** 1160 + * foo in method 1161 + */ 1162 + foo_param: string; 1163 + }; 1164 + query?: never; 1165 + url: '/api/v{api-version}/simple:operation'; 1166 + }; 1167 + 1168 + export type GetApiVbyApiVersionSimpleOperationErrors = { 1169 + /** 1170 + * Default error response 1171 + */ 1172 + default: ModelWithBoolean; 1173 + }; 1174 + 1175 + export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; 1176 + 1177 + export type GetApiVbyApiVersionSimpleOperationResponses = { 1178 + /** 1179 + * Response is a simple number 1180 + */ 1181 + 200: number; 1182 + }; 1183 + 1184 + export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; 1185 + 1186 + export type DeleteCallWithoutParametersAndResponseData = { 1187 + body?: never; 1188 + path?: never; 1189 + query?: never; 1190 + url: '/api/v{api-version}/simple'; 1191 + }; 1192 + 1193 + export type GetCallWithoutParametersAndResponseData = { 1194 + body?: never; 1195 + path?: never; 1196 + query?: never; 1197 + url: '/api/v{api-version}/simple'; 1198 + }; 1199 + 1200 + export type HeadCallWithoutParametersAndResponseData = { 1201 + body?: never; 1202 + path?: never; 1203 + query?: never; 1204 + url: '/api/v{api-version}/simple'; 1205 + }; 1206 + 1207 + export type OptionsCallWithoutParametersAndResponseData = { 1208 + body?: never; 1209 + path?: never; 1210 + query?: never; 1211 + url: '/api/v{api-version}/simple'; 1212 + }; 1213 + 1214 + export type PatchCallWithoutParametersAndResponseData = { 1215 + body?: never; 1216 + path?: never; 1217 + query?: never; 1218 + url: '/api/v{api-version}/simple'; 1219 + }; 1220 + 1221 + export type PostCallWithoutParametersAndResponseData = { 1222 + body?: never; 1223 + path?: never; 1224 + query?: never; 1225 + url: '/api/v{api-version}/simple'; 1226 + }; 1227 + 1228 + export type PutCallWithoutParametersAndResponseData = { 1229 + body?: never; 1230 + path?: never; 1231 + query?: never; 1232 + url: '/api/v{api-version}/simple'; 1233 + }; 1234 + 1235 + export type DeleteFooData3 = { 1236 + body?: never; 1237 + headers: { 1238 + /** 1239 + * Parameter with illegal characters 1240 + */ 1241 + 'x-Foo-Bar': ModelWithString; 1242 + }; 1243 + path: { 1244 + /** 1245 + * foo in method 1246 + */ 1247 + foo_param: string; 1248 + /** 1249 + * bar in method 1250 + */ 1251 + BarParam: string; 1252 + }; 1253 + query?: never; 1254 + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; 1255 + }; 1256 + 1257 + export type CallWithDescriptionsData = { 1258 + body?: never; 1259 + path?: never; 1260 + query?: { 1261 + /** 1262 + * Testing multiline comments in string: First line 1263 + * Second line 1264 + * 1265 + * Fourth line 1266 + */ 1267 + parameterWithBreaks?: string; 1268 + /** 1269 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1270 + */ 1271 + parameterWithBackticks?: string; 1272 + /** 1273 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1274 + */ 1275 + parameterWithSlashes?: string; 1276 + /** 1277 + * Testing expression placeholders in string: ${expression} should work 1278 + */ 1279 + parameterWithExpressionPlaceholders?: string; 1280 + /** 1281 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1282 + */ 1283 + parameterWithQuotes?: string; 1284 + /** 1285 + * Testing reserved characters in string: * inline * and ** inline ** should work 1286 + */ 1287 + parameterWithReservedCharacters?: string; 1288 + }; 1289 + url: '/api/v{api-version}/descriptions'; 1290 + }; 1291 + 1292 + export type DeprecatedCallData = { 1293 + body?: never; 1294 + headers: { 1295 + /** 1296 + * This parameter is deprecated 1297 + * 1298 + * @deprecated 1299 + */ 1300 + parameter: DeprecatedModel | null; 1301 + }; 1302 + path?: never; 1303 + query?: never; 1304 + url: '/api/v{api-version}/parameters/deprecated'; 1305 + }; 1306 + 1307 + export type CallWithParametersData = { 1308 + /** 1309 + * This is the parameter that goes into the body 1310 + */ 1311 + body: { 1312 + [key: string]: unknown; 1313 + } | null; 1314 + headers: { 1315 + /** 1316 + * This is the parameter that goes into the header 1317 + */ 1318 + parameterHeader: string | null; 1319 + }; 1320 + path: { 1321 + /** 1322 + * This is the parameter that goes into the path 1323 + */ 1324 + parameterPath: string | null; 1325 + /** 1326 + * api-version should be required in standalone clients 1327 + */ 1328 + 'api-version': string | null; 1329 + }; 1330 + query: { 1331 + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; 1332 + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; 1333 + /** 1334 + * This is the parameter that goes into the query params 1335 + */ 1336 + cursor: string | null; 1337 + }; 1338 + url: '/api/v{api-version}/parameters/{parameterPath}'; 1339 + }; 1340 + 1341 + export type CallWithWeirdParameterNamesData = { 1342 + /** 1343 + * This is the parameter that goes into the body 1344 + */ 1345 + body: ModelWithString | null; 1346 + headers: { 1347 + /** 1348 + * This is the parameter that goes into the request header 1349 + */ 1350 + 'parameter.header': string | null; 1351 + }; 1352 + path: { 1353 + /** 1354 + * This is the parameter that goes into the path 1355 + */ 1356 + 'parameter.path.1'?: string; 1357 + /** 1358 + * This is the parameter that goes into the path 1359 + */ 1360 + 'parameter-path-2'?: string; 1361 + /** 1362 + * This is the parameter that goes into the path 1363 + */ 1364 + 'PARAMETER-PATH-3'?: string; 1365 + /** 1366 + * api-version should be required in standalone clients 1367 + */ 1368 + 'api-version': string | null; 1369 + }; 1370 + query: { 1371 + /** 1372 + * This is the parameter with a reserved keyword 1373 + */ 1374 + default?: string; 1375 + /** 1376 + * This is the parameter that goes into the request query params 1377 + */ 1378 + 'parameter-query': string | null; 1379 + }; 1380 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; 1381 + }; 1382 + 1383 + export type GetCallWithOptionalParamData = { 1384 + /** 1385 + * This is a required parameter 1386 + */ 1387 + body: ModelWithOneOfEnum; 1388 + path?: never; 1389 + query?: { 1390 + /** 1391 + * This is an optional parameter 1392 + */ 1393 + page?: number; 1394 + }; 1395 + url: '/api/v{api-version}/parameters'; 1396 + }; 1397 + 1398 + export type PostCallWithOptionalParamData = { 1399 + /** 1400 + * This is an optional parameter 1401 + */ 1402 + body?: { 1403 + offset?: number | null; 1404 + }; 1405 + path?: never; 1406 + query: { 1407 + /** 1408 + * This is a required parameter 1409 + */ 1410 + parameter: Pageable; 1411 + }; 1412 + url: '/api/v{api-version}/parameters'; 1413 + }; 1414 + 1415 + export type PostCallWithOptionalParamResponses = { 1416 + /** 1417 + * Response is a simple number 1418 + */ 1419 + 200: number; 1420 + /** 1421 + * Success 1422 + */ 1423 + 204: void; 1424 + }; 1425 + 1426 + export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; 1427 + 1428 + export type PostApiVbyApiVersionRequestBodyData = { 1429 + /** 1430 + * A reusable request body 1431 + */ 1432 + body?: SimpleRequestBody; 1433 + path?: never; 1434 + query?: { 1435 + /** 1436 + * This is a reusable parameter 1437 + */ 1438 + parameter?: string; 1439 + }; 1440 + url: '/api/v{api-version}/requestBody'; 1441 + }; 1442 + 1443 + export type PostApiVbyApiVersionFormDataData = { 1444 + /** 1445 + * A reusable request body 1446 + */ 1447 + body?: SimpleFormData; 1448 + path?: never; 1449 + query?: { 1450 + /** 1451 + * This is a reusable parameter 1452 + */ 1453 + parameter?: string; 1454 + }; 1455 + url: '/api/v{api-version}/formData'; 1456 + }; 1457 + 1458 + export type CallWithDefaultParametersData = { 1459 + body?: never; 1460 + path?: never; 1461 + query?: { 1462 + /** 1463 + * This is a simple string with default value 1464 + */ 1465 + parameterString?: string | null; 1466 + /** 1467 + * This is a simple number with default value 1468 + */ 1469 + parameterNumber?: number | null; 1470 + /** 1471 + * This is a simple boolean with default value 1472 + */ 1473 + parameterBoolean?: boolean | null; 1474 + /** 1475 + * This is a simple enum with default value 1476 + */ 1477 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1478 + /** 1479 + * This is a simple model with default value 1480 + */ 1481 + parameterModel?: ModelWithString | null; 1482 + }; 1483 + url: '/api/v{api-version}/defaults'; 1484 + }; 1485 + 1486 + export type CallWithDefaultOptionalParametersData = { 1487 + body?: never; 1488 + path?: never; 1489 + query?: { 1490 + /** 1491 + * This is a simple string that is optional with default value 1492 + */ 1493 + parameterString?: string; 1494 + /** 1495 + * This is a simple number that is optional with default value 1496 + */ 1497 + parameterNumber?: number; 1498 + /** 1499 + * This is a simple boolean that is optional with default value 1500 + */ 1501 + parameterBoolean?: boolean; 1502 + /** 1503 + * This is a simple enum that is optional with default value 1504 + */ 1505 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1506 + /** 1507 + * This is a simple model that is optional with default value 1508 + */ 1509 + parameterModel?: ModelWithString; 1510 + }; 1511 + url: '/api/v{api-version}/defaults'; 1512 + }; 1513 + 1514 + export type CallToTestOrderOfParamsData = { 1515 + body?: never; 1516 + path?: never; 1517 + query: { 1518 + /** 1519 + * This is a optional string with default 1520 + */ 1521 + parameterOptionalStringWithDefault?: string; 1522 + /** 1523 + * This is a optional string with empty default 1524 + */ 1525 + parameterOptionalStringWithEmptyDefault?: string; 1526 + /** 1527 + * This is a optional string with no default 1528 + */ 1529 + parameterOptionalStringWithNoDefault?: string; 1530 + /** 1531 + * This is a string with default 1532 + */ 1533 + parameterStringWithDefault: string; 1534 + /** 1535 + * This is a string with empty default 1536 + */ 1537 + parameterStringWithEmptyDefault: string; 1538 + /** 1539 + * This is a string with no default 1540 + */ 1541 + parameterStringWithNoDefault: string; 1542 + /** 1543 + * This is a string that can be null with no default 1544 + */ 1545 + parameterStringNullableWithNoDefault?: string | null; 1546 + /** 1547 + * This is a string that can be null with default 1548 + */ 1549 + parameterStringNullableWithDefault?: string | null; 1550 + }; 1551 + url: '/api/v{api-version}/defaults'; 1552 + }; 1553 + 1554 + export type DuplicateNameData = { 1555 + body?: never; 1556 + path?: never; 1557 + query?: never; 1558 + url: '/api/v{api-version}/duplicate'; 1559 + }; 1560 + 1561 + export type DuplicateName2Data = { 1562 + body?: never; 1563 + path?: never; 1564 + query?: never; 1565 + url: '/api/v{api-version}/duplicate'; 1566 + }; 1567 + 1568 + export type DuplicateName3Data = { 1569 + body?: never; 1570 + path?: never; 1571 + query?: never; 1572 + url: '/api/v{api-version}/duplicate'; 1573 + }; 1574 + 1575 + export type DuplicateName4Data = { 1576 + body?: never; 1577 + path?: never; 1578 + query?: never; 1579 + url: '/api/v{api-version}/duplicate'; 1580 + }; 1581 + 1582 + export type CallWithNoContentResponseData = { 1583 + body?: never; 1584 + path?: never; 1585 + query?: never; 1586 + url: '/api/v{api-version}/no-content'; 1587 + }; 1588 + 1589 + export type CallWithNoContentResponseResponses = { 1590 + /** 1591 + * Success 1592 + */ 1593 + 204: void; 1594 + }; 1595 + 1596 + export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; 1597 + 1598 + export type CallWithResponseAndNoContentResponseData = { 1599 + body?: never; 1600 + path?: never; 1601 + query?: never; 1602 + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; 1603 + }; 1604 + 1605 + export type CallWithResponseAndNoContentResponseResponses = { 1606 + /** 1607 + * Response is a simple number 1608 + */ 1609 + 200: number; 1610 + /** 1611 + * Success 1612 + */ 1613 + 204: void; 1614 + }; 1615 + 1616 + export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; 1617 + 1618 + export type DummyAData = { 1619 + body?: never; 1620 + path?: never; 1621 + query?: never; 1622 + url: '/api/v{api-version}/multiple-tags/a'; 1623 + }; 1624 + 1625 + export type DummyAResponses = { 1626 + 200: _400; 1627 + }; 1628 + 1629 + export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; 1630 + 1631 + export type DummyBData = { 1632 + body?: never; 1633 + path?: never; 1634 + query?: never; 1635 + url: '/api/v{api-version}/multiple-tags/b'; 1636 + }; 1637 + 1638 + export type DummyBResponses = { 1639 + /** 1640 + * Success 1641 + */ 1642 + 204: void; 1643 + }; 1644 + 1645 + export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; 1646 + 1647 + export type CallWithResponseData = { 1648 + body?: never; 1649 + path?: never; 1650 + query?: never; 1651 + url: '/api/v{api-version}/response'; 1652 + }; 1653 + 1654 + export type CallWithResponseResponses = { 1655 + default: Import; 1656 + }; 1657 + 1658 + export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; 1659 + 1660 + export type CallWithDuplicateResponsesData = { 1661 + body?: never; 1662 + path?: never; 1663 + query?: never; 1664 + url: '/api/v{api-version}/response'; 1665 + }; 1666 + 1667 + export type CallWithDuplicateResponsesErrors = { 1668 + /** 1669 + * Message for 500 error 1670 + */ 1671 + 500: ModelWithStringError; 1672 + /** 1673 + * Message for 501 error 1674 + */ 1675 + 501: ModelWithStringError; 1676 + /** 1677 + * Message for 502 error 1678 + */ 1679 + 502: ModelWithStringError; 1680 + /** 1681 + * Message for 4XX errors 1682 + */ 1683 + '4XX': DictionaryWithArray; 1684 + /** 1685 + * Default error response 1686 + */ 1687 + default: ModelWithBoolean; 1688 + }; 1689 + 1690 + export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; 1691 + 1692 + export type CallWithDuplicateResponsesResponses = { 1693 + /** 1694 + * Message for 200 response 1695 + */ 1696 + 200: ModelWithBoolean & ModelWithInteger; 1697 + /** 1698 + * Message for 201 response 1699 + */ 1700 + 201: ModelWithString; 1701 + /** 1702 + * Message for 202 response 1703 + */ 1704 + 202: ModelWithString; 1705 + }; 1706 + 1707 + export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; 1708 + 1709 + export type CallWithResponsesData = { 1710 + body?: never; 1711 + path?: never; 1712 + query?: never; 1713 + url: '/api/v{api-version}/response'; 1714 + }; 1715 + 1716 + export type CallWithResponsesErrors = { 1717 + /** 1718 + * Message for 500 error 1719 + */ 1720 + 500: ModelWithStringError; 1721 + /** 1722 + * Message for 501 error 1723 + */ 1724 + 501: ModelWithStringError; 1725 + /** 1726 + * Message for 502 error 1727 + */ 1728 + 502: ModelWithStringError; 1729 + /** 1730 + * Message for default response 1731 + */ 1732 + default: ModelWithStringError; 1733 + }; 1734 + 1735 + export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; 1736 + 1737 + export type CallWithResponsesResponses = { 1738 + /** 1739 + * Message for 200 response 1740 + */ 1741 + 200: { 1742 + readonly '@namespace.string'?: string; 1743 + readonly '@namespace.integer'?: number; 1744 + readonly value?: Array<ModelWithString>; 1745 + }; 1746 + /** 1747 + * Message for 201 response 1748 + */ 1749 + 201: ModelThatExtends; 1750 + /** 1751 + * Message for 202 response 1752 + */ 1753 + 202: ModelThatExtendsExtends; 1754 + }; 1755 + 1756 + export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; 1757 + 1758 + export type CollectionFormatData = { 1759 + body?: never; 1760 + path?: never; 1761 + query: { 1762 + /** 1763 + * This is an array parameter that is sent as csv format (comma-separated values) 1764 + */ 1765 + parameterArrayCSV: Array<string> | null; 1766 + /** 1767 + * This is an array parameter that is sent as ssv format (space-separated values) 1768 + */ 1769 + parameterArraySSV: Array<string> | null; 1770 + /** 1771 + * This is an array parameter that is sent as tsv format (tab-separated values) 1772 + */ 1773 + parameterArrayTSV: Array<string> | null; 1774 + /** 1775 + * This is an array parameter that is sent as pipes format (pipe-separated values) 1776 + */ 1777 + parameterArrayPipes: Array<string> | null; 1778 + /** 1779 + * This is an array parameter that is sent as multi format (multiple parameter instances) 1780 + */ 1781 + parameterArrayMulti: Array<string> | null; 1782 + }; 1783 + url: '/api/v{api-version}/collectionFormat'; 1784 + }; 1785 + 1786 + export type TypesData = { 1787 + body?: never; 1788 + path?: { 1789 + /** 1790 + * This is a number parameter 1791 + */ 1792 + id?: number; 1793 + }; 1794 + query: { 1795 + /** 1796 + * This is a number parameter 1797 + */ 1798 + parameterNumber: number; 1799 + /** 1800 + * This is a string parameter 1801 + */ 1802 + parameterString: string | null; 1803 + /** 1804 + * This is a boolean parameter 1805 + */ 1806 + parameterBoolean: boolean | null; 1807 + /** 1808 + * This is an object parameter 1809 + */ 1810 + parameterObject: { 1811 + [key: string]: unknown; 1812 + } | null; 1813 + /** 1814 + * This is an array parameter 1815 + */ 1816 + parameterArray: Array<string> | null; 1817 + /** 1818 + * This is a dictionary parameter 1819 + */ 1820 + parameterDictionary: { 1821 + [key: string]: unknown; 1822 + } | null; 1823 + /** 1824 + * This is an enum parameter 1825 + */ 1826 + parameterEnum: 'Success' | 'Warning' | 'Error' | null; 1827 + }; 1828 + url: '/api/v{api-version}/types'; 1829 + }; 1830 + 1831 + export type TypesResponses = { 1832 + /** 1833 + * Response is a simple number 1834 + */ 1835 + 200: number; 1836 + /** 1837 + * Response is a simple string 1838 + */ 1839 + 201: string; 1840 + /** 1841 + * Response is a simple boolean 1842 + */ 1843 + 202: boolean; 1844 + /** 1845 + * Response is a simple object 1846 + */ 1847 + 203: { 1848 + [key: string]: unknown; 1849 + }; 1850 + }; 1851 + 1852 + export type TypesResponse = TypesResponses[keyof TypesResponses]; 1853 + 1854 + export type UploadFileData = { 1855 + body: Blob | File; 1856 + path: { 1857 + /** 1858 + * api-version should be required in standalone clients 1859 + */ 1860 + 'api-version': string | null; 1861 + }; 1862 + query?: never; 1863 + url: '/api/v{api-version}/upload'; 1864 + }; 1865 + 1866 + export type UploadFileResponses = { 1867 + 200: boolean; 1868 + }; 1869 + 1870 + export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; 1871 + 1872 + export type FileResponseData = { 1873 + body?: never; 1874 + path: { 1875 + id: string; 1876 + /** 1877 + * api-version should be required in standalone clients 1878 + */ 1879 + 'api-version': string; 1880 + }; 1881 + query?: never; 1882 + url: '/api/v{api-version}/file/{id}'; 1883 + }; 1884 + 1885 + export type FileResponseResponses = { 1886 + /** 1887 + * Success 1888 + */ 1889 + 200: Blob | File; 1890 + }; 1891 + 1892 + export type FileResponseResponse = FileResponseResponses[keyof FileResponseResponses]; 1893 + 1894 + export type ComplexTypesData = { 1895 + body?: never; 1896 + path?: never; 1897 + query: { 1898 + /** 1899 + * Parameter containing object 1900 + */ 1901 + parameterObject: { 1902 + first?: { 1903 + second?: { 1904 + third?: string; 1905 + }; 1906 + }; 1907 + }; 1908 + /** 1909 + * Parameter containing reference 1910 + */ 1911 + parameterReference: ModelWithString; 1912 + }; 1913 + url: '/api/v{api-version}/complex'; 1914 + }; 1915 + 1916 + export type ComplexTypesErrors = { 1917 + /** 1918 + * 400 `server` error 1919 + */ 1920 + 400: unknown; 1921 + /** 1922 + * 500 server error 1923 + */ 1924 + 500: unknown; 1925 + }; 1926 + 1927 + export type ComplexTypesResponses = { 1928 + /** 1929 + * Successful response 1930 + */ 1931 + 200: Array<ModelWithString>; 1932 + }; 1933 + 1934 + export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; 1935 + 1936 + export type MultipartResponseData = { 1937 + body?: never; 1938 + path?: never; 1939 + query?: never; 1940 + url: '/api/v{api-version}/multipart'; 1941 + }; 1942 + 1943 + export type MultipartResponseResponses = { 1944 + /** 1945 + * OK 1946 + */ 1947 + 200: { 1948 + file?: Blob | File; 1949 + metadata?: { 1950 + foo?: string; 1951 + bar?: string; 1952 + }; 1953 + }; 1954 + }; 1955 + 1956 + export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; 1957 + 1958 + export type MultipartRequestData = { 1959 + body?: { 1960 + content?: Blob | File; 1961 + data?: ModelWithString | null; 1962 + }; 1963 + path?: never; 1964 + query?: never; 1965 + url: '/api/v{api-version}/multipart'; 1966 + }; 1967 + 1968 + export type ComplexParamsData = { 1969 + body?: { 1970 + readonly key: string | null; 1971 + name: string | null; 1972 + enabled?: boolean; 1973 + type: 'Monkey' | 'Horse' | 'Bird'; 1974 + listOfModels?: Array<ModelWithString> | null; 1975 + listOfStrings?: Array<string> | null; 1976 + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 1977 + readonly user?: { 1978 + readonly id?: number; 1979 + readonly name?: string | null; 1980 + }; 1981 + }; 1982 + path: { 1983 + id: number; 1984 + /** 1985 + * api-version should be required in standalone clients 1986 + */ 1987 + 'api-version': string; 1988 + }; 1989 + query?: never; 1990 + url: '/api/v{api-version}/complex/{id}'; 1991 + }; 1992 + 1993 + export type ComplexParamsResponses = { 1994 + /** 1995 + * Success 1996 + */ 1997 + 200: ModelWithString; 1998 + }; 1999 + 2000 + export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; 2001 + 2002 + export type CallWithResultFromHeaderData = { 2003 + body?: never; 2004 + path?: never; 2005 + query?: never; 2006 + url: '/api/v{api-version}/header'; 2007 + }; 2008 + 2009 + export type CallWithResultFromHeaderErrors = { 2010 + /** 2011 + * 400 server error 2012 + */ 2013 + 400: unknown; 2014 + /** 2015 + * 500 server error 2016 + */ 2017 + 500: unknown; 2018 + }; 2019 + 2020 + export type CallWithResultFromHeaderResponses = { 2021 + /** 2022 + * Successful response 2023 + */ 2024 + 200: unknown; 2025 + }; 2026 + 2027 + export type TestErrorCodeData = { 2028 + body?: never; 2029 + path?: never; 2030 + query: { 2031 + /** 2032 + * Status code to return 2033 + */ 2034 + status: number; 2035 + }; 2036 + url: '/api/v{api-version}/error'; 2037 + }; 2038 + 2039 + export type TestErrorCodeErrors = { 2040 + /** 2041 + * Custom message: Internal Server Error 2042 + */ 2043 + 500: unknown; 2044 + /** 2045 + * Custom message: Not Implemented 2046 + */ 2047 + 501: unknown; 2048 + /** 2049 + * Custom message: Bad Gateway 2050 + */ 2051 + 502: unknown; 2052 + /** 2053 + * Custom message: Service Unavailable 2054 + */ 2055 + 503: unknown; 2056 + }; 2057 + 2058 + export type TestErrorCodeResponses = { 2059 + /** 2060 + * Custom message: Successful response 2061 + */ 2062 + 200: unknown; 2063 + }; 2064 + 2065 + export type NonAsciiæøåÆøÅöôêÊ字符串Data = { 2066 + body?: never; 2067 + path?: never; 2068 + query: { 2069 + /** 2070 + * Dummy input param 2071 + */ 2072 + nonAsciiParamæøåÆØÅöôêÊ: number; 2073 + }; 2074 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2075 + }; 2076 + 2077 + export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { 2078 + /** 2079 + * Successful response 2080 + */ 2081 + 200: Array<NonAsciiStringæøåÆøÅöôêÊ字符串>; 2082 + }; 2083 + 2084 + export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; 2085 + 2086 + export type PutWithFormUrlEncodedData = { 2087 + body: ArrayWithStrings; 2088 + path?: never; 2089 + query?: never; 2090 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2091 + };
+16
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { type ClientOptions, type Config, createClient, createConfig } from './client/index.js'; 4 + import type { ClientOptions as ClientOptions2 } from './types.gen.js'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 15 + 16 + export const client = createClient(createConfig<ClientOptions2>({ baseURL: 'http://localhost:3000/base' }));
+229
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/client/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { 4 + useAsyncData, 5 + useFetch, 6 + useLazyAsyncData, 7 + useLazyFetch, 8 + } from 'nuxt/app'; 9 + import { reactive, ref, watch } from 'vue'; 10 + 11 + import { createSseClient } from '../core/serverSentEvents.gen.js'; 12 + import type { HttpMethod } from '../core/types.gen.js'; 13 + import type { Client, Config, RequestOptions } from './types.gen.js'; 14 + import { 15 + buildUrl, 16 + createConfig, 17 + executeFetchFn, 18 + mergeConfigs, 19 + mergeHeaders, 20 + mergeInterceptors, 21 + serializeBody, 22 + setAuthParams, 23 + unwrapRefs, 24 + } from './utils.gen.js'; 25 + 26 + export const createClient = (config: Config = {}): Client => { 27 + let _config = mergeConfigs(createConfig(), config); 28 + 29 + const getConfig = (): Config => ({ ..._config }); 30 + 31 + const setConfig = (config: Config): Config => { 32 + _config = mergeConfigs(_config, config); 33 + return getConfig(); 34 + }; 35 + 36 + const beforeRequest = async (options: RequestOptions) => { 37 + const opts = { 38 + ..._config, 39 + ...options, 40 + $fetch: options.$fetch ?? _config.$fetch ?? $fetch, 41 + headers: mergeHeaders(_config.headers, options.headers), 42 + onRequest: mergeInterceptors(_config.onRequest, options.onRequest), 43 + onResponse: mergeInterceptors(_config.onResponse, options.onResponse), 44 + }; 45 + 46 + if (opts.security) { 47 + await setAuthParams({ 48 + ...opts, 49 + security: opts.security, 50 + }); 51 + } 52 + 53 + if (opts.requestValidator) { 54 + await opts.requestValidator(opts); 55 + } 56 + 57 + const url = buildUrl(opts); 58 + 59 + return { opts, url }; 60 + }; 61 + 62 + const request: Client['request'] = ({ 63 + asyncDataOptions, 64 + composable = '$fetch', 65 + ...options 66 + }) => { 67 + const key = options.key; 68 + const opts = { 69 + ..._config, 70 + ...options, 71 + $fetch: options.$fetch ?? _config.$fetch ?? $fetch, 72 + headers: mergeHeaders(_config.headers, options.headers), 73 + onRequest: mergeInterceptors(_config.onRequest, options.onRequest), 74 + onResponse: mergeInterceptors(_config.onResponse, options.onResponse), 75 + }; 76 + 77 + const { 78 + requestValidator, 79 + responseTransformer, 80 + responseValidator, 81 + security, 82 + } = opts; 83 + if (requestValidator || security) { 84 + // auth must happen in interceptors otherwise we'd need to require 85 + // asyncContext enabled 86 + // https://nuxt.com/docs/guide/going-further/experimental-features#asynccontext 87 + opts.onRequest = [ 88 + async ({ options }) => { 89 + if (security) { 90 + await setAuthParams({ 91 + auth: opts.auth, 92 + headers: options.headers, 93 + query: options.query, 94 + security, 95 + }); 96 + } 97 + 98 + if (requestValidator) { 99 + await requestValidator({ 100 + ...options, 101 + // @ts-expect-error 102 + body: options.rawBody, 103 + }); 104 + } 105 + }, 106 + ...opts.onRequest, 107 + ]; 108 + } 109 + 110 + if (responseTransformer || responseValidator) { 111 + opts.onResponse = [ 112 + ...opts.onResponse, 113 + async ({ options, response }) => { 114 + if (options.responseType && options.responseType !== 'json') { 115 + return; 116 + } 117 + 118 + if (!response.ok) { 119 + return; 120 + } 121 + 122 + if (responseValidator) { 123 + await responseValidator(response._data); 124 + } 125 + 126 + if (responseTransformer) { 127 + response._data = await responseTransformer(response._data); 128 + } 129 + }, 130 + ]; 131 + } 132 + 133 + // remove Content-Type header if body is empty to avoid sending invalid requests 134 + if (opts.body === undefined || opts.body === '') { 135 + opts.headers.delete('Content-Type'); 136 + } 137 + 138 + const fetchFn = opts.$fetch; 139 + 140 + if (composable === '$fetch') { 141 + return executeFetchFn( 142 + // @ts-expect-error 143 + opts, 144 + fetchFn, 145 + ); 146 + } 147 + 148 + if (composable === 'useFetch' || composable === 'useLazyFetch') { 149 + opts.rawBody = opts.body; 150 + const bodyParams = reactive({ 151 + body: opts.body, 152 + bodySerializer: opts.bodySerializer, 153 + }); 154 + const body = ref(serializeBody(opts)); 155 + opts.body = body; 156 + watch(bodyParams, (changed) => { 157 + body.value = serializeBody(changed); 158 + }); 159 + return composable === 'useLazyFetch' 160 + ? useLazyFetch(() => buildUrl(opts), opts) 161 + : useFetch(() => buildUrl(opts), opts); 162 + } 163 + 164 + const handler: any = () => 165 + executeFetchFn( 166 + // @ts-expect-error 167 + opts, 168 + fetchFn, 169 + ); 170 + 171 + if (composable === 'useAsyncData') { 172 + return key 173 + ? useAsyncData(key, handler, asyncDataOptions) 174 + : useAsyncData(handler, asyncDataOptions); 175 + } 176 + 177 + if (composable === 'useLazyAsyncData') { 178 + return key 179 + ? useLazyAsyncData(key, handler, asyncDataOptions) 180 + : useLazyAsyncData(handler, asyncDataOptions); 181 + } 182 + 183 + return undefined as any; 184 + }; 185 + 186 + const makeMethodFn = 187 + (method: Uppercase<HttpMethod>) => (options: RequestOptions) => 188 + request({ ...options, method }); 189 + 190 + const makeSseFn = 191 + (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => { 192 + const { opts, url } = await beforeRequest(options); 193 + return createSseClient({ 194 + ...unwrapRefs(opts), 195 + body: opts.body as BodyInit | null | undefined, 196 + method, 197 + onRequest: undefined, 198 + signal: unwrapRefs(opts.signal) as AbortSignal, 199 + url, 200 + }); 201 + }; 202 + 203 + return { 204 + buildUrl, 205 + connect: makeMethodFn('CONNECT'), 206 + delete: makeMethodFn('DELETE'), 207 + get: makeMethodFn('GET'), 208 + getConfig, 209 + head: makeMethodFn('HEAD'), 210 + options: makeMethodFn('OPTIONS'), 211 + patch: makeMethodFn('PATCH'), 212 + post: makeMethodFn('POST'), 213 + put: makeMethodFn('PUT'), 214 + request, 215 + setConfig, 216 + sse: { 217 + connect: makeSseFn('CONNECT'), 218 + delete: makeSseFn('DELETE'), 219 + get: makeSseFn('GET'), 220 + head: makeSseFn('HEAD'), 221 + options: makeSseFn('OPTIONS'), 222 + patch: makeSseFn('PATCH'), 223 + post: makeSseFn('POST'), 224 + put: makeSseFn('PUT'), 225 + trace: makeSseFn('TRACE'), 226 + }, 227 + trace: makeMethodFn('TRACE'), 228 + } as Client; 229 + };
+24
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/client/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type { Auth } from '../core/auth.gen.js'; 4 + export type { QuerySerializerOptions } from '../core/bodySerializer.gen.js'; 5 + export { 6 + formDataBodySerializer, 7 + jsonBodySerializer, 8 + urlSearchParamsBodySerializer, 9 + } from '../core/bodySerializer.gen.js'; 10 + export { buildClientParams } from '../core/params.gen.js'; 11 + export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen.js'; 12 + export { createClient } from './client.gen.js'; 13 + export type { 14 + Client, 15 + ClientOptions, 16 + Composable, 17 + Config, 18 + CreateClientConfig, 19 + Options, 20 + RequestOptions, 21 + RequestResult, 22 + TDataShape, 23 + } from './types.gen.js'; 24 + export { createConfig } from './utils.gen.js';
+204
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/client/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { 4 + AsyncDataOptions, 5 + useAsyncData, 6 + useFetch, 7 + UseFetchOptions, 8 + useLazyAsyncData, 9 + useLazyFetch, 10 + } from 'nuxt/app'; 11 + import type { Ref } from 'vue'; 12 + 13 + import type { Auth } from '../core/auth.gen.js'; 14 + import type { QuerySerializerOptions } from '../core/bodySerializer.gen.js'; 15 + import type { 16 + ServerSentEventsOptions, 17 + ServerSentEventsResult, 18 + } from '../core/serverSentEvents.gen.js'; 19 + import type { 20 + Client as CoreClient, 21 + Config as CoreConfig, 22 + } from '../core/types.gen.js'; 23 + 24 + export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; 25 + type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; 26 + type MatrixStyle = 'label' | 'matrix' | 'simple'; 27 + export type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; 28 + type ObjectStyle = 'form' | 'deepObject'; 29 + 30 + export type QuerySerializer = ( 31 + query: Parameters<Client['buildUrl']>[0]['query'], 32 + ) => string; 33 + 34 + type WithRefs<TData> = { 35 + [K in keyof TData]: NonNullable<TData[K]> extends object 36 + ? WithRefs<NonNullable<TData[K]>> | Ref<NonNullable<TData[K]>> 37 + : NonNullable<TData[K]> | Ref<NonNullable<TData[K]>>; 38 + }; 39 + 40 + // copied from Nuxt 41 + export type KeysOf<T> = Array< 42 + T extends T ? (keyof T extends string ? keyof T : never) : never 43 + >; 44 + 45 + export interface Config<T extends ClientOptions = ClientOptions> 46 + extends Omit< 47 + FetchOptions<unknown>, 48 + 'baseURL' | 'body' | 'headers' | 'method' | 'query' 49 + >, 50 + WithRefs<Pick<FetchOptions<unknown>, 'query'>>, 51 + Omit<CoreConfig, 'querySerializer'> { 52 + /** 53 + * Base URL for all requests made by this client. 54 + */ 55 + baseURL?: T['baseURL']; 56 + /** 57 + * A function for serializing request query parameters. By default, arrays 58 + * will be exploded in form style, objects will be exploded in deepObject 59 + * style, and reserved characters are percent-encoded. 60 + * 61 + * {@link https://swagger.io/docs/specification/serialization/#query View examples} 62 + */ 63 + querySerializer?: QuerySerializer | QuerySerializerOptions; 64 + } 65 + 66 + export interface RequestOptions< 67 + TComposable extends Composable = '$fetch', 68 + ResT = unknown, 69 + DefaultT = undefined, 70 + Url extends string = string, 71 + > extends Config, 72 + WithRefs<{ 73 + /** 74 + * Any body that you want to add to your request. 75 + * 76 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} 77 + */ 78 + body?: unknown; 79 + path?: FetchOptions<unknown>['query']; 80 + query?: FetchOptions<unknown>['query']; 81 + rawBody?: unknown; 82 + }>, 83 + Pick< 84 + ServerSentEventsOptions<ResT>, 85 + | 'onSseError' 86 + | 'onSseEvent' 87 + | 'sseDefaultRetryDelay' 88 + | 'sseMaxRetryAttempts' 89 + | 'sseMaxRetryDelay' 90 + > { 91 + asyncDataOptions?: AsyncDataOptions<ResT, ResT, KeysOf<ResT>, DefaultT>; 92 + composable?: TComposable; 93 + key?: string; 94 + /** 95 + * Security mechanism(s) to use for the request. 96 + */ 97 + security?: ReadonlyArray<Auth>; 98 + url: Url; 99 + } 100 + 101 + export type RequestResult< 102 + TComposable extends Composable, 103 + ResT, 104 + TError, 105 + > = TComposable extends '$fetch' 106 + ? ReturnType<typeof $fetch<ResT>> 107 + : TComposable extends 'useAsyncData' 108 + ? ReturnType<typeof useAsyncData<ResT | null, TError>> 109 + : TComposable extends 'useFetch' 110 + ? ReturnType<typeof useFetch<ResT | null, TError>> 111 + : TComposable extends 'useLazyAsyncData' 112 + ? ReturnType<typeof useLazyAsyncData<ResT | null, TError>> 113 + : TComposable extends 'useLazyFetch' 114 + ? ReturnType<typeof useLazyFetch<ResT | null, TError>> 115 + : never; 116 + 117 + export interface ClientOptions { 118 + baseURL?: string; 119 + } 120 + 121 + type MethodFn = < 122 + TComposable extends Composable = '$fetch', 123 + ResT = unknown, 124 + TError = unknown, 125 + DefaultT = undefined, 126 + >( 127 + options: Omit<RequestOptions<TComposable, ResT, DefaultT>, 'method'>, 128 + ) => RequestResult<TComposable, ResT, TError>; 129 + 130 + type SseFn = < 131 + TComposable extends Composable = '$fetch', 132 + ResT = unknown, 133 + TError = unknown, 134 + DefaultT = undefined, 135 + >( 136 + options: Omit<RequestOptions<TComposable, ResT, DefaultT>, 'method'>, 137 + ) => Promise<ServerSentEventsResult<RequestResult<TComposable, ResT, TError>>>; 138 + 139 + type RequestFn = < 140 + TComposable extends Composable = '$fetch', 141 + ResT = unknown, 142 + TError = unknown, 143 + DefaultT = undefined, 144 + >( 145 + options: Omit<RequestOptions<TComposable, ResT, DefaultT>, 'method'> & 146 + Pick<Required<RequestOptions<TComposable, ResT, DefaultT>>, 'method'>, 147 + ) => RequestResult<TComposable, ResT, TError>; 148 + 149 + /** 150 + * The `createClientConfig()` function will be called on client initialization 151 + * and the returned object will become the client's initial configuration. 152 + * 153 + * You may want to initialize your client this way instead of calling 154 + * `setConfig()`. This is useful for example if you're using Next.js 155 + * to ensure your client always has the correct values. 156 + */ 157 + export type CreateClientConfig<T extends ClientOptions = ClientOptions> = ( 158 + override?: Config<ClientOptions & T>, 159 + ) => Config<Required<ClientOptions> & T>; 160 + 161 + export interface TDataShape { 162 + body?: unknown; 163 + headers?: unknown; 164 + path?: FetchOptions<unknown>['query']; 165 + query?: FetchOptions<unknown>['query']; 166 + url: string; 167 + } 168 + 169 + export type BuildUrlOptions< 170 + TData extends Omit<TDataShape, 'headers'> = Omit<TDataShape, 'headers'>, 171 + > = Pick<WithRefs<TData>, 'path' | 'query'> & 172 + Pick<TData, 'url'> & 173 + Pick<Options<'$fetch', TData>, 'baseURL' | 'querySerializer'>; 174 + 175 + type BuildUrlFn = <TData extends Omit<TDataShape, 'headers'>>( 176 + options: BuildUrlOptions<TData>, 177 + ) => string; 178 + 179 + export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn>; 180 + 181 + type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>; 182 + 183 + export type Options< 184 + TComposable extends Composable = '$fetch', 185 + TData extends TDataShape = TDataShape, 186 + ResT = unknown, 187 + DefaultT = undefined, 188 + > = OmitKeys< 189 + RequestOptions<TComposable, ResT, DefaultT>, 190 + 'body' | 'path' | 'query' | 'url' 191 + > & 192 + ([TData] extends [never] ? unknown : WithRefs<Omit<TData, 'url'>>); 193 + 194 + type FetchOptions<TData> = Omit< 195 + UseFetchOptions<TData, TData>, 196 + keyof AsyncDataOptions<TData> 197 + >; 198 + 199 + export type Composable = 200 + | '$fetch' 201 + | 'useAsyncData' 202 + | 'useFetch' 203 + | 'useLazyAsyncData' 204 + | 'useLazyFetch';
+398
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/client/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { ComputedRef, Ref } from 'vue'; 4 + import { isRef, toValue, unref } from 'vue'; 5 + 6 + import { getAuthToken } from '../core/auth.gen.js'; 7 + import type { QuerySerializerOptions } from '../core/bodySerializer.gen.js'; 8 + import { jsonBodySerializer } from '../core/bodySerializer.gen.js'; 9 + import { 10 + serializeArrayParam, 11 + serializeObjectParam, 12 + serializePrimitiveParam, 13 + } from '../core/pathSerializer.gen.js'; 14 + import type { 15 + ArraySeparatorStyle, 16 + BuildUrlOptions, 17 + Client, 18 + ClientOptions, 19 + Config, 20 + QuerySerializer, 21 + RequestOptions, 22 + } from './types.gen.js'; 23 + 24 + type PathSerializer = Pick<Required<BuildUrlOptions>, 'path' | 'url'>; 25 + 26 + const PATH_PARAM_RE = /\{[^{}]+\}/g; 27 + 28 + type MaybeArray<T> = T | T[]; 29 + 30 + const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { 31 + let url = _url; 32 + const matches = _url.match(PATH_PARAM_RE); 33 + if (matches) { 34 + for (const match of matches) { 35 + let explode = false; 36 + let name = match.substring(1, match.length - 1); 37 + let style: ArraySeparatorStyle = 'simple'; 38 + 39 + if (name.endsWith('*')) { 40 + explode = true; 41 + name = name.substring(0, name.length - 1); 42 + } 43 + 44 + if (name.startsWith('.')) { 45 + name = name.substring(1); 46 + style = 'label'; 47 + } else if (name.startsWith(';')) { 48 + name = name.substring(1); 49 + style = 'matrix'; 50 + } 51 + 52 + const value = toValue( 53 + (toValue(path) as Record<string, unknown> | undefined)?.[name], 54 + ); 55 + 56 + if (value === undefined || value === null) { 57 + continue; 58 + } 59 + 60 + if (Array.isArray(value)) { 61 + url = url.replace( 62 + match, 63 + serializeArrayParam({ explode, name, style, value }), 64 + ); 65 + continue; 66 + } 67 + 68 + if (typeof value === 'object') { 69 + url = url.replace( 70 + match, 71 + serializeObjectParam({ 72 + explode, 73 + name, 74 + style, 75 + value: value as Record<string, unknown>, 76 + valueOnly: true, 77 + }), 78 + ); 79 + continue; 80 + } 81 + 82 + if (style === 'matrix') { 83 + url = url.replace( 84 + match, 85 + `;${serializePrimitiveParam({ 86 + name, 87 + value: value as string, 88 + })}`, 89 + ); 90 + continue; 91 + } 92 + 93 + const replaceValue = encodeURIComponent( 94 + style === 'label' ? `.${value as string}` : (value as string), 95 + ); 96 + url = url.replace(match, replaceValue); 97 + } 98 + } 99 + return url; 100 + }; 101 + 102 + export const createQuerySerializer = <T = unknown>({ 103 + parameters = {}, 104 + ...args 105 + }: QuerySerializerOptions = {}) => { 106 + const querySerializer = (queryParams: T) => { 107 + const search: string[] = []; 108 + const qParams = toValue(queryParams); 109 + if (qParams && typeof qParams === 'object') { 110 + for (const name in qParams) { 111 + const value = toValue(qParams[name]); 112 + 113 + if (value === undefined || value === null) { 114 + continue; 115 + } 116 + 117 + const options = parameters[name] || args; 118 + 119 + if (Array.isArray(value)) { 120 + const serializedArray = serializeArrayParam({ 121 + allowReserved: options.allowReserved, 122 + explode: true, 123 + name, 124 + style: 'form', 125 + value, 126 + ...options.array, 127 + }); 128 + if (serializedArray) search.push(serializedArray); 129 + } else if (typeof value === 'object') { 130 + const serializedObject = serializeObjectParam({ 131 + allowReserved: options.allowReserved, 132 + explode: true, 133 + name, 134 + style: 'deepObject', 135 + value: value as Record<string, unknown>, 136 + ...options.object, 137 + }); 138 + if (serializedObject) search.push(serializedObject); 139 + } else { 140 + const serializedPrimitive = serializePrimitiveParam({ 141 + allowReserved: options.allowReserved, 142 + name, 143 + value: value as string, 144 + }); 145 + if (serializedPrimitive) search.push(serializedPrimitive); 146 + } 147 + } 148 + } 149 + return search.join('&'); 150 + }; 151 + return querySerializer; 152 + }; 153 + 154 + const checkForExistence = ( 155 + options: Pick<RequestOptions, 'auth' | 'query'> & { 156 + headers: Headers; 157 + }, 158 + name?: string, 159 + ): boolean => { 160 + if (!name) { 161 + return false; 162 + } 163 + if ( 164 + options.headers.has(name) || 165 + (toValue(options.query) as Record<string, unknown> | undefined)?.[name] || 166 + options.headers.get('Cookie')?.includes(`${name}=`) 167 + ) { 168 + return true; 169 + } 170 + return false; 171 + }; 172 + 173 + export const setAuthParams = async ({ 174 + security, 175 + ...options 176 + }: Pick<Required<RequestOptions>, 'security'> & 177 + Pick<RequestOptions, 'auth' | 'query'> & { 178 + headers: Headers; 179 + }) => { 180 + for (const auth of security) { 181 + if (checkForExistence(options, auth.name)) { 182 + continue; 183 + } 184 + const token = await getAuthToken(auth, options.auth); 185 + 186 + if (!token) { 187 + continue; 188 + } 189 + 190 + const name = auth.name ?? 'Authorization'; 191 + 192 + switch (auth.in) { 193 + case 'query': { 194 + if (!options.query) { 195 + options.query = {}; 196 + } 197 + const queryValue = toValue(options.query) as 198 + | Record<string, unknown> 199 + | undefined; 200 + if (queryValue) { 201 + queryValue[name] = token; 202 + } 203 + break; 204 + } 205 + case 'cookie': 206 + options.headers.append('Cookie', `${name}=${token}`); 207 + break; 208 + case 'header': 209 + default: 210 + options.headers.set(name, token); 211 + break; 212 + } 213 + } 214 + }; 215 + 216 + export const buildUrl: Client['buildUrl'] = (options) => { 217 + const url = getUrl({ 218 + baseUrl: options.baseURL as string, 219 + path: options.path, 220 + query: options.query, 221 + querySerializer: 222 + typeof options.querySerializer === 'function' 223 + ? options.querySerializer 224 + : createQuerySerializer(options.querySerializer), 225 + url: options.url, 226 + }); 227 + return url; 228 + }; 229 + 230 + export const getUrl = ({ 231 + baseUrl, 232 + path, 233 + query, 234 + querySerializer, 235 + url: _url, 236 + }: Pick<BuildUrlOptions, 'path' | 'query' | 'url'> & { 237 + baseUrl?: string; 238 + querySerializer: QuerySerializer; 239 + }) => { 240 + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; 241 + let url = (baseUrl ?? '') + pathUrl; 242 + if (path) { 243 + url = defaultPathSerializer({ path, url }); 244 + } 245 + let search = query ? querySerializer(query) : ''; 246 + if (search.startsWith('?')) { 247 + search = search.substring(1); 248 + } 249 + if (search) { 250 + url += `?${search}`; 251 + } 252 + return url; 253 + }; 254 + 255 + export const mergeConfigs = (a: Config, b: Config): Config => { 256 + const config = { ...a, ...b }; 257 + if (config.baseURL?.endsWith('/')) { 258 + config.baseURL = config.baseURL.substring(0, config.baseURL.length - 1); 259 + } 260 + config.headers = mergeHeaders(a.headers, b.headers); 261 + return config; 262 + }; 263 + 264 + const headersEntries = (headers: Headers): Array<[string, string]> => { 265 + const entries: Array<[string, string]> = []; 266 + headers.forEach((value, key) => { 267 + entries.push([key, value]); 268 + }); 269 + return entries; 270 + }; 271 + 272 + export const mergeHeaders = ( 273 + ...headers: Array<Required<Config>['headers'] | undefined> 274 + ): Headers => { 275 + const mergedHeaders = new Headers(); 276 + for (const header of headers) { 277 + if (!header || typeof header !== 'object') { 278 + continue; 279 + } 280 + 281 + let h: unknown = header; 282 + if (isRef(h)) { 283 + h = unref(h); 284 + } 285 + 286 + const iterator = 287 + h instanceof Headers 288 + ? headersEntries(h) 289 + : Object.entries(h as Record<string, unknown>); 290 + 291 + for (const [key, value] of iterator) { 292 + if (value === null) { 293 + mergedHeaders.delete(key); 294 + } else if (Array.isArray(value)) { 295 + for (const v of value) { 296 + mergedHeaders.append(key, unwrapRefs(v) as string); 297 + } 298 + } else if (value !== undefined) { 299 + const v = unwrapRefs(value); 300 + // assume object headers are meant to be JSON stringified, i.e. their 301 + // content value in OpenAPI specification is 'application/json' 302 + mergedHeaders.set( 303 + key, 304 + typeof v === 'object' ? JSON.stringify(v) : (v as string), 305 + ); 306 + } 307 + } 308 + } 309 + return mergedHeaders; 310 + }; 311 + 312 + export const mergeInterceptors = <T>(...args: Array<MaybeArray<T>>): Array<T> => 313 + args.reduce<Array<T>>((acc, item) => { 314 + if (typeof item === 'function') { 315 + acc.push(item); 316 + } else if (Array.isArray(item)) { 317 + return acc.concat(item); 318 + } 319 + return acc; 320 + }, []); 321 + 322 + const defaultQuerySerializer = createQuerySerializer({ 323 + allowReserved: false, 324 + array: { 325 + explode: true, 326 + style: 'form', 327 + }, 328 + object: { 329 + explode: true, 330 + style: 'deepObject', 331 + }, 332 + }); 333 + 334 + const defaultHeaders = { 335 + 'Content-Type': 'application/json', 336 + }; 337 + 338 + export const createConfig = <T extends ClientOptions = ClientOptions>( 339 + override: Config<Omit<ClientOptions, keyof T> & T> = {}, 340 + ): Config<Omit<ClientOptions, keyof T> & T> => ({ 341 + ...jsonBodySerializer, 342 + headers: defaultHeaders, 343 + querySerializer: defaultQuerySerializer, 344 + ...override, 345 + }); 346 + 347 + type UnwrapRefs<T> = 348 + T extends Ref<infer V> 349 + ? V 350 + : T extends ComputedRef<infer V> 351 + ? V 352 + : T extends Record<string, unknown> // this doesn't handle functions well 353 + ? { [K in keyof T]: UnwrapRefs<T[K]> } 354 + : T; 355 + 356 + export const unwrapRefs = <T>(value: T): UnwrapRefs<T> => { 357 + if (value === null || typeof value !== 'object' || value instanceof Headers) { 358 + return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>; 359 + } 360 + 361 + if (Array.isArray(value)) { 362 + return value.map((item) => unwrapRefs(item)) as UnwrapRefs<T>; 363 + } 364 + 365 + if (isRef(value)) { 366 + return unwrapRefs(unref(value) as T); 367 + } 368 + 369 + // unwrap into new object to avoid modifying the source 370 + const result: Record<string, unknown> = {}; 371 + for (const key in value) { 372 + result[key] = unwrapRefs(value[key] as T); 373 + } 374 + return result as UnwrapRefs<T>; 375 + }; 376 + 377 + export const serializeBody = ( 378 + opts: Pick<Parameters<Client['request']>[0], 'body' | 'bodySerializer'>, 379 + ) => { 380 + if (opts.body && opts.bodySerializer) { 381 + return opts.bodySerializer(opts.body); 382 + } 383 + return opts.body; 384 + }; 385 + 386 + export const executeFetchFn = ( 387 + opts: Omit<Parameters<Client['request']>[0], 'composable'>, 388 + fetchFn: Required<Config>['$fetch'], 389 + ) => { 390 + const unwrappedOpts = unwrapRefs(opts); 391 + unwrappedOpts.rawBody = unwrappedOpts.body; 392 + unwrappedOpts.body = serializeBody(unwrappedOpts); 393 + return fetchFn( 394 + buildUrl(opts), 395 + // @ts-expect-error 396 + unwrappedOpts, 397 + ); 398 + };
+42
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/core/auth.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type AuthToken = string | undefined; 4 + 5 + export interface Auth { 6 + /** 7 + * Which part of the request do we use to send the auth? 8 + * 9 + * @default 'header' 10 + */ 11 + in?: 'header' | 'query' | 'cookie'; 12 + /** 13 + * Header or query parameter name. 14 + * 15 + * @default 'Authorization' 16 + */ 17 + name?: string; 18 + scheme?: 'basic' | 'bearer'; 19 + type: 'apiKey' | 'http'; 20 + } 21 + 22 + export const getAuthToken = async ( 23 + auth: Auth, 24 + callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken, 25 + ): Promise<string | undefined> => { 26 + const token = 27 + typeof callback === 'function' ? await callback(auth) : callback; 28 + 29 + if (!token) { 30 + return; 31 + } 32 + 33 + if (auth.scheme === 'bearer') { 34 + return `Bearer ${token}`; 35 + } 36 + 37 + if (auth.scheme === 'basic') { 38 + return `Basic ${btoa(token)}`; 39 + } 40 + 41 + return token; 42 + };
+100
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/core/bodySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { 4 + ArrayStyle, 5 + ObjectStyle, 6 + SerializerOptions, 7 + } from './pathSerializer.gen.js'; 8 + 9 + export type QuerySerializer = (query: Record<string, unknown>) => string; 10 + 11 + export type BodySerializer = (body: any) => any; 12 + 13 + type QuerySerializerOptionsObject = { 14 + allowReserved?: boolean; 15 + array?: Partial<SerializerOptions<ArrayStyle>>; 16 + object?: Partial<SerializerOptions<ObjectStyle>>; 17 + }; 18 + 19 + export type QuerySerializerOptions = QuerySerializerOptionsObject & { 20 + /** 21 + * Per-parameter serialization overrides. When provided, these settings 22 + * override the global array/object settings for specific parameter names. 23 + */ 24 + parameters?: Record<string, QuerySerializerOptionsObject>; 25 + }; 26 + 27 + const serializeFormDataPair = ( 28 + data: FormData, 29 + key: string, 30 + value: unknown, 31 + ): void => { 32 + if (typeof value === 'string' || value instanceof Blob) { 33 + data.append(key, value); 34 + } else if (value instanceof Date) { 35 + data.append(key, value.toISOString()); 36 + } else { 37 + data.append(key, JSON.stringify(value)); 38 + } 39 + }; 40 + 41 + const serializeUrlSearchParamsPair = ( 42 + data: URLSearchParams, 43 + key: string, 44 + value: unknown, 45 + ): void => { 46 + if (typeof value === 'string') { 47 + data.append(key, value); 48 + } else { 49 + data.append(key, JSON.stringify(value)); 50 + } 51 + }; 52 + 53 + export const formDataBodySerializer = { 54 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 55 + body: T, 56 + ): FormData => { 57 + const data = new FormData(); 58 + 59 + Object.entries(body).forEach(([key, value]) => { 60 + if (value === undefined || value === null) { 61 + return; 62 + } 63 + if (Array.isArray(value)) { 64 + value.forEach((v) => serializeFormDataPair(data, key, v)); 65 + } else { 66 + serializeFormDataPair(data, key, value); 67 + } 68 + }); 69 + 70 + return data; 71 + }, 72 + }; 73 + 74 + export const jsonBodySerializer = { 75 + bodySerializer: <T>(body: T): string => 76 + JSON.stringify(body, (_key, value) => 77 + typeof value === 'bigint' ? value.toString() : value, 78 + ), 79 + }; 80 + 81 + export const urlSearchParamsBodySerializer = { 82 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 83 + body: T, 84 + ): string => { 85 + const data = new URLSearchParams(); 86 + 87 + Object.entries(body).forEach(([key, value]) => { 88 + if (value === undefined || value === null) { 89 + return; 90 + } 91 + if (Array.isArray(value)) { 92 + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); 93 + } else { 94 + serializeUrlSearchParamsPair(data, key, value); 95 + } 96 + }); 97 + 98 + return data.toString(); 99 + }, 100 + };
+176
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/core/params.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + type Slot = 'body' | 'headers' | 'path' | 'query'; 4 + 5 + export type Field = 6 + | { 7 + in: Exclude<Slot, 'body'>; 8 + /** 9 + * Field name. This is the name we want the user to see and use. 10 + */ 11 + key: string; 12 + /** 13 + * Field mapped name. This is the name we want to use in the request. 14 + * If omitted, we use the same value as `key`. 15 + */ 16 + map?: string; 17 + } 18 + | { 19 + in: Extract<Slot, 'body'>; 20 + /** 21 + * Key isn't required for bodies. 22 + */ 23 + key?: string; 24 + map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 36 + }; 37 + 38 + export interface Fields { 39 + allowExtra?: Partial<Record<Slot, boolean>>; 40 + args?: ReadonlyArray<Field>; 41 + } 42 + 43 + export type FieldsConfig = ReadonlyArray<Field | Fields>; 44 + 45 + const extraPrefixesMap: Record<string, Slot> = { 46 + $body_: 'body', 47 + $headers_: 'headers', 48 + $path_: 'path', 49 + $query_: 'query', 50 + }; 51 + const extraPrefixes = Object.entries(extraPrefixesMap); 52 + 53 + type KeyMap = Map< 54 + string, 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 63 + >; 64 + 65 + const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { 66 + if (!map) { 67 + map = new Map(); 68 + } 69 + 70 + for (const config of fields) { 71 + if ('in' in config) { 72 + if (config.key) { 73 + map.set(config.key, { 74 + in: config.in, 75 + map: config.map, 76 + }); 77 + } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 82 + } else if (config.args) { 83 + buildKeyMap(config.args, map); 84 + } 85 + } 86 + 87 + return map; 88 + }; 89 + 90 + interface Params { 91 + body: unknown; 92 + headers: Record<string, unknown>; 93 + path: Record<string, unknown>; 94 + query: Record<string, unknown>; 95 + } 96 + 97 + const stripEmptySlots = (params: Params) => { 98 + for (const [slot, value] of Object.entries(params)) { 99 + if (value && typeof value === 'object' && !Object.keys(value).length) { 100 + delete params[slot as Slot]; 101 + } 102 + } 103 + }; 104 + 105 + export const buildClientParams = ( 106 + args: ReadonlyArray<unknown>, 107 + fields: FieldsConfig, 108 + ) => { 109 + const params: Params = { 110 + body: {}, 111 + headers: {}, 112 + path: {}, 113 + query: {}, 114 + }; 115 + 116 + const map = buildKeyMap(fields); 117 + 118 + let config: FieldsConfig[number] | undefined; 119 + 120 + for (const [index, arg] of args.entries()) { 121 + if (fields[index]) { 122 + config = fields[index]; 123 + } 124 + 125 + if (!config) { 126 + continue; 127 + } 128 + 129 + if ('in' in config) { 130 + if (config.key) { 131 + const field = map.get(config.key)!; 132 + const name = field.map || config.key; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 136 + } else { 137 + params.body = arg; 138 + } 139 + } else { 140 + for (const [key, value] of Object.entries(arg ?? {})) { 141 + const field = map.get(key); 142 + 143 + if (field) { 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 150 + } else { 151 + const extra = extraPrefixes.find(([prefix]) => 152 + key.startsWith(prefix), 153 + ); 154 + 155 + if (extra) { 156 + const [prefix, slot] = extra; 157 + (params[slot] as Record<string, unknown>)[ 158 + key.slice(prefix.length) 159 + ] = value; 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 162 + if (allowed) { 163 + (params[slot as Slot] as Record<string, unknown>)[key] = value; 164 + break; 165 + } 166 + } 167 + } 168 + } 169 + } 170 + } 171 + } 172 + 173 + stripEmptySlots(params); 174 + 175 + return params; 176 + };
+181
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/core/pathSerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + interface SerializeOptions<T> 4 + extends SerializePrimitiveOptions, 5 + SerializerOptions<T> {} 6 + 7 + interface SerializePrimitiveOptions { 8 + allowReserved?: boolean; 9 + name: string; 10 + } 11 + 12 + export interface SerializerOptions<T> { 13 + /** 14 + * @default true 15 + */ 16 + explode: boolean; 17 + style: T; 18 + } 19 + 20 + export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; 21 + export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; 22 + type MatrixStyle = 'label' | 'matrix' | 'simple'; 23 + export type ObjectStyle = 'form' | 'deepObject'; 24 + type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; 25 + 26 + interface SerializePrimitiveParam extends SerializePrimitiveOptions { 27 + value: string; 28 + } 29 + 30 + export const separatorArrayExplode = (style: ArraySeparatorStyle) => { 31 + switch (style) { 32 + case 'label': 33 + return '.'; 34 + case 'matrix': 35 + return ';'; 36 + case 'simple': 37 + return ','; 38 + default: 39 + return '&'; 40 + } 41 + }; 42 + 43 + export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { 44 + switch (style) { 45 + case 'form': 46 + return ','; 47 + case 'pipeDelimited': 48 + return '|'; 49 + case 'spaceDelimited': 50 + return '%20'; 51 + default: 52 + return ','; 53 + } 54 + }; 55 + 56 + export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { 57 + switch (style) { 58 + case 'label': 59 + return '.'; 60 + case 'matrix': 61 + return ';'; 62 + case 'simple': 63 + return ','; 64 + default: 65 + return '&'; 66 + } 67 + }; 68 + 69 + export const serializeArrayParam = ({ 70 + allowReserved, 71 + explode, 72 + name, 73 + style, 74 + value, 75 + }: SerializeOptions<ArraySeparatorStyle> & { 76 + value: unknown[]; 77 + }) => { 78 + if (!explode) { 79 + const joinedValues = ( 80 + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) 81 + ).join(separatorArrayNoExplode(style)); 82 + switch (style) { 83 + case 'label': 84 + return `.${joinedValues}`; 85 + case 'matrix': 86 + return `;${name}=${joinedValues}`; 87 + case 'simple': 88 + return joinedValues; 89 + default: 90 + return `${name}=${joinedValues}`; 91 + } 92 + } 93 + 94 + const separator = separatorArrayExplode(style); 95 + const joinedValues = value 96 + .map((v) => { 97 + if (style === 'label' || style === 'simple') { 98 + return allowReserved ? v : encodeURIComponent(v as string); 99 + } 100 + 101 + return serializePrimitiveParam({ 102 + allowReserved, 103 + name, 104 + value: v as string, 105 + }); 106 + }) 107 + .join(separator); 108 + return style === 'label' || style === 'matrix' 109 + ? separator + joinedValues 110 + : joinedValues; 111 + }; 112 + 113 + export const serializePrimitiveParam = ({ 114 + allowReserved, 115 + name, 116 + value, 117 + }: SerializePrimitiveParam) => { 118 + if (value === undefined || value === null) { 119 + return ''; 120 + } 121 + 122 + if (typeof value === 'object') { 123 + throw new Error( 124 + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', 125 + ); 126 + } 127 + 128 + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; 129 + }; 130 + 131 + export const serializeObjectParam = ({ 132 + allowReserved, 133 + explode, 134 + name, 135 + style, 136 + value, 137 + valueOnly, 138 + }: SerializeOptions<ObjectSeparatorStyle> & { 139 + value: Record<string, unknown> | Date; 140 + valueOnly?: boolean; 141 + }) => { 142 + if (value instanceof Date) { 143 + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; 144 + } 145 + 146 + if (style !== 'deepObject' && !explode) { 147 + let values: string[] = []; 148 + Object.entries(value).forEach(([key, v]) => { 149 + values = [ 150 + ...values, 151 + key, 152 + allowReserved ? (v as string) : encodeURIComponent(v as string), 153 + ]; 154 + }); 155 + const joinedValues = values.join(','); 156 + switch (style) { 157 + case 'form': 158 + return `${name}=${joinedValues}`; 159 + case 'label': 160 + return `.${joinedValues}`; 161 + case 'matrix': 162 + return `;${name}=${joinedValues}`; 163 + default: 164 + return joinedValues; 165 + } 166 + } 167 + 168 + const separator = separatorObjectExplode(style); 169 + const joinedValues = Object.entries(value) 170 + .map(([key, v]) => 171 + serializePrimitiveParam({ 172 + allowReserved, 173 + name: style === 'deepObject' ? `${name}[${key}]` : key, 174 + value: v as string, 175 + }), 176 + ) 177 + .join(separator); 178 + return style === 'label' || style === 'matrix' 179 + ? separator + joinedValues 180 + : joinedValues; 181 + };
+136
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/core/queryKeySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + /** 4 + * JSON-friendly union that mirrors what Pinia Colada can hash. 5 + */ 6 + export type JsonValue = 7 + | null 8 + | string 9 + | number 10 + | boolean 11 + | JsonValue[] 12 + | { [key: string]: JsonValue }; 13 + 14 + /** 15 + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. 16 + */ 17 + export const queryKeyJsonReplacer = (_key: string, value: unknown) => { 18 + if ( 19 + value === undefined || 20 + typeof value === 'function' || 21 + typeof value === 'symbol' 22 + ) { 23 + return undefined; 24 + } 25 + if (typeof value === 'bigint') { 26 + return value.toString(); 27 + } 28 + if (value instanceof Date) { 29 + return value.toISOString(); 30 + } 31 + return value; 32 + }; 33 + 34 + /** 35 + * Safely stringifies a value and parses it back into a JsonValue. 36 + */ 37 + export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { 38 + try { 39 + const json = JSON.stringify(input, queryKeyJsonReplacer); 40 + if (json === undefined) { 41 + return undefined; 42 + } 43 + return JSON.parse(json) as JsonValue; 44 + } catch { 45 + return undefined; 46 + } 47 + }; 48 + 49 + /** 50 + * Detects plain objects (including objects with a null prototype). 51 + */ 52 + const isPlainObject = (value: unknown): value is Record<string, unknown> => { 53 + if (value === null || typeof value !== 'object') { 54 + return false; 55 + } 56 + const prototype = Object.getPrototypeOf(value as object); 57 + return prototype === Object.prototype || prototype === null; 58 + }; 59 + 60 + /** 61 + * Turns URLSearchParams into a sorted JSON object for deterministic keys. 62 + */ 63 + const serializeSearchParams = (params: URLSearchParams): JsonValue => { 64 + const entries = Array.from(params.entries()).sort(([a], [b]) => 65 + a.localeCompare(b), 66 + ); 67 + const result: Record<string, JsonValue> = {}; 68 + 69 + for (const [key, value] of entries) { 70 + const existing = result[key]; 71 + if (existing === undefined) { 72 + result[key] = value; 73 + continue; 74 + } 75 + 76 + if (Array.isArray(existing)) { 77 + (existing as string[]).push(value); 78 + } else { 79 + result[key] = [existing, value]; 80 + } 81 + } 82 + 83 + return result; 84 + }; 85 + 86 + /** 87 + * Normalizes any accepted value into a JSON-friendly shape for query keys. 88 + */ 89 + export const serializeQueryKeyValue = ( 90 + value: unknown, 91 + ): JsonValue | undefined => { 92 + if (value === null) { 93 + return null; 94 + } 95 + 96 + if ( 97 + typeof value === 'string' || 98 + typeof value === 'number' || 99 + typeof value === 'boolean' 100 + ) { 101 + return value; 102 + } 103 + 104 + if ( 105 + value === undefined || 106 + typeof value === 'function' || 107 + typeof value === 'symbol' 108 + ) { 109 + return undefined; 110 + } 111 + 112 + if (typeof value === 'bigint') { 113 + return value.toString(); 114 + } 115 + 116 + if (value instanceof Date) { 117 + return value.toISOString(); 118 + } 119 + 120 + if (Array.isArray(value)) { 121 + return stringifyToJsonValue(value); 122 + } 123 + 124 + if ( 125 + typeof URLSearchParams !== 'undefined' && 126 + value instanceof URLSearchParams 127 + ) { 128 + return serializeSearchParams(value); 129 + } 130 + 131 + if (isPlainObject(value)) { 132 + return stringifyToJsonValue(value); 133 + } 134 + 135 + return undefined; 136 + };
+266
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/core/serverSentEvents.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Config } from './types.gen.js'; 4 + 5 + export type ServerSentEventsOptions<TData = unknown> = Omit< 6 + RequestInit, 7 + 'method' 8 + > & 9 + Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & { 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 + * Implementing clients can call request interceptors inside this hook. 19 + */ 20 + onRequest?: (url: string, init: RequestInit) => Promise<Request>; 21 + /** 22 + * Callback invoked when a network or parsing error occurs during streaming. 23 + * 24 + * This option applies only if the endpoint returns a stream of events. 25 + * 26 + * @param error The error that occurred. 27 + */ 28 + onSseError?: (error: unknown) => void; 29 + /** 30 + * Callback invoked when an event is streamed from the server. 31 + * 32 + * This option applies only if the endpoint returns a stream of events. 33 + * 34 + * @param event Event streamed from the server. 35 + * @returns Nothing (void). 36 + */ 37 + onSseEvent?: (event: StreamEvent<TData>) => void; 38 + serializedBody?: RequestInit['body']; 39 + /** 40 + * Default retry delay in milliseconds. 41 + * 42 + * This option applies only if the endpoint returns a stream of events. 43 + * 44 + * @default 3000 45 + */ 46 + sseDefaultRetryDelay?: number; 47 + /** 48 + * Maximum number of retry attempts before giving up. 49 + */ 50 + sseMaxRetryAttempts?: number; 51 + /** 52 + * Maximum retry delay in milliseconds. 53 + * 54 + * Applies only when exponential backoff is used. 55 + * 56 + * This option applies only if the endpoint returns a stream of events. 57 + * 58 + * @default 30000 59 + */ 60 + sseMaxRetryDelay?: number; 61 + /** 62 + * Optional sleep function for retry backoff. 63 + * 64 + * Defaults to using `setTimeout`. 65 + */ 66 + sseSleepFn?: (ms: number) => Promise<void>; 67 + url: string; 68 + }; 69 + 70 + export interface StreamEvent<TData = unknown> { 71 + data: TData; 72 + event?: string; 73 + id?: string; 74 + retry?: number; 75 + } 76 + 77 + export type ServerSentEventsResult< 78 + TData = unknown, 79 + TReturn = void, 80 + TNext = unknown, 81 + > = { 82 + stream: AsyncGenerator< 83 + TData extends Record<string, unknown> ? TData[keyof TData] : TData, 84 + TReturn, 85 + TNext 86 + >; 87 + }; 88 + 89 + export const createSseClient = <TData = unknown>({ 90 + onRequest, 91 + onSseError, 92 + onSseEvent, 93 + responseTransformer, 94 + responseValidator, 95 + sseDefaultRetryDelay, 96 + sseMaxRetryAttempts, 97 + sseMaxRetryDelay, 98 + sseSleepFn, 99 + url, 100 + ...options 101 + }: ServerSentEventsOptions): ServerSentEventsResult<TData> => { 102 + let lastEventId: string | undefined; 103 + 104 + const sleep = 105 + sseSleepFn ?? 106 + ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); 107 + 108 + const createStream = async function* () { 109 + let retryDelay: number = sseDefaultRetryDelay ?? 3000; 110 + let attempt = 0; 111 + const signal = options.signal ?? new AbortController().signal; 112 + 113 + while (true) { 114 + if (signal.aborted) break; 115 + 116 + attempt++; 117 + 118 + const headers = 119 + options.headers instanceof Headers 120 + ? options.headers 121 + : new Headers(options.headers as Record<string, string> | undefined); 122 + 123 + if (lastEventId !== undefined) { 124 + headers.set('Last-Event-ID', lastEventId); 125 + } 126 + 127 + try { 128 + const requestInit: RequestInit = { 129 + redirect: 'follow', 130 + ...options, 131 + body: options.serializedBody, 132 + headers, 133 + signal, 134 + }; 135 + let request = new Request(url, requestInit); 136 + if (onRequest) { 137 + request = await onRequest(url, requestInit); 138 + } 139 + // fetch must be assigned here, otherwise it would throw the error: 140 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 141 + const _fetch = options.fetch ?? globalThis.fetch; 142 + const response = await _fetch(request); 143 + 144 + if (!response.ok) 145 + throw new Error( 146 + `SSE failed: ${response.status} ${response.statusText}`, 147 + ); 148 + 149 + if (!response.body) throw new Error('No body in SSE response'); 150 + 151 + const reader = response.body 152 + .pipeThrough(new TextDecoderStream()) 153 + .getReader(); 154 + 155 + let buffer = ''; 156 + 157 + const abortHandler = () => { 158 + try { 159 + reader.cancel(); 160 + } catch { 161 + // noop 162 + } 163 + }; 164 + 165 + signal.addEventListener('abort', abortHandler); 166 + 167 + try { 168 + while (true) { 169 + const { done, value } = await reader.read(); 170 + if (done) break; 171 + buffer += value; 172 + // Normalize line endings: CRLF -> LF, then CR -> LF 173 + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); 174 + 175 + const chunks = buffer.split('\n\n'); 176 + buffer = chunks.pop() ?? ''; 177 + 178 + for (const chunk of chunks) { 179 + const lines = chunk.split('\n'); 180 + const dataLines: Array<string> = []; 181 + let eventName: string | undefined; 182 + 183 + for (const line of lines) { 184 + if (line.startsWith('data:')) { 185 + dataLines.push(line.replace(/^data:\s*/, '')); 186 + } else if (line.startsWith('event:')) { 187 + eventName = line.replace(/^event:\s*/, ''); 188 + } else if (line.startsWith('id:')) { 189 + lastEventId = line.replace(/^id:\s*/, ''); 190 + } else if (line.startsWith('retry:')) { 191 + const parsed = Number.parseInt( 192 + line.replace(/^retry:\s*/, ''), 193 + 10, 194 + ); 195 + if (!Number.isNaN(parsed)) { 196 + retryDelay = parsed; 197 + } 198 + } 199 + } 200 + 201 + let data: unknown; 202 + let parsedJson = false; 203 + 204 + if (dataLines.length) { 205 + const rawData = dataLines.join('\n'); 206 + try { 207 + data = JSON.parse(rawData); 208 + parsedJson = true; 209 + } catch { 210 + data = rawData; 211 + } 212 + } 213 + 214 + if (parsedJson) { 215 + if (responseValidator) { 216 + await responseValidator(data); 217 + } 218 + 219 + if (responseTransformer) { 220 + data = await responseTransformer(data); 221 + } 222 + } 223 + 224 + onSseEvent?.({ 225 + data, 226 + event: eventName, 227 + id: lastEventId, 228 + retry: retryDelay, 229 + }); 230 + 231 + if (dataLines.length) { 232 + yield data as any; 233 + } 234 + } 235 + } 236 + } finally { 237 + signal.removeEventListener('abort', abortHandler); 238 + reader.releaseLock(); 239 + } 240 + 241 + break; // exit loop on normal completion 242 + } catch (error) { 243 + // connection failed or aborted; retry after delay 244 + onSseError?.(error); 245 + 246 + if ( 247 + sseMaxRetryAttempts !== undefined && 248 + attempt >= sseMaxRetryAttempts 249 + ) { 250 + break; // stop after firing error 251 + } 252 + 253 + // exponential backoff: double retry each attempt, cap at 30s 254 + const backoff = Math.min( 255 + retryDelay * 2 ** (attempt - 1), 256 + sseMaxRetryDelay ?? 30000, 257 + ); 258 + await sleep(backoff); 259 + } 260 + } 261 + }; 262 + 263 + const stream = createStream(); 264 + 265 + return { stream }; 266 + };
+118
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/core/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth, AuthToken } from './auth.gen.js'; 4 + import type { 5 + BodySerializer, 6 + QuerySerializer, 7 + QuerySerializerOptions, 8 + } from './bodySerializer.gen.js'; 9 + 10 + export type HttpMethod = 11 + | 'connect' 12 + | 'delete' 13 + | 'get' 14 + | 'head' 15 + | 'options' 16 + | 'patch' 17 + | 'post' 18 + | 'put' 19 + | 'trace'; 20 + 21 + export type Client< 22 + RequestFn = never, 23 + Config = unknown, 24 + MethodFn = never, 25 + BuildUrlFn = never, 26 + SseFn = never, 27 + > = { 28 + /** 29 + * Returns the final request URL. 30 + */ 31 + buildUrl: BuildUrlFn; 32 + getConfig: () => Config; 33 + request: RequestFn; 34 + setConfig: (config: Config) => Config; 35 + } & { 36 + [K in HttpMethod]: MethodFn; 37 + } & ([SseFn] extends [never] 38 + ? { sse?: never } 39 + : { sse: { [K in HttpMethod]: SseFn } }); 40 + 41 + export interface Config { 42 + /** 43 + * Auth token or a function returning auth token. The resolved value will be 44 + * added to the request payload as defined by its `security` array. 45 + */ 46 + auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken; 47 + /** 48 + * A function for serializing request body parameter. By default, 49 + * {@link JSON.stringify()} will be used. 50 + */ 51 + bodySerializer?: BodySerializer | null; 52 + /** 53 + * An object containing any HTTP headers that you want to pre-populate your 54 + * `Headers` object with. 55 + * 56 + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} 57 + */ 58 + headers?: 59 + | RequestInit['headers'] 60 + | Record< 61 + string, 62 + | string 63 + | number 64 + | boolean 65 + | (string | number | boolean)[] 66 + | null 67 + | undefined 68 + | unknown 69 + >; 70 + /** 71 + * The request method. 72 + * 73 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} 74 + */ 75 + method?: Uppercase<HttpMethod>; 76 + /** 77 + * A function for serializing request query parameters. By default, arrays 78 + * will be exploded in form style, objects will be exploded in deepObject 79 + * style, and reserved characters are percent-encoded. 80 + * 81 + * This method will have no effect if the native `paramsSerializer()` Axios 82 + * API function is used. 83 + * 84 + * {@link https://swagger.io/docs/specification/serialization/#query View examples} 85 + */ 86 + querySerializer?: QuerySerializer | QuerySerializerOptions; 87 + /** 88 + * A function validating request data. This is useful if you want to ensure 89 + * the request conforms to the desired shape, so it can be safely sent to 90 + * the server. 91 + */ 92 + requestValidator?: (data: unknown) => Promise<unknown>; 93 + /** 94 + * A function transforming response data before it's returned. This is useful 95 + * for post-processing data, e.g. converting ISO strings into Date objects. 96 + */ 97 + responseTransformer?: (data: unknown) => Promise<unknown>; 98 + /** 99 + * A function validating response data. This is useful if you want to ensure 100 + * the response conforms to the desired shape, so it can be safely passed to 101 + * the transformers and returned to the user. 102 + */ 103 + responseValidator?: (data: unknown) => Promise<unknown>; 104 + } 105 + 106 + type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 + ? true 108 + : [T] extends [never | undefined] 109 + ? [undefined] extends [T] 110 + ? false 111 + : true 112 + : false; 113 + 114 + export type OmitNever<T extends Record<string, unknown>> = { 115 + [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 + ? never 117 + : K]: T[K]; 118 + };
+143
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/core/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { BodySerializer, QuerySerializer } from './bodySerializer.gen.js'; 4 + import { 5 + type ArraySeparatorStyle, 6 + serializeArrayParam, 7 + serializeObjectParam, 8 + serializePrimitiveParam, 9 + } from './pathSerializer.gen.js'; 10 + 11 + export interface PathSerializer { 12 + path: Record<string, unknown>; 13 + url: string; 14 + } 15 + 16 + export const PATH_PARAM_RE = /\{[^{}]+\}/g; 17 + 18 + export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { 19 + let url = _url; 20 + const matches = _url.match(PATH_PARAM_RE); 21 + if (matches) { 22 + for (const match of matches) { 23 + let explode = false; 24 + let name = match.substring(1, match.length - 1); 25 + let style: ArraySeparatorStyle = 'simple'; 26 + 27 + if (name.endsWith('*')) { 28 + explode = true; 29 + name = name.substring(0, name.length - 1); 30 + } 31 + 32 + if (name.startsWith('.')) { 33 + name = name.substring(1); 34 + style = 'label'; 35 + } else if (name.startsWith(';')) { 36 + name = name.substring(1); 37 + style = 'matrix'; 38 + } 39 + 40 + const value = path[name]; 41 + 42 + if (value === undefined || value === null) { 43 + continue; 44 + } 45 + 46 + if (Array.isArray(value)) { 47 + url = url.replace( 48 + match, 49 + serializeArrayParam({ explode, name, style, value }), 50 + ); 51 + continue; 52 + } 53 + 54 + if (typeof value === 'object') { 55 + url = url.replace( 56 + match, 57 + serializeObjectParam({ 58 + explode, 59 + name, 60 + style, 61 + value: value as Record<string, unknown>, 62 + valueOnly: true, 63 + }), 64 + ); 65 + continue; 66 + } 67 + 68 + if (style === 'matrix') { 69 + url = url.replace( 70 + match, 71 + `;${serializePrimitiveParam({ 72 + name, 73 + value: value as string, 74 + })}`, 75 + ); 76 + continue; 77 + } 78 + 79 + const replaceValue = encodeURIComponent( 80 + style === 'label' ? `.${value as string}` : (value as string), 81 + ); 82 + url = url.replace(match, replaceValue); 83 + } 84 + } 85 + return url; 86 + }; 87 + 88 + export const getUrl = ({ 89 + baseUrl, 90 + path, 91 + query, 92 + querySerializer, 93 + url: _url, 94 + }: { 95 + baseUrl?: string; 96 + path?: Record<string, unknown>; 97 + query?: Record<string, unknown>; 98 + querySerializer: QuerySerializer; 99 + url: string; 100 + }) => { 101 + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; 102 + let url = (baseUrl ?? '') + pathUrl; 103 + if (path) { 104 + url = defaultPathSerializer({ path, url }); 105 + } 106 + let search = query ? querySerializer(query) : ''; 107 + if (search.startsWith('?')) { 108 + search = search.substring(1); 109 + } 110 + if (search) { 111 + url += `?${search}`; 112 + } 113 + return url; 114 + }; 115 + 116 + export function getValidRequestBody(options: { 117 + body?: unknown; 118 + bodySerializer?: BodySerializer | null; 119 + serializedBody?: unknown; 120 + }) { 121 + const hasBody = options.body !== undefined; 122 + const isSerializedBody = hasBody && options.bodySerializer; 123 + 124 + if (isSerializedBody) { 125 + if ('serializedBody' in options) { 126 + const hasSerializedBody = 127 + options.serializedBody !== undefined && options.serializedBody !== ''; 128 + 129 + return hasSerializedBody ? options.serializedBody : null; 130 + } 131 + 132 + // not all clients implement a serializedBody property (i.e. client-axios) 133 + return options.body !== '' ? options.body : null; 134 + } 135 + 136 + // plain/text body 137 + if (hasBody) { 138 + return options.body; 139 + } 140 + 141 + // no body was provided 142 + return undefined; 143 + }
+4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export { apiVVersionODataControllerCount, callToTestOrderOfParams, callWithDefaultOptionalParameters, callWithDefaultParameters, callWithDescriptions, callWithDuplicateResponses, callWithNoContentResponse, callWithParameters, callWithResponse, callWithResponseAndNoContentResponse, callWithResponses, callWithResultFromHeader, callWithWeirdParameterNames, collectionFormat, complexParams, complexTypes, deleteCallWithoutParametersAndResponse, deleteFoo, deprecatedCall, dummyA, dummyB, duplicateName, duplicateName2, duplicateName3, duplicateName4, export_, fileResponse, fooWow, getApiVbyApiVersionSimpleOperation, getCallWithOptionalParam, getCallWithoutParametersAndResponse, headCallWithoutParametersAndResponse, import_, multipartRequest, multipartResponse, nonAsciiæøåÆøÅöôêÊ字符串, type Options, optionsCallWithoutParametersAndResponse, patchApiVbyApiVersionNoTag, patchCallWithoutParametersAndResponse, postApiVbyApiVersionFormData, postApiVbyApiVersionRequestBody, postCallWithOptionalParam, postCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, putWithFormUrlEncoded, testErrorCode, types, uploadFile } from './sdk.gen.js'; 4 + export type { _3eNum1Период, _400, AdditionalPropertiesIntegerIssue, AdditionalPropertiesUnknownIssue, AdditionalPropertiesUnknownIssue2, AdditionalPropertiesUnknownIssue3, AdditionalPropertiesUnknownIssueWritable, AnyOfAnyAndNull, AnyOfArrays, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountResponses, ArrayWithAnyOfProperties, ArrayWithArray, ArrayWithBooleans, ArrayWithNumbers, ArrayWithProperties, ArrayWithReferences, ArrayWithStrings, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponse, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesError, CallWithResponsesErrors, CallWithResponsesResponse, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CamelCaseCommentWithBreaks, CharactersInDescription, ClientOptions, CollectionFormatData, CommentWithBackticks, CommentWithBackticksAndQuotes, CommentWithBreaks, CommentWithExpressionPlaceholders, CommentWithQuotes, CommentWithReservedCharacters, CommentWithSlashes, ComplexParamsData, ComplexParamsResponse, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponse, ComplexTypesResponses, CompositionBaseModel, CompositionExtendedModel, CompositionWithAllOfAndNullable, CompositionWithAnyOf, CompositionWithAnyOfAndNullable, CompositionWithAnyOfAnonymous, CompositionWithNestedAnyAndTypeNull, CompositionWithNestedAnyOfAndNull, CompositionWithOneOf, CompositionWithOneOfAndComplexArrayDictionary, CompositionWithOneOfAndNullable, CompositionWithOneOfAndProperties, CompositionWithOneOfAndSimpleArrayDictionary, CompositionWithOneOfAndSimpleDictionary, CompositionWithOneOfAnonymous, CompositionWithOneOfDiscriminator, ConstValue, Default, DeleteCallWithoutParametersAndResponseData, DeleteFooData, DeleteFooData2, DeleteFooData3, DeprecatedCallData, DeprecatedModel, DictionaryWithArray, DictionaryWithDictionary, DictionaryWithProperties, DictionaryWithPropertiesAndAdditionalProperties, DictionaryWithReference, DictionaryWithString, DummyAData, DummyAResponse, DummyAResponses, DummyBData, DummyBResponse, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, EnumFromDescription, EnumWithExtensions, EnumWithNumbers, EnumWithReplacedCharacters, EnumWithStrings, EnumWithXEnumNames, ExportData, ExternalRefA, ExternalRefB, ExternalSharedExternalSharedModel, File, FileResponseData, FileResponseResponse, FileResponseResponses, FileWritable, FooWowData, FooWowResponses, FreeFormObjectWithAdditionalPropertiesEqEmptyObject, FreeFormObjectWithAdditionalPropertiesEqTrue, FreeFormObjectWithoutAdditionalProperties, GenericSchemaDuplicateIssue1SystemBoolean, GenericSchemaDuplicateIssue1SystemBooleanWritable, GenericSchemaDuplicateIssue1SystemString, GenericSchemaDuplicateIssue1SystemStringWritable, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, Import, ImportData, ImportResponse, ImportResponses, IoK8sApimachineryPkgApisMetaV1DeleteOptions, IoK8sApimachineryPkgApisMetaV1Preconditions, ModelCircle, ModelFromZendesk, ModelSquare, ModelThatExtends, ModelThatExtendsExtends, ModelWithAdditionalPropertiesEqTrue, ModelWithAnyOfConstantSizeArray, ModelWithAnyOfConstantSizeArrayAndIntersect, ModelWithAnyOfConstantSizeArrayNullable, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable, ModelWithArray, ModelWithArrayReadOnlyAndWriteOnly, ModelWithArrayReadOnlyAndWriteOnlyWritable, ModelWithBackticksInDescription, ModelWithBoolean, ModelWithCircularReference, ModelWithConst, ModelWithConstantSizeArray, ModelWithDictionary, ModelWithDuplicateImports, ModelWithDuplicateProperties, ModelWithEnum, ModelWithEnumFromDescription, ModelWithEnumWithHyphen, ModelWithInteger, ModelWithNestedArrayEnums, ModelWithNestedArrayEnumsData, ModelWithNestedArrayEnumsDataBar, ModelWithNestedArrayEnumsDataFoo, ModelWithNestedCompositionEnums, ModelWithNestedEnums, ModelWithNestedProperties, ModelWithNullableObject, ModelWithNullableString, ModelWithNumericEnumUnion, ModelWithOneOfAndProperties, ModelWithOneOfEnum, ModelWithOrderedProperties, ModelWithPattern, ModelWithPatternWritable, ModelWithPrefixItemsConstantSizeArray, ModelWithProperties, ModelWithPropertiesWritable, ModelWithReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnlyWritable, ModelWithReference, ModelWithReferenceWritable, ModelWithString, ModelWithStringError, MultipartRequestData, MultipartResponseData, MultipartResponseResponse, MultipartResponseResponses, NestedAnyOfArraysNullable, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Responses, NonAsciiStringæøåÆøÅöôêÊ字符串, NullableObject, OneOfAllOfIssue, OneOfAllOfIssueWritable, OptionsCallWithoutParametersAndResponseData, Pageable, ParameterSimpleParameterUnused, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PostServiceWithEmptyTagResponse, PostServiceWithEmptyTagResponse2, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, SchemaWithFormRestrictedKeys, SimpleBoolean, SimpleFile, SimpleFormData, SimpleInteger, SimpleParameter, SimpleReference, SimpleRequestBody, SimpleString, SimpleStringWithPattern, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponse, TypesResponses, UploadFileData, UploadFileResponse, UploadFileResponses, XFooBar } from './types.gen.js';
+206
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/sdk.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { client } from './client.gen.js'; 4 + import { type Client, type Composable, formDataBodySerializer, type Options as Options2, type TDataShape, urlSearchParamsBodySerializer } from './client/index.js'; 5 + import type { ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseData, CallWithResponseResponse, CallWithResponsesData, CallWithResponsesError, CallWithResponsesResponse, CallWithResultFromHeaderData, CallWithWeirdParameterNamesData, CollectionFormatData, ComplexParamsData, ComplexParamsResponse, ComplexTypesData, ComplexTypesResponse, DeleteCallWithoutParametersAndResponseData, DeleteFooData3, DeprecatedCallData, DummyAData, DummyAResponse, DummyBData, DummyBResponse, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, ExportData, FileResponseData, FileResponseResponse, FooWowData, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, ImportData, ImportResponse, MultipartRequestData, MultipartResponseData, MultipartResponseResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, OptionsCallWithoutParametersAndResponseData, PatchApiVbyApiVersionNoTagData, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, TestErrorCodeData, TypesData, TypesResponse, UploadFileData, UploadFileResponse } from './types.gen.js'; 6 + 7 + export type Options<TComposable extends Composable = '$fetch', TData extends TDataShape = TDataShape, ResT = unknown, DefaultT = undefined> = Options2<TComposable, TData, ResT, DefaultT> & { 8 + /** 9 + * You can provide a client instance returned by `createClient()` instead of 10 + * individual options. This might be also useful if you want to implement a 11 + * custom client. 12 + */ 13 + client?: Client; 14 + /** 15 + * You can pass arbitrary values through the `meta` object. This can be 16 + * used to access values that aren't defined as part of the SDK function. 17 + */ 18 + meta?: Record<string, unknown>; 19 + }; 20 + 21 + export const export_ = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, ExportData, unknown, DefaultT>) => (options.client ?? client).get<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/no+tag', ...options }); 22 + 23 + export const patchApiVbyApiVersionNoTag = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, PatchApiVbyApiVersionNoTagData, unknown, DefaultT>) => (options.client ?? client).patch<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/no+tag', ...options }); 24 + 25 + export const import_ = <TComposable extends Composable = '$fetch', DefaultT extends ImportResponse = ImportResponse>(options: Options<TComposable, ImportData, ImportResponse, DefaultT>) => (options.client ?? client).post<TComposable, ImportResponse | DefaultT, unknown, DefaultT>({ 26 + url: '/api/v{api-version}/no+tag', 27 + ...options, 28 + headers: { 29 + 'Content-Type': 'application/json', 30 + ...options.headers 31 + } 32 + }); 33 + 34 + export const fooWow = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, FooWowData, unknown, DefaultT>) => (options.client ?? client).put<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/no+tag', ...options }); 35 + 36 + export const apiVVersionODataControllerCount = <TComposable extends Composable = '$fetch', DefaultT extends ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponse>(options: Options<TComposable, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, DefaultT>) => (options.client ?? client).get<TComposable, ApiVVersionODataControllerCountResponse | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/simple/$count', ...options }); 37 + 38 + export const getApiVbyApiVersionSimpleOperation = <TComposable extends Composable = '$fetch', DefaultT extends GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponse>(options: Options<TComposable, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationResponse, DefaultT>) => (options.client ?? client).get<TComposable, GetApiVbyApiVersionSimpleOperationResponse | DefaultT, GetApiVbyApiVersionSimpleOperationError, DefaultT>({ url: '/api/v{api-version}/simple:operation', ...options }); 39 + 40 + export const deleteCallWithoutParametersAndResponse = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, DeleteCallWithoutParametersAndResponseData, unknown, DefaultT>) => (options.client ?? client).delete<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/simple', ...options }); 41 + 42 + export const getCallWithoutParametersAndResponse = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, GetCallWithoutParametersAndResponseData, unknown, DefaultT>) => (options.client ?? client).get<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/simple', ...options }); 43 + 44 + export const headCallWithoutParametersAndResponse = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, HeadCallWithoutParametersAndResponseData, unknown, DefaultT>) => (options.client ?? client).head<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/simple', ...options }); 45 + 46 + export const optionsCallWithoutParametersAndResponse = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, OptionsCallWithoutParametersAndResponseData, unknown, DefaultT>) => (options.client ?? client).options<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/simple', ...options }); 47 + 48 + export const patchCallWithoutParametersAndResponse = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, PatchCallWithoutParametersAndResponseData, unknown, DefaultT>) => (options.client ?? client).patch<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/simple', ...options }); 49 + 50 + export const postCallWithoutParametersAndResponse = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, PostCallWithoutParametersAndResponseData, unknown, DefaultT>) => (options.client ?? client).post<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/simple', ...options }); 51 + 52 + export const putCallWithoutParametersAndResponse = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, PutCallWithoutParametersAndResponseData, unknown, DefaultT>) => (options.client ?? client).put<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/simple', ...options }); 53 + 54 + export const deleteFoo = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, DeleteFooData3, unknown, DefaultT>) => (options.client ?? client).delete<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', ...options }); 55 + 56 + export const callWithDescriptions = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, CallWithDescriptionsData, unknown, DefaultT>) => (options.client ?? client).post<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/descriptions', ...options }); 57 + 58 + /** 59 + * @deprecated 60 + */ 61 + export const deprecatedCall = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, DeprecatedCallData, unknown, DefaultT>) => (options.client ?? client).post<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/parameters/deprecated', ...options }); 62 + 63 + export const callWithParameters = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, CallWithParametersData, unknown, DefaultT>) => (options.client ?? client).post<TComposable, unknown | DefaultT, unknown, DefaultT>({ 64 + url: '/api/v{api-version}/parameters/{parameterPath}', 65 + ...options, 66 + headers: { 67 + 'Content-Type': 'application/json', 68 + ...options.headers 69 + } 70 + }); 71 + 72 + export const callWithWeirdParameterNames = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, CallWithWeirdParameterNamesData, unknown, DefaultT>) => (options.client ?? client).post<TComposable, unknown | DefaultT, unknown, DefaultT>({ 73 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', 74 + ...options, 75 + headers: { 76 + 'Content-Type': 'application/json', 77 + ...options.headers 78 + } 79 + }); 80 + 81 + export const getCallWithOptionalParam = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, GetCallWithOptionalParamData, unknown, DefaultT>) => (options.client ?? client).get<TComposable, unknown | DefaultT, unknown, DefaultT>({ 82 + url: '/api/v{api-version}/parameters', 83 + ...options, 84 + headers: { 85 + 'Content-Type': 'application/json', 86 + ...options.headers 87 + } 88 + }); 89 + 90 + export const postCallWithOptionalParam = <TComposable extends Composable = '$fetch', DefaultT extends PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponse>(options: Options<TComposable, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, DefaultT>) => (options.client ?? client).post<TComposable, PostCallWithOptionalParamResponse | DefaultT, unknown, DefaultT>({ 91 + url: '/api/v{api-version}/parameters', 92 + ...options, 93 + headers: { 94 + 'Content-Type': 'application/json', 95 + ...options.headers 96 + } 97 + }); 98 + 99 + export const postApiVbyApiVersionRequestBody = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, PostApiVbyApiVersionRequestBodyData, unknown, DefaultT>) => (options.client ?? client).post<TComposable, unknown | DefaultT, unknown, DefaultT>({ 100 + url: '/api/v{api-version}/requestBody', 101 + ...options, 102 + headers: { 103 + 'Content-Type': 'application/json', 104 + ...options.headers 105 + } 106 + }); 107 + 108 + export const postApiVbyApiVersionFormData = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, PostApiVbyApiVersionFormDataData, unknown, DefaultT>) => (options.client ?? client).post<TComposable, unknown | DefaultT, unknown, DefaultT>({ 109 + ...formDataBodySerializer, 110 + url: '/api/v{api-version}/formData', 111 + ...options, 112 + headers: { 113 + 'Content-Type': null, 114 + ...options.headers 115 + } 116 + }); 117 + 118 + export const callWithDefaultParameters = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, CallWithDefaultParametersData, unknown, DefaultT>) => (options.client ?? client).get<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/defaults', ...options }); 119 + 120 + export const callWithDefaultOptionalParameters = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, CallWithDefaultOptionalParametersData, unknown, DefaultT>) => (options.client ?? client).post<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/defaults', ...options }); 121 + 122 + export const callToTestOrderOfParams = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, CallToTestOrderOfParamsData, unknown, DefaultT>) => (options.client ?? client).put<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/defaults', ...options }); 123 + 124 + export const duplicateName = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, DuplicateNameData, unknown, DefaultT>) => (options.client ?? client).delete<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/duplicate', ...options }); 125 + 126 + export const duplicateName2 = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, DuplicateName2Data, unknown, DefaultT>) => (options.client ?? client).get<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/duplicate', ...options }); 127 + 128 + export const duplicateName3 = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, DuplicateName3Data, unknown, DefaultT>) => (options.client ?? client).post<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/duplicate', ...options }); 129 + 130 + export const duplicateName4 = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, DuplicateName4Data, unknown, DefaultT>) => (options.client ?? client).put<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/duplicate', ...options }); 131 + 132 + export const callWithNoContentResponse = <TComposable extends Composable = '$fetch', DefaultT extends CallWithNoContentResponseResponse = CallWithNoContentResponseResponse>(options: Options<TComposable, CallWithNoContentResponseData, CallWithNoContentResponseResponse, DefaultT>) => (options.client ?? client).get<TComposable, CallWithNoContentResponseResponse | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/no-content', ...options }); 133 + 134 + export const callWithResponseAndNoContentResponse = <TComposable extends Composable = '$fetch', DefaultT extends CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponse>(options: Options<TComposable, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, DefaultT>) => (options.client ?? client).get<TComposable, CallWithResponseAndNoContentResponseResponse | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/multiple-tags/response-and-no-content', ...options }); 135 + 136 + export const dummyA = <TComposable extends Composable = '$fetch', DefaultT extends DummyAResponse = DummyAResponse>(options: Options<TComposable, DummyAData, DummyAResponse, DefaultT>) => (options.client ?? client).get<TComposable, DummyAResponse | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/multiple-tags/a', ...options }); 137 + 138 + export const dummyB = <TComposable extends Composable = '$fetch', DefaultT extends DummyBResponse = DummyBResponse>(options: Options<TComposable, DummyBData, DummyBResponse, DefaultT>) => (options.client ?? client).get<TComposable, DummyBResponse | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/multiple-tags/b', ...options }); 139 + 140 + export const callWithResponse = <TComposable extends Composable = '$fetch', DefaultT extends CallWithResponseResponse = CallWithResponseResponse>(options: Options<TComposable, CallWithResponseData, CallWithResponseResponse, DefaultT>) => (options.client ?? client).get<TComposable, CallWithResponseResponse | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/response', ...options }); 141 + 142 + export const callWithDuplicateResponses = <TComposable extends Composable = '$fetch', DefaultT extends CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponse>(options: Options<TComposable, CallWithDuplicateResponsesData, CallWithDuplicateResponsesResponse, DefaultT>) => (options.client ?? client).post<TComposable, CallWithDuplicateResponsesResponse | DefaultT, CallWithDuplicateResponsesError, DefaultT>({ url: '/api/v{api-version}/response', ...options }); 143 + 144 + export const callWithResponses = <TComposable extends Composable = '$fetch', DefaultT extends CallWithResponsesResponse = CallWithResponsesResponse>(options: Options<TComposable, CallWithResponsesData, CallWithResponsesResponse, DefaultT>) => (options.client ?? client).put<TComposable, CallWithResponsesResponse | DefaultT, CallWithResponsesError, DefaultT>({ url: '/api/v{api-version}/response', ...options }); 145 + 146 + export const collectionFormat = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, CollectionFormatData, unknown, DefaultT>) => (options.client ?? client).get<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/collectionFormat', ...options }); 147 + 148 + export const types = <TComposable extends Composable = '$fetch', DefaultT extends TypesResponse = TypesResponse>(options: Options<TComposable, TypesData, TypesResponse, DefaultT>) => (options.client ?? client).get<TComposable, TypesResponse | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/types', ...options }); 149 + 150 + export const uploadFile = <TComposable extends Composable = '$fetch', DefaultT extends UploadFileResponse = UploadFileResponse>(options: Options<TComposable, UploadFileData, UploadFileResponse, DefaultT>) => (options.client ?? client).post<TComposable, UploadFileResponse | DefaultT, unknown, DefaultT>({ 151 + ...urlSearchParamsBodySerializer, 152 + url: '/api/v{api-version}/upload', 153 + ...options, 154 + headers: { 155 + 'Content-Type': 'application/x-www-form-urlencoded', 156 + ...options.headers 157 + } 158 + }); 159 + 160 + export const fileResponse = <TComposable extends Composable = '$fetch', DefaultT extends FileResponseResponse = FileResponseResponse>(options: Options<TComposable, FileResponseData, FileResponseResponse, DefaultT>) => (options.client ?? client).get<TComposable, FileResponseResponse | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/file/{id}', ...options }); 161 + 162 + export const complexTypes = <TComposable extends Composable = '$fetch', DefaultT extends ComplexTypesResponse = ComplexTypesResponse>(options: Options<TComposable, ComplexTypesData, ComplexTypesResponse, DefaultT>) => (options.client ?? client).get<TComposable, ComplexTypesResponse | DefaultT, unknown, DefaultT>({ 163 + querySerializer: { parameters: { parameterObject: { object: { style: 'form' } } } }, 164 + url: '/api/v{api-version}/complex', 165 + ...options 166 + }); 167 + 168 + export const multipartResponse = <TComposable extends Composable = '$fetch', DefaultT extends MultipartResponseResponse = MultipartResponseResponse>(options: Options<TComposable, MultipartResponseData, MultipartResponseResponse, DefaultT>) => (options.client ?? client).get<TComposable, MultipartResponseResponse | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/multipart', ...options }); 169 + 170 + export const multipartRequest = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, MultipartRequestData, unknown, DefaultT>) => (options.client ?? client).post<TComposable, unknown | DefaultT, unknown, DefaultT>({ 171 + ...formDataBodySerializer, 172 + url: '/api/v{api-version}/multipart', 173 + ...options, 174 + headers: { 175 + 'Content-Type': null, 176 + ...options.headers 177 + } 178 + }); 179 + 180 + export const complexParams = <TComposable extends Composable = '$fetch', DefaultT extends ComplexParamsResponse = ComplexParamsResponse>(options: Options<TComposable, ComplexParamsData, ComplexParamsResponse, DefaultT>) => (options.client ?? client).put<TComposable, ComplexParamsResponse | DefaultT, unknown, DefaultT>({ 181 + url: '/api/v{api-version}/complex/{id}', 182 + ...options, 183 + headers: { 184 + 'Content-Type': 'application/json-patch+json', 185 + ...options.headers 186 + } 187 + }); 188 + 189 + export const callWithResultFromHeader = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, CallWithResultFromHeaderData, unknown, DefaultT>) => (options.client ?? client).post<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/header', ...options }); 190 + 191 + export const testErrorCode = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, TestErrorCodeData, unknown, DefaultT>) => (options.client ?? client).post<TComposable, unknown | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/error', ...options }); 192 + 193 + export const nonAsciiæøåÆøÅöôêÊ字符串 = <TComposable extends Composable = '$fetch', DefaultT extends NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Response>(options: Options<TComposable, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, DefaultT>) => (options.client ?? client).post<TComposable, NonAsciiæøåÆøÅöôêÊ字符串Response | DefaultT, unknown, DefaultT>({ url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', ...options }); 194 + 195 + /** 196 + * Login User 197 + */ 198 + export const putWithFormUrlEncoded = <TComposable extends Composable = '$fetch', DefaultT = undefined>(options: Options<TComposable, PutWithFormUrlEncodedData, unknown, DefaultT>) => (options.client ?? client).put<TComposable, unknown | DefaultT, unknown, DefaultT>({ 199 + ...urlSearchParamsBodySerializer, 200 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', 201 + ...options, 202 + headers: { 203 + 'Content-Type': 'application/x-www-form-urlencoded', 204 + ...options.headers 205 + } 206 + });
+2091
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type ClientOptions = { 4 + baseURL: 'http://localhost:3000/base' | (string & {}); 5 + }; 6 + 7 + /** 8 + * Model with number-only name 9 + */ 10 + export type _400 = string; 11 + 12 + /** 13 + * External ref to shared model (A) 14 + */ 15 + export type ExternalRefA = ExternalSharedExternalSharedModel; 16 + 17 + /** 18 + * External ref to shared model (B) 19 + */ 20 + export type ExternalRefB = ExternalSharedExternalSharedModel; 21 + 22 + /** 23 + * Testing multiline comments in string: First line 24 + * Second line 25 + * 26 + * Fourth line 27 + */ 28 + export type CamelCaseCommentWithBreaks = number; 29 + 30 + /** 31 + * Testing multiline comments in string: First line 32 + * Second line 33 + * 34 + * Fourth line 35 + */ 36 + export type CommentWithBreaks = number; 37 + 38 + /** 39 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 40 + */ 41 + export type CommentWithBackticks = number; 42 + 43 + /** 44 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 45 + */ 46 + export type CommentWithBackticksAndQuotes = number; 47 + 48 + /** 49 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 50 + */ 51 + export type CommentWithSlashes = number; 52 + 53 + /** 54 + * Testing expression placeholders in string: ${expression} should work 55 + */ 56 + export type CommentWithExpressionPlaceholders = number; 57 + 58 + /** 59 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 60 + */ 61 + export type CommentWithQuotes = number; 62 + 63 + /** 64 + * Testing reserved characters in string: * inline * and ** inline ** should work 65 + */ 66 + export type CommentWithReservedCharacters = number; 67 + 68 + /** 69 + * This is a simple number 70 + */ 71 + export type SimpleInteger = number; 72 + 73 + /** 74 + * This is a simple boolean 75 + */ 76 + export type SimpleBoolean = boolean; 77 + 78 + /** 79 + * This is a simple string 80 + */ 81 + export type SimpleString = string; 82 + 83 + /** 84 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 85 + */ 86 + export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; 87 + 88 + /** 89 + * This is a simple file 90 + */ 91 + export type SimpleFile = Blob | File; 92 + 93 + /** 94 + * This is a simple reference 95 + */ 96 + export type SimpleReference = ModelWithString; 97 + 98 + /** 99 + * This is a simple string 100 + */ 101 + export type SimpleStringWithPattern = string | null; 102 + 103 + /** 104 + * This is a simple enum with strings 105 + */ 106 + export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | '\'Single Quote\'' | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; 107 + 108 + export type EnumWithReplacedCharacters = '\'Single Quote\'' | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; 109 + 110 + /** 111 + * This is a simple enum with numbers 112 + */ 113 + export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; 114 + 115 + /** 116 + * Success=1,Warning=2,Error=3 117 + */ 118 + export type EnumFromDescription = number; 119 + 120 + /** 121 + * This is a simple enum with numbers 122 + */ 123 + export type EnumWithExtensions = 200 | 400 | 500; 124 + 125 + export type EnumWithXEnumNames = 0 | 1 | 2; 126 + 127 + /** 128 + * This is a simple array with numbers 129 + */ 130 + export type ArrayWithNumbers = Array<number>; 131 + 132 + /** 133 + * This is a simple array with booleans 134 + */ 135 + export type ArrayWithBooleans = Array<boolean>; 136 + 137 + /** 138 + * This is a simple array with strings 139 + */ 140 + export type ArrayWithStrings = Array<string>; 141 + 142 + /** 143 + * This is a simple array with references 144 + */ 145 + export type ArrayWithReferences = Array<ModelWithString>; 146 + 147 + /** 148 + * This is a simple array containing an array 149 + */ 150 + export type ArrayWithArray = Array<Array<ModelWithString>>; 151 + 152 + /** 153 + * This is a simple array with properties 154 + */ 155 + export type ArrayWithProperties = Array<{ 156 + '16x16'?: CamelCaseCommentWithBreaks; 157 + bar?: string; 158 + }>; 159 + 160 + /** 161 + * This is a simple array with any of properties 162 + */ 163 + export type ArrayWithAnyOfProperties = Array<{ 164 + foo?: string; 165 + } | { 166 + bar?: string; 167 + }>; 168 + 169 + export type AnyOfAnyAndNull = { 170 + data?: unknown | null; 171 + }; 172 + 173 + /** 174 + * This is a simple array with any of properties 175 + */ 176 + export type AnyOfArrays = { 177 + results?: Array<{ 178 + foo?: string; 179 + } | { 180 + bar?: string; 181 + }>; 182 + }; 183 + 184 + /** 185 + * This is a string dictionary 186 + */ 187 + export type DictionaryWithString = { 188 + [key: string]: string; 189 + }; 190 + 191 + export type DictionaryWithPropertiesAndAdditionalProperties = { 192 + foo?: number; 193 + bar?: boolean; 194 + [key: string]: string | number | boolean | undefined; 195 + }; 196 + 197 + /** 198 + * This is a string reference 199 + */ 200 + export type DictionaryWithReference = { 201 + [key: string]: ModelWithString; 202 + }; 203 + 204 + /** 205 + * This is a complex dictionary 206 + */ 207 + export type DictionaryWithArray = { 208 + [key: string]: Array<ModelWithString>; 209 + }; 210 + 211 + /** 212 + * This is a string dictionary 213 + */ 214 + export type DictionaryWithDictionary = { 215 + [key: string]: { 216 + [key: string]: string; 217 + }; 218 + }; 219 + 220 + /** 221 + * This is a complex dictionary 222 + */ 223 + export type DictionaryWithProperties = { 224 + [key: string]: { 225 + foo?: string; 226 + bar?: string; 227 + }; 228 + }; 229 + 230 + /** 231 + * This is a model with one number property 232 + */ 233 + export type ModelWithInteger = { 234 + /** 235 + * This is a simple number property 236 + */ 237 + prop?: number; 238 + }; 239 + 240 + /** 241 + * This is a model with one boolean property 242 + */ 243 + export type ModelWithBoolean = { 244 + /** 245 + * This is a simple boolean property 246 + */ 247 + prop?: boolean; 248 + }; 249 + 250 + /** 251 + * This is a model with one string property 252 + */ 253 + export type ModelWithString = { 254 + /** 255 + * This is a simple string property 256 + */ 257 + prop?: string; 258 + }; 259 + 260 + /** 261 + * This is a model with one string property 262 + */ 263 + export type ModelWithStringError = { 264 + /** 265 + * This is a simple string property 266 + */ 267 + prop?: string; 268 + }; 269 + 270 + /** 271 + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) 272 + */ 273 + export type ModelFromZendesk = string; 274 + 275 + /** 276 + * This is a model with one string property 277 + */ 278 + export type ModelWithNullableString = { 279 + /** 280 + * This is a simple string property 281 + */ 282 + nullableProp1?: string | null; 283 + /** 284 + * This is a simple string property 285 + */ 286 + nullableRequiredProp1: string | null; 287 + /** 288 + * This is a simple string property 289 + */ 290 + nullableProp2?: string | null; 291 + /** 292 + * This is a simple string property 293 + */ 294 + nullableRequiredProp2: string | null; 295 + /** 296 + * This is a simple enum with strings 297 + */ 298 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 299 + }; 300 + 301 + /** 302 + * This is a model with one enum 303 + */ 304 + export type ModelWithEnum = { 305 + /** 306 + * This is a simple enum with strings 307 + */ 308 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 309 + /** 310 + * These are the HTTP error code enums 311 + */ 312 + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; 313 + /** 314 + * Simple boolean enum 315 + */ 316 + bool?: true; 317 + }; 318 + 319 + /** 320 + * This is a model with one enum with escaped name 321 + */ 322 + export type ModelWithEnumWithHyphen = { 323 + /** 324 + * Foo-Bar-Baz-Qux 325 + */ 326 + 'foo-bar-baz-qux'?: '3.0'; 327 + }; 328 + 329 + /** 330 + * This is a model with one enum 331 + */ 332 + export type ModelWithEnumFromDescription = { 333 + /** 334 + * Success=1,Warning=2,Error=3 335 + */ 336 + test?: number; 337 + }; 338 + 339 + /** 340 + * This is a model with nested enums 341 + */ 342 + export type ModelWithNestedEnums = { 343 + dictionaryWithEnum?: { 344 + [key: string]: 'Success' | 'Warning' | 'Error'; 345 + }; 346 + dictionaryWithEnumFromDescription?: { 347 + [key: string]: number; 348 + }; 349 + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; 350 + arrayWithDescription?: Array<number>; 351 + /** 352 + * This is a simple enum with strings 353 + */ 354 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 355 + }; 356 + 357 + /** 358 + * This is a model with one property containing a reference 359 + */ 360 + export type ModelWithReference = { 361 + prop?: ModelWithProperties; 362 + }; 363 + 364 + /** 365 + * This is a model with one property containing an array 366 + */ 367 + export type ModelWithArrayReadOnlyAndWriteOnly = { 368 + prop?: Array<ModelWithReadOnlyAndWriteOnly>; 369 + propWithFile?: Array<Blob | File>; 370 + propWithNumber?: Array<number>; 371 + }; 372 + 373 + /** 374 + * This is a model with one property containing an array 375 + */ 376 + export type ModelWithArray = { 377 + prop?: Array<ModelWithString>; 378 + propWithFile?: Array<Blob | File>; 379 + propWithNumber?: Array<number>; 380 + }; 381 + 382 + /** 383 + * This is a model with one property containing a dictionary 384 + */ 385 + export type ModelWithDictionary = { 386 + prop?: { 387 + [key: string]: string; 388 + }; 389 + }; 390 + 391 + /** 392 + * This is a deprecated model with a deprecated property 393 + * 394 + * @deprecated 395 + */ 396 + export type DeprecatedModel = { 397 + /** 398 + * This is a deprecated property 399 + * 400 + * @deprecated 401 + */ 402 + prop?: string; 403 + }; 404 + 405 + /** 406 + * This is a model with one property containing a circular reference 407 + */ 408 + export type ModelWithCircularReference = { 409 + prop?: ModelWithCircularReference; 410 + }; 411 + 412 + /** 413 + * This is a model with one property with a 'one of' relationship 414 + */ 415 + export type CompositionWithOneOf = { 416 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 417 + }; 418 + 419 + /** 420 + * This is a model with one property with a 'one of' relationship where the options are not $ref 421 + */ 422 + export type CompositionWithOneOfAnonymous = { 423 + propA?: { 424 + propA?: string; 425 + } | string | number; 426 + }; 427 + 428 + /** 429 + * Circle 430 + */ 431 + export type ModelCircle = { 432 + kind: string; 433 + radius?: number; 434 + }; 435 + 436 + /** 437 + * Square 438 + */ 439 + export type ModelSquare = { 440 + kind: string; 441 + sideLength?: number; 442 + }; 443 + 444 + /** 445 + * This is a model with one property with a 'one of' relationship where the options are not $ref 446 + */ 447 + export type CompositionWithOneOfDiscriminator = ({ 448 + kind: 'circle'; 449 + } & ModelCircle) | ({ 450 + kind: 'square'; 451 + } & ModelSquare); 452 + 453 + /** 454 + * This is a model with one property with a 'any of' relationship 455 + */ 456 + export type CompositionWithAnyOf = { 457 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 458 + }; 459 + 460 + /** 461 + * This is a model with one property with a 'any of' relationship where the options are not $ref 462 + */ 463 + export type CompositionWithAnyOfAnonymous = { 464 + propA?: { 465 + propA?: string; 466 + } | string | number; 467 + }; 468 + 469 + /** 470 + * This is a model with nested 'any of' property with a type null 471 + */ 472 + export type CompositionWithNestedAnyAndTypeNull = { 473 + propA?: Array<ModelWithDictionary | null> | Array<ModelWithArray | null>; 474 + }; 475 + 476 + export type _3eNum1Период = 'Bird' | 'Dog'; 477 + 478 + export type ConstValue = 'ConstValue'; 479 + 480 + /** 481 + * This is a model with one property with a 'any of' relationship where the options are not $ref 482 + */ 483 + export type CompositionWithNestedAnyOfAndNull = { 484 + /** 485 + * Scopes 486 + */ 487 + propA?: Array<_3eNum1Период | ConstValue> | null; 488 + }; 489 + 490 + /** 491 + * This is a model with one property with a 'one of' relationship 492 + */ 493 + export type CompositionWithOneOfAndNullable = { 494 + propA?: { 495 + boolean?: boolean; 496 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 497 + }; 498 + 499 + /** 500 + * This is a model that contains a simple dictionary within composition 501 + */ 502 + export type CompositionWithOneOfAndSimpleDictionary = { 503 + propA?: boolean | { 504 + [key: string]: number; 505 + }; 506 + }; 507 + 508 + /** 509 + * This is a model that contains a dictionary of simple arrays within composition 510 + */ 511 + export type CompositionWithOneOfAndSimpleArrayDictionary = { 512 + propA?: boolean | { 513 + [key: string]: Array<boolean>; 514 + }; 515 + }; 516 + 517 + /** 518 + * This is a model that contains a dictionary of complex arrays (composited) within composition 519 + */ 520 + export type CompositionWithOneOfAndComplexArrayDictionary = { 521 + propA?: boolean | { 522 + [key: string]: Array<number | string>; 523 + }; 524 + }; 525 + 526 + /** 527 + * This is a model with one property with a 'all of' relationship 528 + */ 529 + export type CompositionWithAllOfAndNullable = { 530 + propA?: ({ 531 + boolean?: boolean; 532 + } & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null; 533 + }; 534 + 535 + /** 536 + * This is a model with one property with a 'any of' relationship 537 + */ 538 + export type CompositionWithAnyOfAndNullable = { 539 + propA?: { 540 + boolean?: boolean; 541 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 542 + }; 543 + 544 + /** 545 + * This is a base model with two simple optional properties 546 + */ 547 + export type CompositionBaseModel = { 548 + firstName?: string; 549 + lastname?: string; 550 + }; 551 + 552 + /** 553 + * This is a model that extends the base model 554 + */ 555 + export type CompositionExtendedModel = CompositionBaseModel & { 556 + age: number; 557 + firstName: string; 558 + lastname: string; 559 + }; 560 + 561 + /** 562 + * This is a model with one nested property 563 + */ 564 + export type ModelWithProperties = { 565 + required: string; 566 + readonly requiredAndReadOnly: string; 567 + requiredAndNullable: string | null; 568 + string?: string; 569 + number?: number; 570 + boolean?: boolean; 571 + reference?: ModelWithString; 572 + 'property with space'?: string; 573 + default?: string; 574 + try?: string; 575 + readonly '@namespace.string'?: string; 576 + readonly '@namespace.integer'?: number; 577 + }; 578 + 579 + /** 580 + * This is a model with one nested property 581 + */ 582 + export type ModelWithNestedProperties = { 583 + readonly first: { 584 + readonly second: { 585 + readonly third: string | null; 586 + } | null; 587 + } | null; 588 + }; 589 + 590 + /** 591 + * This is a model with duplicated properties 592 + */ 593 + export type ModelWithDuplicateProperties = { 594 + prop?: ModelWithString; 595 + }; 596 + 597 + /** 598 + * This is a model with ordered properties 599 + */ 600 + export type ModelWithOrderedProperties = { 601 + zebra?: string; 602 + apple?: string; 603 + hawaii?: string; 604 + }; 605 + 606 + /** 607 + * This is a model with duplicated imports 608 + */ 609 + export type ModelWithDuplicateImports = { 610 + propA?: ModelWithString; 611 + propB?: ModelWithString; 612 + propC?: ModelWithString; 613 + }; 614 + 615 + /** 616 + * This is a model that extends another model 617 + */ 618 + export type ModelThatExtends = ModelWithString & { 619 + propExtendsA?: string; 620 + propExtendsB?: ModelWithString; 621 + }; 622 + 623 + /** 624 + * This is a model that extends another model 625 + */ 626 + export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { 627 + propExtendsC?: string; 628 + propExtendsD?: ModelWithString; 629 + }; 630 + 631 + /** 632 + * This is a model that contains a some patterns 633 + */ 634 + export type ModelWithPattern = { 635 + key: string; 636 + name: string; 637 + readonly enabled?: boolean; 638 + readonly modified?: string; 639 + id?: string; 640 + text?: string; 641 + patternWithSingleQuotes?: string; 642 + patternWithNewline?: string; 643 + patternWithBacktick?: string; 644 + }; 645 + 646 + export type File = { 647 + /** 648 + * Id 649 + */ 650 + readonly id?: string; 651 + /** 652 + * Updated at 653 + */ 654 + readonly updated_at?: string; 655 + /** 656 + * Created at 657 + */ 658 + readonly created_at?: string; 659 + /** 660 + * Mime 661 + */ 662 + mime: string; 663 + /** 664 + * File 665 + */ 666 + readonly file?: string; 667 + }; 668 + 669 + export type Default = { 670 + name?: string; 671 + }; 672 + 673 + export type Pageable = { 674 + page?: number; 675 + size?: number; 676 + sort?: Array<string>; 677 + }; 678 + 679 + /** 680 + * This is a free-form object without additionalProperties. 681 + */ 682 + export type FreeFormObjectWithoutAdditionalProperties = { 683 + [key: string]: unknown; 684 + }; 685 + 686 + /** 687 + * This is a free-form object with additionalProperties: true. 688 + */ 689 + export type FreeFormObjectWithAdditionalPropertiesEqTrue = { 690 + [key: string]: unknown; 691 + }; 692 + 693 + /** 694 + * This is a free-form object with additionalProperties: {}. 695 + */ 696 + export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { 697 + [key: string]: unknown; 698 + }; 699 + 700 + export type ModelWithConst = { 701 + String?: 'String'; 702 + number?: 0; 703 + null?: null; 704 + withType?: 'Some string'; 705 + }; 706 + 707 + /** 708 + * This is a model with one property and additionalProperties: true 709 + */ 710 + export type ModelWithAdditionalPropertiesEqTrue = { 711 + /** 712 + * This is a simple string property 713 + */ 714 + prop?: string; 715 + [key: string]: unknown | string | undefined; 716 + }; 717 + 718 + export type NestedAnyOfArraysNullable = { 719 + nullableArray?: Array<string | boolean> | null; 720 + }; 721 + 722 + export type CompositionWithOneOfAndProperties = ({ 723 + foo: SimpleParameter; 724 + } | { 725 + bar: NonAsciiStringæøåÆøÅöôêÊ字符串; 726 + }) & { 727 + baz: number | null; 728 + qux: number; 729 + }; 730 + 731 + /** 732 + * An object that can be null 733 + */ 734 + export type NullableObject = { 735 + foo?: string; 736 + } | null; 737 + 738 + /** 739 + * Some % character 740 + */ 741 + export type CharactersInDescription = string; 742 + 743 + export type ModelWithNullableObject = { 744 + data?: NullableObject; 745 + }; 746 + 747 + export type ModelWithOneOfEnum = { 748 + foo: 'Bar'; 749 + } | { 750 + foo: 'Baz'; 751 + } | { 752 + foo: 'Qux'; 753 + } | { 754 + content: string; 755 + foo: 'Quux'; 756 + } | { 757 + content: [ 758 + string, 759 + string 760 + ]; 761 + foo: 'Corge'; 762 + }; 763 + 764 + export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; 765 + 766 + export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; 767 + 768 + export type ModelWithNestedArrayEnumsData = { 769 + foo?: Array<ModelWithNestedArrayEnumsDataFoo>; 770 + bar?: Array<ModelWithNestedArrayEnumsDataBar>; 771 + }; 772 + 773 + export type ModelWithNestedArrayEnums = { 774 + array_strings?: Array<string>; 775 + data?: ModelWithNestedArrayEnumsData; 776 + }; 777 + 778 + export type ModelWithNestedCompositionEnums = { 779 + foo?: ModelWithNestedArrayEnumsDataFoo; 780 + }; 781 + 782 + export type ModelWithReadOnlyAndWriteOnly = { 783 + foo: string; 784 + readonly bar: string; 785 + }; 786 + 787 + export type ModelWithConstantSizeArray = [ 788 + number, 789 + number 790 + ]; 791 + 792 + export type ModelWithAnyOfConstantSizeArray = [ 793 + number | string, 794 + number | string, 795 + number | string 796 + ]; 797 + 798 + export type ModelWithPrefixItemsConstantSizeArray = [ 799 + ModelWithInteger, 800 + number | string, 801 + string 802 + ]; 803 + 804 + export type ModelWithAnyOfConstantSizeArrayNullable = [ 805 + number | null | string, 806 + number | null | string, 807 + number | null | string 808 + ]; 809 + 810 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ 811 + number | Import, 812 + number | Import 813 + ]; 814 + 815 + export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ 816 + number & string, 817 + number & string 818 + ]; 819 + 820 + export type ModelWithNumericEnumUnion = { 821 + /** 822 + * Период 823 + */ 824 + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; 825 + }; 826 + 827 + /** 828 + * Some description with `back ticks` 829 + */ 830 + export type ModelWithBackticksInDescription = { 831 + /** 832 + * The template `that` should be used for parsing and importing the contents of the CSV file. 833 + * 834 + * <br/><p>There is one placeholder currently supported:<ul> <li><b>${x}</b> - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)</li></ul><p>Example of a correct JSON template:</p> 835 + * <pre> 836 + * [ 837 + * { 838 + * "resourceType": "Asset", 839 + * "identifier": { 840 + * "name": "${1}", 841 + * "domain": { 842 + * "name": "${2}", 843 + * "community": { 844 + * "name": "Some Community" 845 + * } 846 + * } 847 + * }, 848 + * "attributes" : { 849 + * "00000000-0000-0000-0000-000000003115" : [ { 850 + * "value" : "${3}" 851 + * } ], 852 + * "00000000-0000-0000-0000-000000000222" : [ { 853 + * "value" : "${4}" 854 + * } ] 855 + * } 856 + * } 857 + * ] 858 + * </pre> 859 + */ 860 + template?: string; 861 + }; 862 + 863 + export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & { 864 + baz: number | null; 865 + qux: number; 866 + }; 867 + 868 + /** 869 + * Model used to test deduplication strategy (unused) 870 + */ 871 + export type ParameterSimpleParameterUnused = string; 872 + 873 + /** 874 + * Model used to test deduplication strategy 875 + */ 876 + export type PostServiceWithEmptyTagResponse = string; 877 + 878 + /** 879 + * Model used to test deduplication strategy 880 + */ 881 + export type PostServiceWithEmptyTagResponse2 = string; 882 + 883 + /** 884 + * Model used to test deduplication strategy 885 + */ 886 + export type DeleteFooData = string; 887 + 888 + /** 889 + * Model used to test deduplication strategy 890 + */ 891 + export type DeleteFooData2 = string; 892 + 893 + /** 894 + * Model with restricted keyword name 895 + */ 896 + export type Import = string; 897 + 898 + export type SchemaWithFormRestrictedKeys = { 899 + description?: string; 900 + 'x-enum-descriptions'?: string; 901 + 'x-enum-varnames'?: string; 902 + 'x-enumNames'?: string; 903 + title?: string; 904 + object?: { 905 + description?: string; 906 + 'x-enum-descriptions'?: string; 907 + 'x-enum-varnames'?: string; 908 + 'x-enumNames'?: string; 909 + title?: string; 910 + }; 911 + array?: Array<{ 912 + description?: string; 913 + 'x-enum-descriptions'?: string; 914 + 'x-enum-varnames'?: string; 915 + 'x-enumNames'?: string; 916 + title?: string; 917 + }>; 918 + }; 919 + 920 + /** 921 + * This schema was giving PascalCase transformations a hard time 922 + */ 923 + export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = { 924 + /** 925 + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. 926 + */ 927 + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; 928 + }; 929 + 930 + /** 931 + * This schema was giving PascalCase transformations a hard time 932 + */ 933 + export type IoK8sApimachineryPkgApisMetaV1Preconditions = { 934 + /** 935 + * Specifies the target ResourceVersion 936 + */ 937 + resourceVersion?: string; 938 + /** 939 + * Specifies the target UID. 940 + */ 941 + uid?: string; 942 + }; 943 + 944 + export type AdditionalPropertiesUnknownIssue = { 945 + [key: string]: string | number; 946 + }; 947 + 948 + export type AdditionalPropertiesUnknownIssue2 = { 949 + [key: string]: string | number; 950 + }; 951 + 952 + export type AdditionalPropertiesUnknownIssue3 = string & { 953 + entries: { 954 + [key: string]: AdditionalPropertiesUnknownIssue; 955 + }; 956 + }; 957 + 958 + export type AdditionalPropertiesIntegerIssue = { 959 + value: number; 960 + [key: string]: number; 961 + }; 962 + 963 + export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 964 + 965 + export type GenericSchemaDuplicateIssue1SystemBoolean = { 966 + item?: boolean; 967 + error?: string | null; 968 + readonly hasError?: boolean; 969 + data?: { 970 + [key: string]: never; 971 + }; 972 + }; 973 + 974 + export type GenericSchemaDuplicateIssue1SystemString = { 975 + item?: string | null; 976 + error?: string | null; 977 + readonly hasError?: boolean; 978 + }; 979 + 980 + export type ExternalSharedExternalSharedModel = { 981 + id: string; 982 + name?: string; 983 + }; 984 + 985 + /** 986 + * This is a model with one property containing a reference 987 + */ 988 + export type ModelWithReferenceWritable = { 989 + prop?: ModelWithPropertiesWritable; 990 + }; 991 + 992 + /** 993 + * This is a model with one property containing an array 994 + */ 995 + export type ModelWithArrayReadOnlyAndWriteOnlyWritable = { 996 + prop?: Array<ModelWithReadOnlyAndWriteOnlyWritable>; 997 + propWithFile?: Array<Blob | File>; 998 + propWithNumber?: Array<number>; 999 + }; 1000 + 1001 + /** 1002 + * This is a model with one nested property 1003 + */ 1004 + export type ModelWithPropertiesWritable = { 1005 + required: string; 1006 + requiredAndNullable: string | null; 1007 + string?: string; 1008 + number?: number; 1009 + boolean?: boolean; 1010 + reference?: ModelWithString; 1011 + 'property with space'?: string; 1012 + default?: string; 1013 + try?: string; 1014 + }; 1015 + 1016 + /** 1017 + * This is a model that contains a some patterns 1018 + */ 1019 + export type ModelWithPatternWritable = { 1020 + key: string; 1021 + name: string; 1022 + id?: string; 1023 + text?: string; 1024 + patternWithSingleQuotes?: string; 1025 + patternWithNewline?: string; 1026 + patternWithBacktick?: string; 1027 + }; 1028 + 1029 + export type FileWritable = { 1030 + /** 1031 + * Mime 1032 + */ 1033 + mime: string; 1034 + }; 1035 + 1036 + export type ModelWithReadOnlyAndWriteOnlyWritable = { 1037 + foo: string; 1038 + baz: string; 1039 + }; 1040 + 1041 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = [ 1042 + number | Import, 1043 + number | Import 1044 + ]; 1045 + 1046 + export type AdditionalPropertiesUnknownIssueWritable = { 1047 + [key: string]: string | number; 1048 + }; 1049 + 1050 + export type OneOfAllOfIssueWritable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 1051 + 1052 + export type GenericSchemaDuplicateIssue1SystemBooleanWritable = { 1053 + item?: boolean; 1054 + error?: string | null; 1055 + data?: { 1056 + [key: string]: never; 1057 + }; 1058 + }; 1059 + 1060 + export type GenericSchemaDuplicateIssue1SystemStringWritable = { 1061 + item?: string | null; 1062 + error?: string | null; 1063 + }; 1064 + 1065 + /** 1066 + * This is a reusable parameter 1067 + */ 1068 + export type SimpleParameter = string; 1069 + 1070 + /** 1071 + * Parameter with illegal characters 1072 + */ 1073 + export type XFooBar = ModelWithString; 1074 + 1075 + /** 1076 + * A reusable request body 1077 + */ 1078 + export type SimpleRequestBody = ModelWithString; 1079 + 1080 + /** 1081 + * A reusable request body 1082 + */ 1083 + export type SimpleFormData = ModelWithString; 1084 + 1085 + export type ExportData = { 1086 + body?: never; 1087 + path?: never; 1088 + query?: never; 1089 + url: '/api/v{api-version}/no+tag'; 1090 + }; 1091 + 1092 + export type PatchApiVbyApiVersionNoTagData = { 1093 + body?: never; 1094 + path?: never; 1095 + query?: never; 1096 + url: '/api/v{api-version}/no+tag'; 1097 + }; 1098 + 1099 + export type PatchApiVbyApiVersionNoTagResponses = { 1100 + /** 1101 + * OK 1102 + */ 1103 + default: unknown; 1104 + }; 1105 + 1106 + export type ImportData = { 1107 + body: ModelWithReadOnlyAndWriteOnlyWritable | ModelWithArrayReadOnlyAndWriteOnlyWritable; 1108 + path?: never; 1109 + query?: never; 1110 + url: '/api/v{api-version}/no+tag'; 1111 + }; 1112 + 1113 + export type ImportResponses = { 1114 + /** 1115 + * Success 1116 + */ 1117 + 200: ModelFromZendesk; 1118 + /** 1119 + * Default success response 1120 + */ 1121 + default: ModelWithReadOnlyAndWriteOnly; 1122 + }; 1123 + 1124 + export type ImportResponse = ImportResponses[keyof ImportResponses]; 1125 + 1126 + export type FooWowData = { 1127 + body?: never; 1128 + path?: never; 1129 + query?: never; 1130 + url: '/api/v{api-version}/no+tag'; 1131 + }; 1132 + 1133 + export type FooWowResponses = { 1134 + /** 1135 + * OK 1136 + */ 1137 + default: unknown; 1138 + }; 1139 + 1140 + export type ApiVVersionODataControllerCountData = { 1141 + body?: never; 1142 + path?: never; 1143 + query?: never; 1144 + url: '/api/v{api-version}/simple/$count'; 1145 + }; 1146 + 1147 + export type ApiVVersionODataControllerCountResponses = { 1148 + /** 1149 + * Success 1150 + */ 1151 + 200: ModelFromZendesk; 1152 + }; 1153 + 1154 + export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; 1155 + 1156 + export type GetApiVbyApiVersionSimpleOperationData = { 1157 + body?: never; 1158 + path: { 1159 + /** 1160 + * foo in method 1161 + */ 1162 + foo_param: string; 1163 + }; 1164 + query?: never; 1165 + url: '/api/v{api-version}/simple:operation'; 1166 + }; 1167 + 1168 + export type GetApiVbyApiVersionSimpleOperationErrors = { 1169 + /** 1170 + * Default error response 1171 + */ 1172 + default: ModelWithBoolean; 1173 + }; 1174 + 1175 + export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; 1176 + 1177 + export type GetApiVbyApiVersionSimpleOperationResponses = { 1178 + /** 1179 + * Response is a simple number 1180 + */ 1181 + 200: number; 1182 + }; 1183 + 1184 + export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; 1185 + 1186 + export type DeleteCallWithoutParametersAndResponseData = { 1187 + body?: never; 1188 + path?: never; 1189 + query?: never; 1190 + url: '/api/v{api-version}/simple'; 1191 + }; 1192 + 1193 + export type GetCallWithoutParametersAndResponseData = { 1194 + body?: never; 1195 + path?: never; 1196 + query?: never; 1197 + url: '/api/v{api-version}/simple'; 1198 + }; 1199 + 1200 + export type HeadCallWithoutParametersAndResponseData = { 1201 + body?: never; 1202 + path?: never; 1203 + query?: never; 1204 + url: '/api/v{api-version}/simple'; 1205 + }; 1206 + 1207 + export type OptionsCallWithoutParametersAndResponseData = { 1208 + body?: never; 1209 + path?: never; 1210 + query?: never; 1211 + url: '/api/v{api-version}/simple'; 1212 + }; 1213 + 1214 + export type PatchCallWithoutParametersAndResponseData = { 1215 + body?: never; 1216 + path?: never; 1217 + query?: never; 1218 + url: '/api/v{api-version}/simple'; 1219 + }; 1220 + 1221 + export type PostCallWithoutParametersAndResponseData = { 1222 + body?: never; 1223 + path?: never; 1224 + query?: never; 1225 + url: '/api/v{api-version}/simple'; 1226 + }; 1227 + 1228 + export type PutCallWithoutParametersAndResponseData = { 1229 + body?: never; 1230 + path?: never; 1231 + query?: never; 1232 + url: '/api/v{api-version}/simple'; 1233 + }; 1234 + 1235 + export type DeleteFooData3 = { 1236 + body?: never; 1237 + headers: { 1238 + /** 1239 + * Parameter with illegal characters 1240 + */ 1241 + 'x-Foo-Bar': ModelWithString; 1242 + }; 1243 + path: { 1244 + /** 1245 + * foo in method 1246 + */ 1247 + foo_param: string; 1248 + /** 1249 + * bar in method 1250 + */ 1251 + BarParam: string; 1252 + }; 1253 + query?: never; 1254 + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; 1255 + }; 1256 + 1257 + export type CallWithDescriptionsData = { 1258 + body?: never; 1259 + path?: never; 1260 + query?: { 1261 + /** 1262 + * Testing multiline comments in string: First line 1263 + * Second line 1264 + * 1265 + * Fourth line 1266 + */ 1267 + parameterWithBreaks?: string; 1268 + /** 1269 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1270 + */ 1271 + parameterWithBackticks?: string; 1272 + /** 1273 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1274 + */ 1275 + parameterWithSlashes?: string; 1276 + /** 1277 + * Testing expression placeholders in string: ${expression} should work 1278 + */ 1279 + parameterWithExpressionPlaceholders?: string; 1280 + /** 1281 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1282 + */ 1283 + parameterWithQuotes?: string; 1284 + /** 1285 + * Testing reserved characters in string: * inline * and ** inline ** should work 1286 + */ 1287 + parameterWithReservedCharacters?: string; 1288 + }; 1289 + url: '/api/v{api-version}/descriptions'; 1290 + }; 1291 + 1292 + export type DeprecatedCallData = { 1293 + body?: never; 1294 + headers: { 1295 + /** 1296 + * This parameter is deprecated 1297 + * 1298 + * @deprecated 1299 + */ 1300 + parameter: DeprecatedModel | null; 1301 + }; 1302 + path?: never; 1303 + query?: never; 1304 + url: '/api/v{api-version}/parameters/deprecated'; 1305 + }; 1306 + 1307 + export type CallWithParametersData = { 1308 + /** 1309 + * This is the parameter that goes into the body 1310 + */ 1311 + body: { 1312 + [key: string]: unknown; 1313 + } | null; 1314 + headers: { 1315 + /** 1316 + * This is the parameter that goes into the header 1317 + */ 1318 + parameterHeader: string | null; 1319 + }; 1320 + path: { 1321 + /** 1322 + * This is the parameter that goes into the path 1323 + */ 1324 + parameterPath: string | null; 1325 + /** 1326 + * api-version should be required in standalone clients 1327 + */ 1328 + 'api-version': string | null; 1329 + }; 1330 + query: { 1331 + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; 1332 + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; 1333 + /** 1334 + * This is the parameter that goes into the query params 1335 + */ 1336 + cursor: string | null; 1337 + }; 1338 + url: '/api/v{api-version}/parameters/{parameterPath}'; 1339 + }; 1340 + 1341 + export type CallWithWeirdParameterNamesData = { 1342 + /** 1343 + * This is the parameter that goes into the body 1344 + */ 1345 + body: ModelWithString | null; 1346 + headers: { 1347 + /** 1348 + * This is the parameter that goes into the request header 1349 + */ 1350 + 'parameter.header': string | null; 1351 + }; 1352 + path: { 1353 + /** 1354 + * This is the parameter that goes into the path 1355 + */ 1356 + 'parameter.path.1'?: string; 1357 + /** 1358 + * This is the parameter that goes into the path 1359 + */ 1360 + 'parameter-path-2'?: string; 1361 + /** 1362 + * This is the parameter that goes into the path 1363 + */ 1364 + 'PARAMETER-PATH-3'?: string; 1365 + /** 1366 + * api-version should be required in standalone clients 1367 + */ 1368 + 'api-version': string | null; 1369 + }; 1370 + query: { 1371 + /** 1372 + * This is the parameter with a reserved keyword 1373 + */ 1374 + default?: string; 1375 + /** 1376 + * This is the parameter that goes into the request query params 1377 + */ 1378 + 'parameter-query': string | null; 1379 + }; 1380 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; 1381 + }; 1382 + 1383 + export type GetCallWithOptionalParamData = { 1384 + /** 1385 + * This is a required parameter 1386 + */ 1387 + body: ModelWithOneOfEnum; 1388 + path?: never; 1389 + query?: { 1390 + /** 1391 + * This is an optional parameter 1392 + */ 1393 + page?: number; 1394 + }; 1395 + url: '/api/v{api-version}/parameters'; 1396 + }; 1397 + 1398 + export type PostCallWithOptionalParamData = { 1399 + /** 1400 + * This is an optional parameter 1401 + */ 1402 + body?: { 1403 + offset?: number | null; 1404 + }; 1405 + path?: never; 1406 + query: { 1407 + /** 1408 + * This is a required parameter 1409 + */ 1410 + parameter: Pageable; 1411 + }; 1412 + url: '/api/v{api-version}/parameters'; 1413 + }; 1414 + 1415 + export type PostCallWithOptionalParamResponses = { 1416 + /** 1417 + * Response is a simple number 1418 + */ 1419 + 200: number; 1420 + /** 1421 + * Success 1422 + */ 1423 + 204: void; 1424 + }; 1425 + 1426 + export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; 1427 + 1428 + export type PostApiVbyApiVersionRequestBodyData = { 1429 + /** 1430 + * A reusable request body 1431 + */ 1432 + body?: SimpleRequestBody; 1433 + path?: never; 1434 + query?: { 1435 + /** 1436 + * This is a reusable parameter 1437 + */ 1438 + parameter?: string; 1439 + }; 1440 + url: '/api/v{api-version}/requestBody'; 1441 + }; 1442 + 1443 + export type PostApiVbyApiVersionFormDataData = { 1444 + /** 1445 + * A reusable request body 1446 + */ 1447 + body?: SimpleFormData; 1448 + path?: never; 1449 + query?: { 1450 + /** 1451 + * This is a reusable parameter 1452 + */ 1453 + parameter?: string; 1454 + }; 1455 + url: '/api/v{api-version}/formData'; 1456 + }; 1457 + 1458 + export type CallWithDefaultParametersData = { 1459 + body?: never; 1460 + path?: never; 1461 + query?: { 1462 + /** 1463 + * This is a simple string with default value 1464 + */ 1465 + parameterString?: string | null; 1466 + /** 1467 + * This is a simple number with default value 1468 + */ 1469 + parameterNumber?: number | null; 1470 + /** 1471 + * This is a simple boolean with default value 1472 + */ 1473 + parameterBoolean?: boolean | null; 1474 + /** 1475 + * This is a simple enum with default value 1476 + */ 1477 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1478 + /** 1479 + * This is a simple model with default value 1480 + */ 1481 + parameterModel?: ModelWithString | null; 1482 + }; 1483 + url: '/api/v{api-version}/defaults'; 1484 + }; 1485 + 1486 + export type CallWithDefaultOptionalParametersData = { 1487 + body?: never; 1488 + path?: never; 1489 + query?: { 1490 + /** 1491 + * This is a simple string that is optional with default value 1492 + */ 1493 + parameterString?: string; 1494 + /** 1495 + * This is a simple number that is optional with default value 1496 + */ 1497 + parameterNumber?: number; 1498 + /** 1499 + * This is a simple boolean that is optional with default value 1500 + */ 1501 + parameterBoolean?: boolean; 1502 + /** 1503 + * This is a simple enum that is optional with default value 1504 + */ 1505 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1506 + /** 1507 + * This is a simple model that is optional with default value 1508 + */ 1509 + parameterModel?: ModelWithString; 1510 + }; 1511 + url: '/api/v{api-version}/defaults'; 1512 + }; 1513 + 1514 + export type CallToTestOrderOfParamsData = { 1515 + body?: never; 1516 + path?: never; 1517 + query: { 1518 + /** 1519 + * This is a optional string with default 1520 + */ 1521 + parameterOptionalStringWithDefault?: string; 1522 + /** 1523 + * This is a optional string with empty default 1524 + */ 1525 + parameterOptionalStringWithEmptyDefault?: string; 1526 + /** 1527 + * This is a optional string with no default 1528 + */ 1529 + parameterOptionalStringWithNoDefault?: string; 1530 + /** 1531 + * This is a string with default 1532 + */ 1533 + parameterStringWithDefault: string; 1534 + /** 1535 + * This is a string with empty default 1536 + */ 1537 + parameterStringWithEmptyDefault: string; 1538 + /** 1539 + * This is a string with no default 1540 + */ 1541 + parameterStringWithNoDefault: string; 1542 + /** 1543 + * This is a string that can be null with no default 1544 + */ 1545 + parameterStringNullableWithNoDefault?: string | null; 1546 + /** 1547 + * This is a string that can be null with default 1548 + */ 1549 + parameterStringNullableWithDefault?: string | null; 1550 + }; 1551 + url: '/api/v{api-version}/defaults'; 1552 + }; 1553 + 1554 + export type DuplicateNameData = { 1555 + body?: never; 1556 + path?: never; 1557 + query?: never; 1558 + url: '/api/v{api-version}/duplicate'; 1559 + }; 1560 + 1561 + export type DuplicateName2Data = { 1562 + body?: never; 1563 + path?: never; 1564 + query?: never; 1565 + url: '/api/v{api-version}/duplicate'; 1566 + }; 1567 + 1568 + export type DuplicateName3Data = { 1569 + body?: never; 1570 + path?: never; 1571 + query?: never; 1572 + url: '/api/v{api-version}/duplicate'; 1573 + }; 1574 + 1575 + export type DuplicateName4Data = { 1576 + body?: never; 1577 + path?: never; 1578 + query?: never; 1579 + url: '/api/v{api-version}/duplicate'; 1580 + }; 1581 + 1582 + export type CallWithNoContentResponseData = { 1583 + body?: never; 1584 + path?: never; 1585 + query?: never; 1586 + url: '/api/v{api-version}/no-content'; 1587 + }; 1588 + 1589 + export type CallWithNoContentResponseResponses = { 1590 + /** 1591 + * Success 1592 + */ 1593 + 204: void; 1594 + }; 1595 + 1596 + export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; 1597 + 1598 + export type CallWithResponseAndNoContentResponseData = { 1599 + body?: never; 1600 + path?: never; 1601 + query?: never; 1602 + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; 1603 + }; 1604 + 1605 + export type CallWithResponseAndNoContentResponseResponses = { 1606 + /** 1607 + * Response is a simple number 1608 + */ 1609 + 200: number; 1610 + /** 1611 + * Success 1612 + */ 1613 + 204: void; 1614 + }; 1615 + 1616 + export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; 1617 + 1618 + export type DummyAData = { 1619 + body?: never; 1620 + path?: never; 1621 + query?: never; 1622 + url: '/api/v{api-version}/multiple-tags/a'; 1623 + }; 1624 + 1625 + export type DummyAResponses = { 1626 + 200: _400; 1627 + }; 1628 + 1629 + export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; 1630 + 1631 + export type DummyBData = { 1632 + body?: never; 1633 + path?: never; 1634 + query?: never; 1635 + url: '/api/v{api-version}/multiple-tags/b'; 1636 + }; 1637 + 1638 + export type DummyBResponses = { 1639 + /** 1640 + * Success 1641 + */ 1642 + 204: void; 1643 + }; 1644 + 1645 + export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; 1646 + 1647 + export type CallWithResponseData = { 1648 + body?: never; 1649 + path?: never; 1650 + query?: never; 1651 + url: '/api/v{api-version}/response'; 1652 + }; 1653 + 1654 + export type CallWithResponseResponses = { 1655 + default: Import; 1656 + }; 1657 + 1658 + export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; 1659 + 1660 + export type CallWithDuplicateResponsesData = { 1661 + body?: never; 1662 + path?: never; 1663 + query?: never; 1664 + url: '/api/v{api-version}/response'; 1665 + }; 1666 + 1667 + export type CallWithDuplicateResponsesErrors = { 1668 + /** 1669 + * Message for 500 error 1670 + */ 1671 + 500: ModelWithStringError; 1672 + /** 1673 + * Message for 501 error 1674 + */ 1675 + 501: ModelWithStringError; 1676 + /** 1677 + * Message for 502 error 1678 + */ 1679 + 502: ModelWithStringError; 1680 + /** 1681 + * Message for 4XX errors 1682 + */ 1683 + '4XX': DictionaryWithArray; 1684 + /** 1685 + * Default error response 1686 + */ 1687 + default: ModelWithBoolean; 1688 + }; 1689 + 1690 + export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; 1691 + 1692 + export type CallWithDuplicateResponsesResponses = { 1693 + /** 1694 + * Message for 200 response 1695 + */ 1696 + 200: ModelWithBoolean & ModelWithInteger; 1697 + /** 1698 + * Message for 201 response 1699 + */ 1700 + 201: ModelWithString; 1701 + /** 1702 + * Message for 202 response 1703 + */ 1704 + 202: ModelWithString; 1705 + }; 1706 + 1707 + export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; 1708 + 1709 + export type CallWithResponsesData = { 1710 + body?: never; 1711 + path?: never; 1712 + query?: never; 1713 + url: '/api/v{api-version}/response'; 1714 + }; 1715 + 1716 + export type CallWithResponsesErrors = { 1717 + /** 1718 + * Message for 500 error 1719 + */ 1720 + 500: ModelWithStringError; 1721 + /** 1722 + * Message for 501 error 1723 + */ 1724 + 501: ModelWithStringError; 1725 + /** 1726 + * Message for 502 error 1727 + */ 1728 + 502: ModelWithStringError; 1729 + /** 1730 + * Message for default response 1731 + */ 1732 + default: ModelWithStringError; 1733 + }; 1734 + 1735 + export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; 1736 + 1737 + export type CallWithResponsesResponses = { 1738 + /** 1739 + * Message for 200 response 1740 + */ 1741 + 200: { 1742 + readonly '@namespace.string'?: string; 1743 + readonly '@namespace.integer'?: number; 1744 + readonly value?: Array<ModelWithString>; 1745 + }; 1746 + /** 1747 + * Message for 201 response 1748 + */ 1749 + 201: ModelThatExtends; 1750 + /** 1751 + * Message for 202 response 1752 + */ 1753 + 202: ModelThatExtendsExtends; 1754 + }; 1755 + 1756 + export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; 1757 + 1758 + export type CollectionFormatData = { 1759 + body?: never; 1760 + path?: never; 1761 + query: { 1762 + /** 1763 + * This is an array parameter that is sent as csv format (comma-separated values) 1764 + */ 1765 + parameterArrayCSV: Array<string> | null; 1766 + /** 1767 + * This is an array parameter that is sent as ssv format (space-separated values) 1768 + */ 1769 + parameterArraySSV: Array<string> | null; 1770 + /** 1771 + * This is an array parameter that is sent as tsv format (tab-separated values) 1772 + */ 1773 + parameterArrayTSV: Array<string> | null; 1774 + /** 1775 + * This is an array parameter that is sent as pipes format (pipe-separated values) 1776 + */ 1777 + parameterArrayPipes: Array<string> | null; 1778 + /** 1779 + * This is an array parameter that is sent as multi format (multiple parameter instances) 1780 + */ 1781 + parameterArrayMulti: Array<string> | null; 1782 + }; 1783 + url: '/api/v{api-version}/collectionFormat'; 1784 + }; 1785 + 1786 + export type TypesData = { 1787 + body?: never; 1788 + path?: { 1789 + /** 1790 + * This is a number parameter 1791 + */ 1792 + id?: number; 1793 + }; 1794 + query: { 1795 + /** 1796 + * This is a number parameter 1797 + */ 1798 + parameterNumber: number; 1799 + /** 1800 + * This is a string parameter 1801 + */ 1802 + parameterString: string | null; 1803 + /** 1804 + * This is a boolean parameter 1805 + */ 1806 + parameterBoolean: boolean | null; 1807 + /** 1808 + * This is an object parameter 1809 + */ 1810 + parameterObject: { 1811 + [key: string]: unknown; 1812 + } | null; 1813 + /** 1814 + * This is an array parameter 1815 + */ 1816 + parameterArray: Array<string> | null; 1817 + /** 1818 + * This is a dictionary parameter 1819 + */ 1820 + parameterDictionary: { 1821 + [key: string]: unknown; 1822 + } | null; 1823 + /** 1824 + * This is an enum parameter 1825 + */ 1826 + parameterEnum: 'Success' | 'Warning' | 'Error' | null; 1827 + }; 1828 + url: '/api/v{api-version}/types'; 1829 + }; 1830 + 1831 + export type TypesResponses = { 1832 + /** 1833 + * Response is a simple number 1834 + */ 1835 + 200: number; 1836 + /** 1837 + * Response is a simple string 1838 + */ 1839 + 201: string; 1840 + /** 1841 + * Response is a simple boolean 1842 + */ 1843 + 202: boolean; 1844 + /** 1845 + * Response is a simple object 1846 + */ 1847 + 203: { 1848 + [key: string]: unknown; 1849 + }; 1850 + }; 1851 + 1852 + export type TypesResponse = TypesResponses[keyof TypesResponses]; 1853 + 1854 + export type UploadFileData = { 1855 + body: Blob | File; 1856 + path: { 1857 + /** 1858 + * api-version should be required in standalone clients 1859 + */ 1860 + 'api-version': string | null; 1861 + }; 1862 + query?: never; 1863 + url: '/api/v{api-version}/upload'; 1864 + }; 1865 + 1866 + export type UploadFileResponses = { 1867 + 200: boolean; 1868 + }; 1869 + 1870 + export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; 1871 + 1872 + export type FileResponseData = { 1873 + body?: never; 1874 + path: { 1875 + id: string; 1876 + /** 1877 + * api-version should be required in standalone clients 1878 + */ 1879 + 'api-version': string; 1880 + }; 1881 + query?: never; 1882 + url: '/api/v{api-version}/file/{id}'; 1883 + }; 1884 + 1885 + export type FileResponseResponses = { 1886 + /** 1887 + * Success 1888 + */ 1889 + 200: Blob | File; 1890 + }; 1891 + 1892 + export type FileResponseResponse = FileResponseResponses[keyof FileResponseResponses]; 1893 + 1894 + export type ComplexTypesData = { 1895 + body?: never; 1896 + path?: never; 1897 + query: { 1898 + /** 1899 + * Parameter containing object 1900 + */ 1901 + parameterObject: { 1902 + first?: { 1903 + second?: { 1904 + third?: string; 1905 + }; 1906 + }; 1907 + }; 1908 + /** 1909 + * Parameter containing reference 1910 + */ 1911 + parameterReference: ModelWithString; 1912 + }; 1913 + url: '/api/v{api-version}/complex'; 1914 + }; 1915 + 1916 + export type ComplexTypesErrors = { 1917 + /** 1918 + * 400 `server` error 1919 + */ 1920 + 400: unknown; 1921 + /** 1922 + * 500 server error 1923 + */ 1924 + 500: unknown; 1925 + }; 1926 + 1927 + export type ComplexTypesResponses = { 1928 + /** 1929 + * Successful response 1930 + */ 1931 + 200: Array<ModelWithString>; 1932 + }; 1933 + 1934 + export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; 1935 + 1936 + export type MultipartResponseData = { 1937 + body?: never; 1938 + path?: never; 1939 + query?: never; 1940 + url: '/api/v{api-version}/multipart'; 1941 + }; 1942 + 1943 + export type MultipartResponseResponses = { 1944 + /** 1945 + * OK 1946 + */ 1947 + 200: { 1948 + file?: Blob | File; 1949 + metadata?: { 1950 + foo?: string; 1951 + bar?: string; 1952 + }; 1953 + }; 1954 + }; 1955 + 1956 + export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; 1957 + 1958 + export type MultipartRequestData = { 1959 + body?: { 1960 + content?: Blob | File; 1961 + data?: ModelWithString | null; 1962 + }; 1963 + path?: never; 1964 + query?: never; 1965 + url: '/api/v{api-version}/multipart'; 1966 + }; 1967 + 1968 + export type ComplexParamsData = { 1969 + body?: { 1970 + readonly key: string | null; 1971 + name: string | null; 1972 + enabled?: boolean; 1973 + type: 'Monkey' | 'Horse' | 'Bird'; 1974 + listOfModels?: Array<ModelWithString> | null; 1975 + listOfStrings?: Array<string> | null; 1976 + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 1977 + readonly user?: { 1978 + readonly id?: number; 1979 + readonly name?: string | null; 1980 + }; 1981 + }; 1982 + path: { 1983 + id: number; 1984 + /** 1985 + * api-version should be required in standalone clients 1986 + */ 1987 + 'api-version': string; 1988 + }; 1989 + query?: never; 1990 + url: '/api/v{api-version}/complex/{id}'; 1991 + }; 1992 + 1993 + export type ComplexParamsResponses = { 1994 + /** 1995 + * Success 1996 + */ 1997 + 200: ModelWithString; 1998 + }; 1999 + 2000 + export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; 2001 + 2002 + export type CallWithResultFromHeaderData = { 2003 + body?: never; 2004 + path?: never; 2005 + query?: never; 2006 + url: '/api/v{api-version}/header'; 2007 + }; 2008 + 2009 + export type CallWithResultFromHeaderErrors = { 2010 + /** 2011 + * 400 server error 2012 + */ 2013 + 400: unknown; 2014 + /** 2015 + * 500 server error 2016 + */ 2017 + 500: unknown; 2018 + }; 2019 + 2020 + export type CallWithResultFromHeaderResponses = { 2021 + /** 2022 + * Successful response 2023 + */ 2024 + 200: unknown; 2025 + }; 2026 + 2027 + export type TestErrorCodeData = { 2028 + body?: never; 2029 + path?: never; 2030 + query: { 2031 + /** 2032 + * Status code to return 2033 + */ 2034 + status: number; 2035 + }; 2036 + url: '/api/v{api-version}/error'; 2037 + }; 2038 + 2039 + export type TestErrorCodeErrors = { 2040 + /** 2041 + * Custom message: Internal Server Error 2042 + */ 2043 + 500: unknown; 2044 + /** 2045 + * Custom message: Not Implemented 2046 + */ 2047 + 501: unknown; 2048 + /** 2049 + * Custom message: Bad Gateway 2050 + */ 2051 + 502: unknown; 2052 + /** 2053 + * Custom message: Service Unavailable 2054 + */ 2055 + 503: unknown; 2056 + }; 2057 + 2058 + export type TestErrorCodeResponses = { 2059 + /** 2060 + * Custom message: Successful response 2061 + */ 2062 + 200: unknown; 2063 + }; 2064 + 2065 + export type NonAsciiæøåÆøÅöôêÊ字符串Data = { 2066 + body?: never; 2067 + path?: never; 2068 + query: { 2069 + /** 2070 + * Dummy input param 2071 + */ 2072 + nonAsciiParamæøåÆØÅöôêÊ: number; 2073 + }; 2074 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2075 + }; 2076 + 2077 + export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { 2078 + /** 2079 + * Successful response 2080 + */ 2081 + 200: Array<NonAsciiStringæøåÆøÅöôêÊ字符串>; 2082 + }; 2083 + 2084 + export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; 2085 + 2086 + export type PutWithFormUrlEncodedData = { 2087 + body: ArrayWithStrings; 2088 + path?: never; 2089 + query?: never; 2090 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2091 + };
+16
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { type ClientOptions, type Config, createClient, createConfig } from './client/index.js'; 4 + import type { ClientOptions as ClientOptions2 } from './types.gen.js'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 15 + 16 + export const client = createClient(createConfig<ClientOptions2>({ baseUrl: 'http://localhost:3000/base' }));
+287
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/client/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { ofetch, type ResponseType as OfetchResponseType } from 'ofetch'; 4 + 5 + import { createSseClient } from '../core/serverSentEvents.gen.js'; 6 + import type { HttpMethod } from '../core/types.gen.js'; 7 + import { getValidRequestBody } from '../core/utils.gen.js'; 8 + import type { 9 + Client, 10 + Config, 11 + RequestOptions, 12 + ResolvedRequestOptions, 13 + } from './types.gen.js'; 14 + import { 15 + buildOfetchOptions, 16 + buildUrl, 17 + createConfig, 18 + createInterceptors, 19 + isRepeatableBody, 20 + mapParseAsToResponseType, 21 + mergeConfigs, 22 + mergeHeaders, 23 + parseError, 24 + parseSuccess, 25 + setAuthParams, 26 + wrapDataReturn, 27 + wrapErrorReturn, 28 + } from './utils.gen.js'; 29 + 30 + type ReqInit = Omit<RequestInit, 'body' | 'headers'> & { 31 + body?: BodyInit | null | undefined; 32 + headers: ReturnType<typeof mergeHeaders>; 33 + }; 34 + 35 + export const createClient = (config: Config = {}): Client => { 36 + let _config = mergeConfigs(createConfig(), config); 37 + 38 + const getConfig = (): Config => ({ ..._config }); 39 + 40 + const setConfig = (config: Config): Config => { 41 + _config = mergeConfigs(_config, config); 42 + return getConfig(); 43 + }; 44 + 45 + const interceptors = createInterceptors< 46 + Request, 47 + Response, 48 + unknown, 49 + ResolvedRequestOptions 50 + >(); 51 + 52 + // precompute serialized / network body 53 + const resolveOptions = async (options: RequestOptions) => { 54 + const opts = { 55 + ..._config, 56 + ...options, 57 + headers: mergeHeaders(_config.headers, options.headers), 58 + serializedBody: undefined, 59 + }; 60 + 61 + if (opts.security) { 62 + await setAuthParams({ 63 + ...opts, 64 + security: opts.security, 65 + }); 66 + } 67 + 68 + if (opts.requestValidator) { 69 + await opts.requestValidator(opts); 70 + } 71 + 72 + if (opts.body !== undefined && opts.bodySerializer) { 73 + opts.serializedBody = opts.bodySerializer(opts.body); 74 + } 75 + 76 + // remove Content-Type if body is empty to avoid invalid requests 77 + if (opts.body === undefined || opts.serializedBody === '') { 78 + opts.headers.delete('Content-Type'); 79 + } 80 + 81 + // if a raw body is provided (no serializer), adjust Content-Type only when it 82 + // equals the default JSON value to better match the concrete body type 83 + if ( 84 + opts.body !== undefined && 85 + opts.bodySerializer === null && 86 + (opts.headers.get('Content-Type') || '').toLowerCase() === 87 + 'application/json' 88 + ) { 89 + const b: unknown = opts.body; 90 + if (typeof FormData !== 'undefined' && b instanceof FormData) { 91 + // let the runtime set the multipart boundary 92 + opts.headers.delete('Content-Type'); 93 + } else if ( 94 + typeof URLSearchParams !== 'undefined' && 95 + b instanceof URLSearchParams 96 + ) { 97 + // standard urlencoded content type (+ charset) 98 + opts.headers.set( 99 + 'Content-Type', 100 + 'application/x-www-form-urlencoded;charset=UTF-8', 101 + ); 102 + } else if (typeof Blob !== 'undefined' && b instanceof Blob) { 103 + const t = b.type?.trim(); 104 + if (t) { 105 + opts.headers.set('Content-Type', t); 106 + } else { 107 + // unknown blob type: avoid sending a misleading JSON header 108 + opts.headers.delete('Content-Type'); 109 + } 110 + } 111 + } 112 + 113 + // precompute network body (stability for retries and interceptors) 114 + const networkBody = getValidRequestBody(opts) as 115 + | RequestInit['body'] 116 + | null 117 + | undefined; 118 + 119 + const url = buildUrl(opts); 120 + 121 + return { networkBody, opts, url }; 122 + }; 123 + 124 + // apply request interceptors and mirror header/method/signal back to opts 125 + const applyRequestInterceptors = async ( 126 + request: Request, 127 + opts: ResolvedRequestOptions, 128 + body: BodyInit | null | undefined, 129 + ) => { 130 + for (const fn of interceptors.request.fns) { 131 + if (fn) { 132 + request = await fn(request, opts); 133 + } 134 + } 135 + // reflect interceptor changes into opts used by the network layer 136 + opts.headers = request.headers; 137 + opts.method = request.method as Uppercase<HttpMethod>; 138 + // ignore request.body changes to avoid turning serialized bodies into streams 139 + // body comes only from getValidRequestBody(options) 140 + // reflect signal if present 141 + opts.signal = (request as any).signal as AbortSignal | undefined; 142 + 143 + // When body is FormData, remove Content-Type header to avoid boundary mismatch. 144 + // Note: We already delete Content-Type in resolveOptions for FormData, but the 145 + // Request constructor (line 175) re-adds it with an auto-generated boundary. 146 + // Since we pass the original FormData (not the Request's body) to ofetch, and 147 + // ofetch will generate its own boundary, we must remove the Request's Content-Type 148 + // to let ofetch set the correct one. Otherwise the boundary in the header won't 149 + // match the boundary in the actual multipart body sent by ofetch. 150 + if (typeof FormData !== 'undefined' && body instanceof FormData) { 151 + opts.headers.delete('Content-Type'); 152 + } 153 + 154 + return request; 155 + }; 156 + 157 + // build ofetch options with stable retry logic based on body repeatability 158 + const buildNetworkOptions = ( 159 + opts: ResolvedRequestOptions, 160 + body: BodyInit | null | undefined, 161 + responseType: OfetchResponseType | undefined, 162 + ) => { 163 + const effectiveRetry = isRepeatableBody(body) 164 + ? (opts.retry as any) 165 + : (0 as any); 166 + return buildOfetchOptions(opts, body, responseType, effectiveRetry); 167 + }; 168 + 169 + const request: Client['request'] = async (options) => { 170 + const { 171 + networkBody: initialNetworkBody, 172 + opts, 173 + url, 174 + } = await resolveOptions(options as any); 175 + // map parseAs -> ofetch responseType once per request 176 + const ofetchResponseType: OfetchResponseType | undefined = 177 + mapParseAsToResponseType(opts.parseAs, opts.responseType); 178 + 179 + const $ofetch = opts.ofetch ?? ofetch; 180 + 181 + // create Request before network to run middleware consistently 182 + const networkBody = initialNetworkBody; 183 + const requestInit: ReqInit = { 184 + body: networkBody, 185 + headers: opts.headers as Headers, 186 + method: opts.method, 187 + redirect: 'follow', 188 + signal: opts.signal, 189 + }; 190 + let request = new Request(url, requestInit); 191 + 192 + request = await applyRequestInterceptors(request, opts, networkBody); 193 + const finalUrl = request.url; 194 + 195 + // build ofetch options and perform the request (.raw keeps the Response) 196 + const responseOptions = buildNetworkOptions( 197 + opts as ResolvedRequestOptions, 198 + networkBody, 199 + ofetchResponseType, 200 + ); 201 + 202 + let response = await $ofetch.raw(finalUrl, responseOptions); 203 + 204 + for (const fn of interceptors.response.fns) { 205 + if (fn) { 206 + response = await fn(response, request, opts); 207 + } 208 + } 209 + 210 + const result = { request, response }; 211 + 212 + if (response.ok) { 213 + const data = await parseSuccess(response, opts, ofetchResponseType); 214 + return wrapDataReturn(data, result, opts.responseStyle); 215 + } 216 + 217 + let finalError = await parseError(response); 218 + 219 + for (const fn of interceptors.error.fns) { 220 + if (fn) { 221 + finalError = await fn(finalError, response, request, opts); 222 + } 223 + } 224 + 225 + // ensure error is never undefined after interceptors 226 + finalError = (finalError as any) || ({} as string); 227 + 228 + if (opts.throwOnError) { 229 + throw finalError; 230 + } 231 + 232 + return wrapErrorReturn(finalError, result, opts.responseStyle) as any; 233 + }; 234 + 235 + const makeMethodFn = 236 + (method: Uppercase<HttpMethod>) => (options: RequestOptions) => 237 + request({ ...options, method } as any); 238 + 239 + const makeSseFn = 240 + (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => { 241 + const { networkBody, opts, url } = await resolveOptions(options); 242 + const optsForSse: any = { ...opts }; 243 + delete optsForSse.body; // body is provided via serializedBody below 244 + return createSseClient({ 245 + ...optsForSse, 246 + fetch: opts.fetch, 247 + headers: opts.headers as Headers, 248 + method, 249 + onRequest: async (url, init) => { 250 + let request = new Request(url, init); 251 + request = await applyRequestInterceptors(request, opts, networkBody); 252 + return request; 253 + }, 254 + serializedBody: networkBody as BodyInit | null | undefined, 255 + signal: opts.signal, 256 + url, 257 + }); 258 + }; 259 + 260 + return { 261 + buildUrl, 262 + connect: makeMethodFn('CONNECT'), 263 + delete: makeMethodFn('DELETE'), 264 + get: makeMethodFn('GET'), 265 + getConfig, 266 + head: makeMethodFn('HEAD'), 267 + interceptors, 268 + options: makeMethodFn('OPTIONS'), 269 + patch: makeMethodFn('PATCH'), 270 + post: makeMethodFn('POST'), 271 + put: makeMethodFn('PUT'), 272 + request, 273 + setConfig, 274 + sse: { 275 + connect: makeSseFn('CONNECT'), 276 + delete: makeSseFn('DELETE'), 277 + get: makeSseFn('GET'), 278 + head: makeSseFn('HEAD'), 279 + options: makeSseFn('OPTIONS'), 280 + patch: makeSseFn('PATCH'), 281 + post: makeSseFn('POST'), 282 + put: makeSseFn('PUT'), 283 + trace: makeSseFn('TRACE'), 284 + }, 285 + trace: makeMethodFn('TRACE'), 286 + } as Client; 287 + };
+25
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/client/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type { Auth } from '../core/auth.gen.js'; 4 + export type { QuerySerializerOptions } from '../core/bodySerializer.gen.js'; 5 + export { 6 + formDataBodySerializer, 7 + jsonBodySerializer, 8 + urlSearchParamsBodySerializer, 9 + } from '../core/bodySerializer.gen.js'; 10 + export { buildClientParams } from '../core/params.gen.js'; 11 + export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen.js'; 12 + export { createClient } from './client.gen.js'; 13 + export type { 14 + Client, 15 + ClientOptions, 16 + Config, 17 + CreateClientConfig, 18 + Options, 19 + RequestOptions, 20 + RequestResult, 21 + ResolvedRequestOptions, 22 + ResponseStyle, 23 + TDataShape, 24 + } from './types.gen.js'; 25 + export { createConfig, mergeHeaders } from './utils.gen.js';
+308
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/client/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { 4 + FetchOptions as OfetchOptions, 5 + ResponseType as OfetchResponseType, 6 + } from 'ofetch'; 7 + import type { ofetch } from 'ofetch'; 8 + 9 + import type { Auth } from '../core/auth.gen.js'; 10 + import type { 11 + ServerSentEventsOptions, 12 + ServerSentEventsResult, 13 + } from '../core/serverSentEvents.gen.js'; 14 + import type { 15 + Client as CoreClient, 16 + Config as CoreConfig, 17 + } from '../core/types.gen.js'; 18 + import type { Middleware } from './utils.gen.js'; 19 + 20 + export type ResponseStyle = 'data' | 'fields'; 21 + 22 + export interface Config<T extends ClientOptions = ClientOptions> 23 + extends Omit<RequestInit, 'body' | 'headers' | 'method'>, 24 + CoreConfig { 25 + /** 26 + * HTTP(S) agent configuration (Node.js only). Passed through to ofetch. 27 + */ 28 + agent?: OfetchOptions['agent']; 29 + /** 30 + * Base URL for all requests made by this client. 31 + */ 32 + baseUrl?: T['baseUrl']; 33 + /** 34 + * Node-only proxy/agent options. 35 + */ 36 + dispatcher?: OfetchOptions['dispatcher']; 37 + /** 38 + * Fetch API implementation. Used for SSE streaming. You can use this option 39 + * to provide a custom fetch instance. 40 + * 41 + * @default globalThis.fetch 42 + */ 43 + fetch?: typeof fetch; 44 + /** 45 + * Controls the native ofetch behaviour that throws `FetchError` when 46 + * `response.ok === false`. We default to suppressing it to match the fetch 47 + * client semantics and let `throwOnError` drive the outcome. 48 + */ 49 + ignoreResponseError?: OfetchOptions['ignoreResponseError']; 50 + // No custom fetch option: provide custom instance via `ofetch` instead 51 + /** 52 + * Please don't use the Fetch client for Next.js applications. The `next` 53 + * options won't have any effect. 54 + * 55 + * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead. 56 + */ 57 + next?: never; 58 + /** 59 + * Custom ofetch instance created via `ofetch.create()`. If provided, it will 60 + * be used for requests instead of the default `ofetch` export. 61 + */ 62 + ofetch?: typeof ofetch; 63 + /** 64 + * ofetch hook called before a request is sent. 65 + */ 66 + onRequest?: OfetchOptions['onRequest']; 67 + /** 68 + * ofetch hook called when a request fails before receiving a response 69 + * (e.g., network errors or aborted requests). 70 + */ 71 + onRequestError?: OfetchOptions['onRequestError']; 72 + /** 73 + * ofetch hook called after a successful response is received and parsed. 74 + */ 75 + onResponse?: OfetchOptions['onResponse']; 76 + /** 77 + * ofetch hook called when the response indicates an error (non-ok status) 78 + * or when response parsing fails. 79 + */ 80 + onResponseError?: OfetchOptions['onResponseError']; 81 + /** 82 + * Return the response data parsed in a specified format. By default, `auto` 83 + * will infer the appropriate method from the `Content-Type` response header. 84 + * You can override this behavior with any of the {@link Body} methods. 85 + * Select `stream` if you don't want to parse response data at all. 86 + * 87 + * @default 'auto' 88 + */ 89 + parseAs?: 90 + | 'arrayBuffer' 91 + | 'auto' 92 + | 'blob' 93 + | 'formData' 94 + | 'json' 95 + | 'stream' 96 + | 'text'; 97 + /** Custom response parser (ofetch). */ 98 + parseResponse?: OfetchOptions['parseResponse']; 99 + /** 100 + * Should we return only data or multiple fields (data, error, response, etc.)? 101 + * 102 + * @default 'fields' 103 + */ 104 + responseStyle?: ResponseStyle; 105 + /** 106 + * ofetch responseType override. If provided, it will be passed directly to 107 + * ofetch and take precedence over `parseAs`. 108 + */ 109 + responseType?: OfetchResponseType; 110 + /** 111 + * Automatically retry failed requests. 112 + */ 113 + retry?: OfetchOptions['retry']; 114 + /** 115 + * Delay (in ms) between retry attempts. 116 + */ 117 + retryDelay?: OfetchOptions['retryDelay']; 118 + /** 119 + * HTTP status codes that should trigger a retry. 120 + */ 121 + retryStatusCodes?: OfetchOptions['retryStatusCodes']; 122 + /** 123 + * Throw an error instead of returning it in the response? 124 + * 125 + * @default false 126 + */ 127 + throwOnError?: T['throwOnError']; 128 + /** 129 + * Abort the request after the given milliseconds. 130 + */ 131 + timeout?: number; 132 + } 133 + 134 + export interface RequestOptions< 135 + TData = unknown, 136 + TResponseStyle extends ResponseStyle = 'fields', 137 + ThrowOnError extends boolean = boolean, 138 + Url extends string = string, 139 + > extends Config<{ 140 + responseStyle: TResponseStyle; 141 + throwOnError: ThrowOnError; 142 + }>, 143 + Pick< 144 + ServerSentEventsOptions<TData>, 145 + | 'onSseError' 146 + | 'onSseEvent' 147 + | 'sseDefaultRetryDelay' 148 + | 'sseMaxRetryAttempts' 149 + | 'sseMaxRetryDelay' 150 + > { 151 + /** 152 + * Any body that you want to add to your request. 153 + * 154 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} 155 + */ 156 + body?: unknown; 157 + path?: Record<string, unknown>; 158 + query?: Record<string, unknown>; 159 + /** 160 + * Security mechanism(s) to use for the request. 161 + */ 162 + security?: ReadonlyArray<Auth>; 163 + url: Url; 164 + } 165 + 166 + export interface ResolvedRequestOptions< 167 + TResponseStyle extends ResponseStyle = 'fields', 168 + ThrowOnError extends boolean = boolean, 169 + Url extends string = string, 170 + > extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> { 171 + serializedBody?: string; 172 + } 173 + 174 + export type RequestResult< 175 + TData = unknown, 176 + TError = unknown, 177 + ThrowOnError extends boolean = boolean, 178 + TResponseStyle extends ResponseStyle = 'fields', 179 + > = ThrowOnError extends true 180 + ? Promise< 181 + TResponseStyle extends 'data' 182 + ? TData extends Record<string, unknown> 183 + ? TData[keyof TData] 184 + : TData 185 + : { 186 + data: TData extends Record<string, unknown> 187 + ? TData[keyof TData] 188 + : TData; 189 + request: Request; 190 + response: Response; 191 + } 192 + > 193 + : Promise< 194 + TResponseStyle extends 'data' 195 + ? 196 + | (TData extends Record<string, unknown> 197 + ? TData[keyof TData] 198 + : TData) 199 + | undefined 200 + : ( 201 + | { 202 + data: TData extends Record<string, unknown> 203 + ? TData[keyof TData] 204 + : TData; 205 + error: undefined; 206 + } 207 + | { 208 + data: undefined; 209 + error: TError extends Record<string, unknown> 210 + ? TError[keyof TError] 211 + : TError; 212 + } 213 + ) & { 214 + request: Request; 215 + response: Response; 216 + } 217 + >; 218 + 219 + export interface ClientOptions { 220 + baseUrl?: string; 221 + responseStyle?: ResponseStyle; 222 + throwOnError?: boolean; 223 + } 224 + 225 + type MethodFn = < 226 + TData = unknown, 227 + TError = unknown, 228 + ThrowOnError extends boolean = false, 229 + TResponseStyle extends ResponseStyle = 'fields', 230 + >( 231 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>, 232 + ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>; 233 + 234 + type SseFn = < 235 + TData = unknown, 236 + TError = unknown, 237 + ThrowOnError extends boolean = false, 238 + TResponseStyle extends ResponseStyle = 'fields', 239 + >( 240 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>, 241 + ) => Promise<ServerSentEventsResult<TData, TError>>; 242 + 243 + type RequestFn = < 244 + TData = unknown, 245 + TError = unknown, 246 + ThrowOnError extends boolean = false, 247 + TResponseStyle extends ResponseStyle = 'fields', 248 + >( 249 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & 250 + Pick< 251 + Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 252 + 'method' 253 + >, 254 + ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>; 255 + 256 + type BuildUrlFn = < 257 + TData extends { 258 + body?: unknown; 259 + path?: Record<string, unknown>; 260 + query?: Record<string, unknown>; 261 + url: string; 262 + }, 263 + >( 264 + options: TData & Options<TData>, 265 + ) => string; 266 + 267 + export type Client = CoreClient< 268 + RequestFn, 269 + Config, 270 + MethodFn, 271 + BuildUrlFn, 272 + SseFn 273 + > & { 274 + interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>; 275 + }; 276 + 277 + /** 278 + * The `createClientConfig()` function will be called on client initialization 279 + * and the returned object will become the client's initial configuration. 280 + * 281 + * You may want to initialize your client this way instead of calling 282 + * `setConfig()`. This is useful for example if you're using Next.js 283 + * to ensure your client always has the correct values. 284 + */ 285 + export type CreateClientConfig<T extends ClientOptions = ClientOptions> = ( 286 + override?: Config<ClientOptions & T>, 287 + ) => Config<Required<ClientOptions> & T>; 288 + 289 + export interface TDataShape { 290 + body?: unknown; 291 + headers?: unknown; 292 + path?: unknown; 293 + query?: unknown; 294 + url: string; 295 + } 296 + 297 + type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>; 298 + 299 + export type Options< 300 + TData extends TDataShape = TDataShape, 301 + ThrowOnError extends boolean = boolean, 302 + TResponse = unknown, 303 + TResponseStyle extends ResponseStyle = 'fields', 304 + > = OmitKeys< 305 + RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 306 + 'body' | 'path' | 'query' | 'url' 307 + > & 308 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
+544
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/client/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { 4 + FetchOptions as OfetchOptions, 5 + ResponseType as OfetchResponseType, 6 + } from 'ofetch'; 7 + 8 + import { getAuthToken } from '../core/auth.gen.js'; 9 + import type { QuerySerializerOptions } from '../core/bodySerializer.gen.js'; 10 + import { jsonBodySerializer } from '../core/bodySerializer.gen.js'; 11 + import { 12 + serializeArrayParam, 13 + serializeObjectParam, 14 + serializePrimitiveParam, 15 + } from '../core/pathSerializer.gen.js'; 16 + import { getUrl } from '../core/utils.gen.js'; 17 + import type { 18 + Client, 19 + ClientOptions, 20 + Config, 21 + RequestOptions, 22 + ResolvedRequestOptions, 23 + ResponseStyle, 24 + } from './types.gen.js'; 25 + 26 + export const createQuerySerializer = <T = unknown>({ 27 + parameters = {}, 28 + ...args 29 + }: QuerySerializerOptions = {}) => { 30 + const querySerializer = (queryParams: T) => { 31 + const search: string[] = []; 32 + if (queryParams && typeof queryParams === 'object') { 33 + for (const name in queryParams) { 34 + const value = queryParams[name]; 35 + 36 + if (value === undefined || value === null) { 37 + continue; 38 + } 39 + 40 + const options = parameters[name] || args; 41 + 42 + if (Array.isArray(value)) { 43 + const serializedArray = serializeArrayParam({ 44 + allowReserved: options.allowReserved, 45 + explode: true, 46 + name, 47 + style: 'form', 48 + value, 49 + ...options.array, 50 + }); 51 + if (serializedArray) search.push(serializedArray); 52 + } else if (typeof value === 'object') { 53 + const serializedObject = serializeObjectParam({ 54 + allowReserved: options.allowReserved, 55 + explode: true, 56 + name, 57 + style: 'deepObject', 58 + value: value as Record<string, unknown>, 59 + ...options.object, 60 + }); 61 + if (serializedObject) search.push(serializedObject); 62 + } else { 63 + const serializedPrimitive = serializePrimitiveParam({ 64 + allowReserved: options.allowReserved, 65 + name, 66 + value: value as string, 67 + }); 68 + if (serializedPrimitive) search.push(serializedPrimitive); 69 + } 70 + } 71 + } 72 + return search.join('&'); 73 + }; 74 + return querySerializer; 75 + }; 76 + 77 + /** 78 + * Infers parseAs value from provided Content-Type header. 79 + */ 80 + export const getParseAs = ( 81 + contentType: string | null, 82 + ): Exclude<Config['parseAs'], 'auto'> => { 83 + if (!contentType) { 84 + // If no Content-Type header is provided, the best we can do is return the raw response body, 85 + // which is effectively the same as the 'stream' option. 86 + return 'stream'; 87 + } 88 + 89 + const cleanContent = contentType.split(';')[0]?.trim(); 90 + 91 + if (!cleanContent) { 92 + return; 93 + } 94 + 95 + if ( 96 + cleanContent.startsWith('application/json') || 97 + cleanContent.endsWith('+json') 98 + ) { 99 + return 'json'; 100 + } 101 + 102 + if (cleanContent === 'multipart/form-data') { 103 + return 'formData'; 104 + } 105 + 106 + if ( 107 + ['application/', 'audio/', 'image/', 'video/'].some((type) => 108 + cleanContent.startsWith(type), 109 + ) 110 + ) { 111 + return 'blob'; 112 + } 113 + 114 + if (cleanContent.startsWith('text/')) { 115 + return 'text'; 116 + } 117 + 118 + return; 119 + }; 120 + 121 + /** 122 + * Map our parseAs value to ofetch responseType when not explicitly provided. 123 + */ 124 + export const mapParseAsToResponseType = ( 125 + parseAs: Config['parseAs'] | undefined, 126 + explicit?: OfetchResponseType, 127 + ): OfetchResponseType | undefined => { 128 + if (explicit) return explicit; 129 + switch (parseAs) { 130 + case 'arrayBuffer': 131 + case 'blob': 132 + case 'json': 133 + case 'text': 134 + case 'stream': 135 + return parseAs; 136 + case 'formData': 137 + case 'auto': 138 + default: 139 + return undefined; // let ofetch auto-detect 140 + } 141 + }; 142 + 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Headers; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if ( 153 + options.headers.has(name) || 154 + options.query?.[name] || 155 + options.headers.get('Cookie')?.includes(`${name}=`) 156 + ) { 157 + return true; 158 + } 159 + return false; 160 + }; 161 + 162 + export const setAuthParams = async ({ 163 + security, 164 + ...options 165 + }: Pick<Required<RequestOptions>, 'security'> & 166 + Pick<RequestOptions, 'auth' | 'query'> & { 167 + headers: Headers; 168 + }) => { 169 + for (const auth of security) { 170 + if (checkForExistence(options, auth.name)) { 171 + continue; 172 + } 173 + 174 + const token = await getAuthToken(auth, options.auth); 175 + 176 + if (!token) { 177 + continue; 178 + } 179 + 180 + const name = auth.name ?? 'Authorization'; 181 + 182 + switch (auth.in) { 183 + case 'query': 184 + if (!options.query) { 185 + options.query = {}; 186 + } 187 + options.query[name] = token; 188 + break; 189 + case 'cookie': 190 + options.headers.append('Cookie', `${name}=${token}`); 191 + break; 192 + case 'header': 193 + default: 194 + options.headers.set(name, token); 195 + break; 196 + } 197 + } 198 + }; 199 + 200 + export const buildUrl: Client['buildUrl'] = (options) => 201 + getUrl({ 202 + baseUrl: options.baseUrl as string, 203 + path: options.path, 204 + query: options.query, 205 + querySerializer: 206 + typeof options.querySerializer === 'function' 207 + ? options.querySerializer 208 + : createQuerySerializer(options.querySerializer), 209 + url: options.url, 210 + }); 211 + 212 + export const mergeConfigs = (a: Config, b: Config): Config => { 213 + const config = { ...a, ...b }; 214 + if (config.baseUrl?.endsWith('/')) { 215 + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); 216 + } 217 + config.headers = mergeHeaders(a.headers, b.headers); 218 + return config; 219 + }; 220 + 221 + const headersEntries = (headers: Headers): Array<[string, string]> => { 222 + const entries: Array<[string, string]> = []; 223 + headers.forEach((value, key) => { 224 + entries.push([key, value]); 225 + }); 226 + return entries; 227 + }; 228 + 229 + export const mergeHeaders = ( 230 + ...headers: Array<Required<Config>['headers'] | undefined> 231 + ): Headers => { 232 + const mergedHeaders = new Headers(); 233 + for (const header of headers) { 234 + if (!header) { 235 + continue; 236 + } 237 + 238 + const iterator = 239 + header instanceof Headers 240 + ? headersEntries(header) 241 + : Object.entries(header); 242 + 243 + for (const [key, value] of iterator) { 244 + if (value === null) { 245 + mergedHeaders.delete(key); 246 + } else if (Array.isArray(value)) { 247 + for (const v of value) { 248 + mergedHeaders.append(key, v as string); 249 + } 250 + } else if (value !== undefined) { 251 + // assume object headers are meant to be JSON stringified, i.e. their 252 + // content value in OpenAPI specification is 'application/json' 253 + mergedHeaders.set( 254 + key, 255 + typeof value === 'object' ? JSON.stringify(value) : (value as string), 256 + ); 257 + } 258 + } 259 + } 260 + return mergedHeaders; 261 + }; 262 + 263 + /** 264 + * Heuristic to detect whether a request body can be safely retried. 265 + */ 266 + export const isRepeatableBody = (body: unknown): boolean => { 267 + if (body == null) return true; // undefined/null treated as no-body 268 + if (typeof body === 'string') return true; 269 + if (typeof URLSearchParams !== 'undefined' && body instanceof URLSearchParams) 270 + return true; 271 + if (typeof Uint8Array !== 'undefined' && body instanceof Uint8Array) 272 + return true; 273 + if (typeof ArrayBuffer !== 'undefined' && body instanceof ArrayBuffer) 274 + return true; 275 + if (typeof Blob !== 'undefined' && body instanceof Blob) return true; 276 + if (typeof FormData !== 'undefined' && body instanceof FormData) return true; 277 + // Streams are not repeatable 278 + if (typeof ReadableStream !== 'undefined' && body instanceof ReadableStream) 279 + return false; 280 + // Default: assume non-repeatable for unknown structured bodies 281 + return false; 282 + }; 283 + 284 + /** 285 + * Small helper to unify data vs fields return style. 286 + */ 287 + export const wrapDataReturn = <T>( 288 + data: T, 289 + result: { request: Request; response: Response }, 290 + responseStyle: ResponseStyle | undefined, 291 + ): 292 + | T 293 + | ((T extends Record<string, unknown> ? { data: T } : { data: T }) & 294 + typeof result) => 295 + (responseStyle ?? 'fields') === 'data' 296 + ? (data as any) 297 + : ({ data, ...result } as any); 298 + 299 + /** 300 + * Small helper to unify error vs fields return style. 301 + */ 302 + export const wrapErrorReturn = <E>( 303 + error: E, 304 + result: { request: Request; response: Response }, 305 + responseStyle: ResponseStyle | undefined, 306 + ): 307 + | undefined 308 + | ((E extends Record<string, unknown> ? { error: E } : { error: E }) & 309 + typeof result) => 310 + (responseStyle ?? 'fields') === 'data' 311 + ? undefined 312 + : ({ error, ...result } as any); 313 + 314 + /** 315 + * Build options for $ofetch.raw from our resolved opts and body. 316 + */ 317 + export const buildOfetchOptions = ( 318 + opts: ResolvedRequestOptions, 319 + body: BodyInit | null | undefined, 320 + responseType: OfetchResponseType | undefined, 321 + retryOverride?: OfetchOptions['retry'], 322 + ): OfetchOptions => 323 + ({ 324 + agent: opts.agent as OfetchOptions['agent'], 325 + body, 326 + credentials: opts.credentials as OfetchOptions['credentials'], 327 + dispatcher: opts.dispatcher as OfetchOptions['dispatcher'], 328 + headers: opts.headers as Headers, 329 + ignoreResponseError: 330 + (opts.ignoreResponseError as OfetchOptions['ignoreResponseError']) ?? 331 + true, 332 + method: opts.method, 333 + onRequest: opts.onRequest as OfetchOptions['onRequest'], 334 + onRequestError: opts.onRequestError as OfetchOptions['onRequestError'], 335 + onResponse: opts.onResponse as OfetchOptions['onResponse'], 336 + onResponseError: opts.onResponseError as OfetchOptions['onResponseError'], 337 + parseResponse: opts.parseResponse as OfetchOptions['parseResponse'], 338 + // URL already includes query 339 + query: undefined, 340 + responseType, 341 + retry: retryOverride ?? (opts.retry as OfetchOptions['retry']), 342 + retryDelay: opts.retryDelay as OfetchOptions['retryDelay'], 343 + retryStatusCodes: 344 + opts.retryStatusCodes as OfetchOptions['retryStatusCodes'], 345 + signal: opts.signal, 346 + timeout: opts.timeout as number | undefined, 347 + }) as OfetchOptions; 348 + 349 + /** 350 + * Parse a successful response, handling empty bodies and stream cases. 351 + */ 352 + export const parseSuccess = async ( 353 + response: Response, 354 + opts: ResolvedRequestOptions, 355 + ofetchResponseType?: OfetchResponseType, 356 + ): Promise<unknown> => { 357 + // Stream requested: return stream body 358 + if (ofetchResponseType === 'stream') { 359 + return response.body; 360 + } 361 + 362 + const inferredParseAs = 363 + (opts.parseAs === 'auto' 364 + ? getParseAs(response.headers.get('Content-Type')) 365 + : opts.parseAs) ?? 'json'; 366 + 367 + // Handle empty responses 368 + if ( 369 + response.status === 204 || 370 + response.headers.get('Content-Length') === '0' 371 + ) { 372 + switch (inferredParseAs) { 373 + case 'arrayBuffer': 374 + case 'blob': 375 + case 'text': 376 + return await (response as any)[inferredParseAs](); 377 + case 'formData': 378 + return new FormData(); 379 + case 'stream': 380 + return response.body; 381 + default: 382 + return {}; 383 + } 384 + } 385 + 386 + // Prefer ofetch-populated data unless we explicitly need raw `formData` 387 + let data: unknown = (response as any)._data; 388 + if (inferredParseAs === 'formData' || typeof data === 'undefined') { 389 + switch (inferredParseAs) { 390 + case 'arrayBuffer': 391 + case 'blob': 392 + case 'formData': 393 + case 'text': 394 + data = await (response as any)[inferredParseAs](); 395 + break; 396 + case 'json': { 397 + // Some servers return 200 with no Content-Length and empty body. 398 + // response.json() would throw; detect empty via clone().text() first. 399 + const txt = await response.clone().text(); 400 + if (!txt) { 401 + data = {}; 402 + } else { 403 + data = await (response as any).json(); 404 + } 405 + break; 406 + } 407 + case 'stream': 408 + return response.body; 409 + } 410 + } 411 + 412 + if (inferredParseAs === 'json') { 413 + if (opts.responseValidator) { 414 + await opts.responseValidator(data); 415 + } 416 + if (opts.responseTransformer) { 417 + data = await opts.responseTransformer(data); 418 + } 419 + } 420 + 421 + return data; 422 + }; 423 + 424 + /** 425 + * Parse an error response payload. 426 + */ 427 + export const parseError = async (response: Response): Promise<unknown> => { 428 + let error: unknown = (response as any)._data; 429 + if (typeof error === 'undefined') { 430 + const textError = await response.text(); 431 + try { 432 + error = JSON.parse(textError); 433 + } catch { 434 + error = textError; 435 + } 436 + } 437 + return error ?? ({} as string); 438 + }; 439 + 440 + type ErrInterceptor<Err, Res, Req, Options> = ( 441 + error: Err, 442 + response: Res, 443 + request: Req, 444 + options: Options, 445 + ) => Err | Promise<Err>; 446 + 447 + type ReqInterceptor<Req, Options> = ( 448 + request: Req, 449 + options: Options, 450 + ) => Req | Promise<Req>; 451 + 452 + type ResInterceptor<Res, Req, Options> = ( 453 + response: Res, 454 + request: Req, 455 + options: Options, 456 + ) => Res | Promise<Res>; 457 + 458 + class Interceptors<Interceptor> { 459 + fns: Array<Interceptor | null> = []; 460 + 461 + clear(): void { 462 + this.fns = []; 463 + } 464 + 465 + eject(id: number | Interceptor): void { 466 + const index = this.getInterceptorIndex(id); 467 + if (this.fns[index]) { 468 + this.fns[index] = null; 469 + } 470 + } 471 + 472 + exists(id: number | Interceptor): boolean { 473 + const index = this.getInterceptorIndex(id); 474 + return Boolean(this.fns[index]); 475 + } 476 + 477 + getInterceptorIndex(id: number | Interceptor): number { 478 + if (typeof id === 'number') { 479 + return this.fns[id] ? id : -1; 480 + } 481 + return this.fns.indexOf(id); 482 + } 483 + 484 + update( 485 + id: number | Interceptor, 486 + fn: Interceptor, 487 + ): number | Interceptor | false { 488 + const index = this.getInterceptorIndex(id); 489 + if (this.fns[index]) { 490 + this.fns[index] = fn; 491 + return id; 492 + } 493 + return false; 494 + } 495 + 496 + use(fn: Interceptor): number { 497 + this.fns.push(fn); 498 + return this.fns.length - 1; 499 + } 500 + } 501 + 502 + export interface Middleware<Req, Res, Err, Options> { 503 + error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>; 504 + request: Interceptors<ReqInterceptor<Req, Options>>; 505 + response: Interceptors<ResInterceptor<Res, Req, Options>>; 506 + } 507 + 508 + export const createInterceptors = <Req, Res, Err, Options>(): Middleware< 509 + Req, 510 + Res, 511 + Err, 512 + Options 513 + > => ({ 514 + error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(), 515 + request: new Interceptors<ReqInterceptor<Req, Options>>(), 516 + response: new Interceptors<ResInterceptor<Res, Req, Options>>(), 517 + }); 518 + 519 + const defaultQuerySerializer = createQuerySerializer({ 520 + allowReserved: false, 521 + array: { 522 + explode: true, 523 + style: 'form', 524 + }, 525 + object: { 526 + explode: true, 527 + style: 'deepObject', 528 + }, 529 + }); 530 + 531 + const defaultHeaders = { 532 + 'Content-Type': 'application/json', 533 + }; 534 + 535 + export const createConfig = <T extends ClientOptions = ClientOptions>( 536 + override: Config<Omit<ClientOptions, keyof T> & T> = {}, 537 + ): Config<Omit<ClientOptions, keyof T> & T> => ({ 538 + ...jsonBodySerializer, 539 + headers: defaultHeaders, 540 + ignoreResponseError: true, 541 + parseAs: 'auto', 542 + querySerializer: defaultQuerySerializer, 543 + ...override, 544 + });
+42
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/core/auth.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type AuthToken = string | undefined; 4 + 5 + export interface Auth { 6 + /** 7 + * Which part of the request do we use to send the auth? 8 + * 9 + * @default 'header' 10 + */ 11 + in?: 'header' | 'query' | 'cookie'; 12 + /** 13 + * Header or query parameter name. 14 + * 15 + * @default 'Authorization' 16 + */ 17 + name?: string; 18 + scheme?: 'basic' | 'bearer'; 19 + type: 'apiKey' | 'http'; 20 + } 21 + 22 + export const getAuthToken = async ( 23 + auth: Auth, 24 + callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken, 25 + ): Promise<string | undefined> => { 26 + const token = 27 + typeof callback === 'function' ? await callback(auth) : callback; 28 + 29 + if (!token) { 30 + return; 31 + } 32 + 33 + if (auth.scheme === 'bearer') { 34 + return `Bearer ${token}`; 35 + } 36 + 37 + if (auth.scheme === 'basic') { 38 + return `Basic ${btoa(token)}`; 39 + } 40 + 41 + return token; 42 + };
+100
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/core/bodySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { 4 + ArrayStyle, 5 + ObjectStyle, 6 + SerializerOptions, 7 + } from './pathSerializer.gen.js'; 8 + 9 + export type QuerySerializer = (query: Record<string, unknown>) => string; 10 + 11 + export type BodySerializer = (body: any) => any; 12 + 13 + type QuerySerializerOptionsObject = { 14 + allowReserved?: boolean; 15 + array?: Partial<SerializerOptions<ArrayStyle>>; 16 + object?: Partial<SerializerOptions<ObjectStyle>>; 17 + }; 18 + 19 + export type QuerySerializerOptions = QuerySerializerOptionsObject & { 20 + /** 21 + * Per-parameter serialization overrides. When provided, these settings 22 + * override the global array/object settings for specific parameter names. 23 + */ 24 + parameters?: Record<string, QuerySerializerOptionsObject>; 25 + }; 26 + 27 + const serializeFormDataPair = ( 28 + data: FormData, 29 + key: string, 30 + value: unknown, 31 + ): void => { 32 + if (typeof value === 'string' || value instanceof Blob) { 33 + data.append(key, value); 34 + } else if (value instanceof Date) { 35 + data.append(key, value.toISOString()); 36 + } else { 37 + data.append(key, JSON.stringify(value)); 38 + } 39 + }; 40 + 41 + const serializeUrlSearchParamsPair = ( 42 + data: URLSearchParams, 43 + key: string, 44 + value: unknown, 45 + ): void => { 46 + if (typeof value === 'string') { 47 + data.append(key, value); 48 + } else { 49 + data.append(key, JSON.stringify(value)); 50 + } 51 + }; 52 + 53 + export const formDataBodySerializer = { 54 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 55 + body: T, 56 + ): FormData => { 57 + const data = new FormData(); 58 + 59 + Object.entries(body).forEach(([key, value]) => { 60 + if (value === undefined || value === null) { 61 + return; 62 + } 63 + if (Array.isArray(value)) { 64 + value.forEach((v) => serializeFormDataPair(data, key, v)); 65 + } else { 66 + serializeFormDataPair(data, key, value); 67 + } 68 + }); 69 + 70 + return data; 71 + }, 72 + }; 73 + 74 + export const jsonBodySerializer = { 75 + bodySerializer: <T>(body: T): string => 76 + JSON.stringify(body, (_key, value) => 77 + typeof value === 'bigint' ? value.toString() : value, 78 + ), 79 + }; 80 + 81 + export const urlSearchParamsBodySerializer = { 82 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 83 + body: T, 84 + ): string => { 85 + const data = new URLSearchParams(); 86 + 87 + Object.entries(body).forEach(([key, value]) => { 88 + if (value === undefined || value === null) { 89 + return; 90 + } 91 + if (Array.isArray(value)) { 92 + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); 93 + } else { 94 + serializeUrlSearchParamsPair(data, key, value); 95 + } 96 + }); 97 + 98 + return data.toString(); 99 + }, 100 + };
+176
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/core/params.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + type Slot = 'body' | 'headers' | 'path' | 'query'; 4 + 5 + export type Field = 6 + | { 7 + in: Exclude<Slot, 'body'>; 8 + /** 9 + * Field name. This is the name we want the user to see and use. 10 + */ 11 + key: string; 12 + /** 13 + * Field mapped name. This is the name we want to use in the request. 14 + * If omitted, we use the same value as `key`. 15 + */ 16 + map?: string; 17 + } 18 + | { 19 + in: Extract<Slot, 'body'>; 20 + /** 21 + * Key isn't required for bodies. 22 + */ 23 + key?: string; 24 + map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 36 + }; 37 + 38 + export interface Fields { 39 + allowExtra?: Partial<Record<Slot, boolean>>; 40 + args?: ReadonlyArray<Field>; 41 + } 42 + 43 + export type FieldsConfig = ReadonlyArray<Field | Fields>; 44 + 45 + const extraPrefixesMap: Record<string, Slot> = { 46 + $body_: 'body', 47 + $headers_: 'headers', 48 + $path_: 'path', 49 + $query_: 'query', 50 + }; 51 + const extraPrefixes = Object.entries(extraPrefixesMap); 52 + 53 + type KeyMap = Map< 54 + string, 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 63 + >; 64 + 65 + const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { 66 + if (!map) { 67 + map = new Map(); 68 + } 69 + 70 + for (const config of fields) { 71 + if ('in' in config) { 72 + if (config.key) { 73 + map.set(config.key, { 74 + in: config.in, 75 + map: config.map, 76 + }); 77 + } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 82 + } else if (config.args) { 83 + buildKeyMap(config.args, map); 84 + } 85 + } 86 + 87 + return map; 88 + }; 89 + 90 + interface Params { 91 + body: unknown; 92 + headers: Record<string, unknown>; 93 + path: Record<string, unknown>; 94 + query: Record<string, unknown>; 95 + } 96 + 97 + const stripEmptySlots = (params: Params) => { 98 + for (const [slot, value] of Object.entries(params)) { 99 + if (value && typeof value === 'object' && !Object.keys(value).length) { 100 + delete params[slot as Slot]; 101 + } 102 + } 103 + }; 104 + 105 + export const buildClientParams = ( 106 + args: ReadonlyArray<unknown>, 107 + fields: FieldsConfig, 108 + ) => { 109 + const params: Params = { 110 + body: {}, 111 + headers: {}, 112 + path: {}, 113 + query: {}, 114 + }; 115 + 116 + const map = buildKeyMap(fields); 117 + 118 + let config: FieldsConfig[number] | undefined; 119 + 120 + for (const [index, arg] of args.entries()) { 121 + if (fields[index]) { 122 + config = fields[index]; 123 + } 124 + 125 + if (!config) { 126 + continue; 127 + } 128 + 129 + if ('in' in config) { 130 + if (config.key) { 131 + const field = map.get(config.key)!; 132 + const name = field.map || config.key; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 136 + } else { 137 + params.body = arg; 138 + } 139 + } else { 140 + for (const [key, value] of Object.entries(arg ?? {})) { 141 + const field = map.get(key); 142 + 143 + if (field) { 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 150 + } else { 151 + const extra = extraPrefixes.find(([prefix]) => 152 + key.startsWith(prefix), 153 + ); 154 + 155 + if (extra) { 156 + const [prefix, slot] = extra; 157 + (params[slot] as Record<string, unknown>)[ 158 + key.slice(prefix.length) 159 + ] = value; 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 162 + if (allowed) { 163 + (params[slot as Slot] as Record<string, unknown>)[key] = value; 164 + break; 165 + } 166 + } 167 + } 168 + } 169 + } 170 + } 171 + } 172 + 173 + stripEmptySlots(params); 174 + 175 + return params; 176 + };
+181
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/core/pathSerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + interface SerializeOptions<T> 4 + extends SerializePrimitiveOptions, 5 + SerializerOptions<T> {} 6 + 7 + interface SerializePrimitiveOptions { 8 + allowReserved?: boolean; 9 + name: string; 10 + } 11 + 12 + export interface SerializerOptions<T> { 13 + /** 14 + * @default true 15 + */ 16 + explode: boolean; 17 + style: T; 18 + } 19 + 20 + export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; 21 + export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; 22 + type MatrixStyle = 'label' | 'matrix' | 'simple'; 23 + export type ObjectStyle = 'form' | 'deepObject'; 24 + type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; 25 + 26 + interface SerializePrimitiveParam extends SerializePrimitiveOptions { 27 + value: string; 28 + } 29 + 30 + export const separatorArrayExplode = (style: ArraySeparatorStyle) => { 31 + switch (style) { 32 + case 'label': 33 + return '.'; 34 + case 'matrix': 35 + return ';'; 36 + case 'simple': 37 + return ','; 38 + default: 39 + return '&'; 40 + } 41 + }; 42 + 43 + export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { 44 + switch (style) { 45 + case 'form': 46 + return ','; 47 + case 'pipeDelimited': 48 + return '|'; 49 + case 'spaceDelimited': 50 + return '%20'; 51 + default: 52 + return ','; 53 + } 54 + }; 55 + 56 + export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { 57 + switch (style) { 58 + case 'label': 59 + return '.'; 60 + case 'matrix': 61 + return ';'; 62 + case 'simple': 63 + return ','; 64 + default: 65 + return '&'; 66 + } 67 + }; 68 + 69 + export const serializeArrayParam = ({ 70 + allowReserved, 71 + explode, 72 + name, 73 + style, 74 + value, 75 + }: SerializeOptions<ArraySeparatorStyle> & { 76 + value: unknown[]; 77 + }) => { 78 + if (!explode) { 79 + const joinedValues = ( 80 + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) 81 + ).join(separatorArrayNoExplode(style)); 82 + switch (style) { 83 + case 'label': 84 + return `.${joinedValues}`; 85 + case 'matrix': 86 + return `;${name}=${joinedValues}`; 87 + case 'simple': 88 + return joinedValues; 89 + default: 90 + return `${name}=${joinedValues}`; 91 + } 92 + } 93 + 94 + const separator = separatorArrayExplode(style); 95 + const joinedValues = value 96 + .map((v) => { 97 + if (style === 'label' || style === 'simple') { 98 + return allowReserved ? v : encodeURIComponent(v as string); 99 + } 100 + 101 + return serializePrimitiveParam({ 102 + allowReserved, 103 + name, 104 + value: v as string, 105 + }); 106 + }) 107 + .join(separator); 108 + return style === 'label' || style === 'matrix' 109 + ? separator + joinedValues 110 + : joinedValues; 111 + }; 112 + 113 + export const serializePrimitiveParam = ({ 114 + allowReserved, 115 + name, 116 + value, 117 + }: SerializePrimitiveParam) => { 118 + if (value === undefined || value === null) { 119 + return ''; 120 + } 121 + 122 + if (typeof value === 'object') { 123 + throw new Error( 124 + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', 125 + ); 126 + } 127 + 128 + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; 129 + }; 130 + 131 + export const serializeObjectParam = ({ 132 + allowReserved, 133 + explode, 134 + name, 135 + style, 136 + value, 137 + valueOnly, 138 + }: SerializeOptions<ObjectSeparatorStyle> & { 139 + value: Record<string, unknown> | Date; 140 + valueOnly?: boolean; 141 + }) => { 142 + if (value instanceof Date) { 143 + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; 144 + } 145 + 146 + if (style !== 'deepObject' && !explode) { 147 + let values: string[] = []; 148 + Object.entries(value).forEach(([key, v]) => { 149 + values = [ 150 + ...values, 151 + key, 152 + allowReserved ? (v as string) : encodeURIComponent(v as string), 153 + ]; 154 + }); 155 + const joinedValues = values.join(','); 156 + switch (style) { 157 + case 'form': 158 + return `${name}=${joinedValues}`; 159 + case 'label': 160 + return `.${joinedValues}`; 161 + case 'matrix': 162 + return `;${name}=${joinedValues}`; 163 + default: 164 + return joinedValues; 165 + } 166 + } 167 + 168 + const separator = separatorObjectExplode(style); 169 + const joinedValues = Object.entries(value) 170 + .map(([key, v]) => 171 + serializePrimitiveParam({ 172 + allowReserved, 173 + name: style === 'deepObject' ? `${name}[${key}]` : key, 174 + value: v as string, 175 + }), 176 + ) 177 + .join(separator); 178 + return style === 'label' || style === 'matrix' 179 + ? separator + joinedValues 180 + : joinedValues; 181 + };
+136
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/core/queryKeySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + /** 4 + * JSON-friendly union that mirrors what Pinia Colada can hash. 5 + */ 6 + export type JsonValue = 7 + | null 8 + | string 9 + | number 10 + | boolean 11 + | JsonValue[] 12 + | { [key: string]: JsonValue }; 13 + 14 + /** 15 + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. 16 + */ 17 + export const queryKeyJsonReplacer = (_key: string, value: unknown) => { 18 + if ( 19 + value === undefined || 20 + typeof value === 'function' || 21 + typeof value === 'symbol' 22 + ) { 23 + return undefined; 24 + } 25 + if (typeof value === 'bigint') { 26 + return value.toString(); 27 + } 28 + if (value instanceof Date) { 29 + return value.toISOString(); 30 + } 31 + return value; 32 + }; 33 + 34 + /** 35 + * Safely stringifies a value and parses it back into a JsonValue. 36 + */ 37 + export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { 38 + try { 39 + const json = JSON.stringify(input, queryKeyJsonReplacer); 40 + if (json === undefined) { 41 + return undefined; 42 + } 43 + return JSON.parse(json) as JsonValue; 44 + } catch { 45 + return undefined; 46 + } 47 + }; 48 + 49 + /** 50 + * Detects plain objects (including objects with a null prototype). 51 + */ 52 + const isPlainObject = (value: unknown): value is Record<string, unknown> => { 53 + if (value === null || typeof value !== 'object') { 54 + return false; 55 + } 56 + const prototype = Object.getPrototypeOf(value as object); 57 + return prototype === Object.prototype || prototype === null; 58 + }; 59 + 60 + /** 61 + * Turns URLSearchParams into a sorted JSON object for deterministic keys. 62 + */ 63 + const serializeSearchParams = (params: URLSearchParams): JsonValue => { 64 + const entries = Array.from(params.entries()).sort(([a], [b]) => 65 + a.localeCompare(b), 66 + ); 67 + const result: Record<string, JsonValue> = {}; 68 + 69 + for (const [key, value] of entries) { 70 + const existing = result[key]; 71 + if (existing === undefined) { 72 + result[key] = value; 73 + continue; 74 + } 75 + 76 + if (Array.isArray(existing)) { 77 + (existing as string[]).push(value); 78 + } else { 79 + result[key] = [existing, value]; 80 + } 81 + } 82 + 83 + return result; 84 + }; 85 + 86 + /** 87 + * Normalizes any accepted value into a JSON-friendly shape for query keys. 88 + */ 89 + export const serializeQueryKeyValue = ( 90 + value: unknown, 91 + ): JsonValue | undefined => { 92 + if (value === null) { 93 + return null; 94 + } 95 + 96 + if ( 97 + typeof value === 'string' || 98 + typeof value === 'number' || 99 + typeof value === 'boolean' 100 + ) { 101 + return value; 102 + } 103 + 104 + if ( 105 + value === undefined || 106 + typeof value === 'function' || 107 + typeof value === 'symbol' 108 + ) { 109 + return undefined; 110 + } 111 + 112 + if (typeof value === 'bigint') { 113 + return value.toString(); 114 + } 115 + 116 + if (value instanceof Date) { 117 + return value.toISOString(); 118 + } 119 + 120 + if (Array.isArray(value)) { 121 + return stringifyToJsonValue(value); 122 + } 123 + 124 + if ( 125 + typeof URLSearchParams !== 'undefined' && 126 + value instanceof URLSearchParams 127 + ) { 128 + return serializeSearchParams(value); 129 + } 130 + 131 + if (isPlainObject(value)) { 132 + return stringifyToJsonValue(value); 133 + } 134 + 135 + return undefined; 136 + };
+266
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/core/serverSentEvents.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Config } from './types.gen.js'; 4 + 5 + export type ServerSentEventsOptions<TData = unknown> = Omit< 6 + RequestInit, 7 + 'method' 8 + > & 9 + Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & { 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 + * Implementing clients can call request interceptors inside this hook. 19 + */ 20 + onRequest?: (url: string, init: RequestInit) => Promise<Request>; 21 + /** 22 + * Callback invoked when a network or parsing error occurs during streaming. 23 + * 24 + * This option applies only if the endpoint returns a stream of events. 25 + * 26 + * @param error The error that occurred. 27 + */ 28 + onSseError?: (error: unknown) => void; 29 + /** 30 + * Callback invoked when an event is streamed from the server. 31 + * 32 + * This option applies only if the endpoint returns a stream of events. 33 + * 34 + * @param event Event streamed from the server. 35 + * @returns Nothing (void). 36 + */ 37 + onSseEvent?: (event: StreamEvent<TData>) => void; 38 + serializedBody?: RequestInit['body']; 39 + /** 40 + * Default retry delay in milliseconds. 41 + * 42 + * This option applies only if the endpoint returns a stream of events. 43 + * 44 + * @default 3000 45 + */ 46 + sseDefaultRetryDelay?: number; 47 + /** 48 + * Maximum number of retry attempts before giving up. 49 + */ 50 + sseMaxRetryAttempts?: number; 51 + /** 52 + * Maximum retry delay in milliseconds. 53 + * 54 + * Applies only when exponential backoff is used. 55 + * 56 + * This option applies only if the endpoint returns a stream of events. 57 + * 58 + * @default 30000 59 + */ 60 + sseMaxRetryDelay?: number; 61 + /** 62 + * Optional sleep function for retry backoff. 63 + * 64 + * Defaults to using `setTimeout`. 65 + */ 66 + sseSleepFn?: (ms: number) => Promise<void>; 67 + url: string; 68 + }; 69 + 70 + export interface StreamEvent<TData = unknown> { 71 + data: TData; 72 + event?: string; 73 + id?: string; 74 + retry?: number; 75 + } 76 + 77 + export type ServerSentEventsResult< 78 + TData = unknown, 79 + TReturn = void, 80 + TNext = unknown, 81 + > = { 82 + stream: AsyncGenerator< 83 + TData extends Record<string, unknown> ? TData[keyof TData] : TData, 84 + TReturn, 85 + TNext 86 + >; 87 + }; 88 + 89 + export const createSseClient = <TData = unknown>({ 90 + onRequest, 91 + onSseError, 92 + onSseEvent, 93 + responseTransformer, 94 + responseValidator, 95 + sseDefaultRetryDelay, 96 + sseMaxRetryAttempts, 97 + sseMaxRetryDelay, 98 + sseSleepFn, 99 + url, 100 + ...options 101 + }: ServerSentEventsOptions): ServerSentEventsResult<TData> => { 102 + let lastEventId: string | undefined; 103 + 104 + const sleep = 105 + sseSleepFn ?? 106 + ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); 107 + 108 + const createStream = async function* () { 109 + let retryDelay: number = sseDefaultRetryDelay ?? 3000; 110 + let attempt = 0; 111 + const signal = options.signal ?? new AbortController().signal; 112 + 113 + while (true) { 114 + if (signal.aborted) break; 115 + 116 + attempt++; 117 + 118 + const headers = 119 + options.headers instanceof Headers 120 + ? options.headers 121 + : new Headers(options.headers as Record<string, string> | undefined); 122 + 123 + if (lastEventId !== undefined) { 124 + headers.set('Last-Event-ID', lastEventId); 125 + } 126 + 127 + try { 128 + const requestInit: RequestInit = { 129 + redirect: 'follow', 130 + ...options, 131 + body: options.serializedBody, 132 + headers, 133 + signal, 134 + }; 135 + let request = new Request(url, requestInit); 136 + if (onRequest) { 137 + request = await onRequest(url, requestInit); 138 + } 139 + // fetch must be assigned here, otherwise it would throw the error: 140 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 141 + const _fetch = options.fetch ?? globalThis.fetch; 142 + const response = await _fetch(request); 143 + 144 + if (!response.ok) 145 + throw new Error( 146 + `SSE failed: ${response.status} ${response.statusText}`, 147 + ); 148 + 149 + if (!response.body) throw new Error('No body in SSE response'); 150 + 151 + const reader = response.body 152 + .pipeThrough(new TextDecoderStream()) 153 + .getReader(); 154 + 155 + let buffer = ''; 156 + 157 + const abortHandler = () => { 158 + try { 159 + reader.cancel(); 160 + } catch { 161 + // noop 162 + } 163 + }; 164 + 165 + signal.addEventListener('abort', abortHandler); 166 + 167 + try { 168 + while (true) { 169 + const { done, value } = await reader.read(); 170 + if (done) break; 171 + buffer += value; 172 + // Normalize line endings: CRLF -> LF, then CR -> LF 173 + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); 174 + 175 + const chunks = buffer.split('\n\n'); 176 + buffer = chunks.pop() ?? ''; 177 + 178 + for (const chunk of chunks) { 179 + const lines = chunk.split('\n'); 180 + const dataLines: Array<string> = []; 181 + let eventName: string | undefined; 182 + 183 + for (const line of lines) { 184 + if (line.startsWith('data:')) { 185 + dataLines.push(line.replace(/^data:\s*/, '')); 186 + } else if (line.startsWith('event:')) { 187 + eventName = line.replace(/^event:\s*/, ''); 188 + } else if (line.startsWith('id:')) { 189 + lastEventId = line.replace(/^id:\s*/, ''); 190 + } else if (line.startsWith('retry:')) { 191 + const parsed = Number.parseInt( 192 + line.replace(/^retry:\s*/, ''), 193 + 10, 194 + ); 195 + if (!Number.isNaN(parsed)) { 196 + retryDelay = parsed; 197 + } 198 + } 199 + } 200 + 201 + let data: unknown; 202 + let parsedJson = false; 203 + 204 + if (dataLines.length) { 205 + const rawData = dataLines.join('\n'); 206 + try { 207 + data = JSON.parse(rawData); 208 + parsedJson = true; 209 + } catch { 210 + data = rawData; 211 + } 212 + } 213 + 214 + if (parsedJson) { 215 + if (responseValidator) { 216 + await responseValidator(data); 217 + } 218 + 219 + if (responseTransformer) { 220 + data = await responseTransformer(data); 221 + } 222 + } 223 + 224 + onSseEvent?.({ 225 + data, 226 + event: eventName, 227 + id: lastEventId, 228 + retry: retryDelay, 229 + }); 230 + 231 + if (dataLines.length) { 232 + yield data as any; 233 + } 234 + } 235 + } 236 + } finally { 237 + signal.removeEventListener('abort', abortHandler); 238 + reader.releaseLock(); 239 + } 240 + 241 + break; // exit loop on normal completion 242 + } catch (error) { 243 + // connection failed or aborted; retry after delay 244 + onSseError?.(error); 245 + 246 + if ( 247 + sseMaxRetryAttempts !== undefined && 248 + attempt >= sseMaxRetryAttempts 249 + ) { 250 + break; // stop after firing error 251 + } 252 + 253 + // exponential backoff: double retry each attempt, cap at 30s 254 + const backoff = Math.min( 255 + retryDelay * 2 ** (attempt - 1), 256 + sseMaxRetryDelay ?? 30000, 257 + ); 258 + await sleep(backoff); 259 + } 260 + } 261 + }; 262 + 263 + const stream = createStream(); 264 + 265 + return { stream }; 266 + };
+118
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/core/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth, AuthToken } from './auth.gen.js'; 4 + import type { 5 + BodySerializer, 6 + QuerySerializer, 7 + QuerySerializerOptions, 8 + } from './bodySerializer.gen.js'; 9 + 10 + export type HttpMethod = 11 + | 'connect' 12 + | 'delete' 13 + | 'get' 14 + | 'head' 15 + | 'options' 16 + | 'patch' 17 + | 'post' 18 + | 'put' 19 + | 'trace'; 20 + 21 + export type Client< 22 + RequestFn = never, 23 + Config = unknown, 24 + MethodFn = never, 25 + BuildUrlFn = never, 26 + SseFn = never, 27 + > = { 28 + /** 29 + * Returns the final request URL. 30 + */ 31 + buildUrl: BuildUrlFn; 32 + getConfig: () => Config; 33 + request: RequestFn; 34 + setConfig: (config: Config) => Config; 35 + } & { 36 + [K in HttpMethod]: MethodFn; 37 + } & ([SseFn] extends [never] 38 + ? { sse?: never } 39 + : { sse: { [K in HttpMethod]: SseFn } }); 40 + 41 + export interface Config { 42 + /** 43 + * Auth token or a function returning auth token. The resolved value will be 44 + * added to the request payload as defined by its `security` array. 45 + */ 46 + auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken; 47 + /** 48 + * A function for serializing request body parameter. By default, 49 + * {@link JSON.stringify()} will be used. 50 + */ 51 + bodySerializer?: BodySerializer | null; 52 + /** 53 + * An object containing any HTTP headers that you want to pre-populate your 54 + * `Headers` object with. 55 + * 56 + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} 57 + */ 58 + headers?: 59 + | RequestInit['headers'] 60 + | Record< 61 + string, 62 + | string 63 + | number 64 + | boolean 65 + | (string | number | boolean)[] 66 + | null 67 + | undefined 68 + | unknown 69 + >; 70 + /** 71 + * The request method. 72 + * 73 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} 74 + */ 75 + method?: Uppercase<HttpMethod>; 76 + /** 77 + * A function for serializing request query parameters. By default, arrays 78 + * will be exploded in form style, objects will be exploded in deepObject 79 + * style, and reserved characters are percent-encoded. 80 + * 81 + * This method will have no effect if the native `paramsSerializer()` Axios 82 + * API function is used. 83 + * 84 + * {@link https://swagger.io/docs/specification/serialization/#query View examples} 85 + */ 86 + querySerializer?: QuerySerializer | QuerySerializerOptions; 87 + /** 88 + * A function validating request data. This is useful if you want to ensure 89 + * the request conforms to the desired shape, so it can be safely sent to 90 + * the server. 91 + */ 92 + requestValidator?: (data: unknown) => Promise<unknown>; 93 + /** 94 + * A function transforming response data before it's returned. This is useful 95 + * for post-processing data, e.g. converting ISO strings into Date objects. 96 + */ 97 + responseTransformer?: (data: unknown) => Promise<unknown>; 98 + /** 99 + * A function validating response data. This is useful if you want to ensure 100 + * the response conforms to the desired shape, so it can be safely passed to 101 + * the transformers and returned to the user. 102 + */ 103 + responseValidator?: (data: unknown) => Promise<unknown>; 104 + } 105 + 106 + type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 + ? true 108 + : [T] extends [never | undefined] 109 + ? [undefined] extends [T] 110 + ? false 111 + : true 112 + : false; 113 + 114 + export type OmitNever<T extends Record<string, unknown>> = { 115 + [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 + ? never 117 + : K]: T[K]; 118 + };
+143
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/core/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { BodySerializer, QuerySerializer } from './bodySerializer.gen.js'; 4 + import { 5 + type ArraySeparatorStyle, 6 + serializeArrayParam, 7 + serializeObjectParam, 8 + serializePrimitiveParam, 9 + } from './pathSerializer.gen.js'; 10 + 11 + export interface PathSerializer { 12 + path: Record<string, unknown>; 13 + url: string; 14 + } 15 + 16 + export const PATH_PARAM_RE = /\{[^{}]+\}/g; 17 + 18 + export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { 19 + let url = _url; 20 + const matches = _url.match(PATH_PARAM_RE); 21 + if (matches) { 22 + for (const match of matches) { 23 + let explode = false; 24 + let name = match.substring(1, match.length - 1); 25 + let style: ArraySeparatorStyle = 'simple'; 26 + 27 + if (name.endsWith('*')) { 28 + explode = true; 29 + name = name.substring(0, name.length - 1); 30 + } 31 + 32 + if (name.startsWith('.')) { 33 + name = name.substring(1); 34 + style = 'label'; 35 + } else if (name.startsWith(';')) { 36 + name = name.substring(1); 37 + style = 'matrix'; 38 + } 39 + 40 + const value = path[name]; 41 + 42 + if (value === undefined || value === null) { 43 + continue; 44 + } 45 + 46 + if (Array.isArray(value)) { 47 + url = url.replace( 48 + match, 49 + serializeArrayParam({ explode, name, style, value }), 50 + ); 51 + continue; 52 + } 53 + 54 + if (typeof value === 'object') { 55 + url = url.replace( 56 + match, 57 + serializeObjectParam({ 58 + explode, 59 + name, 60 + style, 61 + value: value as Record<string, unknown>, 62 + valueOnly: true, 63 + }), 64 + ); 65 + continue; 66 + } 67 + 68 + if (style === 'matrix') { 69 + url = url.replace( 70 + match, 71 + `;${serializePrimitiveParam({ 72 + name, 73 + value: value as string, 74 + })}`, 75 + ); 76 + continue; 77 + } 78 + 79 + const replaceValue = encodeURIComponent( 80 + style === 'label' ? `.${value as string}` : (value as string), 81 + ); 82 + url = url.replace(match, replaceValue); 83 + } 84 + } 85 + return url; 86 + }; 87 + 88 + export const getUrl = ({ 89 + baseUrl, 90 + path, 91 + query, 92 + querySerializer, 93 + url: _url, 94 + }: { 95 + baseUrl?: string; 96 + path?: Record<string, unknown>; 97 + query?: Record<string, unknown>; 98 + querySerializer: QuerySerializer; 99 + url: string; 100 + }) => { 101 + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; 102 + let url = (baseUrl ?? '') + pathUrl; 103 + if (path) { 104 + url = defaultPathSerializer({ path, url }); 105 + } 106 + let search = query ? querySerializer(query) : ''; 107 + if (search.startsWith('?')) { 108 + search = search.substring(1); 109 + } 110 + if (search) { 111 + url += `?${search}`; 112 + } 113 + return url; 114 + }; 115 + 116 + export function getValidRequestBody(options: { 117 + body?: unknown; 118 + bodySerializer?: BodySerializer | null; 119 + serializedBody?: unknown; 120 + }) { 121 + const hasBody = options.body !== undefined; 122 + const isSerializedBody = hasBody && options.bodySerializer; 123 + 124 + if (isSerializedBody) { 125 + if ('serializedBody' in options) { 126 + const hasSerializedBody = 127 + options.serializedBody !== undefined && options.serializedBody !== ''; 128 + 129 + return hasSerializedBody ? options.serializedBody : null; 130 + } 131 + 132 + // not all clients implement a serializedBody property (i.e. client-axios) 133 + return options.body !== '' ? options.body : null; 134 + } 135 + 136 + // plain/text body 137 + if (hasBody) { 138 + return options.body; 139 + } 140 + 141 + // no body was provided 142 + return undefined; 143 + }
+4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export { apiVVersionODataControllerCount, callToTestOrderOfParams, callWithDefaultOptionalParameters, callWithDefaultParameters, callWithDescriptions, callWithDuplicateResponses, callWithNoContentResponse, callWithParameters, callWithResponse, callWithResponseAndNoContentResponse, callWithResponses, callWithResultFromHeader, callWithWeirdParameterNames, collectionFormat, complexParams, complexTypes, deleteCallWithoutParametersAndResponse, deleteFoo, deprecatedCall, dummyA, dummyB, duplicateName, duplicateName2, duplicateName3, duplicateName4, export_, fileResponse, fooWow, getApiVbyApiVersionSimpleOperation, getCallWithOptionalParam, getCallWithoutParametersAndResponse, headCallWithoutParametersAndResponse, import_, multipartRequest, multipartResponse, nonAsciiæøåÆøÅöôêÊ字符串, type Options, optionsCallWithoutParametersAndResponse, patchApiVbyApiVersionNoTag, patchCallWithoutParametersAndResponse, postApiVbyApiVersionFormData, postApiVbyApiVersionRequestBody, postCallWithOptionalParam, postCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, putWithFormUrlEncoded, testErrorCode, types, uploadFile } from './sdk.gen.js'; 4 + export type { _3eNum1Период, _400, AdditionalPropertiesIntegerIssue, AdditionalPropertiesUnknownIssue, AdditionalPropertiesUnknownIssue2, AdditionalPropertiesUnknownIssue3, AdditionalPropertiesUnknownIssueWritable, AnyOfAnyAndNull, AnyOfArrays, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountResponses, ArrayWithAnyOfProperties, ArrayWithArray, ArrayWithBooleans, ArrayWithNumbers, ArrayWithProperties, ArrayWithReferences, ArrayWithStrings, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponse, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesError, CallWithResponsesErrors, CallWithResponsesResponse, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CamelCaseCommentWithBreaks, CharactersInDescription, ClientOptions, CollectionFormatData, CommentWithBackticks, CommentWithBackticksAndQuotes, CommentWithBreaks, CommentWithExpressionPlaceholders, CommentWithQuotes, CommentWithReservedCharacters, CommentWithSlashes, ComplexParamsData, ComplexParamsResponse, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponse, ComplexTypesResponses, CompositionBaseModel, CompositionExtendedModel, CompositionWithAllOfAndNullable, CompositionWithAnyOf, CompositionWithAnyOfAndNullable, CompositionWithAnyOfAnonymous, CompositionWithNestedAnyAndTypeNull, CompositionWithNestedAnyOfAndNull, CompositionWithOneOf, CompositionWithOneOfAndComplexArrayDictionary, CompositionWithOneOfAndNullable, CompositionWithOneOfAndProperties, CompositionWithOneOfAndSimpleArrayDictionary, CompositionWithOneOfAndSimpleDictionary, CompositionWithOneOfAnonymous, CompositionWithOneOfDiscriminator, ConstValue, Default, DeleteCallWithoutParametersAndResponseData, DeleteFooData, DeleteFooData2, DeleteFooData3, DeprecatedCallData, DeprecatedModel, DictionaryWithArray, DictionaryWithDictionary, DictionaryWithProperties, DictionaryWithPropertiesAndAdditionalProperties, DictionaryWithReference, DictionaryWithString, DummyAData, DummyAResponse, DummyAResponses, DummyBData, DummyBResponse, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, EnumFromDescription, EnumWithExtensions, EnumWithNumbers, EnumWithReplacedCharacters, EnumWithStrings, EnumWithXEnumNames, ExportData, ExternalRefA, ExternalRefB, ExternalSharedExternalSharedModel, File, FileResponseData, FileResponseResponse, FileResponseResponses, FileWritable, FooWowData, FooWowResponses, FreeFormObjectWithAdditionalPropertiesEqEmptyObject, FreeFormObjectWithAdditionalPropertiesEqTrue, FreeFormObjectWithoutAdditionalProperties, GenericSchemaDuplicateIssue1SystemBoolean, GenericSchemaDuplicateIssue1SystemBooleanWritable, GenericSchemaDuplicateIssue1SystemString, GenericSchemaDuplicateIssue1SystemStringWritable, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, Import, ImportData, ImportResponse, ImportResponses, IoK8sApimachineryPkgApisMetaV1DeleteOptions, IoK8sApimachineryPkgApisMetaV1Preconditions, ModelCircle, ModelFromZendesk, ModelSquare, ModelThatExtends, ModelThatExtendsExtends, ModelWithAdditionalPropertiesEqTrue, ModelWithAnyOfConstantSizeArray, ModelWithAnyOfConstantSizeArrayAndIntersect, ModelWithAnyOfConstantSizeArrayNullable, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable, ModelWithArray, ModelWithArrayReadOnlyAndWriteOnly, ModelWithArrayReadOnlyAndWriteOnlyWritable, ModelWithBackticksInDescription, ModelWithBoolean, ModelWithCircularReference, ModelWithConst, ModelWithConstantSizeArray, ModelWithDictionary, ModelWithDuplicateImports, ModelWithDuplicateProperties, ModelWithEnum, ModelWithEnumFromDescription, ModelWithEnumWithHyphen, ModelWithInteger, ModelWithNestedArrayEnums, ModelWithNestedArrayEnumsData, ModelWithNestedArrayEnumsDataBar, ModelWithNestedArrayEnumsDataFoo, ModelWithNestedCompositionEnums, ModelWithNestedEnums, ModelWithNestedProperties, ModelWithNullableObject, ModelWithNullableString, ModelWithNumericEnumUnion, ModelWithOneOfAndProperties, ModelWithOneOfEnum, ModelWithOrderedProperties, ModelWithPattern, ModelWithPatternWritable, ModelWithPrefixItemsConstantSizeArray, ModelWithProperties, ModelWithPropertiesWritable, ModelWithReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnlyWritable, ModelWithReference, ModelWithReferenceWritable, ModelWithString, ModelWithStringError, MultipartRequestData, MultipartResponseData, MultipartResponseResponse, MultipartResponseResponses, NestedAnyOfArraysNullable, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Responses, NonAsciiStringæøåÆøÅöôêÊ字符串, NullableObject, OneOfAllOfIssue, OneOfAllOfIssueWritable, OptionsCallWithoutParametersAndResponseData, Pageable, ParameterSimpleParameterUnused, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PostServiceWithEmptyTagResponse, PostServiceWithEmptyTagResponse2, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, SchemaWithFormRestrictedKeys, SimpleBoolean, SimpleFile, SimpleFormData, SimpleInteger, SimpleParameter, SimpleReference, SimpleRequestBody, SimpleString, SimpleStringWithPattern, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponse, TypesResponses, UploadFileData, UploadFileResponse, UploadFileResponses, XFooBar } from './types.gen.js';
+206
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/sdk.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { client } from './client.gen.js'; 4 + import { type Client, formDataBodySerializer, type Options as Options2, type TDataShape, urlSearchParamsBodySerializer } from './client/index.js'; 5 + import type { ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponses, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesErrors, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CollectionFormatData, ComplexParamsData, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponses, DeleteCallWithoutParametersAndResponseData, DeleteFooData3, DeprecatedCallData, DummyAData, DummyAResponses, DummyBData, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, ExportData, FileResponseData, FileResponseResponses, FooWowData, FooWowResponses, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, ImportData, ImportResponses, MultipartRequestData, MultipartResponseData, MultipartResponseResponses, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Responses, OptionsCallWithoutParametersAndResponseData, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponses, UploadFileData, UploadFileResponses } from './types.gen.js'; 6 + 7 + export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & { 8 + /** 9 + * You can provide a client instance returned by `createClient()` instead of 10 + * individual options. This might be also useful if you want to implement a 11 + * custom client. 12 + */ 13 + client?: Client; 14 + /** 15 + * You can pass arbitrary values through the `meta` object. This can be 16 + * used to access values that aren't defined as part of the SDK function. 17 + */ 18 + meta?: Record<string, unknown>; 19 + }; 20 + 21 + export const export_ = <ThrowOnError extends boolean = false>(options?: Options<ExportData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 22 + 23 + export const patchApiVbyApiVersionNoTag = <ThrowOnError extends boolean = false>(options?: Options<PatchApiVbyApiVersionNoTagData, ThrowOnError>) => (options?.client ?? client).patch<PatchApiVbyApiVersionNoTagResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 24 + 25 + export const import_ = <ThrowOnError extends boolean = false>(options: Options<ImportData, ThrowOnError>) => (options.client ?? client).post<ImportResponses, unknown, ThrowOnError>({ 26 + url: '/api/v{api-version}/no+tag', 27 + ...options, 28 + headers: { 29 + 'Content-Type': 'application/json', 30 + ...options.headers 31 + } 32 + }); 33 + 34 + export const fooWow = <ThrowOnError extends boolean = false>(options?: Options<FooWowData, ThrowOnError>) => (options?.client ?? client).put<FooWowResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no+tag', ...options }); 35 + 36 + export const apiVVersionODataControllerCount = <ThrowOnError extends boolean = false>(options?: Options<ApiVVersionODataControllerCountData, ThrowOnError>) => (options?.client ?? client).get<ApiVVersionODataControllerCountResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple/$count', ...options }); 37 + 38 + export const getApiVbyApiVersionSimpleOperation = <ThrowOnError extends boolean = false>(options: Options<GetApiVbyApiVersionSimpleOperationData, ThrowOnError>) => (options.client ?? client).get<GetApiVbyApiVersionSimpleOperationResponses, GetApiVbyApiVersionSimpleOperationErrors, ThrowOnError>({ url: '/api/v{api-version}/simple:operation', ...options }); 39 + 40 + export const deleteCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<DeleteCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 41 + 42 + export const getCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<GetCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 43 + 44 + export const headCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<HeadCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).head<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 45 + 46 + export const optionsCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<OptionsCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).options<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 47 + 48 + export const patchCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PatchCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).patch<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 49 + 50 + export const postCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PostCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 51 + 52 + export const putCallWithoutParametersAndResponse = <ThrowOnError extends boolean = false>(options?: Options<PutCallWithoutParametersAndResponseData, ThrowOnError>) => (options?.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/simple', ...options }); 53 + 54 + export const deleteFoo = <ThrowOnError extends boolean = false>(options: Options<DeleteFooData3, ThrowOnError>) => (options.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', ...options }); 55 + 56 + export const callWithDescriptions = <ThrowOnError extends boolean = false>(options?: Options<CallWithDescriptionsData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/descriptions', ...options }); 57 + 58 + /** 59 + * @deprecated 60 + */ 61 + export const deprecatedCall = <ThrowOnError extends boolean = false>(options: Options<DeprecatedCallData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/parameters/deprecated', ...options }); 62 + 63 + export const callWithParameters = <ThrowOnError extends boolean = false>(options: Options<CallWithParametersData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ 64 + url: '/api/v{api-version}/parameters/{parameterPath}', 65 + ...options, 66 + headers: { 67 + 'Content-Type': 'application/json', 68 + ...options.headers 69 + } 70 + }); 71 + 72 + export const callWithWeirdParameterNames = <ThrowOnError extends boolean = false>(options: Options<CallWithWeirdParameterNamesData, ThrowOnError>) => (options.client ?? client).post<unknown, unknown, ThrowOnError>({ 73 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', 74 + ...options, 75 + headers: { 76 + 'Content-Type': 'application/json', 77 + ...options.headers 78 + } 79 + }); 80 + 81 + export const getCallWithOptionalParam = <ThrowOnError extends boolean = false>(options: Options<GetCallWithOptionalParamData, ThrowOnError>) => (options.client ?? client).get<unknown, unknown, ThrowOnError>({ 82 + url: '/api/v{api-version}/parameters', 83 + ...options, 84 + headers: { 85 + 'Content-Type': 'application/json', 86 + ...options.headers 87 + } 88 + }); 89 + 90 + export const postCallWithOptionalParam = <ThrowOnError extends boolean = false>(options: Options<PostCallWithOptionalParamData, ThrowOnError>) => (options.client ?? client).post<PostCallWithOptionalParamResponses, unknown, ThrowOnError>({ 91 + url: '/api/v{api-version}/parameters', 92 + ...options, 93 + headers: { 94 + 'Content-Type': 'application/json', 95 + ...options.headers 96 + } 97 + }); 98 + 99 + export const postApiVbyApiVersionRequestBody = <ThrowOnError extends boolean = false>(options?: Options<PostApiVbyApiVersionRequestBodyData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 100 + url: '/api/v{api-version}/requestBody', 101 + ...options, 102 + headers: { 103 + 'Content-Type': 'application/json', 104 + ...options?.headers 105 + } 106 + }); 107 + 108 + export const postApiVbyApiVersionFormData = <ThrowOnError extends boolean = false>(options?: Options<PostApiVbyApiVersionFormDataData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 109 + ...formDataBodySerializer, 110 + url: '/api/v{api-version}/formData', 111 + ...options, 112 + headers: { 113 + 'Content-Type': null, 114 + ...options?.headers 115 + } 116 + }); 117 + 118 + export const callWithDefaultParameters = <ThrowOnError extends boolean = false>(options?: Options<CallWithDefaultParametersData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 119 + 120 + export const callWithDefaultOptionalParameters = <ThrowOnError extends boolean = false>(options?: Options<CallWithDefaultOptionalParametersData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 121 + 122 + export const callToTestOrderOfParams = <ThrowOnError extends boolean = false>(options: Options<CallToTestOrderOfParamsData, ThrowOnError>) => (options.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/defaults', ...options }); 123 + 124 + export const duplicateName = <ThrowOnError extends boolean = false>(options?: Options<DuplicateNameData, ThrowOnError>) => (options?.client ?? client).delete<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 125 + 126 + export const duplicateName2 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName2Data, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 127 + 128 + export const duplicateName3 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName3Data, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 129 + 130 + export const duplicateName4 = <ThrowOnError extends boolean = false>(options?: Options<DuplicateName4Data, ThrowOnError>) => (options?.client ?? client).put<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/duplicate', ...options }); 131 + 132 + export const callWithNoContentResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithNoContentResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithNoContentResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/no-content', ...options }); 133 + 134 + export const callWithResponseAndNoContentResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponseAndNoContentResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithResponseAndNoContentResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/response-and-no-content', ...options }); 135 + 136 + export const dummyA = <ThrowOnError extends boolean = false>(options?: Options<DummyAData, ThrowOnError>) => (options?.client ?? client).get<DummyAResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/a', ...options }); 137 + 138 + export const dummyB = <ThrowOnError extends boolean = false>(options?: Options<DummyBData, ThrowOnError>) => (options?.client ?? client).get<DummyBResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multiple-tags/b', ...options }); 139 + 140 + export const callWithResponse = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponseData, ThrowOnError>) => (options?.client ?? client).get<CallWithResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 141 + 142 + export const callWithDuplicateResponses = <ThrowOnError extends boolean = false>(options?: Options<CallWithDuplicateResponsesData, ThrowOnError>) => (options?.client ?? client).post<CallWithDuplicateResponsesResponses, CallWithDuplicateResponsesErrors, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 143 + 144 + export const callWithResponses = <ThrowOnError extends boolean = false>(options?: Options<CallWithResponsesData, ThrowOnError>) => (options?.client ?? client).put<CallWithResponsesResponses, CallWithResponsesErrors, ThrowOnError>({ url: '/api/v{api-version}/response', ...options }); 145 + 146 + export const collectionFormat = <ThrowOnError extends boolean = false>(options: Options<CollectionFormatData, ThrowOnError>) => (options.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/api/v{api-version}/collectionFormat', ...options }); 147 + 148 + export const types = <ThrowOnError extends boolean = false>(options: Options<TypesData, ThrowOnError>) => (options.client ?? client).get<TypesResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/types', ...options }); 149 + 150 + export const uploadFile = <ThrowOnError extends boolean = false>(options: Options<UploadFileData, ThrowOnError>) => (options.client ?? client).post<UploadFileResponses, unknown, ThrowOnError>({ 151 + ...urlSearchParamsBodySerializer, 152 + url: '/api/v{api-version}/upload', 153 + ...options, 154 + headers: { 155 + 'Content-Type': 'application/x-www-form-urlencoded', 156 + ...options.headers 157 + } 158 + }); 159 + 160 + export const fileResponse = <ThrowOnError extends boolean = false>(options: Options<FileResponseData, ThrowOnError>) => (options.client ?? client).get<FileResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/file/{id}', ...options }); 161 + 162 + export const complexTypes = <ThrowOnError extends boolean = false>(options: Options<ComplexTypesData, ThrowOnError>) => (options.client ?? client).get<ComplexTypesResponses, ComplexTypesErrors, ThrowOnError>({ 163 + querySerializer: { parameters: { parameterObject: { object: { style: 'form' } } } }, 164 + url: '/api/v{api-version}/complex', 165 + ...options 166 + }); 167 + 168 + export const multipartResponse = <ThrowOnError extends boolean = false>(options?: Options<MultipartResponseData, ThrowOnError>) => (options?.client ?? client).get<MultipartResponseResponses, unknown, ThrowOnError>({ url: '/api/v{api-version}/multipart', ...options }); 169 + 170 + export const multipartRequest = <ThrowOnError extends boolean = false>(options?: Options<MultipartRequestData, ThrowOnError>) => (options?.client ?? client).post<unknown, unknown, ThrowOnError>({ 171 + ...formDataBodySerializer, 172 + url: '/api/v{api-version}/multipart', 173 + ...options, 174 + headers: { 175 + 'Content-Type': null, 176 + ...options?.headers 177 + } 178 + }); 179 + 180 + export const complexParams = <ThrowOnError extends boolean = false>(options: Options<ComplexParamsData, ThrowOnError>) => (options.client ?? client).put<ComplexParamsResponses, unknown, ThrowOnError>({ 181 + url: '/api/v{api-version}/complex/{id}', 182 + ...options, 183 + headers: { 184 + 'Content-Type': 'application/json-patch+json', 185 + ...options.headers 186 + } 187 + }); 188 + 189 + export const callWithResultFromHeader = <ThrowOnError extends boolean = false>(options?: Options<CallWithResultFromHeaderData, ThrowOnError>) => (options?.client ?? client).post<CallWithResultFromHeaderResponses, CallWithResultFromHeaderErrors, ThrowOnError>({ url: '/api/v{api-version}/header', ...options }); 190 + 191 + export const testErrorCode = <ThrowOnError extends boolean = false>(options: Options<TestErrorCodeData, ThrowOnError>) => (options.client ?? client).post<TestErrorCodeResponses, TestErrorCodeErrors, ThrowOnError>({ url: '/api/v{api-version}/error', ...options }); 192 + 193 + export const nonAsciiæøåÆøÅöôêÊ字符串 = <ThrowOnError extends boolean = false>(options: Options<NonAsciiæøåÆøÅöôêÊ字符串Data, ThrowOnError>) => (options.client ?? client).post<NonAsciiæøåÆøÅöôêÊ字符串Responses, unknown, ThrowOnError>({ url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', ...options }); 194 + 195 + /** 196 + * Login User 197 + */ 198 + export const putWithFormUrlEncoded = <ThrowOnError extends boolean = false>(options: Options<PutWithFormUrlEncodedData, ThrowOnError>) => (options.client ?? client).put<unknown, unknown, ThrowOnError>({ 199 + ...urlSearchParamsBodySerializer, 200 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', 201 + ...options, 202 + headers: { 203 + 'Content-Type': 'application/x-www-form-urlencoded', 204 + ...options.headers 205 + } 206 + });
+2091
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-node16-sdk/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type ClientOptions = { 4 + baseUrl: 'http://localhost:3000/base' | (string & {}); 5 + }; 6 + 7 + /** 8 + * Model with number-only name 9 + */ 10 + export type _400 = string; 11 + 12 + /** 13 + * External ref to shared model (A) 14 + */ 15 + export type ExternalRefA = ExternalSharedExternalSharedModel; 16 + 17 + /** 18 + * External ref to shared model (B) 19 + */ 20 + export type ExternalRefB = ExternalSharedExternalSharedModel; 21 + 22 + /** 23 + * Testing multiline comments in string: First line 24 + * Second line 25 + * 26 + * Fourth line 27 + */ 28 + export type CamelCaseCommentWithBreaks = number; 29 + 30 + /** 31 + * Testing multiline comments in string: First line 32 + * Second line 33 + * 34 + * Fourth line 35 + */ 36 + export type CommentWithBreaks = number; 37 + 38 + /** 39 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 40 + */ 41 + export type CommentWithBackticks = number; 42 + 43 + /** 44 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 45 + */ 46 + export type CommentWithBackticksAndQuotes = number; 47 + 48 + /** 49 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 50 + */ 51 + export type CommentWithSlashes = number; 52 + 53 + /** 54 + * Testing expression placeholders in string: ${expression} should work 55 + */ 56 + export type CommentWithExpressionPlaceholders = number; 57 + 58 + /** 59 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 60 + */ 61 + export type CommentWithQuotes = number; 62 + 63 + /** 64 + * Testing reserved characters in string: * inline * and ** inline ** should work 65 + */ 66 + export type CommentWithReservedCharacters = number; 67 + 68 + /** 69 + * This is a simple number 70 + */ 71 + export type SimpleInteger = number; 72 + 73 + /** 74 + * This is a simple boolean 75 + */ 76 + export type SimpleBoolean = boolean; 77 + 78 + /** 79 + * This is a simple string 80 + */ 81 + export type SimpleString = string; 82 + 83 + /** 84 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 85 + */ 86 + export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; 87 + 88 + /** 89 + * This is a simple file 90 + */ 91 + export type SimpleFile = Blob | File; 92 + 93 + /** 94 + * This is a simple reference 95 + */ 96 + export type SimpleReference = ModelWithString; 97 + 98 + /** 99 + * This is a simple string 100 + */ 101 + export type SimpleStringWithPattern = string | null; 102 + 103 + /** 104 + * This is a simple enum with strings 105 + */ 106 + export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | '\'Single Quote\'' | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; 107 + 108 + export type EnumWithReplacedCharacters = '\'Single Quote\'' | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; 109 + 110 + /** 111 + * This is a simple enum with numbers 112 + */ 113 + export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; 114 + 115 + /** 116 + * Success=1,Warning=2,Error=3 117 + */ 118 + export type EnumFromDescription = number; 119 + 120 + /** 121 + * This is a simple enum with numbers 122 + */ 123 + export type EnumWithExtensions = 200 | 400 | 500; 124 + 125 + export type EnumWithXEnumNames = 0 | 1 | 2; 126 + 127 + /** 128 + * This is a simple array with numbers 129 + */ 130 + export type ArrayWithNumbers = Array<number>; 131 + 132 + /** 133 + * This is a simple array with booleans 134 + */ 135 + export type ArrayWithBooleans = Array<boolean>; 136 + 137 + /** 138 + * This is a simple array with strings 139 + */ 140 + export type ArrayWithStrings = Array<string>; 141 + 142 + /** 143 + * This is a simple array with references 144 + */ 145 + export type ArrayWithReferences = Array<ModelWithString>; 146 + 147 + /** 148 + * This is a simple array containing an array 149 + */ 150 + export type ArrayWithArray = Array<Array<ModelWithString>>; 151 + 152 + /** 153 + * This is a simple array with properties 154 + */ 155 + export type ArrayWithProperties = Array<{ 156 + '16x16'?: CamelCaseCommentWithBreaks; 157 + bar?: string; 158 + }>; 159 + 160 + /** 161 + * This is a simple array with any of properties 162 + */ 163 + export type ArrayWithAnyOfProperties = Array<{ 164 + foo?: string; 165 + } | { 166 + bar?: string; 167 + }>; 168 + 169 + export type AnyOfAnyAndNull = { 170 + data?: unknown | null; 171 + }; 172 + 173 + /** 174 + * This is a simple array with any of properties 175 + */ 176 + export type AnyOfArrays = { 177 + results?: Array<{ 178 + foo?: string; 179 + } | { 180 + bar?: string; 181 + }>; 182 + }; 183 + 184 + /** 185 + * This is a string dictionary 186 + */ 187 + export type DictionaryWithString = { 188 + [key: string]: string; 189 + }; 190 + 191 + export type DictionaryWithPropertiesAndAdditionalProperties = { 192 + foo?: number; 193 + bar?: boolean; 194 + [key: string]: string | number | boolean | undefined; 195 + }; 196 + 197 + /** 198 + * This is a string reference 199 + */ 200 + export type DictionaryWithReference = { 201 + [key: string]: ModelWithString; 202 + }; 203 + 204 + /** 205 + * This is a complex dictionary 206 + */ 207 + export type DictionaryWithArray = { 208 + [key: string]: Array<ModelWithString>; 209 + }; 210 + 211 + /** 212 + * This is a string dictionary 213 + */ 214 + export type DictionaryWithDictionary = { 215 + [key: string]: { 216 + [key: string]: string; 217 + }; 218 + }; 219 + 220 + /** 221 + * This is a complex dictionary 222 + */ 223 + export type DictionaryWithProperties = { 224 + [key: string]: { 225 + foo?: string; 226 + bar?: string; 227 + }; 228 + }; 229 + 230 + /** 231 + * This is a model with one number property 232 + */ 233 + export type ModelWithInteger = { 234 + /** 235 + * This is a simple number property 236 + */ 237 + prop?: number; 238 + }; 239 + 240 + /** 241 + * This is a model with one boolean property 242 + */ 243 + export type ModelWithBoolean = { 244 + /** 245 + * This is a simple boolean property 246 + */ 247 + prop?: boolean; 248 + }; 249 + 250 + /** 251 + * This is a model with one string property 252 + */ 253 + export type ModelWithString = { 254 + /** 255 + * This is a simple string property 256 + */ 257 + prop?: string; 258 + }; 259 + 260 + /** 261 + * This is a model with one string property 262 + */ 263 + export type ModelWithStringError = { 264 + /** 265 + * This is a simple string property 266 + */ 267 + prop?: string; 268 + }; 269 + 270 + /** 271 + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) 272 + */ 273 + export type ModelFromZendesk = string; 274 + 275 + /** 276 + * This is a model with one string property 277 + */ 278 + export type ModelWithNullableString = { 279 + /** 280 + * This is a simple string property 281 + */ 282 + nullableProp1?: string | null; 283 + /** 284 + * This is a simple string property 285 + */ 286 + nullableRequiredProp1: string | null; 287 + /** 288 + * This is a simple string property 289 + */ 290 + nullableProp2?: string | null; 291 + /** 292 + * This is a simple string property 293 + */ 294 + nullableRequiredProp2: string | null; 295 + /** 296 + * This is a simple enum with strings 297 + */ 298 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 299 + }; 300 + 301 + /** 302 + * This is a model with one enum 303 + */ 304 + export type ModelWithEnum = { 305 + /** 306 + * This is a simple enum with strings 307 + */ 308 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 309 + /** 310 + * These are the HTTP error code enums 311 + */ 312 + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; 313 + /** 314 + * Simple boolean enum 315 + */ 316 + bool?: true; 317 + }; 318 + 319 + /** 320 + * This is a model with one enum with escaped name 321 + */ 322 + export type ModelWithEnumWithHyphen = { 323 + /** 324 + * Foo-Bar-Baz-Qux 325 + */ 326 + 'foo-bar-baz-qux'?: '3.0'; 327 + }; 328 + 329 + /** 330 + * This is a model with one enum 331 + */ 332 + export type ModelWithEnumFromDescription = { 333 + /** 334 + * Success=1,Warning=2,Error=3 335 + */ 336 + test?: number; 337 + }; 338 + 339 + /** 340 + * This is a model with nested enums 341 + */ 342 + export type ModelWithNestedEnums = { 343 + dictionaryWithEnum?: { 344 + [key: string]: 'Success' | 'Warning' | 'Error'; 345 + }; 346 + dictionaryWithEnumFromDescription?: { 347 + [key: string]: number; 348 + }; 349 + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; 350 + arrayWithDescription?: Array<number>; 351 + /** 352 + * This is a simple enum with strings 353 + */ 354 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 355 + }; 356 + 357 + /** 358 + * This is a model with one property containing a reference 359 + */ 360 + export type ModelWithReference = { 361 + prop?: ModelWithProperties; 362 + }; 363 + 364 + /** 365 + * This is a model with one property containing an array 366 + */ 367 + export type ModelWithArrayReadOnlyAndWriteOnly = { 368 + prop?: Array<ModelWithReadOnlyAndWriteOnly>; 369 + propWithFile?: Array<Blob | File>; 370 + propWithNumber?: Array<number>; 371 + }; 372 + 373 + /** 374 + * This is a model with one property containing an array 375 + */ 376 + export type ModelWithArray = { 377 + prop?: Array<ModelWithString>; 378 + propWithFile?: Array<Blob | File>; 379 + propWithNumber?: Array<number>; 380 + }; 381 + 382 + /** 383 + * This is a model with one property containing a dictionary 384 + */ 385 + export type ModelWithDictionary = { 386 + prop?: { 387 + [key: string]: string; 388 + }; 389 + }; 390 + 391 + /** 392 + * This is a deprecated model with a deprecated property 393 + * 394 + * @deprecated 395 + */ 396 + export type DeprecatedModel = { 397 + /** 398 + * This is a deprecated property 399 + * 400 + * @deprecated 401 + */ 402 + prop?: string; 403 + }; 404 + 405 + /** 406 + * This is a model with one property containing a circular reference 407 + */ 408 + export type ModelWithCircularReference = { 409 + prop?: ModelWithCircularReference; 410 + }; 411 + 412 + /** 413 + * This is a model with one property with a 'one of' relationship 414 + */ 415 + export type CompositionWithOneOf = { 416 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 417 + }; 418 + 419 + /** 420 + * This is a model with one property with a 'one of' relationship where the options are not $ref 421 + */ 422 + export type CompositionWithOneOfAnonymous = { 423 + propA?: { 424 + propA?: string; 425 + } | string | number; 426 + }; 427 + 428 + /** 429 + * Circle 430 + */ 431 + export type ModelCircle = { 432 + kind: string; 433 + radius?: number; 434 + }; 435 + 436 + /** 437 + * Square 438 + */ 439 + export type ModelSquare = { 440 + kind: string; 441 + sideLength?: number; 442 + }; 443 + 444 + /** 445 + * This is a model with one property with a 'one of' relationship where the options are not $ref 446 + */ 447 + export type CompositionWithOneOfDiscriminator = ({ 448 + kind: 'circle'; 449 + } & ModelCircle) | ({ 450 + kind: 'square'; 451 + } & ModelSquare); 452 + 453 + /** 454 + * This is a model with one property with a 'any of' relationship 455 + */ 456 + export type CompositionWithAnyOf = { 457 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 458 + }; 459 + 460 + /** 461 + * This is a model with one property with a 'any of' relationship where the options are not $ref 462 + */ 463 + export type CompositionWithAnyOfAnonymous = { 464 + propA?: { 465 + propA?: string; 466 + } | string | number; 467 + }; 468 + 469 + /** 470 + * This is a model with nested 'any of' property with a type null 471 + */ 472 + export type CompositionWithNestedAnyAndTypeNull = { 473 + propA?: Array<ModelWithDictionary | null> | Array<ModelWithArray | null>; 474 + }; 475 + 476 + export type _3eNum1Период = 'Bird' | 'Dog'; 477 + 478 + export type ConstValue = 'ConstValue'; 479 + 480 + /** 481 + * This is a model with one property with a 'any of' relationship where the options are not $ref 482 + */ 483 + export type CompositionWithNestedAnyOfAndNull = { 484 + /** 485 + * Scopes 486 + */ 487 + propA?: Array<_3eNum1Период | ConstValue> | null; 488 + }; 489 + 490 + /** 491 + * This is a model with one property with a 'one of' relationship 492 + */ 493 + export type CompositionWithOneOfAndNullable = { 494 + propA?: { 495 + boolean?: boolean; 496 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 497 + }; 498 + 499 + /** 500 + * This is a model that contains a simple dictionary within composition 501 + */ 502 + export type CompositionWithOneOfAndSimpleDictionary = { 503 + propA?: boolean | { 504 + [key: string]: number; 505 + }; 506 + }; 507 + 508 + /** 509 + * This is a model that contains a dictionary of simple arrays within composition 510 + */ 511 + export type CompositionWithOneOfAndSimpleArrayDictionary = { 512 + propA?: boolean | { 513 + [key: string]: Array<boolean>; 514 + }; 515 + }; 516 + 517 + /** 518 + * This is a model that contains a dictionary of complex arrays (composited) within composition 519 + */ 520 + export type CompositionWithOneOfAndComplexArrayDictionary = { 521 + propA?: boolean | { 522 + [key: string]: Array<number | string>; 523 + }; 524 + }; 525 + 526 + /** 527 + * This is a model with one property with a 'all of' relationship 528 + */ 529 + export type CompositionWithAllOfAndNullable = { 530 + propA?: ({ 531 + boolean?: boolean; 532 + } & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null; 533 + }; 534 + 535 + /** 536 + * This is a model with one property with a 'any of' relationship 537 + */ 538 + export type CompositionWithAnyOfAndNullable = { 539 + propA?: { 540 + boolean?: boolean; 541 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 542 + }; 543 + 544 + /** 545 + * This is a base model with two simple optional properties 546 + */ 547 + export type CompositionBaseModel = { 548 + firstName?: string; 549 + lastname?: string; 550 + }; 551 + 552 + /** 553 + * This is a model that extends the base model 554 + */ 555 + export type CompositionExtendedModel = CompositionBaseModel & { 556 + age: number; 557 + firstName: string; 558 + lastname: string; 559 + }; 560 + 561 + /** 562 + * This is a model with one nested property 563 + */ 564 + export type ModelWithProperties = { 565 + required: string; 566 + readonly requiredAndReadOnly: string; 567 + requiredAndNullable: string | null; 568 + string?: string; 569 + number?: number; 570 + boolean?: boolean; 571 + reference?: ModelWithString; 572 + 'property with space'?: string; 573 + default?: string; 574 + try?: string; 575 + readonly '@namespace.string'?: string; 576 + readonly '@namespace.integer'?: number; 577 + }; 578 + 579 + /** 580 + * This is a model with one nested property 581 + */ 582 + export type ModelWithNestedProperties = { 583 + readonly first: { 584 + readonly second: { 585 + readonly third: string | null; 586 + } | null; 587 + } | null; 588 + }; 589 + 590 + /** 591 + * This is a model with duplicated properties 592 + */ 593 + export type ModelWithDuplicateProperties = { 594 + prop?: ModelWithString; 595 + }; 596 + 597 + /** 598 + * This is a model with ordered properties 599 + */ 600 + export type ModelWithOrderedProperties = { 601 + zebra?: string; 602 + apple?: string; 603 + hawaii?: string; 604 + }; 605 + 606 + /** 607 + * This is a model with duplicated imports 608 + */ 609 + export type ModelWithDuplicateImports = { 610 + propA?: ModelWithString; 611 + propB?: ModelWithString; 612 + propC?: ModelWithString; 613 + }; 614 + 615 + /** 616 + * This is a model that extends another model 617 + */ 618 + export type ModelThatExtends = ModelWithString & { 619 + propExtendsA?: string; 620 + propExtendsB?: ModelWithString; 621 + }; 622 + 623 + /** 624 + * This is a model that extends another model 625 + */ 626 + export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { 627 + propExtendsC?: string; 628 + propExtendsD?: ModelWithString; 629 + }; 630 + 631 + /** 632 + * This is a model that contains a some patterns 633 + */ 634 + export type ModelWithPattern = { 635 + key: string; 636 + name: string; 637 + readonly enabled?: boolean; 638 + readonly modified?: string; 639 + id?: string; 640 + text?: string; 641 + patternWithSingleQuotes?: string; 642 + patternWithNewline?: string; 643 + patternWithBacktick?: string; 644 + }; 645 + 646 + export type File = { 647 + /** 648 + * Id 649 + */ 650 + readonly id?: string; 651 + /** 652 + * Updated at 653 + */ 654 + readonly updated_at?: string; 655 + /** 656 + * Created at 657 + */ 658 + readonly created_at?: string; 659 + /** 660 + * Mime 661 + */ 662 + mime: string; 663 + /** 664 + * File 665 + */ 666 + readonly file?: string; 667 + }; 668 + 669 + export type Default = { 670 + name?: string; 671 + }; 672 + 673 + export type Pageable = { 674 + page?: number; 675 + size?: number; 676 + sort?: Array<string>; 677 + }; 678 + 679 + /** 680 + * This is a free-form object without additionalProperties. 681 + */ 682 + export type FreeFormObjectWithoutAdditionalProperties = { 683 + [key: string]: unknown; 684 + }; 685 + 686 + /** 687 + * This is a free-form object with additionalProperties: true. 688 + */ 689 + export type FreeFormObjectWithAdditionalPropertiesEqTrue = { 690 + [key: string]: unknown; 691 + }; 692 + 693 + /** 694 + * This is a free-form object with additionalProperties: {}. 695 + */ 696 + export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { 697 + [key: string]: unknown; 698 + }; 699 + 700 + export type ModelWithConst = { 701 + String?: 'String'; 702 + number?: 0; 703 + null?: null; 704 + withType?: 'Some string'; 705 + }; 706 + 707 + /** 708 + * This is a model with one property and additionalProperties: true 709 + */ 710 + export type ModelWithAdditionalPropertiesEqTrue = { 711 + /** 712 + * This is a simple string property 713 + */ 714 + prop?: string; 715 + [key: string]: unknown | string | undefined; 716 + }; 717 + 718 + export type NestedAnyOfArraysNullable = { 719 + nullableArray?: Array<string | boolean> | null; 720 + }; 721 + 722 + export type CompositionWithOneOfAndProperties = ({ 723 + foo: SimpleParameter; 724 + } | { 725 + bar: NonAsciiStringæøåÆøÅöôêÊ字符串; 726 + }) & { 727 + baz: number | null; 728 + qux: number; 729 + }; 730 + 731 + /** 732 + * An object that can be null 733 + */ 734 + export type NullableObject = { 735 + foo?: string; 736 + } | null; 737 + 738 + /** 739 + * Some % character 740 + */ 741 + export type CharactersInDescription = string; 742 + 743 + export type ModelWithNullableObject = { 744 + data?: NullableObject; 745 + }; 746 + 747 + export type ModelWithOneOfEnum = { 748 + foo: 'Bar'; 749 + } | { 750 + foo: 'Baz'; 751 + } | { 752 + foo: 'Qux'; 753 + } | { 754 + content: string; 755 + foo: 'Quux'; 756 + } | { 757 + content: [ 758 + string, 759 + string 760 + ]; 761 + foo: 'Corge'; 762 + }; 763 + 764 + export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; 765 + 766 + export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; 767 + 768 + export type ModelWithNestedArrayEnumsData = { 769 + foo?: Array<ModelWithNestedArrayEnumsDataFoo>; 770 + bar?: Array<ModelWithNestedArrayEnumsDataBar>; 771 + }; 772 + 773 + export type ModelWithNestedArrayEnums = { 774 + array_strings?: Array<string>; 775 + data?: ModelWithNestedArrayEnumsData; 776 + }; 777 + 778 + export type ModelWithNestedCompositionEnums = { 779 + foo?: ModelWithNestedArrayEnumsDataFoo; 780 + }; 781 + 782 + export type ModelWithReadOnlyAndWriteOnly = { 783 + foo: string; 784 + readonly bar: string; 785 + }; 786 + 787 + export type ModelWithConstantSizeArray = [ 788 + number, 789 + number 790 + ]; 791 + 792 + export type ModelWithAnyOfConstantSizeArray = [ 793 + number | string, 794 + number | string, 795 + number | string 796 + ]; 797 + 798 + export type ModelWithPrefixItemsConstantSizeArray = [ 799 + ModelWithInteger, 800 + number | string, 801 + string 802 + ]; 803 + 804 + export type ModelWithAnyOfConstantSizeArrayNullable = [ 805 + number | null | string, 806 + number | null | string, 807 + number | null | string 808 + ]; 809 + 810 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ 811 + number | Import, 812 + number | Import 813 + ]; 814 + 815 + export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ 816 + number & string, 817 + number & string 818 + ]; 819 + 820 + export type ModelWithNumericEnumUnion = { 821 + /** 822 + * Период 823 + */ 824 + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; 825 + }; 826 + 827 + /** 828 + * Some description with `back ticks` 829 + */ 830 + export type ModelWithBackticksInDescription = { 831 + /** 832 + * The template `that` should be used for parsing and importing the contents of the CSV file. 833 + * 834 + * <br/><p>There is one placeholder currently supported:<ul> <li><b>${x}</b> - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)</li></ul><p>Example of a correct JSON template:</p> 835 + * <pre> 836 + * [ 837 + * { 838 + * "resourceType": "Asset", 839 + * "identifier": { 840 + * "name": "${1}", 841 + * "domain": { 842 + * "name": "${2}", 843 + * "community": { 844 + * "name": "Some Community" 845 + * } 846 + * } 847 + * }, 848 + * "attributes" : { 849 + * "00000000-0000-0000-0000-000000003115" : [ { 850 + * "value" : "${3}" 851 + * } ], 852 + * "00000000-0000-0000-0000-000000000222" : [ { 853 + * "value" : "${4}" 854 + * } ] 855 + * } 856 + * } 857 + * ] 858 + * </pre> 859 + */ 860 + template?: string; 861 + }; 862 + 863 + export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & { 864 + baz: number | null; 865 + qux: number; 866 + }; 867 + 868 + /** 869 + * Model used to test deduplication strategy (unused) 870 + */ 871 + export type ParameterSimpleParameterUnused = string; 872 + 873 + /** 874 + * Model used to test deduplication strategy 875 + */ 876 + export type PostServiceWithEmptyTagResponse = string; 877 + 878 + /** 879 + * Model used to test deduplication strategy 880 + */ 881 + export type PostServiceWithEmptyTagResponse2 = string; 882 + 883 + /** 884 + * Model used to test deduplication strategy 885 + */ 886 + export type DeleteFooData = string; 887 + 888 + /** 889 + * Model used to test deduplication strategy 890 + */ 891 + export type DeleteFooData2 = string; 892 + 893 + /** 894 + * Model with restricted keyword name 895 + */ 896 + export type Import = string; 897 + 898 + export type SchemaWithFormRestrictedKeys = { 899 + description?: string; 900 + 'x-enum-descriptions'?: string; 901 + 'x-enum-varnames'?: string; 902 + 'x-enumNames'?: string; 903 + title?: string; 904 + object?: { 905 + description?: string; 906 + 'x-enum-descriptions'?: string; 907 + 'x-enum-varnames'?: string; 908 + 'x-enumNames'?: string; 909 + title?: string; 910 + }; 911 + array?: Array<{ 912 + description?: string; 913 + 'x-enum-descriptions'?: string; 914 + 'x-enum-varnames'?: string; 915 + 'x-enumNames'?: string; 916 + title?: string; 917 + }>; 918 + }; 919 + 920 + /** 921 + * This schema was giving PascalCase transformations a hard time 922 + */ 923 + export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = { 924 + /** 925 + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. 926 + */ 927 + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; 928 + }; 929 + 930 + /** 931 + * This schema was giving PascalCase transformations a hard time 932 + */ 933 + export type IoK8sApimachineryPkgApisMetaV1Preconditions = { 934 + /** 935 + * Specifies the target ResourceVersion 936 + */ 937 + resourceVersion?: string; 938 + /** 939 + * Specifies the target UID. 940 + */ 941 + uid?: string; 942 + }; 943 + 944 + export type AdditionalPropertiesUnknownIssue = { 945 + [key: string]: string | number; 946 + }; 947 + 948 + export type AdditionalPropertiesUnknownIssue2 = { 949 + [key: string]: string | number; 950 + }; 951 + 952 + export type AdditionalPropertiesUnknownIssue3 = string & { 953 + entries: { 954 + [key: string]: AdditionalPropertiesUnknownIssue; 955 + }; 956 + }; 957 + 958 + export type AdditionalPropertiesIntegerIssue = { 959 + value: number; 960 + [key: string]: number; 961 + }; 962 + 963 + export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 964 + 965 + export type GenericSchemaDuplicateIssue1SystemBoolean = { 966 + item?: boolean; 967 + error?: string | null; 968 + readonly hasError?: boolean; 969 + data?: { 970 + [key: string]: never; 971 + }; 972 + }; 973 + 974 + export type GenericSchemaDuplicateIssue1SystemString = { 975 + item?: string | null; 976 + error?: string | null; 977 + readonly hasError?: boolean; 978 + }; 979 + 980 + export type ExternalSharedExternalSharedModel = { 981 + id: string; 982 + name?: string; 983 + }; 984 + 985 + /** 986 + * This is a model with one property containing a reference 987 + */ 988 + export type ModelWithReferenceWritable = { 989 + prop?: ModelWithPropertiesWritable; 990 + }; 991 + 992 + /** 993 + * This is a model with one property containing an array 994 + */ 995 + export type ModelWithArrayReadOnlyAndWriteOnlyWritable = { 996 + prop?: Array<ModelWithReadOnlyAndWriteOnlyWritable>; 997 + propWithFile?: Array<Blob | File>; 998 + propWithNumber?: Array<number>; 999 + }; 1000 + 1001 + /** 1002 + * This is a model with one nested property 1003 + */ 1004 + export type ModelWithPropertiesWritable = { 1005 + required: string; 1006 + requiredAndNullable: string | null; 1007 + string?: string; 1008 + number?: number; 1009 + boolean?: boolean; 1010 + reference?: ModelWithString; 1011 + 'property with space'?: string; 1012 + default?: string; 1013 + try?: string; 1014 + }; 1015 + 1016 + /** 1017 + * This is a model that contains a some patterns 1018 + */ 1019 + export type ModelWithPatternWritable = { 1020 + key: string; 1021 + name: string; 1022 + id?: string; 1023 + text?: string; 1024 + patternWithSingleQuotes?: string; 1025 + patternWithNewline?: string; 1026 + patternWithBacktick?: string; 1027 + }; 1028 + 1029 + export type FileWritable = { 1030 + /** 1031 + * Mime 1032 + */ 1033 + mime: string; 1034 + }; 1035 + 1036 + export type ModelWithReadOnlyAndWriteOnlyWritable = { 1037 + foo: string; 1038 + baz: string; 1039 + }; 1040 + 1041 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = [ 1042 + number | Import, 1043 + number | Import 1044 + ]; 1045 + 1046 + export type AdditionalPropertiesUnknownIssueWritable = { 1047 + [key: string]: string | number; 1048 + }; 1049 + 1050 + export type OneOfAllOfIssueWritable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 1051 + 1052 + export type GenericSchemaDuplicateIssue1SystemBooleanWritable = { 1053 + item?: boolean; 1054 + error?: string | null; 1055 + data?: { 1056 + [key: string]: never; 1057 + }; 1058 + }; 1059 + 1060 + export type GenericSchemaDuplicateIssue1SystemStringWritable = { 1061 + item?: string | null; 1062 + error?: string | null; 1063 + }; 1064 + 1065 + /** 1066 + * This is a reusable parameter 1067 + */ 1068 + export type SimpleParameter = string; 1069 + 1070 + /** 1071 + * Parameter with illegal characters 1072 + */ 1073 + export type XFooBar = ModelWithString; 1074 + 1075 + /** 1076 + * A reusable request body 1077 + */ 1078 + export type SimpleRequestBody = ModelWithString; 1079 + 1080 + /** 1081 + * A reusable request body 1082 + */ 1083 + export type SimpleFormData = ModelWithString; 1084 + 1085 + export type ExportData = { 1086 + body?: never; 1087 + path?: never; 1088 + query?: never; 1089 + url: '/api/v{api-version}/no+tag'; 1090 + }; 1091 + 1092 + export type PatchApiVbyApiVersionNoTagData = { 1093 + body?: never; 1094 + path?: never; 1095 + query?: never; 1096 + url: '/api/v{api-version}/no+tag'; 1097 + }; 1098 + 1099 + export type PatchApiVbyApiVersionNoTagResponses = { 1100 + /** 1101 + * OK 1102 + */ 1103 + default: unknown; 1104 + }; 1105 + 1106 + export type ImportData = { 1107 + body: ModelWithReadOnlyAndWriteOnlyWritable | ModelWithArrayReadOnlyAndWriteOnlyWritable; 1108 + path?: never; 1109 + query?: never; 1110 + url: '/api/v{api-version}/no+tag'; 1111 + }; 1112 + 1113 + export type ImportResponses = { 1114 + /** 1115 + * Success 1116 + */ 1117 + 200: ModelFromZendesk; 1118 + /** 1119 + * Default success response 1120 + */ 1121 + default: ModelWithReadOnlyAndWriteOnly; 1122 + }; 1123 + 1124 + export type ImportResponse = ImportResponses[keyof ImportResponses]; 1125 + 1126 + export type FooWowData = { 1127 + body?: never; 1128 + path?: never; 1129 + query?: never; 1130 + url: '/api/v{api-version}/no+tag'; 1131 + }; 1132 + 1133 + export type FooWowResponses = { 1134 + /** 1135 + * OK 1136 + */ 1137 + default: unknown; 1138 + }; 1139 + 1140 + export type ApiVVersionODataControllerCountData = { 1141 + body?: never; 1142 + path?: never; 1143 + query?: never; 1144 + url: '/api/v{api-version}/simple/$count'; 1145 + }; 1146 + 1147 + export type ApiVVersionODataControllerCountResponses = { 1148 + /** 1149 + * Success 1150 + */ 1151 + 200: ModelFromZendesk; 1152 + }; 1153 + 1154 + export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; 1155 + 1156 + export type GetApiVbyApiVersionSimpleOperationData = { 1157 + body?: never; 1158 + path: { 1159 + /** 1160 + * foo in method 1161 + */ 1162 + foo_param: string; 1163 + }; 1164 + query?: never; 1165 + url: '/api/v{api-version}/simple:operation'; 1166 + }; 1167 + 1168 + export type GetApiVbyApiVersionSimpleOperationErrors = { 1169 + /** 1170 + * Default error response 1171 + */ 1172 + default: ModelWithBoolean; 1173 + }; 1174 + 1175 + export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; 1176 + 1177 + export type GetApiVbyApiVersionSimpleOperationResponses = { 1178 + /** 1179 + * Response is a simple number 1180 + */ 1181 + 200: number; 1182 + }; 1183 + 1184 + export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; 1185 + 1186 + export type DeleteCallWithoutParametersAndResponseData = { 1187 + body?: never; 1188 + path?: never; 1189 + query?: never; 1190 + url: '/api/v{api-version}/simple'; 1191 + }; 1192 + 1193 + export type GetCallWithoutParametersAndResponseData = { 1194 + body?: never; 1195 + path?: never; 1196 + query?: never; 1197 + url: '/api/v{api-version}/simple'; 1198 + }; 1199 + 1200 + export type HeadCallWithoutParametersAndResponseData = { 1201 + body?: never; 1202 + path?: never; 1203 + query?: never; 1204 + url: '/api/v{api-version}/simple'; 1205 + }; 1206 + 1207 + export type OptionsCallWithoutParametersAndResponseData = { 1208 + body?: never; 1209 + path?: never; 1210 + query?: never; 1211 + url: '/api/v{api-version}/simple'; 1212 + }; 1213 + 1214 + export type PatchCallWithoutParametersAndResponseData = { 1215 + body?: never; 1216 + path?: never; 1217 + query?: never; 1218 + url: '/api/v{api-version}/simple'; 1219 + }; 1220 + 1221 + export type PostCallWithoutParametersAndResponseData = { 1222 + body?: never; 1223 + path?: never; 1224 + query?: never; 1225 + url: '/api/v{api-version}/simple'; 1226 + }; 1227 + 1228 + export type PutCallWithoutParametersAndResponseData = { 1229 + body?: never; 1230 + path?: never; 1231 + query?: never; 1232 + url: '/api/v{api-version}/simple'; 1233 + }; 1234 + 1235 + export type DeleteFooData3 = { 1236 + body?: never; 1237 + headers: { 1238 + /** 1239 + * Parameter with illegal characters 1240 + */ 1241 + 'x-Foo-Bar': ModelWithString; 1242 + }; 1243 + path: { 1244 + /** 1245 + * foo in method 1246 + */ 1247 + foo_param: string; 1248 + /** 1249 + * bar in method 1250 + */ 1251 + BarParam: string; 1252 + }; 1253 + query?: never; 1254 + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; 1255 + }; 1256 + 1257 + export type CallWithDescriptionsData = { 1258 + body?: never; 1259 + path?: never; 1260 + query?: { 1261 + /** 1262 + * Testing multiline comments in string: First line 1263 + * Second line 1264 + * 1265 + * Fourth line 1266 + */ 1267 + parameterWithBreaks?: string; 1268 + /** 1269 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1270 + */ 1271 + parameterWithBackticks?: string; 1272 + /** 1273 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1274 + */ 1275 + parameterWithSlashes?: string; 1276 + /** 1277 + * Testing expression placeholders in string: ${expression} should work 1278 + */ 1279 + parameterWithExpressionPlaceholders?: string; 1280 + /** 1281 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1282 + */ 1283 + parameterWithQuotes?: string; 1284 + /** 1285 + * Testing reserved characters in string: * inline * and ** inline ** should work 1286 + */ 1287 + parameterWithReservedCharacters?: string; 1288 + }; 1289 + url: '/api/v{api-version}/descriptions'; 1290 + }; 1291 + 1292 + export type DeprecatedCallData = { 1293 + body?: never; 1294 + headers: { 1295 + /** 1296 + * This parameter is deprecated 1297 + * 1298 + * @deprecated 1299 + */ 1300 + parameter: DeprecatedModel | null; 1301 + }; 1302 + path?: never; 1303 + query?: never; 1304 + url: '/api/v{api-version}/parameters/deprecated'; 1305 + }; 1306 + 1307 + export type CallWithParametersData = { 1308 + /** 1309 + * This is the parameter that goes into the body 1310 + */ 1311 + body: { 1312 + [key: string]: unknown; 1313 + } | null; 1314 + headers: { 1315 + /** 1316 + * This is the parameter that goes into the header 1317 + */ 1318 + parameterHeader: string | null; 1319 + }; 1320 + path: { 1321 + /** 1322 + * This is the parameter that goes into the path 1323 + */ 1324 + parameterPath: string | null; 1325 + /** 1326 + * api-version should be required in standalone clients 1327 + */ 1328 + 'api-version': string | null; 1329 + }; 1330 + query: { 1331 + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; 1332 + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; 1333 + /** 1334 + * This is the parameter that goes into the query params 1335 + */ 1336 + cursor: string | null; 1337 + }; 1338 + url: '/api/v{api-version}/parameters/{parameterPath}'; 1339 + }; 1340 + 1341 + export type CallWithWeirdParameterNamesData = { 1342 + /** 1343 + * This is the parameter that goes into the body 1344 + */ 1345 + body: ModelWithString | null; 1346 + headers: { 1347 + /** 1348 + * This is the parameter that goes into the request header 1349 + */ 1350 + 'parameter.header': string | null; 1351 + }; 1352 + path: { 1353 + /** 1354 + * This is the parameter that goes into the path 1355 + */ 1356 + 'parameter.path.1'?: string; 1357 + /** 1358 + * This is the parameter that goes into the path 1359 + */ 1360 + 'parameter-path-2'?: string; 1361 + /** 1362 + * This is the parameter that goes into the path 1363 + */ 1364 + 'PARAMETER-PATH-3'?: string; 1365 + /** 1366 + * api-version should be required in standalone clients 1367 + */ 1368 + 'api-version': string | null; 1369 + }; 1370 + query: { 1371 + /** 1372 + * This is the parameter with a reserved keyword 1373 + */ 1374 + default?: string; 1375 + /** 1376 + * This is the parameter that goes into the request query params 1377 + */ 1378 + 'parameter-query': string | null; 1379 + }; 1380 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; 1381 + }; 1382 + 1383 + export type GetCallWithOptionalParamData = { 1384 + /** 1385 + * This is a required parameter 1386 + */ 1387 + body: ModelWithOneOfEnum; 1388 + path?: never; 1389 + query?: { 1390 + /** 1391 + * This is an optional parameter 1392 + */ 1393 + page?: number; 1394 + }; 1395 + url: '/api/v{api-version}/parameters'; 1396 + }; 1397 + 1398 + export type PostCallWithOptionalParamData = { 1399 + /** 1400 + * This is an optional parameter 1401 + */ 1402 + body?: { 1403 + offset?: number | null; 1404 + }; 1405 + path?: never; 1406 + query: { 1407 + /** 1408 + * This is a required parameter 1409 + */ 1410 + parameter: Pageable; 1411 + }; 1412 + url: '/api/v{api-version}/parameters'; 1413 + }; 1414 + 1415 + export type PostCallWithOptionalParamResponses = { 1416 + /** 1417 + * Response is a simple number 1418 + */ 1419 + 200: number; 1420 + /** 1421 + * Success 1422 + */ 1423 + 204: void; 1424 + }; 1425 + 1426 + export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; 1427 + 1428 + export type PostApiVbyApiVersionRequestBodyData = { 1429 + /** 1430 + * A reusable request body 1431 + */ 1432 + body?: SimpleRequestBody; 1433 + path?: never; 1434 + query?: { 1435 + /** 1436 + * This is a reusable parameter 1437 + */ 1438 + parameter?: string; 1439 + }; 1440 + url: '/api/v{api-version}/requestBody'; 1441 + }; 1442 + 1443 + export type PostApiVbyApiVersionFormDataData = { 1444 + /** 1445 + * A reusable request body 1446 + */ 1447 + body?: SimpleFormData; 1448 + path?: never; 1449 + query?: { 1450 + /** 1451 + * This is a reusable parameter 1452 + */ 1453 + parameter?: string; 1454 + }; 1455 + url: '/api/v{api-version}/formData'; 1456 + }; 1457 + 1458 + export type CallWithDefaultParametersData = { 1459 + body?: never; 1460 + path?: never; 1461 + query?: { 1462 + /** 1463 + * This is a simple string with default value 1464 + */ 1465 + parameterString?: string | null; 1466 + /** 1467 + * This is a simple number with default value 1468 + */ 1469 + parameterNumber?: number | null; 1470 + /** 1471 + * This is a simple boolean with default value 1472 + */ 1473 + parameterBoolean?: boolean | null; 1474 + /** 1475 + * This is a simple enum with default value 1476 + */ 1477 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1478 + /** 1479 + * This is a simple model with default value 1480 + */ 1481 + parameterModel?: ModelWithString | null; 1482 + }; 1483 + url: '/api/v{api-version}/defaults'; 1484 + }; 1485 + 1486 + export type CallWithDefaultOptionalParametersData = { 1487 + body?: never; 1488 + path?: never; 1489 + query?: { 1490 + /** 1491 + * This is a simple string that is optional with default value 1492 + */ 1493 + parameterString?: string; 1494 + /** 1495 + * This is a simple number that is optional with default value 1496 + */ 1497 + parameterNumber?: number; 1498 + /** 1499 + * This is a simple boolean that is optional with default value 1500 + */ 1501 + parameterBoolean?: boolean; 1502 + /** 1503 + * This is a simple enum that is optional with default value 1504 + */ 1505 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1506 + /** 1507 + * This is a simple model that is optional with default value 1508 + */ 1509 + parameterModel?: ModelWithString; 1510 + }; 1511 + url: '/api/v{api-version}/defaults'; 1512 + }; 1513 + 1514 + export type CallToTestOrderOfParamsData = { 1515 + body?: never; 1516 + path?: never; 1517 + query: { 1518 + /** 1519 + * This is a optional string with default 1520 + */ 1521 + parameterOptionalStringWithDefault?: string; 1522 + /** 1523 + * This is a optional string with empty default 1524 + */ 1525 + parameterOptionalStringWithEmptyDefault?: string; 1526 + /** 1527 + * This is a optional string with no default 1528 + */ 1529 + parameterOptionalStringWithNoDefault?: string; 1530 + /** 1531 + * This is a string with default 1532 + */ 1533 + parameterStringWithDefault: string; 1534 + /** 1535 + * This is a string with empty default 1536 + */ 1537 + parameterStringWithEmptyDefault: string; 1538 + /** 1539 + * This is a string with no default 1540 + */ 1541 + parameterStringWithNoDefault: string; 1542 + /** 1543 + * This is a string that can be null with no default 1544 + */ 1545 + parameterStringNullableWithNoDefault?: string | null; 1546 + /** 1547 + * This is a string that can be null with default 1548 + */ 1549 + parameterStringNullableWithDefault?: string | null; 1550 + }; 1551 + url: '/api/v{api-version}/defaults'; 1552 + }; 1553 + 1554 + export type DuplicateNameData = { 1555 + body?: never; 1556 + path?: never; 1557 + query?: never; 1558 + url: '/api/v{api-version}/duplicate'; 1559 + }; 1560 + 1561 + export type DuplicateName2Data = { 1562 + body?: never; 1563 + path?: never; 1564 + query?: never; 1565 + url: '/api/v{api-version}/duplicate'; 1566 + }; 1567 + 1568 + export type DuplicateName3Data = { 1569 + body?: never; 1570 + path?: never; 1571 + query?: never; 1572 + url: '/api/v{api-version}/duplicate'; 1573 + }; 1574 + 1575 + export type DuplicateName4Data = { 1576 + body?: never; 1577 + path?: never; 1578 + query?: never; 1579 + url: '/api/v{api-version}/duplicate'; 1580 + }; 1581 + 1582 + export type CallWithNoContentResponseData = { 1583 + body?: never; 1584 + path?: never; 1585 + query?: never; 1586 + url: '/api/v{api-version}/no-content'; 1587 + }; 1588 + 1589 + export type CallWithNoContentResponseResponses = { 1590 + /** 1591 + * Success 1592 + */ 1593 + 204: void; 1594 + }; 1595 + 1596 + export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; 1597 + 1598 + export type CallWithResponseAndNoContentResponseData = { 1599 + body?: never; 1600 + path?: never; 1601 + query?: never; 1602 + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; 1603 + }; 1604 + 1605 + export type CallWithResponseAndNoContentResponseResponses = { 1606 + /** 1607 + * Response is a simple number 1608 + */ 1609 + 200: number; 1610 + /** 1611 + * Success 1612 + */ 1613 + 204: void; 1614 + }; 1615 + 1616 + export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; 1617 + 1618 + export type DummyAData = { 1619 + body?: never; 1620 + path?: never; 1621 + query?: never; 1622 + url: '/api/v{api-version}/multiple-tags/a'; 1623 + }; 1624 + 1625 + export type DummyAResponses = { 1626 + 200: _400; 1627 + }; 1628 + 1629 + export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; 1630 + 1631 + export type DummyBData = { 1632 + body?: never; 1633 + path?: never; 1634 + query?: never; 1635 + url: '/api/v{api-version}/multiple-tags/b'; 1636 + }; 1637 + 1638 + export type DummyBResponses = { 1639 + /** 1640 + * Success 1641 + */ 1642 + 204: void; 1643 + }; 1644 + 1645 + export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; 1646 + 1647 + export type CallWithResponseData = { 1648 + body?: never; 1649 + path?: never; 1650 + query?: never; 1651 + url: '/api/v{api-version}/response'; 1652 + }; 1653 + 1654 + export type CallWithResponseResponses = { 1655 + default: Import; 1656 + }; 1657 + 1658 + export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; 1659 + 1660 + export type CallWithDuplicateResponsesData = { 1661 + body?: never; 1662 + path?: never; 1663 + query?: never; 1664 + url: '/api/v{api-version}/response'; 1665 + }; 1666 + 1667 + export type CallWithDuplicateResponsesErrors = { 1668 + /** 1669 + * Message for 500 error 1670 + */ 1671 + 500: ModelWithStringError; 1672 + /** 1673 + * Message for 501 error 1674 + */ 1675 + 501: ModelWithStringError; 1676 + /** 1677 + * Message for 502 error 1678 + */ 1679 + 502: ModelWithStringError; 1680 + /** 1681 + * Message for 4XX errors 1682 + */ 1683 + '4XX': DictionaryWithArray; 1684 + /** 1685 + * Default error response 1686 + */ 1687 + default: ModelWithBoolean; 1688 + }; 1689 + 1690 + export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; 1691 + 1692 + export type CallWithDuplicateResponsesResponses = { 1693 + /** 1694 + * Message for 200 response 1695 + */ 1696 + 200: ModelWithBoolean & ModelWithInteger; 1697 + /** 1698 + * Message for 201 response 1699 + */ 1700 + 201: ModelWithString; 1701 + /** 1702 + * Message for 202 response 1703 + */ 1704 + 202: ModelWithString; 1705 + }; 1706 + 1707 + export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; 1708 + 1709 + export type CallWithResponsesData = { 1710 + body?: never; 1711 + path?: never; 1712 + query?: never; 1713 + url: '/api/v{api-version}/response'; 1714 + }; 1715 + 1716 + export type CallWithResponsesErrors = { 1717 + /** 1718 + * Message for 500 error 1719 + */ 1720 + 500: ModelWithStringError; 1721 + /** 1722 + * Message for 501 error 1723 + */ 1724 + 501: ModelWithStringError; 1725 + /** 1726 + * Message for 502 error 1727 + */ 1728 + 502: ModelWithStringError; 1729 + /** 1730 + * Message for default response 1731 + */ 1732 + default: ModelWithStringError; 1733 + }; 1734 + 1735 + export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; 1736 + 1737 + export type CallWithResponsesResponses = { 1738 + /** 1739 + * Message for 200 response 1740 + */ 1741 + 200: { 1742 + readonly '@namespace.string'?: string; 1743 + readonly '@namespace.integer'?: number; 1744 + readonly value?: Array<ModelWithString>; 1745 + }; 1746 + /** 1747 + * Message for 201 response 1748 + */ 1749 + 201: ModelThatExtends; 1750 + /** 1751 + * Message for 202 response 1752 + */ 1753 + 202: ModelThatExtendsExtends; 1754 + }; 1755 + 1756 + export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; 1757 + 1758 + export type CollectionFormatData = { 1759 + body?: never; 1760 + path?: never; 1761 + query: { 1762 + /** 1763 + * This is an array parameter that is sent as csv format (comma-separated values) 1764 + */ 1765 + parameterArrayCSV: Array<string> | null; 1766 + /** 1767 + * This is an array parameter that is sent as ssv format (space-separated values) 1768 + */ 1769 + parameterArraySSV: Array<string> | null; 1770 + /** 1771 + * This is an array parameter that is sent as tsv format (tab-separated values) 1772 + */ 1773 + parameterArrayTSV: Array<string> | null; 1774 + /** 1775 + * This is an array parameter that is sent as pipes format (pipe-separated values) 1776 + */ 1777 + parameterArrayPipes: Array<string> | null; 1778 + /** 1779 + * This is an array parameter that is sent as multi format (multiple parameter instances) 1780 + */ 1781 + parameterArrayMulti: Array<string> | null; 1782 + }; 1783 + url: '/api/v{api-version}/collectionFormat'; 1784 + }; 1785 + 1786 + export type TypesData = { 1787 + body?: never; 1788 + path?: { 1789 + /** 1790 + * This is a number parameter 1791 + */ 1792 + id?: number; 1793 + }; 1794 + query: { 1795 + /** 1796 + * This is a number parameter 1797 + */ 1798 + parameterNumber: number; 1799 + /** 1800 + * This is a string parameter 1801 + */ 1802 + parameterString: string | null; 1803 + /** 1804 + * This is a boolean parameter 1805 + */ 1806 + parameterBoolean: boolean | null; 1807 + /** 1808 + * This is an object parameter 1809 + */ 1810 + parameterObject: { 1811 + [key: string]: unknown; 1812 + } | null; 1813 + /** 1814 + * This is an array parameter 1815 + */ 1816 + parameterArray: Array<string> | null; 1817 + /** 1818 + * This is a dictionary parameter 1819 + */ 1820 + parameterDictionary: { 1821 + [key: string]: unknown; 1822 + } | null; 1823 + /** 1824 + * This is an enum parameter 1825 + */ 1826 + parameterEnum: 'Success' | 'Warning' | 'Error' | null; 1827 + }; 1828 + url: '/api/v{api-version}/types'; 1829 + }; 1830 + 1831 + export type TypesResponses = { 1832 + /** 1833 + * Response is a simple number 1834 + */ 1835 + 200: number; 1836 + /** 1837 + * Response is a simple string 1838 + */ 1839 + 201: string; 1840 + /** 1841 + * Response is a simple boolean 1842 + */ 1843 + 202: boolean; 1844 + /** 1845 + * Response is a simple object 1846 + */ 1847 + 203: { 1848 + [key: string]: unknown; 1849 + }; 1850 + }; 1851 + 1852 + export type TypesResponse = TypesResponses[keyof TypesResponses]; 1853 + 1854 + export type UploadFileData = { 1855 + body: Blob | File; 1856 + path: { 1857 + /** 1858 + * api-version should be required in standalone clients 1859 + */ 1860 + 'api-version': string | null; 1861 + }; 1862 + query?: never; 1863 + url: '/api/v{api-version}/upload'; 1864 + }; 1865 + 1866 + export type UploadFileResponses = { 1867 + 200: boolean; 1868 + }; 1869 + 1870 + export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; 1871 + 1872 + export type FileResponseData = { 1873 + body?: never; 1874 + path: { 1875 + id: string; 1876 + /** 1877 + * api-version should be required in standalone clients 1878 + */ 1879 + 'api-version': string; 1880 + }; 1881 + query?: never; 1882 + url: '/api/v{api-version}/file/{id}'; 1883 + }; 1884 + 1885 + export type FileResponseResponses = { 1886 + /** 1887 + * Success 1888 + */ 1889 + 200: Blob | File; 1890 + }; 1891 + 1892 + export type FileResponseResponse = FileResponseResponses[keyof FileResponseResponses]; 1893 + 1894 + export type ComplexTypesData = { 1895 + body?: never; 1896 + path?: never; 1897 + query: { 1898 + /** 1899 + * Parameter containing object 1900 + */ 1901 + parameterObject: { 1902 + first?: { 1903 + second?: { 1904 + third?: string; 1905 + }; 1906 + }; 1907 + }; 1908 + /** 1909 + * Parameter containing reference 1910 + */ 1911 + parameterReference: ModelWithString; 1912 + }; 1913 + url: '/api/v{api-version}/complex'; 1914 + }; 1915 + 1916 + export type ComplexTypesErrors = { 1917 + /** 1918 + * 400 `server` error 1919 + */ 1920 + 400: unknown; 1921 + /** 1922 + * 500 server error 1923 + */ 1924 + 500: unknown; 1925 + }; 1926 + 1927 + export type ComplexTypesResponses = { 1928 + /** 1929 + * Successful response 1930 + */ 1931 + 200: Array<ModelWithString>; 1932 + }; 1933 + 1934 + export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; 1935 + 1936 + export type MultipartResponseData = { 1937 + body?: never; 1938 + path?: never; 1939 + query?: never; 1940 + url: '/api/v{api-version}/multipart'; 1941 + }; 1942 + 1943 + export type MultipartResponseResponses = { 1944 + /** 1945 + * OK 1946 + */ 1947 + 200: { 1948 + file?: Blob | File; 1949 + metadata?: { 1950 + foo?: string; 1951 + bar?: string; 1952 + }; 1953 + }; 1954 + }; 1955 + 1956 + export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; 1957 + 1958 + export type MultipartRequestData = { 1959 + body?: { 1960 + content?: Blob | File; 1961 + data?: ModelWithString | null; 1962 + }; 1963 + path?: never; 1964 + query?: never; 1965 + url: '/api/v{api-version}/multipart'; 1966 + }; 1967 + 1968 + export type ComplexParamsData = { 1969 + body?: { 1970 + readonly key: string | null; 1971 + name: string | null; 1972 + enabled?: boolean; 1973 + type: 'Monkey' | 'Horse' | 'Bird'; 1974 + listOfModels?: Array<ModelWithString> | null; 1975 + listOfStrings?: Array<string> | null; 1976 + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 1977 + readonly user?: { 1978 + readonly id?: number; 1979 + readonly name?: string | null; 1980 + }; 1981 + }; 1982 + path: { 1983 + id: number; 1984 + /** 1985 + * api-version should be required in standalone clients 1986 + */ 1987 + 'api-version': string; 1988 + }; 1989 + query?: never; 1990 + url: '/api/v{api-version}/complex/{id}'; 1991 + }; 1992 + 1993 + export type ComplexParamsResponses = { 1994 + /** 1995 + * Success 1996 + */ 1997 + 200: ModelWithString; 1998 + }; 1999 + 2000 + export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; 2001 + 2002 + export type CallWithResultFromHeaderData = { 2003 + body?: never; 2004 + path?: never; 2005 + query?: never; 2006 + url: '/api/v{api-version}/header'; 2007 + }; 2008 + 2009 + export type CallWithResultFromHeaderErrors = { 2010 + /** 2011 + * 400 server error 2012 + */ 2013 + 400: unknown; 2014 + /** 2015 + * 500 server error 2016 + */ 2017 + 500: unknown; 2018 + }; 2019 + 2020 + export type CallWithResultFromHeaderResponses = { 2021 + /** 2022 + * Successful response 2023 + */ 2024 + 200: unknown; 2025 + }; 2026 + 2027 + export type TestErrorCodeData = { 2028 + body?: never; 2029 + path?: never; 2030 + query: { 2031 + /** 2032 + * Status code to return 2033 + */ 2034 + status: number; 2035 + }; 2036 + url: '/api/v{api-version}/error'; 2037 + }; 2038 + 2039 + export type TestErrorCodeErrors = { 2040 + /** 2041 + * Custom message: Internal Server Error 2042 + */ 2043 + 500: unknown; 2044 + /** 2045 + * Custom message: Not Implemented 2046 + */ 2047 + 501: unknown; 2048 + /** 2049 + * Custom message: Bad Gateway 2050 + */ 2051 + 502: unknown; 2052 + /** 2053 + * Custom message: Service Unavailable 2054 + */ 2055 + 503: unknown; 2056 + }; 2057 + 2058 + export type TestErrorCodeResponses = { 2059 + /** 2060 + * Custom message: Successful response 2061 + */ 2062 + 200: unknown; 2063 + }; 2064 + 2065 + export type NonAsciiæøåÆøÅöôêÊ字符串Data = { 2066 + body?: never; 2067 + path?: never; 2068 + query: { 2069 + /** 2070 + * Dummy input param 2071 + */ 2072 + nonAsciiParamæøåÆØÅöôêÊ: number; 2073 + }; 2074 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2075 + }; 2076 + 2077 + export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { 2078 + /** 2079 + * Successful response 2080 + */ 2081 + 200: Array<NonAsciiStringæøåÆøÅöôêÊ字符串>; 2082 + }; 2083 + 2084 + export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; 2085 + 2086 + export type PutWithFormUrlEncodedData = { 2087 + body: ArrayWithStrings; 2088 + path?: never; 2089 + query?: never; 2090 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2091 + };
+14
packages/openapi-ts-tests/main/test/clients.test.ts
··· 162 162 { 163 163 config: createConfig({ 164 164 output: { 165 + path: 'tsconfig-node16-sdk', 166 + tsConfigPath: path.join( 167 + __dirname, 168 + 'tsconfig', 169 + 'tsconfig.node16.json', 170 + ), 171 + }, 172 + plugins: [client, '@hey-api/sdk'], 173 + }), 174 + description: 'SDK with Node16 tsconfig', 175 + }, 176 + { 177 + config: createConfig({ 178 + output: { 165 179 importFileExtension: '.ts', 166 180 path: 'import-file-extension-ts', 167 181 },
+9
packages/openapi-ts-tests/main/test/tsconfig/tsconfig.node16.json
··· 1 + { 2 + "extends": "../../../tsconfig.base.json", 3 + "compilerOptions": { 4 + "declaration": false, 5 + "moduleResolution": "node16", 6 + "resolveJsonModule": true, 7 + "skipLibCheck": true 8 + } 9 + }
+4 -2
packages/openapi-ts/src/config/output.ts
··· 50 50 output.tsConfig = loadTsConfig(findTsConfigPath(output.tsConfigPath)); 51 51 if ( 52 52 output.importFileExtension === undefined && 53 - output.tsConfig?.options.moduleResolution === 54 - ts.ModuleResolutionKind.NodeNext 53 + (output.tsConfig?.options.moduleResolution === 54 + ts.ModuleResolutionKind.NodeNext || 55 + output.tsConfig?.options.moduleResolution === 56 + ts.ModuleResolutionKind.Node16) 55 57 ) { 56 58 output.importFileExtension = '.js'; 57 59 }
+4 -4
packages/openapi-ts/src/types/output.d.ts
··· 70 70 /** 71 71 * If specified, this will be the file extension used when importing 72 72 * other modules. By default, we don't add a file extension and let the 73 - * runtime resolve it. If you're using moduleResolution `nodenext`, we 74 - * default to `.js`. 73 + * runtime resolve it. If you're using moduleResolution `nodenext` or 74 + * `node16`, we default to `.js`. 75 75 * 76 76 * @default undefined 77 77 */ ··· 170 170 /** 171 171 * If specified, this will be the file extension used when importing 172 172 * other modules. By default, we don't add a file extension and let the 173 - * runtime resolve it. If you're using moduleResolution `nodenext`, we 174 - * default to `.js`. 173 + * runtime resolve it. If you're using moduleResolution `nodenext` or 174 + * `node16`, we default to `.js`. 175 175 */ 176 176 importFileExtension: ImportFileExtensions | (string & {}) | null | undefined; 177 177 /**