1 | import type { Plugin } from './definitions';
|
2 | import { WebPlugin } from './web-plugin';
|
3 |
|
4 | export interface WebViewPlugin extends Plugin {
|
5 | setServerBasePath(options: WebViewPath): Promise<void>;
|
6 | getServerBasePath(): Promise<WebViewPath>;
|
7 | persistServerBasePath(): Promise<void>;
|
8 | }
|
9 | export interface WebViewPath {
|
10 | path: string;
|
11 | }
|
12 | export declare const WebView: WebViewPlugin;
|
13 | export interface CapacitorCookiesPlugin {
|
14 | setCookie(options: SetCookieOptions): Promise<void>;
|
15 | deleteCookie(options: DeleteCookieOptions): Promise<void>;
|
16 | clearCookies(options: ClearCookieOptions): Promise<void>;
|
17 | clearAllCookies(): Promise<void>;
|
18 | }
|
19 | interface HttpCookie {
|
20 | url?: string;
|
21 | key: string;
|
22 | value: string;
|
23 | }
|
24 | interface HttpCookieExtras {
|
25 | path?: string;
|
26 | expires?: string;
|
27 | }
|
28 | export declare type SetCookieOptions = HttpCookie & HttpCookieExtras;
|
29 | export declare type DeleteCookieOptions = Omit<HttpCookie, 'value'>;
|
30 | export declare type ClearCookieOptions = Omit<HttpCookie, 'key' | 'value'>;
|
31 | export declare class CapacitorCookiesPluginWeb extends WebPlugin implements CapacitorCookiesPlugin {
|
32 | setCookie(options: SetCookieOptions): Promise<void>;
|
33 | deleteCookie(options: DeleteCookieOptions): Promise<void>;
|
34 | clearCookies(): Promise<void>;
|
35 | clearAllCookies(): Promise<void>;
|
36 | }
|
37 | export declare const CapacitorCookies: CapacitorCookiesPlugin;
|
38 |
|
39 |
|
40 | export interface CapacitorHttpPlugin {
|
41 | request(options: HttpOptions): Promise<HttpResponse>;
|
42 | get(options: HttpOptions): Promise<HttpResponse>;
|
43 | post(options: HttpOptions): Promise<HttpResponse>;
|
44 | put(options: HttpOptions): Promise<HttpResponse>;
|
45 | patch(options: HttpOptions): Promise<HttpResponse>;
|
46 | delete(options: HttpOptions): Promise<HttpResponse>;
|
47 | }
|
48 | export declare type HttpResponseType = 'arraybuffer' | 'blob' | 'json' | 'text' | 'document';
|
49 | export interface HttpOptions {
|
50 | url: string;
|
51 | method?: string;
|
52 | params?: HttpParams;
|
53 | data?: any;
|
54 | headers?: HttpHeaders;
|
55 | |
56 |
|
57 |
|
58 |
|
59 | readTimeout?: number;
|
60 | |
61 |
|
62 |
|
63 | connectTimeout?: number;
|
64 | |
65 |
|
66 |
|
67 | disableRedirects?: boolean;
|
68 | |
69 |
|
70 |
|
71 | webFetchExtra?: RequestInit;
|
72 | |
73 |
|
74 |
|
75 |
|
76 | responseType?: HttpResponseType;
|
77 | |
78 |
|
79 |
|
80 |
|
81 | shouldEncodeUrlParams?: boolean;
|
82 | }
|
83 | export interface HttpParams {
|
84 | [key: string]: string | string[];
|
85 | }
|
86 | export interface HttpHeaders {
|
87 | [key: string]: string;
|
88 | }
|
89 | export interface HttpResponse {
|
90 | data: any;
|
91 | status: number;
|
92 | headers: HttpHeaders;
|
93 | url: string;
|
94 | }
|
95 |
|
96 |
|
97 |
|
98 |
|
99 | export declare const readBlobAsBase64: (blob: Blob) => Promise<string>;
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 | export declare const buildRequestInit: (options: HttpOptions, extra?: RequestInit) => RequestInit;
|
106 | export declare class CapacitorHttpPluginWeb extends WebPlugin implements CapacitorHttpPlugin {
|
107 | |
108 |
|
109 |
|
110 |
|
111 | request(options: HttpOptions): Promise<HttpResponse>;
|
112 | |
113 |
|
114 |
|
115 |
|
116 | get(options: HttpOptions): Promise<HttpResponse>;
|
117 | |
118 |
|
119 |
|
120 |
|
121 | post(options: HttpOptions): Promise<HttpResponse>;
|
122 | |
123 |
|
124 |
|
125 |
|
126 | put(options: HttpOptions): Promise<HttpResponse>;
|
127 | |
128 |
|
129 |
|
130 |
|
131 | patch(options: HttpOptions): Promise<HttpResponse>;
|
132 | |
133 |
|
134 |
|
135 |
|
136 | delete(options: HttpOptions): Promise<HttpResponse>;
|
137 | }
|
138 | export declare const CapacitorHttp: CapacitorHttpPlugin;
|
139 | export {};
|
140 |
|