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