The type of the API request object
The type of the API response object
OptionalonAPIRequest?: (apiRequest: ApiRequest) => voidCallback invoked immediately before sending the request to the API.
OptionalonAPIResponse?: (apiRequest: ApiRequest, apiResponse: ApiResponse) => voidCallback invoked when the raw response is received from the API.
Called as soon as the API response is received, before parsing. The request object is the same reference as provided to onAPIRequest. Useful for tracking, logging, or debugging successful API request-response pairs.
Optionalsignal?: AbortSignalAn AbortSignal used to cancel the request.
Aborting rejects the call with an SDKAbortError (its name is 'AbortError')
and cancels the underlying HTTP request, including while the SDK is waiting to retry
a rate-limited (429) response. Aborting a call that already completed has no effect.
Compose signals to add a deadline: AbortSignal.any([mine, AbortSignal.timeout(5000)]).
Keep only the latest search with createLatestRequest:
const latestSearch = createLatestRequest();
const search = await latestSearch.run((signal) => discoverPlaces({ query, signal }));
if (search.current) showResults(search.value);
OptionalvalidateRequest?: booleanControls whether input request schema validation is performed.
Common parameters shared across all service calls.