|
1 |
| -type AuthToken = string | undefined; |
2 |
| -interface Auth { |
3 |
| - /** |
4 |
| - * Which part of the request do we use to send the auth? |
5 |
| - * |
6 |
| - * @default 'header' |
7 |
| - */ |
8 |
| - in?: 'header' | 'query'; |
9 |
| - /** |
10 |
| - * Header or query parameter name. |
11 |
| - * |
12 |
| - * @default 'Authorization' |
13 |
| - */ |
14 |
| - name?: string; |
15 |
| - scheme?: 'basic' | 'bearer'; |
16 |
| - type: 'apiKey' | 'http'; |
17 |
| -} |
18 |
| -interface SerializerOptions<T> { |
19 |
| - /** |
20 |
| - * @default true |
21 |
| - */ |
22 |
| - explode: boolean; |
23 |
| - style: T; |
24 |
| -} |
25 |
| -type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; |
26 |
| -type ObjectStyle = 'form' | 'deepObject'; |
27 |
| - |
28 |
| -type QuerySerializer = (query: Record<string, unknown>) => string; |
29 |
| -type BodySerializer = (body: any) => any; |
30 |
| -interface QuerySerializerOptions { |
31 |
| - allowReserved?: boolean; |
32 |
| - array?: SerializerOptions<ArrayStyle>; |
33 |
| - object?: SerializerOptions<ObjectStyle>; |
34 |
| -} |
35 |
| -declare const formDataBodySerializer: { |
36 |
| - bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T) => FormData; |
37 |
| -}; |
38 |
| -declare const jsonBodySerializer: { |
39 |
| - bodySerializer: <T>(body: T) => string; |
40 |
| -}; |
41 |
| -declare const urlSearchParamsBodySerializer: { |
42 |
| - bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T) => string; |
43 |
| -}; |
44 |
| - |
45 |
| -interface Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never> { |
46 |
| - /** |
47 |
| - * Returns the final request URL. |
48 |
| - */ |
49 |
| - buildUrl: BuildUrlFn; |
50 |
| - connect: MethodFn; |
51 |
| - delete: MethodFn; |
52 |
| - get: MethodFn; |
53 |
| - getConfig: () => Config; |
54 |
| - head: MethodFn; |
55 |
| - options: MethodFn; |
56 |
| - patch: MethodFn; |
57 |
| - post: MethodFn; |
58 |
| - put: MethodFn; |
59 |
| - request: RequestFn; |
60 |
| - setConfig: (config: Config) => Config; |
61 |
| - trace: MethodFn; |
62 |
| -} |
63 |
| -interface Config$1 { |
64 |
| - /** |
65 |
| - * Auth token or a function returning auth token. The resolved value will be |
66 |
| - * added to the request payload as defined by its `security` array. |
67 |
| - */ |
68 |
| - auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken; |
69 |
| - /** |
70 |
| - * A function for serializing request body parameter. By default, |
71 |
| - * {@link JSON.stringify()} will be used. |
72 |
| - */ |
73 |
| - bodySerializer?: BodySerializer | null; |
74 |
| - /** |
75 |
| - * An object containing any HTTP headers that you want to pre-populate your |
76 |
| - * `Headers` object with. |
77 |
| - * |
78 |
| - * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} |
79 |
| - */ |
80 |
| - headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>; |
81 |
| - /** |
82 |
| - * The request method. |
83 |
| - * |
84 |
| - * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} |
85 |
| - */ |
86 |
| - method?: 'CONNECT' | 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT' | 'TRACE'; |
87 |
| - /** |
88 |
| - * A function for serializing request query parameters. By default, arrays |
89 |
| - * will be exploded in form style, objects will be exploded in deepObject |
90 |
| - * style, and reserved characters are percent-encoded. |
91 |
| - * |
92 |
| - * This method will have no effect if the native `paramsSerializer()` Axios |
93 |
| - * API function is used. |
94 |
| - * |
95 |
| - * {@link https://swagger.io/docs/specification/serialization/#query View examples} |
96 |
| - */ |
97 |
| - querySerializer?: QuerySerializer | QuerySerializerOptions; |
98 |
| - /** |
99 |
| - * A function transforming response data before it's returned. This is useful |
100 |
| - * for post-processing data, e.g. converting ISO strings into Date objects. |
101 |
| - */ |
102 |
| - responseTransformer?: (data: unknown) => Promise<unknown>; |
103 |
| - /** |
104 |
| - * A function validating response data. This is useful if you want to ensure |
105 |
| - * the response conforms to the desired shape, so it can be safely passed to |
106 |
| - * the transformers and returned to the user. |
107 |
| - */ |
108 |
| - responseValidator?: (data: unknown) => Promise<unknown>; |
109 |
| -} |
| 1 | +import { Config as Config$1, Auth, Client as Client$1 } from '@hey-api/client-core'; |
| 2 | +export { Auth, QuerySerializerOptions, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-core'; |
110 | 3 |
|
111 | 4 | type ErrInterceptor<Err, Res, Req, Options> = (error: Err, response: Res, request: Req, options: Options) => Err | Promise<Err>;
|
112 | 5 | type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
|
@@ -228,4 +121,4 @@ type OptionsLegacyParser<TData = unknown, ThrowOnError extends boolean = boolean
|
228 | 121 |
|
229 | 122 | declare const createClient: (config?: Config) => Client;
|
230 | 123 |
|
231 |
| -export { type Auth, type Client, type ClientOptions, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer }; |
| 124 | +export { type Client, type ClientOptions, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig }; |
0 commit comments