feat: Ajout d'un système d'alert
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-05 22:48:06 +02:00
parent 9b039a3fb1
commit 346399d757
217 changed files with 56413 additions and 0 deletions

View File

@ -0,0 +1,7 @@
declare enum HttpMethods {
Get = "get",
Post = "post",
Put = "put",
Delete = "delete"
}
export default HttpMethods;

View File

@ -0,0 +1,19 @@
import { AxiosProxyConfig, AxiosRequestConfig, RawAxiosRequestHeaders, ResponseType } from 'axios';
import { TObject } from '../types';
export interface RequestConfig {
host: string;
version: string;
output: ResponseType;
}
export interface RequestOptions {
timeout?: number;
proxy?: AxiosProxyConfig;
headers?: RawAxiosRequestHeaders;
maxBodyLength?: number;
maxContentLength?: number;
}
export declare type SubPath = 'REST' | 'DATA' | '';
export declare type RequestData = string | TObject.UnknownRec;
export declare type RequestParams = TObject.UnknownRec;
export declare type RequestConstructorConfig = null | Partial<RequestConfig>;
export declare type RequestAxiosConfig = Required<Pick<AxiosRequestConfig, 'url' | 'data' | 'params' | 'method' | 'headers' | 'responseType' | 'transformResponse'>> & Pick<AxiosRequestConfig, 'auth' | 'timeout' | 'proxy' | 'maxBodyLength' | 'maxContentLength'>;

View File

@ -0,0 +1,36 @@
import { TObject } from '../types';
import { LibraryResponse, LibraryLocalResponse } from '../types/api';
import HttpMethods from './HttpMethods';
import { RequestData, RequestParams, RequestConstructorConfig } from './Request';
import Client from '../client';
declare type UnknownRec = TObject.UnknownRec;
declare class Request {
private readonly client;
private readonly method;
private readonly config;
private readonly resource;
private url;
private subPath;
private actionPath;
constructor(client: Client, method: HttpMethods, resource: string, config?: RequestConstructorConfig);
getUserAgent(): string;
getCredentials(): {
apiToken: string | undefined;
apiKey: string | undefined;
apiSecret: string | undefined;
};
private getContentType;
private getRequestBody;
private buildFullUrl;
private buildSubPath;
private makeRequest;
private setBaseURL;
id(value: string | number): this;
action(name: string): this;
request<Body extends RequestData>(data?: RequestData, params?: RequestParams, performAPICall?: true): Promise<LibraryResponse<Body>>;
request<Body extends RequestData, Params extends UnknownRec>(data?: Body, params?: Params, performAPICall?: false): Promise<LibraryLocalResponse<Body, Params>>;
static protocol: "https://";
static parseToJSONb(text: string): any;
static isBrowser(): boolean;
}
export default Request;