API Reference
Complete API reference for @igniter-js/caller — all classes, methods, types, and configuration options.
IgniterCaller
The main entrypoint for creating API client instances.
import { IgniterCaller } from '@igniter-js/caller';IgniterCaller.create()
Creates a new IgniterCallerBuilder instance with an empty configuration.
const api = IgniterCaller.create()
.withBaseUrl('https://api.example.com')
.build();IgniterCallerBuilder
Immutable builder for configuring the API client. Every with* method returns a new builder instance.
Prop
Type
IgniterCallerManager
The runtime engine returned by .build(). Used to create and execute HTTP requests.
Instance Methods
All HTTP method helpers accept an optional URL. When schemas are configured, providing a URL enables full type inference.
Prop
Type
Static Methods
Prop
Type
IgniterCallerRequestBuilder
Fluent per-request API. Returned by api.get(), api.post(), etc. All methods return this for chaining.
Request Configuration
Prop
Type
Resilience
Prop
Type
Response Typing
Prop
Type
Execution
Prop
Type
IgniterCallerSchema
Path-first schema builder for defining type-safe API contracts with Zod (or any StandardSchemaV1 library).
Prop
Type
SchemaPathBuilder
Defines HTTP methods for a single path:
| Method | Signature | Description |
|---|---|---|
get(config) | (config: { request?, responses }) => this | Defines GET endpoint |
post(config) | (config: { request?, responses }) => this | Defines POST endpoint |
put(config) | (config: { request?, responses }) => this | Defines PUT endpoint |
patch(config) | (config: { request?, responses }) => this | Defines PATCH endpoint |
delete(config) | (config: { request?, responses }) => this | Defines DELETE endpoint |
head(config) | (config: { request?, responses }) => this | Defines HEAD endpoint |
ref(key) | (key: string) => { schema, array(), nullable(), optional(), record() } | References a registered schema with Zod wrappers |
build() | () => TMethods | Returns the accumulated method map |
IgniterCallerMock
Builder for creating typed mock registries for testing.
Prop
Type
Mock Handler Shapes
Static response:
{ response: data; status?: number; headers?: Record<string, string>; delayMs?: number }Dynamic handler:
(request: { method; path; url; headers; query; params; body?; ... }) => MockResponseMockCallerStoreAdapter
In-memory store adapter for testing. Implements the IgniterCallerStoreAdapter interface.
import { MockCallerStoreAdapter } from '@igniter-js/caller/adapters';Prop
Type
Types
IgniterCallerApiResponse<T>
The standardized response envelope returned by all requests.
Prop
Type
IgniterCallerError
Custom error class extending IgniterError for all Caller failures.
Prop
Type
Error Codes
| Code | Description |
|---|---|
IGNITER_CALLER_HTTP_ERROR | HTTP response status ≥ 400 |
IGNITER_CALLER_MOCK_HTTP_ERROR | Mock handler returned an error response |
IGNITER_CALLER_TIMEOUT | Request exceeded the configured timeout |
IGNITER_CALLER_REQUEST_VALIDATION_FAILED | Request body failed schema validation |
IGNITER_CALLER_RESPONSE_VALIDATION_FAILED | Response body failed schema validation |
IGNITER_CALLER_SCHEMA_DUPLICATE | Duplicate schema path or method |
IGNITER_CALLER_SCHEMA_INVALID | Invalid schema configuration |
IGNITER_CALLER_UNKNOWN_ERROR | Unexpected catch-all error |
IgniterCallerStoreAdapter
Interface for implementing persistent cache stores.
Prop
Type
IgniterCallerRetryOptions
Prop
Type
IgniterCallerStoreOptions
Prop
Type
Subpath Exports
| Import Path | Purpose |
|---|---|
@igniter-js/caller | Core client: IgniterCaller, IgniterCallerSchema, IgniterCallerMock, types |
@igniter-js/caller/client | React integration: IgniterCallerProvider, useIgniterCaller, hooks |
@igniter-js/caller/telemetry | Telemetry events: IgniterCallerTelemetryEvents |
@igniter-js/caller/adapters | Store adapters: MockCallerStoreAdapter |