···11-// This file is auto-generated by @hey-api/openapi-ts
22-33-import {
44- type ClientOptions,
55- type Config,
66- createClient,
77- createConfig,
88-} from './client';
99-import { createClientConfig } from './src/hey-api.ts';
1010-import type { ClientOptions as ClientOptions2 } from './types.gen';
1111-1212-/**
1313- * The `createClientConfig()` function will be called on client initialization
1414- * and the returned object will become the client's initial configuration.
1515- *
1616- * You may want to initialize your client this way instead of calling
1717- * `setConfig()`. This is useful for example if you're using Next.js
1818- * to ensure your client always has the correct values.
1919- */
2020-export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (
2121- override?: Config<ClientOptions & T>,
2222-) => Config<Required<ClientOptions> & T>;
2323-2424-export const client = createClient(
2525- createClientConfig(
2626- createConfig<ClientOptions2>({
2727- baseUrl: 'https://petstore3.swagger.io/api/v3',
2828- }),
2929- ),
3030-);
···11-// This file is auto-generated by @hey-api/openapi-ts
22-33-import type { Auth, AuthToken } from './auth.gen';
44-import type {
55- BodySerializer,
66- QuerySerializer,
77- QuerySerializerOptions,
88-} from './bodySerializer.gen';
99-1010-export type HttpMethod =
1111- | 'connect'
1212- | 'delete'
1313- | 'get'
1414- | 'head'
1515- | 'options'
1616- | 'patch'
1717- | 'post'
1818- | 'put'
1919- | 'trace';
2020-2121-export type Client<
2222- RequestFn = never,
2323- Config = unknown,
2424- MethodFn = never,
2525- BuildUrlFn = never,
2626- SseFn = never,
2727-> = {
2828- /**
2929- * Returns the final request URL.
3030- */
3131- buildUrl: BuildUrlFn;
3232- getConfig: () => Config;
3333- request: RequestFn;
3434- setConfig: (config: Config) => Config;
3535-} & {
3636- [K in HttpMethod]: MethodFn;
3737-} & ([SseFn] extends [never]
3838- ? { sse?: never }
3939- : { sse: { [K in HttpMethod]: SseFn } });
4040-4141-export interface Config {
4242- /**
4343- * Auth token or a function returning auth token. The resolved value will be
4444- * added to the request payload as defined by its `security` array.
4545- */
4646- auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
4747- /**
4848- * A function for serializing request body parameter. By default,
4949- * {@link JSON.stringify()} will be used.
5050- */
5151- bodySerializer?: BodySerializer | null;
5252- /**
5353- * An object containing any HTTP headers that you want to pre-populate your
5454- * `Headers` object with.
5555- *
5656- * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
5757- */
5858- headers?:
5959- | RequestInit['headers']
6060- | Record<
6161- string,
6262- | string
6363- | number
6464- | boolean
6565- | (string | number | boolean)[]
6666- | null
6767- | undefined
6868- | unknown
6969- >;
7070- /**
7171- * The request method.
7272- *
7373- * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
7474- */
7575- method?: Uppercase<HttpMethod>;
7676- /**
7777- * A function for serializing request query parameters. By default, arrays
7878- * will be exploded in form style, objects will be exploded in deepObject
7979- * style, and reserved characters are percent-encoded.
8080- *
8181- * This method will have no effect if the native `paramsSerializer()` Axios
8282- * API function is used.
8383- *
8484- * {@link https://swagger.io/docs/specification/serialization/#query View examples}
8585- */
8686- querySerializer?: QuerySerializer | QuerySerializerOptions;
8787- /**
8888- * A function validating request data. This is useful if you want to ensure
8989- * the request conforms to the desired shape, so it can be safely sent to
9090- * the server.
9191- */
9292- requestValidator?: (data: unknown) => Promise<unknown>;
9393- /**
9494- * A function transforming response data before it's returned. This is useful
9595- * for post-processing data, e.g. converting ISO strings into Date objects.
9696- */
9797- responseTransformer?: (data: unknown) => Promise<unknown>;
9898- /**
9999- * A function validating response data. This is useful if you want to ensure
100100- * the response conforms to the desired shape, so it can be safely passed to
101101- * the transformers and returned to the user.
102102- */
103103- responseValidator?: (data: unknown) => Promise<unknown>;
104104-}
105105-106106-type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never]
107107- ? true
108108- : [T] extends [never | undefined]
109109- ? [undefined] extends [T]
110110- ? false
111111- : true
112112- : false;
113113-114114-export type OmitNever<T extends Record<string, unknown>> = {
115115- [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true
116116- ? never
117117- : K]: T[K];
118118-};