import { PluginFactoryOptions, ResolveNameParams } from '@kubb/core'; import * as KubbFile from '@kubb/fs/types'; import { ResolvePathOptions, Exclude, Include, Override } from '@kubb/plugin-oas'; import { URLPath } from '@kubb/core/utils'; import { HttpMethod, Operation } from '@kubb/oas'; import { KubbNode, Params } from '@kubb/react'; import { ComponentType, ComponentProps } from 'react'; type TemplateProps$1 = { /** * Name of the function */ name: string; /** * Parameters/options/props that need to be used */ params: Params; /** * Generics that needs to be added for TypeScript */ generics?: string; /** * ReturnType(see async for adding Promise type) */ returnType?: string; /** * Options for JSdocs */ JSDoc?: { comments: string[]; }; client: { baseURL: string | undefined; generics: string | string[]; method: HttpMethod; path: URLPath; dataReturnType: PluginClient['options']['dataReturnType']; withQueryParams: boolean; withData: boolean; withHeaders: boolean; contentType: string; }; }; declare function Template$1({ name, generics, returnType, params, JSDoc, client }: TemplateProps$1): KubbNode; type RootTemplateProps$1 = { children?: React.ReactNode; }; declare function RootTemplate$1({ children }: RootTemplateProps$1): JSX.Element; declare const defaultTemplates$1: { readonly default: typeof Template$1; readonly root: typeof RootTemplate$1; }; type Templates$2 = Partial; type ClientProps = { baseURL: string | undefined; /** * This will make it possible to override the default behaviour. */ Template?: ComponentType>; }; declare function Client({ baseURL, Template }: ClientProps): KubbNode; declare namespace Client { var File: ({ baseURL, ...props }: FileProps$1) => KubbNode; var templates: { readonly default: typeof Template$1; readonly root: typeof RootTemplate$1; }; } type FileProps$1 = { baseURL: string | undefined; /** * This will make it possible to override the default behaviour. */ templates?: Templates$2; }; type TemplateProps = { /** * Name of the function */ name: string; operations: Operation[]; baseURL: string | undefined; }; declare function Template({ name, operations }: TemplateProps): KubbNode; type RootTemplateProps = { children?: React.ReactNode; }; declare function RootTemplate({ children }: RootTemplateProps): JSX.Element; declare const defaultTemplates: { readonly default: typeof Template; readonly root: typeof RootTemplate; }; type Templates$1 = Partial; type Props = { baseURL: string | undefined; /** * This will make it possible to override the default behaviour. */ Template?: ComponentType>; }; declare function Operations({ baseURL, Template }: Props): KubbNode; declare namespace Operations { var File: ({ baseURL, ...props }: FileProps) => KubbNode; var templates: { readonly default: typeof Template; readonly root: typeof RootTemplate; }; } type FileProps = { baseURL: string | undefined; /** * This will make it possible to override the default behaviour. */ templates?: Templates$1; }; type Templates = { operations?: typeof Operations.templates | false; client?: typeof Client.templates | false; }; type Options = { output?: { /** * Output to save the clients. * @default `"clients"`` */ path: string; /** * Name to be used for the `export * as {{exportAs}} from './'` */ exportAs?: string; /** * Add an extension to the generated imports and exports, default it will not use an extension */ extName?: KubbFile.Extname; /** * Define what needs to exported, here you can also disable the export of barrel files * @default `'barrel'` */ exportType?: 'barrel' | 'barrelNamed' | false; }; /** * Group the clients based on the provided name. */ group?: { /** * Tag will group based on the operation tag inside the Swagger file */ type: 'tag'; /** * Relative path to save the grouped clients. * * `{{tag}}` will be replaced by the current tagName. * @example `${output}/{{tag}}Controller` => `clients/PetController` * @default `${output}/{{tag}}Controller` */ output?: string; /** * Name to be used for the `export * as {{exportAs}} from './` * @default `"{{tag}}Service"` */ exportAs?: string; }; /** * Array containing exclude parameters to exclude/skip tags/operations/methods/paths. */ exclude?: Array; /** * Array containing include parameters to include tags/operations/methods/paths. */ include?: Array; /** * Array containing override parameters to override `options` based on tags/operations/methods/paths. */ override?: Array>; client?: { /** * Path to the client import path that will be used to do the API calls. * It will be used as `import client from '${client.importPath}'`. * It allow both relative and absolute path. * the path will be applied as is, so relative path shoule be based on the file being generated. * @default '@kubb/swagger-client/client' */ importPath?: string; }; /** * ReturnType that needs to be used when calling client(). * * `Data` will return ResponseConfig[data]. * * `Full` will return ResponseConfig. * @default `'data'` * @private */ dataReturnType?: 'data' | 'full'; /** * How to pass your pathParams. * * `object` will return the pathParams as an object. * * `inline` will return the pathParams as comma separated params. * @default `'inline'` * @private */ pathParamsType?: 'object' | 'inline'; transformers?: { /** * Customize the names based on the type that is provided by the plugin. */ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string; }; /** * Make it possible to override one of the templates */ templates?: Partial; }; type ResolvedOptions = { extName: KubbFile.Extname | undefined; baseURL: string | undefined; client: Required>; dataReturnType: NonNullable; pathParamsType: NonNullable; templates: NonNullable; }; type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions>; declare module '@kubb/core' { interface _Register { ['@kubb/swagger-client']: PluginClient; } } export { Client as C, type Options as O, type PluginClient as P, Operations as a };