UNPKG

outers

Version:

outers - a all in one package for your day to day use

82 lines (81 loc) 5.45 kB
export declare class APiCall { #private; constructor(Domain: string, ContentType?: { "Content-Type": string; "X-Powered-By": string; Accept: string; Server: string; "Access-Control-Allow-Origin": string; "User-Agent": string; }); /** * The Get function is an asynchronous function that makes a GET request to a specified path and * returns the response as JSON. * @param {string} path - The `path` parameter is a string that represents the endpoint or URL path * that you want to make a GET request to. It is typically used to specify the specific resource or * data you want to retrieve from the server. * @param [Responsejson=true] - The "Responsejson" parameter is a boolean flag that determines * whether the response from the API should be parsed as JSON or not. If set to true, the response * will be parsed as JSON. If set to false, the response will be returned as is without any parsing. * @param {any} headers - The `headers` parameter is an optional parameter that allows you to * specify custom headers for the HTTP request. In the code snippet you provided, the default value * for the `headers` parameter is set to `{'Content-Type': 'application/json'}`. This means that if * no custom headers are provided * @returns the result of the `GetFetch` function, which is being awaited. */ Get(path: string, Responsejson?: boolean, headers?: object): Promise<any>; /** * The function is used for making POST requests with optional parameters for the path, data, * response format, and headers. * @param {string} path - The `path` parameter is a string that represents the endpoint or URL path * where the POST request will be sent to. It specifies the location on the server where the * request should be handled. * @param {any} Data - The "Data" parameter is used to pass the data that you want to send in the * request body. It can be of any type, but in this case, it is expected to be of type "any", which * means it can be any valid JavaScript object. * @param [Responsejson=true] - The `Responsejson` parameter is a boolean flag that determines * whether the response from the server should be parsed as JSON or not. If `Responsejson` is set * to `true`, the response will be parsed as JSON. If it is set to `false`, the response will be * returned as is * @param {any} headers - The `headers` parameter is an optional parameter that allows you to * specify additional headers for the POST request. By default, it is set to `{'Content-Type': * 'application/json'}` which sets the content type of the request to JSON. * @returns the result of the `PostFetch` function, which is awaited. */ Post(path: string, Data: any, Responsejson?: boolean, headers?: object): Promise<any>; /** * The function is used for making DELETE requests with optional parameters for response format and * headers. * @param {string} path - The path parameter is a string that represents the endpoint or resource * that you want to delete. It is appended to the domain to form the complete URL for the DELETE * request. * @param [Responsejson=true] - The Responsejson parameter is a boolean value that determines * whether the response from the DELETE request should be parsed as JSON. If set to true, the * response will be parsed as JSON. If set to false, the response will be returned as is without any * parsing. * @param {any} headers - The `headers` parameter is an optional parameter that allows you to * specify additional headers to include in the DELETE request. By default, it is set to * `{'Content-Type': 'application/json'}` which sets the content type of the request to JSON. * However, you can override this default value by * @returns the result of the `DeleteFetch` function, which is being awaited. */ Delete(path: string, Responsejson?: boolean, headers?: object): Promise<any>; /** * The function is used for making PUT requests with optional parameters for data, response format, and * headers. * @param {string} path - The path parameter is a string that represents the endpoint or URL path where * the PUT request will be sent to. It specifies the location of the resource that needs to be updated * or modified. * @param {any} Data - The `Data` parameter is the payload or data that you want to send in the request * body. It can be of any type, but in this case, it is of type `any`, which means it can be any * JavaScript object. * @param [Responsejson=true] - The `Responsejson` parameter is a boolean flag that determines whether * the response from the server should be parsed as JSON or not. If `Responsejson` is set to `true`, * the response will be parsed as JSON. If it is set to `false`, the response will be returned as is * @param {any} headers - The `headers` parameter is an optional parameter that allows you to specify * additional headers for the PUT request. By default, it is set to `{'Content-Type': * 'application/json'}` which sets the content type of the request to JSON. * @returns the result of the `PutFetch` function. */ Put(path: string, Data: any, Responsejson?: boolean, headers?: object): Promise<any>; }