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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
use wasm_bindgen::prelude::*;
#[wasm_bindgen(module = "firebase/storage")]
extern "C" {
pub type Storage;
pub type Ref;
pub type UploadTask;
pub type UploadTaskSnapshot;
pub type SettableMetadata;
#[wasm_bindgen(extends = SettableMetadata)]
pub type UploadMetadata;
#[wasm_bindgen(extends = UploadMetadata)]
pub type FullMetadata;
pub type TaskState;
#[wasm_bindgen(js_name = getStorage)]
pub fn get_storage() -> Storage;
#[wasm_bindgen(js_name = ref)]
pub fn ref_(storage: Storage, path: &str) -> Ref;
#[wasm_bindgen(js_name = uploadBytesResumable, catch)]
pub fn upload_bytes(ref_: Ref, data: &web_sys::Blob) -> Result<UploadTask, JsValue>;
#[wasm_bindgen(js_name = getDownloadURL, catch)]
pub async fn get_download_url(ref_: Ref) -> Result<JsValue, JsValue>;
#[wasm_bindgen(js_name = deleteObject, catch)]
pub async fn delete_object(ref_: Ref) -> Result<(), JsValue>;
#[wasm_bindgen(js_name = getMetadata, catch)]
pub async fn get_metadata(ref_: Ref) -> Result<JsValue, JsValue>;
#[wasm_bindgen(method)]
pub fn on(
this: &UploadTask,
event: &str,
on_snapshot: &Closure<dyn FnMut(UploadTaskSnapshot)>,
on_error: Option<&Closure<dyn FnMut(JsValue)>>,
on_complete: Option<&Closure<dyn FnMut()>>,
) -> js_sys::Function;
#[wasm_bindgen(method)]
pub fn cancel(this: &UploadTask) -> bool;
#[wasm_bindgen(method)]
pub fn pause(this: &UploadTask) -> bool;
#[wasm_bindgen(method)]
pub fn resume(this: &UploadTask) -> bool;
#[wasm_bindgen(method, getter)]
pub fn snapshot(this: &UploadTask) -> UploadTaskSnapshot;
#[wasm_bindgen(method, getter, js_name = bytesTransferred)]
pub fn bytes_transferred(this: &UploadTaskSnapshot) -> usize;
#[wasm_bindgen(method, getter, js_name = totalBytes)]
pub fn total_bytes(this: &UploadTaskSnapshot) -> usize;
#[wasm_bindgen(method, getter, js_name = ref)]
pub fn ref_(this: &UploadTaskSnapshot) -> Ref;
#[wasm_bindgen(method, getter)]
pub fn metadata(this: &UploadTaskSnapshot) -> FullMetadata;
#[wasm_bindgen(method, getter)]
pub fn state(this: &UploadTaskSnapshot) -> String;
#[wasm_bindgen(method, getter)]
pub fn task(this: &UploadTaskSnapshot) -> UploadTask;
#[wasm_bindgen(method, getter, js_name = cacheControl)]
pub fn cache_control(this: &SettableMetadata) -> Option<String>;
#[wasm_bindgen(method, getter, js_name = contentDisposition)]
pub fn content_disposition(this: &SettableMetadata) -> Option<String>;
#[wasm_bindgen(method, getter, js_name = contentEncoding)]
pub fn content_encoding(this: &SettableMetadata) -> Option<String>;
#[wasm_bindgen(method, getter, js_name = contentLanguage)]
pub fn content_language(this: &SettableMetadata) -> Option<String>;
#[wasm_bindgen(method, getter, js_name = contentType)]
pub fn content_type(this: &SettableMetadata) -> Option<String>;
#[wasm_bindgen(method, getter, js_name = customMetadata)]
pub fn custom_metadata(this: &SettableMetadata) -> Option<js_sys::Object>;
#[wasm_bindgen(method, getter, js_name = md5Hash)]
pub fn md5_hash(this: &UploadMetadata) -> Option<String>;
#[wasm_bindgen(method, getter)]
pub fn bucket(this: &FullMetadata) -> String;
#[wasm_bindgen(method, getter, js_name = fullPath)]
pub fn full_path(this: &FullMetadata) -> String;
#[wasm_bindgen(method, getter)]
pub fn generation(this: &FullMetadata) -> String;
#[wasm_bindgen(method, getter)]
pub fn metageneration(this: &FullMetadata) -> String;
#[wasm_bindgen(method, getter)]
pub fn name(this: &FullMetadata) -> String;
#[wasm_bindgen(method, getter)]
pub fn size(this: &FullMetadata) -> u64;
#[wasm_bindgen(method, getter, js_name = timeCreated)]
pub fn time_created(this: &FullMetadata) -> String;
#[wasm_bindgen(method, getter)]
pub fn updated(this: &FullMetadata) -> String;
#[wasm_bindgen(method, getter, js_name = downloadTokens)]
pub fn download_tokens(this: &FullMetadata) -> Vec<js_sys::JsString>;
#[wasm_bindgen(method, getter, js_name = ref)]
pub fn ref_(this: &FullMetadata) -> Option<Ref>;
}