import { type OnModuleInit } from "@nestjs/common"; import type { QueryClient } from "@tanstack/query-core"; import type { ApisConfig, FetchOptions, FetchResult, UrlOptions } from "../../types/index.js"; import { type KatanaKitModuleOptions } from "./options.js"; /** * Injectable facade over the KatanaKit HTTP client for NestJS providers. * * It exists so backend services never reach for module-level singletons * directly: inject `KatanaKitService` and call the same `use*` methods you use * anywhere else. Every call returns a Safe Result (`{ data, error, ok }`), so * Nest exception filters stay in charge of mapping failures to HTTP responses. * * `onModuleInit()` registers the APIs and the optional query client passed to * {@link KatanaKitModuleOptions}; calling those setters stays idempotent. * * @example * ```ts * import { Injectable } from "@nestjs/common"; * import { KatanaKitService } from "katanakit-js/adapters/nestjs"; * * @Injectable() * export class PokemonService { * constructor(private readonly kit: KatanaKitService) {} * * findById(id: number) { * return this.kit.useGet<{ name: string }>("pokeapi", "pokemonById", { params: { id } }); * } * } * ``` */ export declare class KatanaKitService implements OnModuleInit { private readonly options; private initialized; constructor(options?: KatanaKitModuleOptions); /** Registers `apis` and `queryClient` (when provided) exactly once. */ onModuleInit(): void; /** Registers APIs without going through the module (idempotent per entry). */ useInit(apisConfig: ApisConfig): void; /** Returns the registered API map (base URIs, endpoints, default query). */ useGetApis(): ApisConfig; /** Builds a full URL for a registered endpoint without performing a request. */ useBuildUrl(apiName: string, endpointName: string, options?: UrlOptions): string; /** Performs a request with any HTTP method and returns a Safe Result. */ useFetch(apiName: string, endpointName: string, options?: FetchOptions): Promise>; /** GET helper over a registered endpoint. */ useGet(apiName: string, endpointName: string, urlOptions?: UrlOptions): Promise>; /** POST helper; the body is JSON-serialized unless it is already raw. */ usePost(apiName: string, endpointName: string, body?: unknown, urlOptions?: UrlOptions): Promise>; /** PUT helper; the body is JSON-serialized unless it is already raw. */ usePut(apiName: string, endpointName: string, body?: unknown, urlOptions?: UrlOptions): Promise>; /** PATCH helper; the body is JSON-serialized unless it is already raw. */ usePatch(apiName: string, endpointName: string, body?: unknown, urlOptions?: UrlOptions): Promise>; /** DELETE helper over a registered endpoint. */ useDelete(apiName: string, endpointName: string, urlOptions?: UrlOptions): Promise>; /** The shared TanStack Query client (created on first access when not initialized). */ useQueryClient(): QueryClient; } //# sourceMappingURL=kit.service.d.ts.map