@nestia/fetcher 2.2.0-dev.20231010 → 2.2.0
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.
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Properties of remote API route.
|
|
3
|
+
*
|
|
4
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
5
|
+
*/
|
|
1
6
|
export interface IFetchRoute<Method extends "HEAD" | "GET" | "POST" | "PUT" | "PATCH" | "DELETE"> {
|
|
2
7
|
/**
|
|
3
8
|
* Method of the HTTP request.
|
|
@@ -10,11 +15,11 @@ export interface IFetchRoute<Method extends "HEAD" | "GET" | "POST" | "PUT" | "P
|
|
|
10
15
|
/**
|
|
11
16
|
* Request body data info.
|
|
12
17
|
*/
|
|
13
|
-
request: Method extends "DELETE" | "POST" | "PUT" | "PATCH" ?
|
|
18
|
+
request: Method extends "DELETE" | "POST" | "PUT" | "PATCH" ? IFetchRoute.IBody | null : null;
|
|
14
19
|
/**
|
|
15
20
|
* Response body data info.
|
|
16
21
|
*/
|
|
17
|
-
response: Method extends "HEAD" ? null :
|
|
22
|
+
response: Method extends "HEAD" ? null : IFetchRoute.IBody;
|
|
18
23
|
/**
|
|
19
24
|
* When special status code being used.
|
|
20
25
|
*/
|
|
@@ -23,15 +28,20 @@ export interface IFetchRoute<Method extends "HEAD" | "GET" | "POST" | "PUT" | "P
|
|
|
23
28
|
* Parser of the query string.
|
|
24
29
|
*
|
|
25
30
|
* If content type of response body is `application/x-www-form-urlencoded`,
|
|
26
|
-
* then this `
|
|
31
|
+
* then this `parseQuery` function would be called.
|
|
27
32
|
*
|
|
28
|
-
* If you've forgotten to configuring this property about the
|
|
29
|
-
* `application/x-www-form-urlencoded` typed response body data,
|
|
30
|
-
*
|
|
33
|
+
* If you've forgotten to configuring this `parseQuery` property about the
|
|
34
|
+
* `application/x-www-form-urlencoded` typed response body data, then
|
|
35
|
+
* only the `URLSearchParams` typed instance would be returned instead.
|
|
31
36
|
*/
|
|
32
37
|
parseQuery?(input: URLSearchParams): any;
|
|
33
38
|
}
|
|
34
|
-
export declare namespace
|
|
39
|
+
export declare namespace IFetchRoute {
|
|
40
|
+
/**
|
|
41
|
+
* Metadata of body.
|
|
42
|
+
*
|
|
43
|
+
* Describes how content-type being used in body, and whether encrypted or not.
|
|
44
|
+
*/
|
|
35
45
|
interface IBody {
|
|
36
46
|
type: "application/json" | "application/x-www-form-urlencoded" | "text/plain";
|
|
37
47
|
encrypted?: boolean;
|
package/package.json
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Properties of remote API route.
|
|
3
|
+
*
|
|
4
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
5
|
+
*/
|
|
1
6
|
export interface IFetchRoute<
|
|
2
7
|
Method extends "HEAD" | "GET" | "POST" | "PUT" | "PATCH" | "DELETE",
|
|
3
8
|
> {
|
|
@@ -15,13 +20,13 @@ export interface IFetchRoute<
|
|
|
15
20
|
* Request body data info.
|
|
16
21
|
*/
|
|
17
22
|
request: Method extends "DELETE" | "POST" | "PUT" | "PATCH"
|
|
18
|
-
?
|
|
23
|
+
? IFetchRoute.IBody | null
|
|
19
24
|
: null;
|
|
20
25
|
|
|
21
26
|
/**
|
|
22
27
|
* Response body data info.
|
|
23
28
|
*/
|
|
24
|
-
response: Method extends "HEAD" ? null :
|
|
29
|
+
response: Method extends "HEAD" ? null : IFetchRoute.IBody;
|
|
25
30
|
|
|
26
31
|
/**
|
|
27
32
|
* When special status code being used.
|
|
@@ -32,15 +37,20 @@ export interface IFetchRoute<
|
|
|
32
37
|
* Parser of the query string.
|
|
33
38
|
*
|
|
34
39
|
* If content type of response body is `application/x-www-form-urlencoded`,
|
|
35
|
-
* then this `
|
|
40
|
+
* then this `parseQuery` function would be called.
|
|
36
41
|
*
|
|
37
|
-
* If you've forgotten to configuring this property about the
|
|
38
|
-
* `application/x-www-form-urlencoded` typed response body data,
|
|
39
|
-
*
|
|
42
|
+
* If you've forgotten to configuring this `parseQuery` property about the
|
|
43
|
+
* `application/x-www-form-urlencoded` typed response body data, then
|
|
44
|
+
* only the `URLSearchParams` typed instance would be returned instead.
|
|
40
45
|
*/
|
|
41
46
|
parseQuery?(input: URLSearchParams): any;
|
|
42
47
|
}
|
|
43
|
-
export namespace
|
|
48
|
+
export namespace IFetchRoute {
|
|
49
|
+
/**
|
|
50
|
+
* Metadata of body.
|
|
51
|
+
*
|
|
52
|
+
* Describes how content-type being used in body, and whether encrypted or not.
|
|
53
|
+
*/
|
|
44
54
|
export interface IBody {
|
|
45
55
|
type:
|
|
46
56
|
| "application/json"
|