@docaohuynh/ielts-api-utils 1.0.1 → 1.0.3
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.
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP request utility functions using Bun's fetch API
|
|
3
|
+
*/
|
|
4
|
+
export interface RequestOptions {
|
|
5
|
+
headers?: Record<string, string>;
|
|
6
|
+
timeout?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ResponseData<T = any> {
|
|
9
|
+
data: T;
|
|
10
|
+
status: number;
|
|
11
|
+
statusText: string;
|
|
12
|
+
headers: Headers;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Send a GET request
|
|
16
|
+
* @param url - The URL to send the request to
|
|
17
|
+
* @param options - Request options including headers and timeout
|
|
18
|
+
* @returns Promise with response data
|
|
19
|
+
*/
|
|
20
|
+
export declare function sendGet<T = any>(url: string, options?: RequestOptions): Promise<ResponseData<T>>;
|
|
21
|
+
/**
|
|
22
|
+
* Send a POST request
|
|
23
|
+
* @param url - The URL to send the request to
|
|
24
|
+
* @param body - The request body
|
|
25
|
+
* @param options - Request options including headers and timeout
|
|
26
|
+
* @returns Promise with response data
|
|
27
|
+
*/
|
|
28
|
+
export declare function sendPost<T = any>(url: string, body: any, options?: RequestOptions): Promise<ResponseData<T>>;
|
|
29
|
+
/**
|
|
30
|
+
* Send a GET request with Bearer token authentication
|
|
31
|
+
* @param url - The URL to send the request to
|
|
32
|
+
* @param token - The Bearer token
|
|
33
|
+
* @param options - Request options including headers and timeout
|
|
34
|
+
* @returns Promise with response data
|
|
35
|
+
*/
|
|
36
|
+
export declare function sendGetWithBearer<T = any>(url: string, token: string, options?: RequestOptions): Promise<ResponseData<T>>;
|
|
37
|
+
/**
|
|
38
|
+
* Send a POST request with Bearer token authentication
|
|
39
|
+
* @param url - The URL to send the request to
|
|
40
|
+
* @param body - The request body
|
|
41
|
+
* @param token - The Bearer token
|
|
42
|
+
* @param options - Request options including headers and timeout
|
|
43
|
+
* @returns Promise with response data
|
|
44
|
+
*/
|
|
45
|
+
export declare function sendPostWithBearer<T = any>(url: string, body: any, token: string, options?: RequestOptions): Promise<ResponseData<T>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './fetch';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './slug.util';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const textToSlug: (text: string) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docaohuynh/ielts-api-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Utilities for IELTS API",
|
|
5
5
|
"module": "index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"typescript": "^5.9.2"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"@sindresorhus/slugify": "^2.2.1",
|
|
22
23
|
"@types/luxon": "^3.7.1",
|
|
23
24
|
"luxon": "^3.7.1",
|
|
24
25
|
"transliteration": "^2.3.5"
|