@arkyn/server 2.0.1-beta.11 → 2.0.1-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/deleteRequest.d.ts +13 -0
- package/dist/api/deleteRequest.d.ts.map +1 -0
- package/dist/api/deleteRequest.js +14 -0
- package/dist/api/getRequest.d.ts +12 -0
- package/dist/api/getRequest.d.ts.map +1 -0
- package/dist/api/getRequest.js +13 -0
- package/dist/api/inboxFlowRequest.d.ts +40 -0
- package/dist/api/inboxFlowRequest.d.ts.map +1 -0
- package/dist/api/inboxFlowRequest.js +63 -0
- package/dist/api/makeRequest.d.ts +38 -0
- package/dist/api/makeRequest.d.ts.map +1 -0
- package/dist/api/makeRequest.js +103 -0
- package/dist/api/patchRequest.d.ts +13 -0
- package/dist/api/patchRequest.d.ts.map +1 -0
- package/dist/api/patchRequest.js +14 -0
- package/dist/api/postRequest.d.ts +13 -0
- package/dist/api/postRequest.d.ts.map +1 -0
- package/dist/api/postRequest.js +14 -0
- package/dist/api/putRequest.d.ts +13 -0
- package/dist/api/putRequest.d.ts.map +1 -0
- package/dist/api/putRequest.js +14 -0
- package/dist/config/apiInstance.d.ts +80 -0
- package/dist/config/apiInstance.d.ts.map +1 -0
- package/dist/config/apiInstance.js +111 -0
- package/dist/config/inboxFlowInstance.d.ts +44 -0
- package/dist/config/inboxFlowInstance.d.ts.map +1 -0
- package/dist/config/inboxFlowInstance.js +46 -0
- package/dist/http/badResponses/badGateway.d.ts +23 -0
- package/dist/http/badResponses/badGateway.d.ts.map +1 -1
- package/dist/http/badResponses/badGateway.js +23 -0
- package/dist/http/badResponses/badRequest.d.ts +23 -0
- package/dist/http/badResponses/badRequest.d.ts.map +1 -1
- package/dist/http/badResponses/badRequest.js +23 -0
- package/dist/http/badResponses/conflict.d.ts +23 -0
- package/dist/http/badResponses/conflict.d.ts.map +1 -1
- package/dist/http/badResponses/conflict.js +23 -0
- package/dist/http/badResponses/forbidden.d.ts +23 -0
- package/dist/http/badResponses/forbidden.d.ts.map +1 -1
- package/dist/http/badResponses/forbidden.js +24 -1
- package/dist/http/badResponses/notFound.d.ts +23 -0
- package/dist/http/badResponses/notFound.d.ts.map +1 -1
- package/dist/http/badResponses/notFound.js +23 -0
- package/dist/http/badResponses/notImplemented.d.ts +23 -0
- package/dist/http/badResponses/notImplemented.d.ts.map +1 -1
- package/dist/http/badResponses/notImplemented.js +23 -0
- package/dist/http/badResponses/serverError.d.ts +23 -0
- package/dist/http/badResponses/serverError.d.ts.map +1 -1
- package/dist/http/badResponses/serverError.js +23 -0
- package/dist/http/badResponses/unauthorized.d.ts +23 -0
- package/dist/http/badResponses/unauthorized.d.ts.map +1 -1
- package/dist/http/badResponses/unauthorized.js +23 -0
- package/dist/http/badResponses/unprocessableEntity.d.ts +27 -0
- package/dist/http/badResponses/unprocessableEntity.d.ts.map +1 -1
- package/dist/http/badResponses/unprocessableEntity.js +27 -0
- package/dist/http/successResponses/created.d.ts +25 -0
- package/dist/http/successResponses/created.d.ts.map +1 -1
- package/dist/http/successResponses/created.js +25 -0
- package/dist/http/successResponses/found.d.ts +28 -0
- package/dist/http/successResponses/found.d.ts.map +1 -1
- package/dist/http/successResponses/found.js +28 -0
- package/dist/http/successResponses/noContent.d.ts +16 -1
- package/dist/http/successResponses/noContent.d.ts.map +1 -1
- package/dist/http/successResponses/noContent.js +16 -8
- package/dist/http/successResponses/success.d.ts +25 -0
- package/dist/http/successResponses/success.d.ts.map +1 -1
- package/dist/http/successResponses/success.js +25 -0
- package/dist/http/successResponses/updated.d.ts +25 -0
- package/dist/http/successResponses/updated.d.ts.map +1 -1
- package/dist/http/successResponses/updated.js +25 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/services/decodeErrorMessageFromRequest.d.ts +17 -0
- package/dist/services/decodeErrorMessageFromRequest.d.ts.map +1 -0
- package/dist/services/decodeErrorMessageFromRequest.js +30 -0
- package/dist/services/decodeRequestBody.d.ts.map +1 -1
- package/dist/services/decodeRequestBody.js +12 -16
- package/dist/services/errorHandler.d.ts +42 -1
- package/dist/services/errorHandler.d.ts.map +1 -1
- package/dist/services/errorHandler.js +42 -0
- package/dist/services/formParse.d.ts.map +1 -1
- package/dist/services/formParse.js +4 -2
- package/dist/services/getCaller.d.ts +11 -0
- package/dist/services/getCaller.d.ts.map +1 -1
- package/dist/services/getCaller.js +32 -16
- package/dist/services/httpDebug.d.ts +32 -0
- package/dist/services/httpDebug.d.ts.map +1 -1
- package/dist/services/httpDebug.js +44 -6
- package/package.json +4 -2
- package/src/api/deleteRequest.ts +22 -0
- package/src/api/getRequest.ts +20 -0
- package/src/api/inboxFlowRequest.ts +76 -0
- package/src/api/makeRequest.ts +117 -0
- package/src/api/patchRequest.ts +22 -0
- package/src/api/postRequest.ts +22 -0
- package/src/api/putRequest.ts +22 -0
- package/src/config/apiInstance.ts +148 -0
- package/src/config/inboxFlowInstance.ts +65 -0
- package/src/http/badResponses/badGateway.ts +29 -2
- package/src/http/badResponses/badRequest.ts +29 -2
- package/src/http/badResponses/conflict.ts +29 -2
- package/src/http/badResponses/forbidden.ts +30 -3
- package/src/http/badResponses/notFound.ts +29 -2
- package/src/http/badResponses/notImplemented.ts +29 -2
- package/src/http/badResponses/serverError.ts +29 -2
- package/src/http/badResponses/unauthorized.ts +29 -2
- package/src/http/badResponses/unprocessableEntity.ts +33 -2
- package/src/http/successResponses/created.ts +31 -2
- package/src/http/successResponses/found.ts +32 -0
- package/src/http/successResponses/noContent.ts +20 -11
- package/src/http/successResponses/success.ts +31 -2
- package/src/http/successResponses/updated.ts +31 -2
- package/src/index.ts +11 -1
- package/src/services/decodeErrorMessageFromRequest.ts +36 -0
- package/src/services/decodeRequestBody.ts +11 -15
- package/src/services/errorHandler.ts +45 -1
- package/src/services/formParse.ts +4 -5
- package/src/services/getCaller.ts +39 -18
- package/src/services/httpDebug.ts +46 -5
- package/vitest.config.ts +5 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ApiResponseDTO } from "@arkyn/types";
|
|
2
|
+
/**
|
|
3
|
+
* Sends a DELETE request to the specified URL with optional headers and body.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The expected type of the response data.
|
|
6
|
+
* @param {string} url - The URL to send the DELETE request to.
|
|
7
|
+
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
+
* @param {any} [body] - Optional body to include in the request.
|
|
9
|
+
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
+
*/
|
|
11
|
+
declare function deleteRequest<T = any>(url: string, headers?: HeadersInit, body?: any): Promise<ApiResponseDTO<T>>;
|
|
12
|
+
export { deleteRequest };
|
|
13
|
+
//# sourceMappingURL=deleteRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteRequest.d.ts","sourceRoot":"","sources":["../../src/api/deleteRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD;;;;;;;;GAQG;AAEH,iBAAe,aAAa,CAAC,CAAC,GAAG,GAAG,EAClC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,WAAgB,EACzB,IAAI,CAAC,EAAE,GAAG,GACT,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAE5B;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { makeRequest } from "./makeRequest";
|
|
2
|
+
/**
|
|
3
|
+
* Sends a DELETE request to the specified URL with optional headers and body.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The expected type of the response data.
|
|
6
|
+
* @param {string} url - The URL to send the DELETE request to.
|
|
7
|
+
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
+
* @param {any} [body] - Optional body to include in the request.
|
|
9
|
+
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
+
*/
|
|
11
|
+
async function deleteRequest(url, headers = {}, body) {
|
|
12
|
+
return makeRequest("DELETE", url, headers, body);
|
|
13
|
+
}
|
|
14
|
+
export { deleteRequest };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ApiResponseDTO } from "@arkyn/types";
|
|
2
|
+
/**
|
|
3
|
+
* Sends a GET request to the specified URL with optional headers.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The expected type of the response data.
|
|
6
|
+
* @param {string} url - The URL to send the GET request to.
|
|
7
|
+
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
+
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
9
|
+
*/
|
|
10
|
+
declare function getRequest<T = any>(url: string, headers?: HeadersInit): Promise<ApiResponseDTO<T>>;
|
|
11
|
+
export { getRequest };
|
|
12
|
+
//# sourceMappingURL=getRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRequest.d.ts","sourceRoot":"","sources":["../../src/api/getRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD;;;;;;;GAOG;AAEH,iBAAe,UAAU,CAAC,CAAC,GAAG,GAAG,EAC/B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAE5B;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { makeRequest } from "./makeRequest";
|
|
2
|
+
/**
|
|
3
|
+
* Sends a GET request to the specified URL with optional headers.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The expected type of the response data.
|
|
6
|
+
* @param {string} url - The URL to send the GET request to.
|
|
7
|
+
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
+
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
9
|
+
*/
|
|
10
|
+
async function getRequest(url, headers = {}) {
|
|
11
|
+
return makeRequest("GET", url, headers);
|
|
12
|
+
}
|
|
13
|
+
export { getRequest };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
type ConfigProps = {
|
|
2
|
+
status: number;
|
|
3
|
+
method: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "ERROR";
|
|
4
|
+
request: string;
|
|
5
|
+
response: string;
|
|
6
|
+
token: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Sends a request to the inbox flow API with the provided configuration.
|
|
10
|
+
*
|
|
11
|
+
* @param config - The configuration object for the request.
|
|
12
|
+
* @param config.status - The HTTP status code associated with the request.
|
|
13
|
+
* @param config.method - The HTTP method used for the request. Can be "POST", "GET", "PUT", "DELETE", "PATCH", or "ERROR".
|
|
14
|
+
* @param config.request - The request payload or details as a string.
|
|
15
|
+
* @param config.response - The response payload or details as a string.
|
|
16
|
+
* @param config.token - The token associated with the request for authentication or identification.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* - This function retrieves the inbox flow configuration using `InboxFlowInstance.getInboxConfig()`.
|
|
20
|
+
* - If the configuration is not available, the function will return early without performing any action.
|
|
21
|
+
* - In a development environment (`NODE_ENV === "development"`), the function will also return early.
|
|
22
|
+
* - The request is sent as a POST request to the inbox API URL with the provided configuration details.
|
|
23
|
+
* - If an error occurs during the request, it will be logged using the `httpDebug` service.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const config = {
|
|
28
|
+
* status: 200,
|
|
29
|
+
* method: "POST",
|
|
30
|
+
* request: JSON.stringify({ key: "value" }),
|
|
31
|
+
* response: JSON.stringify({ success: true }),
|
|
32
|
+
* token: "example-token",
|
|
33
|
+
* };
|
|
34
|
+
*
|
|
35
|
+
* await inboxFlowRequest(config);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare function inboxFlowRequest(config: ConfigProps): Promise<void>;
|
|
39
|
+
export { inboxFlowRequest };
|
|
40
|
+
//# sourceMappingURL=inboxFlowRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inboxFlowRequest.d.ts","sourceRoot":"","sources":["../../src/api/inboxFlowRequest.ts"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,iBAAe,gBAAgB,CAAC,MAAM,EAAE,WAAW,iBA+BlD;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { InboxFlowInstance } from "../config/inboxFlowInstance";
|
|
2
|
+
import { httpDebug } from "../services/httpDebug";
|
|
3
|
+
/**
|
|
4
|
+
* Sends a request to the inbox flow API with the provided configuration.
|
|
5
|
+
*
|
|
6
|
+
* @param config - The configuration object for the request.
|
|
7
|
+
* @param config.status - The HTTP status code associated with the request.
|
|
8
|
+
* @param config.method - The HTTP method used for the request. Can be "POST", "GET", "PUT", "DELETE", "PATCH", or "ERROR".
|
|
9
|
+
* @param config.request - The request payload or details as a string.
|
|
10
|
+
* @param config.response - The response payload or details as a string.
|
|
11
|
+
* @param config.token - The token associated with the request for authentication or identification.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* - This function retrieves the inbox flow configuration using `InboxFlowInstance.getInboxConfig()`.
|
|
15
|
+
* - If the configuration is not available, the function will return early without performing any action.
|
|
16
|
+
* - In a development environment (`NODE_ENV === "development"`), the function will also return early.
|
|
17
|
+
* - The request is sent as a POST request to the inbox API URL with the provided configuration details.
|
|
18
|
+
* - If an error occurs during the request, it will be logged using the `httpDebug` service.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const config = {
|
|
23
|
+
* status: 200,
|
|
24
|
+
* method: "POST",
|
|
25
|
+
* request: JSON.stringify({ key: "value" }),
|
|
26
|
+
* response: JSON.stringify({ success: true }),
|
|
27
|
+
* token: "example-token",
|
|
28
|
+
* };
|
|
29
|
+
*
|
|
30
|
+
* await inboxFlowRequest(config);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
async function inboxFlowRequest(config) {
|
|
34
|
+
const inboxFlowInstance = InboxFlowInstance.getInboxConfig();
|
|
35
|
+
if (!inboxFlowInstance)
|
|
36
|
+
return;
|
|
37
|
+
const { inboxChannelId, inboxUserToken, inboxApiUrl } = inboxFlowInstance;
|
|
38
|
+
const { status, method, request, response, token } = config;
|
|
39
|
+
if (process.env.NODE_ENV === "development")
|
|
40
|
+
return;
|
|
41
|
+
try {
|
|
42
|
+
const body = JSON.stringify({
|
|
43
|
+
status,
|
|
44
|
+
channelId: inboxChannelId,
|
|
45
|
+
method,
|
|
46
|
+
token,
|
|
47
|
+
request,
|
|
48
|
+
response,
|
|
49
|
+
});
|
|
50
|
+
await fetch(inboxApiUrl, {
|
|
51
|
+
method: "POST",
|
|
52
|
+
body,
|
|
53
|
+
headers: {
|
|
54
|
+
"Content-Type": "application/json",
|
|
55
|
+
Authorization: `Bearer ${inboxUserToken}`,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
httpDebug("inboxFlowRequest", "Error sending inbox flow request", err);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export { inboxFlowRequest };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ApiResponseDTO } from "@arkyn/types";
|
|
2
|
+
/**
|
|
3
|
+
* Makes an HTTP request using the Fetch API and returns a standardized response.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The expected type of the response data.
|
|
6
|
+
* @param method - The HTTP method to use for the request. Supported methods are:
|
|
7
|
+
* - "POST": Create a new resource.
|
|
8
|
+
* - "PUT": Update an existing resource.
|
|
9
|
+
* - "DELETE": Remove a resource.
|
|
10
|
+
* - "PATCH": Partially update a resource.
|
|
11
|
+
* - "GET": Retrieve a resource.
|
|
12
|
+
* @param url - The URL to which the request is sent.
|
|
13
|
+
* @param headers - Optional headers to include in the request. Defaults to an empty object.
|
|
14
|
+
* @param body - Optional body to include in the request. Should be serializable to JSON.
|
|
15
|
+
* @returns A promise that resolves to an `ApiResponseDTO<T>` object containing:
|
|
16
|
+
* - `success`: A boolean indicating whether the request was successful.
|
|
17
|
+
* - `status`: The HTTP status code of the response.
|
|
18
|
+
* - `message`: A message describing the result of the request.
|
|
19
|
+
* - `response`: The parsed JSON response data, or `null` if parsing fails.
|
|
20
|
+
* - `cause`: Additional error information, if applicable.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { makeRequest } from "./makeRequest";
|
|
25
|
+
*
|
|
26
|
+
* async function fetchData() {
|
|
27
|
+
* const response = await makeRequest("GET", "https://api.example.com/data");
|
|
28
|
+
* if (response.success) {
|
|
29
|
+
* console.log("Data:", response.response);
|
|
30
|
+
* } else {
|
|
31
|
+
* console.error("Error:", response.message);
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare function makeRequest<T = any>(method: "POST" | "PUT" | "DELETE" | "PATCH" | "GET", url: string, headers?: HeadersInit, body?: any): Promise<ApiResponseDTO<T>>;
|
|
37
|
+
export { makeRequest };
|
|
38
|
+
//# sourceMappingURL=makeRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeRequest.d.ts","sourceRoot":"","sources":["../../src/api/makeRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAInD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,iBAAe,WAAW,CAAC,CAAC,GAAG,GAAG,EAChC,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,EACnD,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,WAAgB,EACzB,IAAI,CAAC,EAAE,GAAG,GACT,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAsE5B;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { InboxFlowInstance } from "../config/inboxFlowInstance";
|
|
2
|
+
import { inboxFlowRequest } from "./inboxFlowRequest";
|
|
3
|
+
/**
|
|
4
|
+
* Makes an HTTP request using the Fetch API and returns a standardized response.
|
|
5
|
+
*
|
|
6
|
+
* @template T - The expected type of the response data.
|
|
7
|
+
* @param method - The HTTP method to use for the request. Supported methods are:
|
|
8
|
+
* - "POST": Create a new resource.
|
|
9
|
+
* - "PUT": Update an existing resource.
|
|
10
|
+
* - "DELETE": Remove a resource.
|
|
11
|
+
* - "PATCH": Partially update a resource.
|
|
12
|
+
* - "GET": Retrieve a resource.
|
|
13
|
+
* @param url - The URL to which the request is sent.
|
|
14
|
+
* @param headers - Optional headers to include in the request. Defaults to an empty object.
|
|
15
|
+
* @param body - Optional body to include in the request. Should be serializable to JSON.
|
|
16
|
+
* @returns A promise that resolves to an `ApiResponseDTO<T>` object containing:
|
|
17
|
+
* - `success`: A boolean indicating whether the request was successful.
|
|
18
|
+
* - `status`: The HTTP status code of the response.
|
|
19
|
+
* - `message`: A message describing the result of the request.
|
|
20
|
+
* - `response`: The parsed JSON response data, or `null` if parsing fails.
|
|
21
|
+
* - `cause`: Additional error information, if applicable.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { makeRequest } from "./makeRequest";
|
|
26
|
+
*
|
|
27
|
+
* async function fetchData() {
|
|
28
|
+
* const response = await makeRequest("GET", "https://api.example.com/data");
|
|
29
|
+
* if (response.success) {
|
|
30
|
+
* console.log("Data:", response.response);
|
|
31
|
+
* } else {
|
|
32
|
+
* console.error("Error:", response.message);
|
|
33
|
+
* }
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
async function makeRequest(method, url, headers = {}, body) {
|
|
38
|
+
const successMessage = {
|
|
39
|
+
POST: "Resource created successfully",
|
|
40
|
+
PUT: "Resource updated successfully",
|
|
41
|
+
DELETE: "Resource deleted successfully",
|
|
42
|
+
PATCH: "Resource patched successfully",
|
|
43
|
+
GET: "Request successful",
|
|
44
|
+
};
|
|
45
|
+
try {
|
|
46
|
+
const response = await fetch(url, {
|
|
47
|
+
method,
|
|
48
|
+
headers: {
|
|
49
|
+
...headers,
|
|
50
|
+
"Content-Type": "application/json",
|
|
51
|
+
},
|
|
52
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
53
|
+
});
|
|
54
|
+
const status = response.status;
|
|
55
|
+
let data = null;
|
|
56
|
+
try {
|
|
57
|
+
data = await response.json();
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
data = null;
|
|
61
|
+
}
|
|
62
|
+
inboxFlowRequest({
|
|
63
|
+
method,
|
|
64
|
+
status,
|
|
65
|
+
request: JSON.stringify(response.headers),
|
|
66
|
+
response: JSON.stringify(data),
|
|
67
|
+
token: headers?.Authorization || "TOKEN_NOT_FOUND",
|
|
68
|
+
});
|
|
69
|
+
if (!response.ok) {
|
|
70
|
+
return {
|
|
71
|
+
success: false,
|
|
72
|
+
status,
|
|
73
|
+
message: data?.message || response.statusText || "Request failed",
|
|
74
|
+
response: data,
|
|
75
|
+
cause: null,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
success: true,
|
|
80
|
+
status,
|
|
81
|
+
message: data?.message || successMessage[method],
|
|
82
|
+
response: data,
|
|
83
|
+
cause: null,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
inboxFlowRequest({
|
|
88
|
+
method,
|
|
89
|
+
request: JSON.stringify(headers),
|
|
90
|
+
response: String(err),
|
|
91
|
+
status: 500,
|
|
92
|
+
token: "TOKEN_NOT_FOUND",
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
success: false,
|
|
96
|
+
status: 0,
|
|
97
|
+
message: "Network error or request failed",
|
|
98
|
+
response: null,
|
|
99
|
+
cause: err instanceof Error ? err.message : String(err),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export { makeRequest };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ApiResponseDTO } from "@arkyn/types";
|
|
2
|
+
/**
|
|
3
|
+
* Sends a PATCH request to the specified URL with optional headers and body.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The expected type of the response data.
|
|
6
|
+
* @param {string} url - The URL to send the PATCH request to.
|
|
7
|
+
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
+
* @param {any} body - The body to include in the request.
|
|
9
|
+
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
+
*/
|
|
11
|
+
declare function patchRequest<T = any>(url: string, headers: HeadersInit | undefined, body: any): Promise<ApiResponseDTO<T>>;
|
|
12
|
+
export { patchRequest };
|
|
13
|
+
//# sourceMappingURL=patchRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patchRequest.d.ts","sourceRoot":"","sources":["../../src/api/patchRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD;;;;;;;;GAQG;AAEH,iBAAe,YAAY,CAAC,CAAC,GAAG,GAAG,EACjC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,WAAW,YAAK,EACzB,IAAI,EAAE,GAAG,GACR,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAE5B;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { makeRequest } from "./makeRequest";
|
|
2
|
+
/**
|
|
3
|
+
* Sends a PATCH request to the specified URL with optional headers and body.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The expected type of the response data.
|
|
6
|
+
* @param {string} url - The URL to send the PATCH request to.
|
|
7
|
+
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
+
* @param {any} body - The body to include in the request.
|
|
9
|
+
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
+
*/
|
|
11
|
+
async function patchRequest(url, headers = {}, body) {
|
|
12
|
+
return makeRequest("PATCH", url, headers, body);
|
|
13
|
+
}
|
|
14
|
+
export { patchRequest };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ApiResponseDTO } from "@arkyn/types";
|
|
2
|
+
/**
|
|
3
|
+
* Sends a PATCH request to the specified URL with optional headers and body.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The expected type of the response data.
|
|
6
|
+
* @param {string} url - The URL to send the PATCH request to.
|
|
7
|
+
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
+
* @param {any} body - The body to include in the request.
|
|
9
|
+
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
+
*/
|
|
11
|
+
declare function postRequest<T = any>(url: string, headers: HeadersInit | undefined, body: any): Promise<ApiResponseDTO<T>>;
|
|
12
|
+
export { postRequest };
|
|
13
|
+
//# sourceMappingURL=postRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postRequest.d.ts","sourceRoot":"","sources":["../../src/api/postRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD;;;;;;;;GAQG;AAEH,iBAAe,WAAW,CAAC,CAAC,GAAG,GAAG,EAChC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,WAAW,YAAK,EACzB,IAAI,EAAE,GAAG,GACR,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAE5B;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { makeRequest } from "./makeRequest";
|
|
2
|
+
/**
|
|
3
|
+
* Sends a PATCH request to the specified URL with optional headers and body.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The expected type of the response data.
|
|
6
|
+
* @param {string} url - The URL to send the PATCH request to.
|
|
7
|
+
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
+
* @param {any} body - The body to include in the request.
|
|
9
|
+
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
+
*/
|
|
11
|
+
async function postRequest(url, headers = {}, body) {
|
|
12
|
+
return makeRequest("POST", url, headers, body);
|
|
13
|
+
}
|
|
14
|
+
export { postRequest };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ApiResponseDTO } from "@arkyn/types";
|
|
2
|
+
/**
|
|
3
|
+
* Sends a PATCH request to the specified URL with optional headers and body.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The expected type of the response data.
|
|
6
|
+
* @param {string} url - The URL to send the PATCH request to.
|
|
7
|
+
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
+
* @param {any} body - The body to include in the request.
|
|
9
|
+
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
+
*/
|
|
11
|
+
declare function putRequest<T = any>(url: string, headers: HeadersInit | undefined, body: any): Promise<ApiResponseDTO<T>>;
|
|
12
|
+
export { putRequest };
|
|
13
|
+
//# sourceMappingURL=putRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"putRequest.d.ts","sourceRoot":"","sources":["../../src/api/putRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD;;;;;;;;GAQG;AAEH,iBAAe,UAAU,CAAC,CAAC,GAAG,GAAG,EAC/B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,WAAW,YAAK,EACzB,IAAI,EAAE,GAAG,GACR,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAE5B;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { makeRequest } from "./makeRequest";
|
|
2
|
+
/**
|
|
3
|
+
* Sends a PATCH request to the specified URL with optional headers and body.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The expected type of the response data.
|
|
6
|
+
* @param {string} url - The URL to send the PATCH request to.
|
|
7
|
+
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
+
* @param {any} body - The body to include in the request.
|
|
9
|
+
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
+
*/
|
|
11
|
+
async function putRequest(url, headers = {}, body) {
|
|
12
|
+
return makeRequest("PUT", url, headers, body);
|
|
13
|
+
}
|
|
14
|
+
export { putRequest };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
type ApiAinstanceContructorProps = {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
baseHeaders?: HeadersInit;
|
|
4
|
+
baseToken?: string | null;
|
|
5
|
+
};
|
|
6
|
+
type ApiRequestDataWithoutBodyProps = {
|
|
7
|
+
headers?: HeadersInit;
|
|
8
|
+
token?: string;
|
|
9
|
+
};
|
|
10
|
+
type ApiRequestDataWithBodyProps = {
|
|
11
|
+
body?: any;
|
|
12
|
+
headers?: HeadersInit;
|
|
13
|
+
token?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Class representing an API instance to handle HTTP requests with base configurations.
|
|
17
|
+
*/
|
|
18
|
+
declare class ApiInstance {
|
|
19
|
+
private baseUrl;
|
|
20
|
+
private baseHeaders?;
|
|
21
|
+
private baseToken?;
|
|
22
|
+
/**
|
|
23
|
+
* Creates an instance of ApiInstance.
|
|
24
|
+
* @param props - The configuration properties for the API instance.
|
|
25
|
+
* @param props.baseUrl - The base URL for the API.
|
|
26
|
+
* @param props.baseHeaders - Optional base headers to include in all requests.
|
|
27
|
+
* @param props.baseToken - Optional base token for authorization.
|
|
28
|
+
*/
|
|
29
|
+
constructor(props: ApiAinstanceContructorProps);
|
|
30
|
+
/**
|
|
31
|
+
* Generates the full URL by appending the route to the base URL.
|
|
32
|
+
* @param route - The route to append to the base URL.
|
|
33
|
+
* @returns The full URL as a string.
|
|
34
|
+
*/
|
|
35
|
+
private generateURL;
|
|
36
|
+
/**
|
|
37
|
+
* Generates the headers for a request by merging base headers, provided headers, and tokens.
|
|
38
|
+
* @param initHeaders - Initial headers to include in the request.
|
|
39
|
+
* @param token - Optional token to override the base token.
|
|
40
|
+
* @returns The merged headers as a HeadersInit object.
|
|
41
|
+
*/
|
|
42
|
+
private generateHeaders;
|
|
43
|
+
/**
|
|
44
|
+
* Sends a GET request to the specified route.
|
|
45
|
+
* @param route - The API route to send the GET request to.
|
|
46
|
+
* @param data - The request data, including optional headers and token.
|
|
47
|
+
* @returns The API response data.
|
|
48
|
+
*/
|
|
49
|
+
GET(route: string, data: ApiRequestDataWithoutBodyProps): Promise<import("@arkyn/types").ApiResponseDTO<any>>;
|
|
50
|
+
/**
|
|
51
|
+
* Sends a POST request to the specified route.
|
|
52
|
+
* @param route - The API route to send the POST request to.
|
|
53
|
+
* @param data - The request data, including body, optional headers, and token.
|
|
54
|
+
* @returns The API response data.
|
|
55
|
+
*/
|
|
56
|
+
POST(route: string, data: ApiRequestDataWithBodyProps): Promise<import("@arkyn/types").ApiResponseDTO<any>>;
|
|
57
|
+
/**
|
|
58
|
+
* Sends a PUT request to the specified route.
|
|
59
|
+
* @param route - The API route to send the PUT request to.
|
|
60
|
+
* @param data - The request data, including body, optional headers, and token.
|
|
61
|
+
* @returns The API response data.
|
|
62
|
+
*/
|
|
63
|
+
PUT(route: string, data: ApiRequestDataWithBodyProps): Promise<import("@arkyn/types").ApiResponseDTO<any>>;
|
|
64
|
+
/**
|
|
65
|
+
* Sends a PATCH request to the specified route.
|
|
66
|
+
* @param route - The API route to send the PATCH request to.
|
|
67
|
+
* @param data - The request data, including body, optional headers, and token.
|
|
68
|
+
* @returns The API response data.
|
|
69
|
+
*/
|
|
70
|
+
PATCH(route: string, data: ApiRequestDataWithBodyProps): Promise<import("@arkyn/types").ApiResponseDTO<any>>;
|
|
71
|
+
/**
|
|
72
|
+
* Sends a DELETE request to the specified route.
|
|
73
|
+
* @param route - The API route to send the DELETE request to.
|
|
74
|
+
* @param data - The request data, including body, optional headers, and token.
|
|
75
|
+
* @returns The API response data.
|
|
76
|
+
*/
|
|
77
|
+
DELETE(route: string, data: ApiRequestDataWithBodyProps): Promise<import("@arkyn/types").ApiResponseDTO<any>>;
|
|
78
|
+
}
|
|
79
|
+
export { ApiInstance };
|
|
80
|
+
//# sourceMappingURL=apiInstance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiInstance.d.ts","sourceRoot":"","sources":["../../src/config/apiInstance.ts"],"names":[],"mappings":"AAMA,KAAK,2BAA2B,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,KAAK,8BAA8B,GAAG;IACpC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AAEH,cAAM,WAAW;IACf,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAC,CAAc;IAClC,OAAO,CAAC,SAAS,CAAC,CAAS;IAE3B;;;;;;OAMG;gBAES,KAAK,EAAE,2BAA2B;IAM9C;;;;OAIG;IAEH,OAAO,CAAC,WAAW;IAInB;;;;;OAKG;IAEH,OAAO,CAAC,eAAe;IAcvB;;;;;OAKG;IAEG,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B;IAM7D;;;;;OAKG;IAEG,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B;IAO3D;;;;;OAKG;IAEG,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B;IAO1D;;;;;OAKG;IAEG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B;IAO5D;;;;;OAKG;IAEG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B;CAM9D;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { deleteRequest } from "../api/deleteRequest";
|
|
2
|
+
import { getRequest } from "../api/getRequest";
|
|
3
|
+
import { patchRequest } from "../api/patchRequest";
|
|
4
|
+
import { postRequest } from "../api/postRequest";
|
|
5
|
+
import { putRequest } from "../api/putRequest";
|
|
6
|
+
/**
|
|
7
|
+
* Class representing an API instance to handle HTTP requests with base configurations.
|
|
8
|
+
*/
|
|
9
|
+
class ApiInstance {
|
|
10
|
+
baseUrl;
|
|
11
|
+
baseHeaders;
|
|
12
|
+
baseToken;
|
|
13
|
+
/**
|
|
14
|
+
* Creates an instance of ApiInstance.
|
|
15
|
+
* @param props - The configuration properties for the API instance.
|
|
16
|
+
* @param props.baseUrl - The base URL for the API.
|
|
17
|
+
* @param props.baseHeaders - Optional base headers to include in all requests.
|
|
18
|
+
* @param props.baseToken - Optional base token for authorization.
|
|
19
|
+
*/
|
|
20
|
+
constructor(props) {
|
|
21
|
+
this.baseUrl = props.baseUrl;
|
|
22
|
+
this.baseHeaders = props.baseHeaders || undefined;
|
|
23
|
+
this.baseToken = props.baseToken || undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Generates the full URL by appending the route to the base URL.
|
|
27
|
+
* @param route - The route to append to the base URL.
|
|
28
|
+
* @returns The full URL as a string.
|
|
29
|
+
*/
|
|
30
|
+
generateURL(route) {
|
|
31
|
+
return this.baseUrl + route;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Generates the headers for a request by merging base headers, provided headers, and tokens.
|
|
35
|
+
* @param initHeaders - Initial headers to include in the request.
|
|
36
|
+
* @param token - Optional token to override the base token.
|
|
37
|
+
* @returns The merged headers as a HeadersInit object.
|
|
38
|
+
*/
|
|
39
|
+
generateHeaders(initHeaders, token) {
|
|
40
|
+
let headers = {};
|
|
41
|
+
if (this.baseToken)
|
|
42
|
+
headers = { Authorization: `Bearer ${this.baseToken}` };
|
|
43
|
+
if (this.baseHeaders)
|
|
44
|
+
headers = { ...headers, ...this.baseHeaders };
|
|
45
|
+
if (initHeaders)
|
|
46
|
+
headers = { ...headers, ...initHeaders };
|
|
47
|
+
if (token)
|
|
48
|
+
headers = { ...headers, Authorization: `Bearer ${token}` };
|
|
49
|
+
return headers;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Sends a GET request to the specified route.
|
|
53
|
+
* @param route - The API route to send the GET request to.
|
|
54
|
+
* @param data - The request data, including optional headers and token.
|
|
55
|
+
* @returns The API response data.
|
|
56
|
+
*/
|
|
57
|
+
async GET(route, data) {
|
|
58
|
+
const url = this.generateURL(route);
|
|
59
|
+
const headers = this.generateHeaders(data.headers || {}, data.token);
|
|
60
|
+
return await getRequest(url, headers);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Sends a POST request to the specified route.
|
|
64
|
+
* @param route - The API route to send the POST request to.
|
|
65
|
+
* @param data - The request data, including body, optional headers, and token.
|
|
66
|
+
* @returns The API response data.
|
|
67
|
+
*/
|
|
68
|
+
async POST(route, data) {
|
|
69
|
+
const url = this.generateURL(route);
|
|
70
|
+
const headers = this.generateHeaders(data.headers || {}, data.token);
|
|
71
|
+
const body = data.body;
|
|
72
|
+
return await postRequest(url, headers, body);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Sends a PUT request to the specified route.
|
|
76
|
+
* @param route - The API route to send the PUT request to.
|
|
77
|
+
* @param data - The request data, including body, optional headers, and token.
|
|
78
|
+
* @returns The API response data.
|
|
79
|
+
*/
|
|
80
|
+
async PUT(route, data) {
|
|
81
|
+
const url = this.generateURL(route);
|
|
82
|
+
const headers = this.generateHeaders(data.headers || {}, data.token);
|
|
83
|
+
const body = data.body;
|
|
84
|
+
return await putRequest(url, headers, body);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Sends a PATCH request to the specified route.
|
|
88
|
+
* @param route - The API route to send the PATCH request to.
|
|
89
|
+
* @param data - The request data, including body, optional headers, and token.
|
|
90
|
+
* @returns The API response data.
|
|
91
|
+
*/
|
|
92
|
+
async PATCH(route, data) {
|
|
93
|
+
const url = this.generateURL(route);
|
|
94
|
+
const headers = this.generateHeaders(data.headers || {}, data.token);
|
|
95
|
+
const body = data.body;
|
|
96
|
+
return await patchRequest(url, headers, body);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Sends a DELETE request to the specified route.
|
|
100
|
+
* @param route - The API route to send the DELETE request to.
|
|
101
|
+
* @param data - The request data, including body, optional headers, and token.
|
|
102
|
+
* @returns The API response data.
|
|
103
|
+
*/
|
|
104
|
+
async DELETE(route, data) {
|
|
105
|
+
const url = this.generateURL(route);
|
|
106
|
+
const headers = this.generateHeaders(data.headers || {}, data.token);
|
|
107
|
+
const body = data.body;
|
|
108
|
+
return await deleteRequest(url, headers, body);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
export { ApiInstance };
|