HTTP Client
Core HTTP client with automatic authentication, retry logic, rate limit handling, and response envelope unwrapping.
14 methods
client.get()
Send a GET request. Automatically retried on transient errors (502, 503, 504, 429).
Parameters
endpointrequiredstringAPI endpoint path (e.g., '/projects').
paramsoptionalobjectQuery parameters object. Undefined values are filtered out.
schemaoptionalZodType<T>Zod schema for runtime response validation.
get<T>(endpoint: string, params?: object, options?: { schema?: ZodType<T> }): Promise<T>import { HttpClient } from '@uluops/sdk-core';
const client = new HttpClient({
apiKey: 'ulr_your-api-key',
});
const result = await client.get('/projects');Promise<T>client.post()
Send a POST request. Not retried by default — set retryMutations for idempotent endpoints.
Parameters
endpointrequiredstringAPI endpoint path.
dataoptionalobjectRequest body.
schemaoptionalZodType<T>Zod schema for response validation.
skipAuthoptionalbooleanSkip authentication header (for public endpoints like login).
retryMutationsoptionalbooleanEnable retry for this mutation (only for idempotent operations).
post<T>(endpoint: string, data?: object, options?: { schema?: ZodType<T>; skipAuth?: boolean; retryMutations?: boolean }): Promise<T>import { HttpClient } from '@uluops/sdk-core';
const client = new HttpClient({
apiKey: 'ulr_your-api-key',
});
const result = await client.post('/projects');Promise<T>client.patch()
Send a PATCH request for partial updates.
Parameters
endpointrequiredstringAPI endpoint path.
dataoptionalobjectRequest body with fields to update.
paramsoptionalobjectQuery parameters.
skipAuthoptionalbooleanSkip authentication header.
schemaoptionalZodType<T>Zod schema for runtime response validation.
patch<T>(endpoint: string, data?: object, options?: { params?: object; skipAuth?: boolean; schema?: ZodType<T> }): Promise<T>import { HttpClient } from '@uluops/sdk-core';
const client = new HttpClient({
apiKey: 'ulr_your-api-key',
});
const result = await client.patch('/projects');Promise<T>client.put()
Send a PUT request for full resource replacement.
Parameters
endpointrequiredstringAPI endpoint path.
dataoptionalobjectRequest body.
schemaoptionalZodType<T>Zod schema for response validation.
skipAuthoptionalbooleanSkip authentication header.
put<T>(endpoint: string, data?: object, options?: { schema?: ZodType<T>; skipAuth?: boolean }): Promise<T>import { HttpClient } from '@uluops/sdk-core';
const client = new HttpClient({
apiKey: 'ulr_your-api-key',
});
const result = await client.put('/projects');Promise<T>client.delete()
Send a DELETE request.
Parameters
endpointrequiredstringAPI endpoint path.
dataoptionalobjectOptional request body.
schemaoptionalZodType<T>Zod schema for response validation.
skipAuthoptionalbooleanSkip authentication header.
delete<T>(endpoint: string, data?: object, options?: { schema?: ZodType<T>; skipAuth?: boolean }): Promise<T>import { HttpClient } from '@uluops/sdk-core';
const client = new HttpClient({
apiKey: 'ulr_your-api-key',
});
const result = await client.delete('/projects');Promise<T>client.request()
Low-level request method with full control over options. Includes automatic retry for GET, token refresh on 401, and rate limit handling.
ParametersRequestOptions<T>
methodrequiredstringHTTP method.
GETPOSTPATCHPUTDELETEendpointrequiredstringAPI endpoint path.
dataoptionalobjectRequest body.
paramsoptionalobjectQuery parameters.
retriesoptionalnumberOverride retry count for this request.
retryMutationsoptionalbooleanEnable retry for mutations.
headersoptionalRecord<string, string>Additional headers for this request.
schemaoptionalZodType<T>Zod schema for response validation.
skipAuthoptionalbooleanSkip authentication header.
request<T>(method: HttpMethod, endpoint: string, data?: object, options?: RequestOptions<T>): Promise<T>import { HttpClient } from '@uluops/sdk-core';
const client = new HttpClient({
apiKey: 'ulr_your-api-key',
});
const result = await client.request({ method: 'GET', endpoint: '/projects' });Promise<T>client.requestRaw()
Make a raw request that returns the full response without envelope unwrapping. Does not include retry or token refresh.
Parameters
methodrequiredstringHTTP method.
GETPOSTPATCHPUTDELETEendpointrequiredstringAPI endpoint path.
dataoptionalobjectRequest body.
paramsoptionalobjectQuery parameters.
headersoptionalRecord<string, string>Additional headers.
schemaoptionalZodType<T>Zod schema for response validation.
requestRaw<T>(method: HttpMethod, endpoint: string, data?: object, options?: RawRequestOptions<T>): Promise<T>import { HttpClient } from '@uluops/sdk-core';
const client = new HttpClient({
apiKey: 'ulr_your-api-key',
});
const result = await client.requestRaw('GET', '/projects');Promise<T>client.requestBinary()
Make a request that returns binary data (ArrayBuffer). Used for file downloads, avatar images, etc.
Parameters
methodrequiredstringHTTP method.
GETPOSTPATCHPUTDELETEendpointrequiredstringAPI endpoint path.
paramsoptionalobjectQuery parameters.
headersoptionalRecord<string, string>Additional headers.
Return Fields
datarequiredArrayBufferBinary response data.
contentTyperequiredstringResponse content type.
headersrequiredHeadersResponse headers.
requestBinary(method: HttpMethod, endpoint: string, options?: BinaryRequestOptions): Promise<{ data: ArrayBuffer; contentType: string; headers: Headers }>import { HttpClient } from '@uluops/sdk-core';
const client = new HttpClient({
apiKey: 'ulr_your-api-key',
});
const result = await client.requestBinary('GET', '/projects');
console.log(result.data);// Promise<{ data: ArrayBuffer; contentType: string; headers: Headers }>
{
data: ArrayBuffer;
contentType: string;
headers: Headers;
}client.getRateLimitInfo()
Get the rate limit information from the most recent response. Returns null if no rate limit headers were present.
Return Fields
limitrequirednumberTotal request limit per window.
remainingrequirednumberRequests remaining in current window.
resetrequiredDateWhen the rate limit window resets.
retryAfteroptionalnumberSeconds to wait before retrying (from Retry-After header).
getRateLimitInfo(): RateLimitInfo | nullimport { HttpClient } from '@uluops/sdk-core';
const client = new HttpClient({
apiKey: 'ulr_your-api-key',
});
const result = await client.getRateLimitInfo();
console.log(result.limit);// RateLimitInfo | null
{
limit: number;
remaining: number;
reset: Date;
retryAfter?: number;
}client.getAuthBaseUrl()
Get the auth base URL configured for this client.
getAuthBaseUrl(): stringimport { HttpClient } from '@uluops/sdk-core';
const client = new HttpClient({
apiKey: 'ulr_your-api-key',
});
const result = await client.getAuthBaseUrl();stringclient.setAuthStrategy()
Replace the authentication strategy. Used after login to swap from no-auth to session-based auth.
Parameters
strategyrequiredAuthStrategy | nullNew auth strategy, or null to clear.
setAuthStrategy(strategy: AuthStrategy | null): voidimport { HttpClient } from '@uluops/sdk-core';
const client = new HttpClient({
apiKey: 'ulr_your-api-key',
});
const result = await client.setAuthStrategy('keep_target');voidclient.getAuthStrategy()
Get the current authentication strategy. Returns null if no credentials are configured.
getAuthStrategy(): AuthStrategy | nullimport { HttpClient } from '@uluops/sdk-core';
const client = new HttpClient({
apiKey: 'ulr_your-api-key',
});
const result = await client.getAuthStrategy();AuthStrategy | nullclient.requestStream()
Issue a request and return the raw Response for streaming consumption. Resilience (retry/refresh) applies up to body handoff only. Added in 0.15.0.
Parameters
methodrequiredHttpMethodHTTP method.
endpointrequiredstringAPI endpoint path.
optionsoptionalRequestOptionsRequest options.
requestStream(method, endpoint, options?)import { HttpClient } from '@uluops/sdk-core';
const client = new HttpClient({
apiKey: 'ulr_your-api-key',
});
const result = await client.requestStream('example-value', '/projects');Promise<Response>client.getStream()
GET wrapper over requestStream for streaming downloads. Added in 0.15.0.
Parameters
endpointrequiredstringAPI endpoint path.
paramsoptionalobjectQuery parameters.
optionsoptionalRequestOptionsRequest options.
getStream(endpoint, params?, options?)import { HttpClient } from '@uluops/sdk-core';
const client = new HttpClient({
apiKey: 'ulr_your-api-key',
});
const result = await client.getStream('/projects');Promise<Response>