@techolution-ai/computer-vision
Version:
A JavaScript/TypeScript library for computer vision applications, providing tools for image processing, scanning, and MQTT-based messaging.
87 lines (85 loc) • 2.51 kB
text/typescript
interface IHttpClientRequestOptions {
baseUrl?: string;
withCredentials?: boolean;
headers?: Record<string, string>;
signal?: AbortSignal;
}
declare class HttpClient {
baseUrl: string;
headers: Record<string, string>;
withCredentials: boolean;
constructor(options: {
baseUrl: string;
headers?: Record<string, string>;
withCredentials?: boolean;
});
private _makeRequest;
get<T>(url: string, options?: IHttpClientRequestOptions): Promise<{
status: number;
statusText: string;
headers: Headers;
url: string;
redirected: boolean;
ok: boolean;
data: T;
}>;
post<T, U>(url: string, body?: U, options?: IHttpClientRequestOptions): Promise<{
status: number;
statusText: string;
headers: Headers;
url: string;
redirected: boolean;
ok: boolean;
data: T;
}>;
put<T, U = null>(url: string, body?: U, options?: IHttpClientRequestOptions): Promise<{
status: number;
statusText: string;
headers: Headers;
url: string;
redirected: boolean;
ok: boolean;
data: T;
}>;
delete<T, U = null>(url: string, body?: U, options?: IHttpClientRequestOptions): Promise<{
status: number;
statusText: string;
headers: Headers;
url: string;
redirected: boolean;
ok: boolean;
data: T;
}>;
patch<T, U = null>(url: string, body?: U, options?: IHttpClientRequestOptions): Promise<{
status: number;
statusText: string;
headers: Headers;
url: string;
redirected: boolean;
ok: boolean;
data: T;
}>;
head<T, U = null>(url: string, body?: U, options?: IHttpClientRequestOptions): Promise<{
status: number;
statusText: string;
headers: Headers;
url: string;
redirected: boolean;
ok: boolean;
data: T;
}>;
options<T, U = null>(url: string, body?: U, options?: IHttpClientRequestOptions): Promise<{
status: number;
statusText: string;
headers: Headers;
url: string;
redirected: boolean;
ok: boolean;
data: T;
}>;
addHeaders(headers: Record<string, string>): void;
removeHeader(key: string): void;
clearHeaders(): void;
setWithCredentials(value: boolean): void;
}
export { type IHttpClientRequestOptions, HttpClient as default };