1 | import type { EndpointDefinitions, EndpointBuilder, EndpointDefinition, ReplaceTagTypes } from './endpointDefinitions';
|
2 | import type { UnionToIntersection, NoInfer } from './tsHelpers';
|
3 | import type { CoreModule } from './core/module';
|
4 | import type { CreateApiOptions } from './createApi';
|
5 | import type { BaseQueryFn } from './baseQueryTypes';
|
6 | export interface ApiModules<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string> {
|
7 | }
|
8 | export declare type ModuleName = keyof ApiModules<any, any, any, any>;
|
9 | export declare type Module<Name extends ModuleName> = {
|
10 | name: Name;
|
11 | init<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string>(api: Api<BaseQuery, EndpointDefinitions, ReducerPath, TagTypes, ModuleName>, options: Required<CreateApiOptions<BaseQuery, Definitions, ReducerPath, TagTypes>>, context: ApiContext<Definitions>): {
|
12 | injectEndpoint(endpointName: string, definition: EndpointDefinition<any, any, any, any>): void;
|
13 | };
|
14 | };
|
15 | export interface ApiContext<Definitions extends EndpointDefinitions> {
|
16 | apiUid: string;
|
17 | endpointDefinitions: Definitions;
|
18 | batch(cb: () => void): void;
|
19 | }
|
20 | export declare type Api<BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions, ReducerPath extends string, TagTypes extends string, Enhancers extends ModuleName = CoreModule> = UnionToIntersection<ApiModules<BaseQuery, Definitions, ReducerPath, TagTypes>[Enhancers]> & {
|
21 | |
22 |
|
23 |
|
24 | injectEndpoints<NewDefinitions extends EndpointDefinitions>(_: {
|
25 | endpoints: (build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>) => NewDefinitions;
|
26 | overrideExisting?: boolean;
|
27 | }): Api<BaseQuery, Definitions & NewDefinitions, ReducerPath, TagTypes, Enhancers>;
|
28 | |
29 |
|
30 |
|
31 | enhanceEndpoints<NewTagTypes extends string = never>(_: {
|
32 | addTagTypes?: readonly NewTagTypes[];
|
33 | endpoints?: ReplaceTagTypes<Definitions, TagTypes | NoInfer<NewTagTypes>> extends infer NewDefinitions ? {
|
34 | [K in keyof NewDefinitions]?: Partial<NewDefinitions[K]> | ((definition: NewDefinitions[K]) => void);
|
35 | } : never;
|
36 | }): Api<BaseQuery, ReplaceTagTypes<Definitions, TagTypes | NewTagTypes>, ReducerPath, TagTypes | NewTagTypes, Enhancers>;
|
37 | };
|
38 |
|
\ | No newline at end of file |