HTTP & Safe Methods Reference

Complete TypeScript signatures for all standard request methods, safe tuple helpers, streaming, uploads, and polling.


Method Signatures

signatures.ts
typescript
// 1. Standard request methods
api.request<T>(config: RequestConfig & { url: string; method: HttpMethod }): Promise<HttpResponse<T>>
api.get<T>(url: string, config?: RequestConfig): Promise<HttpResponse<T>>
api.post<T>(url: string, body?: any, config?: RequestConfig): Promise<HttpResponse<T>>
api.put<T>(url: string, body?: any, config?: RequestConfig): Promise<HttpResponse<T>>
api.patch<T>(url: string, body?: any, config?: RequestConfig): Promise<HttpResponse<T>>
api.delete<T>(url: string, config?: RequestConfig): Promise<HttpResponse<T>>
api.del<T>(url: string, config?: RequestConfig): Promise<HttpResponse<T>>

// 2. Safe request methods (Go/Rust [data, error] tuple returns)
api.safe.get<T>(url: string, config?: RequestConfig): Promise<SafeResult<T>>
api.safe.post<T>(url: string, body?: any, config?: RequestConfig): Promise<SafeResult<T>>
api.safe.put<T>(url: string, body?: any, config?: RequestConfig): Promise<SafeResult<T>>
api.safe.patch<T>(url: string, body?: any, config?: RequestConfig): Promise<SafeResult<T>>
api.safe.delete<T>(url: string, config?: RequestConfig): Promise<SafeResult<T>>

// 3. Streaming, uploading, and polling
api.stream(url: string, options?: StreamOptions): AsyncGenerator<StreamEvent, void, unknown>
api.upload<T>(url: string, file: UploadFileSource, options?: UploadOptions): Promise<HttpResponse<T>>
api.poll<T>(url: string, options: PollOptions<T>): Promise<HttpResponse<T>>
api.waitFor<T>(url: string, options: WaitForOptions<T>): Promise<HttpResponse<T>>