1use super::target;
3#[allow(unused_imports)]
4use super::types::*;
5#[allow(unused_imports)]
6use serde::{Deserialize, Serialize};
7#[allow(unused_imports)]
8use serde_json::Value as Json;
9pub type RegistrationId = String;
10#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
11pub enum ServiceWorkerVersionRunningStatus {
12 #[serde(rename = "stopped")]
13 Stopped,
14 #[serde(rename = "starting")]
15 Starting,
16 #[serde(rename = "running")]
17 Running,
18 #[serde(rename = "stopping")]
19 Stopping,
20}
21#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
22pub enum ServiceWorkerVersionStatus {
23 #[serde(rename = "new")]
24 New,
25 #[serde(rename = "installing")]
26 Installing,
27 #[serde(rename = "installed")]
28 Installed,
29 #[serde(rename = "activating")]
30 Activating,
31 #[serde(rename = "activated")]
32 Activated,
33 #[serde(rename = "redundant")]
34 Redundant,
35}
36#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
37pub struct ServiceWorkerRegistration {
38 #[serde(rename = "registrationId")]
39 pub registration_id: RegistrationId,
40 #[serde(default)]
41 #[serde(rename = "scopeURL")]
42 pub scope_url: String,
43 #[serde(default)]
44 #[serde(rename = "isDeleted")]
45 pub is_deleted: bool,
46}
47#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
48pub struct ServiceWorkerVersion {
49 #[serde(default)]
50 #[serde(rename = "versionId")]
51 pub version_id: String,
52 #[serde(rename = "registrationId")]
53 pub registration_id: RegistrationId,
54 #[serde(default)]
55 #[serde(rename = "scriptURL")]
56 pub script_url: String,
57 #[serde(rename = "runningStatus")]
58 pub running_status: ServiceWorkerVersionRunningStatus,
59 #[serde(rename = "status")]
60 pub status: ServiceWorkerVersionStatus,
61 #[serde(skip_serializing_if = "Option::is_none")]
62 #[serde(default)]
63 #[serde(rename = "scriptLastModified")]
64 pub script_last_modified: Option<JsFloat>,
65 #[serde(skip_serializing_if = "Option::is_none")]
66 #[serde(default)]
67 #[serde(rename = "scriptResponseTime")]
68 pub script_response_time: Option<JsFloat>,
69 #[serde(skip_serializing_if = "Option::is_none")]
70 #[serde(rename = "controlledClients")]
71 pub controlled_clients: Option<Vec<target::TargetId>>,
72 #[serde(skip_serializing_if = "Option::is_none")]
73 #[serde(rename = "targetId")]
74 pub target_id: Option<target::TargetId>,
75 #[serde(skip_serializing_if = "Option::is_none")]
76 #[serde(default)]
77 #[serde(rename = "routerRules")]
78 pub router_rules: Option<String>,
79}
80#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
81pub struct ServiceWorkerErrorMessage {
82 #[serde(default)]
83 #[serde(rename = "errorMessage")]
84 pub error_message: String,
85 #[serde(rename = "registrationId")]
86 pub registration_id: RegistrationId,
87 #[serde(default)]
88 #[serde(rename = "versionId")]
89 pub version_id: String,
90 #[serde(default)]
91 #[serde(rename = "sourceURL")]
92 pub source_url: String,
93 #[serde(default)]
94 #[serde(rename = "lineNumber")]
95 pub line_number: JsUInt,
96 #[serde(default)]
97 #[serde(rename = "columnNumber")]
98 pub column_number: JsUInt,
99}
100#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
101pub struct DeliverPushMessage {
102 #[serde(default)]
103 #[serde(rename = "origin")]
104 pub origin: String,
105 #[serde(rename = "registrationId")]
106 pub registration_id: RegistrationId,
107 #[serde(default)]
108 #[serde(rename = "data")]
109 pub data: String,
110}
111#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
112#[serde(rename_all = "camelCase")]
113pub struct Disable(pub Option<serde_json::Value>);
114#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
115pub struct DispatchSyncEvent {
116 #[serde(default)]
117 #[serde(rename = "origin")]
118 pub origin: String,
119 #[serde(rename = "registrationId")]
120 pub registration_id: RegistrationId,
121 #[serde(default)]
122 #[serde(rename = "tag")]
123 pub tag: String,
124 #[serde(default)]
125 #[serde(rename = "lastChance")]
126 pub last_chance: bool,
127}
128#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
129pub struct DispatchPeriodicSyncEvent {
130 #[serde(default)]
131 #[serde(rename = "origin")]
132 pub origin: String,
133 #[serde(rename = "registrationId")]
134 pub registration_id: RegistrationId,
135 #[serde(default)]
136 #[serde(rename = "tag")]
137 pub tag: String,
138}
139#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
140#[serde(rename_all = "camelCase")]
141pub struct Enable(pub Option<serde_json::Value>);
142#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
143pub struct SetForceUpdateOnPageLoad {
144 #[serde(default)]
145 #[serde(rename = "forceUpdateOnPageLoad")]
146 pub force_update_on_page_load: bool,
147}
148#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
149pub struct SkipWaiting {
150 #[serde(default)]
151 #[serde(rename = "scopeURL")]
152 pub scope_url: String,
153}
154#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
155pub struct StartWorker {
156 #[serde(default)]
157 #[serde(rename = "scopeURL")]
158 pub scope_url: String,
159}
160#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
161#[serde(rename_all = "camelCase")]
162pub struct StopAllWorkers(pub Option<serde_json::Value>);
163#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
164pub struct StopWorker {
165 #[serde(default)]
166 #[serde(rename = "versionId")]
167 pub version_id: String,
168}
169#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
170pub struct Unregister {
171 #[serde(default)]
172 #[serde(rename = "scopeURL")]
173 pub scope_url: String,
174}
175#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
176pub struct UpdateRegistration {
177 #[serde(default)]
178 #[serde(rename = "scopeURL")]
179 pub scope_url: String,
180}
181#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
182#[serde(rename_all = "camelCase")]
183pub struct DeliverPushMessageReturnObject {}
184#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
185#[serde(rename_all = "camelCase")]
186pub struct DisableReturnObject {}
187#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
188#[serde(rename_all = "camelCase")]
189pub struct DispatchSyncEventReturnObject {}
190#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
191#[serde(rename_all = "camelCase")]
192pub struct DispatchPeriodicSyncEventReturnObject {}
193#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
194#[serde(rename_all = "camelCase")]
195pub struct EnableReturnObject {}
196#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
197#[serde(rename_all = "camelCase")]
198pub struct SetForceUpdateOnPageLoadReturnObject {}
199#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
200#[serde(rename_all = "camelCase")]
201pub struct SkipWaitingReturnObject {}
202#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
203#[serde(rename_all = "camelCase")]
204pub struct StartWorkerReturnObject {}
205#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
206#[serde(rename_all = "camelCase")]
207pub struct StopAllWorkersReturnObject {}
208#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
209#[serde(rename_all = "camelCase")]
210pub struct StopWorkerReturnObject {}
211#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
212#[serde(rename_all = "camelCase")]
213pub struct UnregisterReturnObject {}
214#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
215#[serde(rename_all = "camelCase")]
216pub struct UpdateRegistrationReturnObject {}
217impl Method for DeliverPushMessage {
218 const NAME: &'static str = "ServiceWorker.deliverPushMessage";
219 type ReturnObject = DeliverPushMessageReturnObject;
220}
221impl Method for Disable {
222 const NAME: &'static str = "ServiceWorker.disable";
223 type ReturnObject = DisableReturnObject;
224}
225impl Method for DispatchSyncEvent {
226 const NAME: &'static str = "ServiceWorker.dispatchSyncEvent";
227 type ReturnObject = DispatchSyncEventReturnObject;
228}
229impl Method for DispatchPeriodicSyncEvent {
230 const NAME: &'static str = "ServiceWorker.dispatchPeriodicSyncEvent";
231 type ReturnObject = DispatchPeriodicSyncEventReturnObject;
232}
233impl Method for Enable {
234 const NAME: &'static str = "ServiceWorker.enable";
235 type ReturnObject = EnableReturnObject;
236}
237impl Method for SetForceUpdateOnPageLoad {
238 const NAME: &'static str = "ServiceWorker.setForceUpdateOnPageLoad";
239 type ReturnObject = SetForceUpdateOnPageLoadReturnObject;
240}
241impl Method for SkipWaiting {
242 const NAME: &'static str = "ServiceWorker.skipWaiting";
243 type ReturnObject = SkipWaitingReturnObject;
244}
245impl Method for StartWorker {
246 const NAME: &'static str = "ServiceWorker.startWorker";
247 type ReturnObject = StartWorkerReturnObject;
248}
249impl Method for StopAllWorkers {
250 const NAME: &'static str = "ServiceWorker.stopAllWorkers";
251 type ReturnObject = StopAllWorkersReturnObject;
252}
253impl Method for StopWorker {
254 const NAME: &'static str = "ServiceWorker.stopWorker";
255 type ReturnObject = StopWorkerReturnObject;
256}
257impl Method for Unregister {
258 const NAME: &'static str = "ServiceWorker.unregister";
259 type ReturnObject = UnregisterReturnObject;
260}
261impl Method for UpdateRegistration {
262 const NAME: &'static str = "ServiceWorker.updateRegistration";
263 type ReturnObject = UpdateRegistrationReturnObject;
264}
265pub mod events {
266 #[allow(unused_imports)]
267 use super::super::types::*;
268 #[allow(unused_imports)]
269 use serde::{Deserialize, Serialize};
270 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
271 pub struct WorkerErrorReportedEvent {
272 pub params: WorkerErrorReportedEventParams,
273 }
274 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
275 pub struct WorkerErrorReportedEventParams {
276 #[serde(rename = "errorMessage")]
277 pub error_message: super::ServiceWorkerErrorMessage,
278 }
279 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
280 pub struct WorkerRegistrationUpdatedEvent {
281 pub params: WorkerRegistrationUpdatedEventParams,
282 }
283 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
284 pub struct WorkerRegistrationUpdatedEventParams {
285 #[serde(rename = "registrations")]
286 pub registrations: Vec<super::ServiceWorkerRegistration>,
287 }
288 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
289 pub struct WorkerVersionUpdatedEvent {
290 pub params: WorkerVersionUpdatedEventParams,
291 }
292 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
293 pub struct WorkerVersionUpdatedEventParams {
294 #[serde(rename = "versions")]
295 pub versions: Vec<super::ServiceWorkerVersion>,
296 }
297}