@translated/lara
Version:
Official Lara SDK for JavaScript and Node.js
35 lines (34 loc) • 1.67 kB
TypeScript
import type { Readable } from "node:stream";
type HttpMethod = "GET" | "POST" | "PUT" | "DELETE";
/** @internal */
export type BaseURL = {
secure: boolean;
hostname: string;
port: number;
};
/** @internal */
export type ClientResponse = {
statusCode: number;
body: any;
};
export type BrowserMultiPartFile = File;
export type NodeMultiPartFile = Readable | string;
export type MultiPartFile = BrowserMultiPartFile | NodeMultiPartFile;
/** @internal */
export declare abstract class LaraClient {
private readonly crypto;
private readonly accessKeyId;
private readonly accessKeySecret;
private readonly extraHeaders;
protected constructor(accessKeyId: string, accessKeySecret: string);
setExtraHeader(name: string, value: string): void;
get<T>(path: string, params?: Record<string, any>, headers?: Record<string, string>): Promise<T>;
delete<T>(path: string, params?: Record<string, any>, headers?: Record<string, string>): Promise<T>;
post<T>(path: string, body?: Record<string, any>, files?: Record<string, MultiPartFile>, headers?: Record<string, string>): Promise<T>;
put<T>(path: string, body?: Record<string, any>, files?: Record<string, MultiPartFile>, headers?: Record<string, string>): Promise<T>;
protected request<T>(method: HttpMethod, path: string, body?: Record<string, any>, files?: Record<string, MultiPartFile>, headers?: Record<string, string>): Promise<T>;
private sign;
protected abstract send(path: string, headers: Record<string, string>, body?: Record<string, any>): Promise<ClientResponse>;
protected abstract wrapMultiPartFile(file: MultiPartFile): any;
}
export {};