This repository was archived by the owner on Sep 26, 2022. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathdefinitions.ts
More file actions
128 lines (112 loc) · 2.74 KB
/
Copy pathdefinitions.ts
File metadata and controls
128 lines (112 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
declare module '@capacitor/core' {
interface PluginRegistry {
Http: HttpPlugin;
}
}
import { FilesystemDirectory } from '@capacitor/core';
export interface HttpPlugin {
request(options: HttpOptions): Promise<HttpResponse>;
setCookie(options: HttpSetCookieOptions): Promise<void>;
getCookies(options: HttpGetCookiesOptions): Promise<HttpGetCookiesResult>;
deleteCookie(options: HttpDeleteCookieOptions): Promise<void>;
clearCookies(options: HttpClearCookiesOptions): Promise<void>;
uploadFile(options: HttpUploadFileOptions): Promise<HttpUploadFileResult>;
downloadFile(
options: HttpDownloadFileOptions,
): Promise<HttpDownloadFileResult>;
}
export interface HttpOptions {
url: string;
method?: string;
params?: HttpParams;
data?: any;
headers?: HttpHeaders;
/**
* How long to wait to read additional data. Resets each time new
* data is received
*/
readTimeout?: number;
/**
* How long to wait for the initial connection.
*/
connectTimeout?: number;
/**
* Extra arguments for fetch when running on the web
*/
webFetchExtra?: RequestInit;
}
export interface HttpParams {
[key: string]: string;
}
export interface HttpHeaders {
[key: string]: string;
}
export interface HttpResponse {
data: any;
status: number;
headers: HttpHeaders;
}
export interface HttpDownloadFileOptions extends HttpOptions {
/**
* The path the downloaded file should be moved to
*/
filePath: string;
/**
* Optionally, the directory to put the file in
*
* If this option is used, filePath can be a relative path rather than absolute
*/
fileDirectory?: FilesystemDirectory;
}
export interface HttpUploadFileOptions extends HttpOptions {
/**
* The URL to upload the file to
*/
url: string;
/**
* The field name to upload the file with
*/
name: string;
/**
* For uploading a file on the web, a JavaScript Blob to upload
*/
blob?: Blob;
/**
* For uploading a file natively, the path to the file on disk to upload
*/
filePath?: string;
/**
* Optionally, the directory to look for the file in.
*
* If this option is used, filePath can be a relative path rather than absolute
*/
fileDirectory?: FilesystemDirectory;
}
export interface HttpCookie {
key: string;
value: string;
}
export interface HttpSetCookieOptions {
url: string;
key: string;
value: string;
ageDays?: number;
}
export interface HttpGetCookiesOptions {
url: string;
}
export interface HttpDeleteCookieOptions {
url: string;
key: string;
}
export interface HttpClearCookiesOptions {
url: string;
}
export interface HttpGetCookiesResult {
value: HttpCookie[];
}
export interface HttpDownloadFileResult {
path?: string;
blob?: Blob;
}
export interface HttpUploadFileResult {}