@azure-net/kit 1.3.1 → 1.3.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Options
|
|
1
|
+
import { type Options } from 'ky';
|
|
2
2
|
export interface IHttpServiceResponse<T = unknown> {
|
|
3
3
|
headers: Record<string, string>;
|
|
4
4
|
status: number;
|
|
@@ -29,16 +29,22 @@ export declare class HttpServiceError<T> implements IHttpServiceError<T> {
|
|
|
29
29
|
export interface IHttpServiceOptions extends Options {
|
|
30
30
|
responseFormat?: 'json' | 'blob' | 'text' | 'arrayBuffer' | 'body';
|
|
31
31
|
}
|
|
32
|
+
export interface IHttpServiceInstanceResponse<T = unknown> extends Response {
|
|
33
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
34
|
+
blob: () => Promise<Blob>;
|
|
35
|
+
formData: () => Promise<FormData>;
|
|
36
|
+
json: <J = T>() => Promise<J>;
|
|
37
|
+
text: () => Promise<string>;
|
|
38
|
+
}
|
|
32
39
|
export interface IHttpServiceInstance {
|
|
33
|
-
<T>(url: string | URL | Request, options?: IHttpServiceOptions)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
extend: (defaultOptions: IHttpServiceOptions | ((parentOptions: IHttpServiceOptions) => IHttpServiceOptions)) => IHttpServiceInstance;
|
|
40
|
+
get: <T>(url: string | URL | Request, options?: IHttpServiceOptions) => Promise<IHttpServiceInstanceResponse<T>>;
|
|
41
|
+
post: <T>(url: string | URL | Request, options?: IHttpServiceOptions) => Promise<IHttpServiceInstanceResponse<T>>;
|
|
42
|
+
put: <T>(url: string | URL | Request, options?: IHttpServiceOptions) => Promise<IHttpServiceInstanceResponse<T>>;
|
|
43
|
+
delete: <T>(url: string | URL | Request, options?: IHttpServiceOptions) => Promise<IHttpServiceInstanceResponse<T>>;
|
|
44
|
+
patch: <T>(url: string | URL | Request, options?: IHttpServiceOptions) => Promise<IHttpServiceInstanceResponse<T>>;
|
|
45
|
+
head?: (url: string | URL | Request, options?: IHttpServiceOptions) => Promise<IHttpServiceInstanceResponse>;
|
|
46
|
+
create: (defaultOptions?: IHttpServiceOptions) => IHttpServiceInstance;
|
|
47
|
+
extend?: (defaultOptions: IHttpServiceOptions | ((parentOptions: IHttpServiceOptions) => IHttpServiceOptions)) => IHttpServiceInstance;
|
|
42
48
|
readonly stop: typeof stop;
|
|
43
49
|
}
|
|
44
50
|
export declare class HttpService {
|