import { KosFetchOptions } from '../types';
import { ErrorResponseContext } from './service-request-error';
export type { ErrorResponseContext };
/**
 * Resolves the service URL configuration.
 * @param _service - The optional service name (not used).
 * @returns An object with `isMock` and `URL` properties.
 *
 * @kosService core.service-request
 * @kosApiLevel 2
 */
export declare const resolveBaseUrl: () => {
    isMock: boolean;
    URL: string;
};
type NonNeverKeys<T> = {
    [K in keyof T]-?: T[K] extends never | undefined ? never : K;
}[keyof T];
/**
 * @kosService core.service-request
 */
export type AvailableMethods<T> = Exclude<NonNeverKeys<T>, "parameters" | "requestBody">;
/**
 * @kosService core.service-request
 */
export type PathsByMethod<T> = {
    [Method in "get" | "put" | "post" | "delete"]: {
        [K in keyof T]: Method extends AvailableMethods<T[K]> ? K : never;
    }[keyof T & keyof {
        [K in keyof T]: Method extends keyof T[K] ? K : never;
    }];
};
type ClientGetParams<Paths extends Record<string, any>, K extends keyof Paths> = Paths[K]["get"] extends {
    parameters: infer P;
} ? P : never;
type ClientPostParams<Paths extends Record<string, any>, K extends keyof Paths> = Paths[K]["post"] extends {
    parameters: infer P;
} ? P : never;
type ClientPutParams<Paths extends Record<string, any>, K extends keyof Paths> = Paths[K]["put"] extends {
    parameters: infer P;
} ? P : never;
type ClientDeleteParams<Paths extends Record<string, any>, K extends keyof Paths> = Paths[K]["delete"] extends {
    parameters: infer P;
} ? P : never;
type ClientPostBody<Paths extends Record<string, any>, K extends keyof Paths> = Paths[K]["post"] extends {
    requestBody: {
        content: infer B;
    };
} ? B[keyof B] : never;
type ClientPutBody<Paths extends Record<string, any>, K extends keyof Paths> = Paths[K]["put"] extends {
    requestBody: {
        content: infer B;
    };
} ? B[keyof B] : never;
/**
 * @kosService core.service-request
 */
export type ClientResponse<Paths extends Record<string, any>, K extends keyof Paths, M extends AvailableMethods<Paths[K]> | string> = Paths[K][M] extends {
    responses: {
        200: {
            content: infer R;
        };
    };
} ? R[keyof R] : unknown;
/**
 * @kosService core.service-request
 */
export type ClientParams<Paths extends Record<string, any>, K extends keyof Paths, M extends AvailableMethods<Paths[K]> | string> = Paths[K][M] extends {
    parameters: infer P;
} ? P : never;
/**
 * @kosService core.service-request
 */
export type ClientBody<Paths extends Record<string, any>, K extends keyof Paths, M extends AvailableMethods<Paths[K]> | string> = Paths[K][M] extends {
    requestBody: {
        content: infer B;
    };
} ? B[keyof B] : never;
/**
 * @kosService core.service-request
 */
export type ServiceResponse<T> = [error: string, data: null, errorContext?: ErrorResponseContext] | [error: null, data: T];
/**
 * @kosService core.service-request
 */
export type DeepRequired<T> = {
    [K in keyof T]-?: T[K] extends object ? DeepRequired<T[K]> : T[K] extends Array<infer U> ? Array<DeepRequired<U>> : T[K];
};
/**
 * @kosService core.service-request
 */
export type ElementType<T> = T extends (infer U)[] ? U : never;
type RequestOptions = Omit<KosFetchOptions, "method" | "body">;
/**
 * @kosService core.service-request
 * @kosApiLevel 2
 */
export declare function createClient<Paths extends Record<string, any>>(): {
    get: <K extends { [K_1 in keyof Paths]: "get" extends infer T ? T extends "get" ? T extends Exclude<NonNeverKeys<Paths[K_1]>, "parameters" | "requestBody"> ? K_1 : never : never : never; }[keyof Paths]>(endpoint: K, params?: ClientGetParams<Paths, K>, options?: RequestOptions) => Promise<ServiceResponse<ClientResponse<Paths, K, "get">>>;
    post: <K extends { [K_1 in keyof Paths]: "post" extends infer T ? T extends "post" ? T extends Exclude<NonNeverKeys<Paths[K_1]>, "parameters" | "requestBody"> ? K_1 : never : never : never; }[keyof Paths]>(endpoint: K, params?: ClientPostParams<Paths, K>, body?: ClientPostBody<Paths, K> | undefined, options?: RequestOptions) => Promise<ServiceResponse<ClientResponse<Paths, K, "post">>>;
    put: <K extends { [K_1 in keyof Paths]: "put" extends infer T ? T extends "put" ? T extends Exclude<NonNeverKeys<Paths[K_1]>, "parameters" | "requestBody"> ? K_1 : never : never : never; }[keyof Paths]>(endpoint: K, params?: ClientPutParams<Paths, K>, body?: ClientPutBody<Paths, K> | undefined, options?: RequestOptions) => Promise<ServiceResponse<ClientResponse<Paths, K, "put">>>;
    delete: <K extends { [K_1 in keyof Paths]: "delete" extends infer T ? T extends "delete" ? T extends Exclude<NonNeverKeys<Paths[K_1]>, "parameters" | "requestBody"> ? K_1 : never : never : never; }[keyof Paths]>(endpoint: K, params?: ClientDeleteParams<Paths, K>, body?: ClientPutBody<Paths, K> | undefined, options?: RequestOptions) => Promise<ServiceResponse<ClientResponse<Paths, K, "delete">>>;
};
//# sourceMappingURL=kos-service-request.d.ts.map