rustenium_cdp_definitions/browser_protocol/dom_storage/
commands.rs1use serde::{Deserialize, Serialize};
2#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3pub struct ClearParams {
4 #[serde(rename = "storageId")]
5 pub storage_id: super::types::StorageId,
6}
7impl ClearParams {
8 pub fn new(storage_id: impl Into<super::types::StorageId>) -> Self {
9 Self {
10 storage_id: storage_id.into(),
11 }
12 }
13}
14#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
15pub enum ClearMethod {
16 #[serde(rename = "DOMStorage.clear")]
17 Clear,
18}
19#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
20pub struct Clear {
21 pub method: ClearMethod,
22 pub params: ClearParams,
23}
24impl Clear {
25 pub const IDENTIFIER: &'static str = "DOMStorage.clear";
26 pub fn identifier(&self) -> &'static str {
27 Self::IDENTIFIER
28 }
29}
30impl crate::CommandResult for Clear {
31 type Result = super::results::ClearResult;
32}
33#[doc = "Disables storage tracking, prevents storage events from being sent to the client.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage/#method-disable)"]
34#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
35pub struct DisableParams {}
36#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
37pub enum DisableMethod {
38 #[serde(rename = "DOMStorage.disable")]
39 Disable,
40}
41#[doc = "Disables storage tracking, prevents storage events from being sent to the client.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage/#method-disable)"]
42#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
43pub struct Disable {
44 pub method: DisableMethod,
45 pub params: DisableParams,
46}
47impl Disable {
48 pub const IDENTIFIER: &'static str = "DOMStorage.disable";
49 pub fn identifier(&self) -> &'static str {
50 Self::IDENTIFIER
51 }
52}
53impl crate::CommandResult for Disable {
54 type Result = super::results::DisableResult;
55}
56#[doc = "Enables storage tracking, storage events will now be delivered to the client.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage/#method-enable)"]
57#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
58pub struct EnableParams {}
59#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
60pub enum EnableMethod {
61 #[serde(rename = "DOMStorage.enable")]
62 Enable,
63}
64#[doc = "Enables storage tracking, storage events will now be delivered to the client.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage/#method-enable)"]
65#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
66pub struct Enable {
67 pub method: EnableMethod,
68 pub params: EnableParams,
69}
70impl Enable {
71 pub const IDENTIFIER: &'static str = "DOMStorage.enable";
72 pub fn identifier(&self) -> &'static str {
73 Self::IDENTIFIER
74 }
75}
76impl crate::CommandResult for Enable {
77 type Result = super::results::EnableResult;
78}
79#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
80pub struct GetDomStorageItemsParams {
81 #[serde(rename = "storageId")]
82 pub storage_id: super::types::StorageId,
83}
84impl GetDomStorageItemsParams {
85 pub fn new(storage_id: impl Into<super::types::StorageId>) -> Self {
86 Self {
87 storage_id: storage_id.into(),
88 }
89 }
90}
91#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
92pub enum GetDomStorageItemsMethod {
93 #[serde(rename = "DOMStorage.getDOMStorageItems")]
94 GetDomStorageItems,
95}
96#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
97pub struct GetDomStorageItems {
98 pub method: GetDomStorageItemsMethod,
99 pub params: GetDomStorageItemsParams,
100}
101impl GetDomStorageItems {
102 pub const IDENTIFIER: &'static str = "DOMStorage.getDOMStorageItems";
103 pub fn identifier(&self) -> &'static str {
104 Self::IDENTIFIER
105 }
106}
107impl crate::CommandResult for GetDomStorageItems {
108 type Result = super::results::GetDomStorageItemsResult;
109}
110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
111pub struct RemoveDomStorageItemParams {
112 #[serde(rename = "storageId")]
113 pub storage_id: super::types::StorageId,
114 #[serde(rename = "key")]
115 pub key: String,
116}
117impl RemoveDomStorageItemParams {
118 pub fn new(storage_id: impl Into<super::types::StorageId>, key: impl Into<String>) -> Self {
119 Self {
120 storage_id: storage_id.into(),
121 key: key.into(),
122 }
123 }
124}
125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
126pub enum RemoveDomStorageItemMethod {
127 #[serde(rename = "DOMStorage.removeDOMStorageItem")]
128 RemoveDomStorageItem,
129}
130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
131pub struct RemoveDomStorageItem {
132 pub method: RemoveDomStorageItemMethod,
133 pub params: RemoveDomStorageItemParams,
134}
135impl RemoveDomStorageItem {
136 pub const IDENTIFIER: &'static str = "DOMStorage.removeDOMStorageItem";
137 pub fn identifier(&self) -> &'static str {
138 Self::IDENTIFIER
139 }
140}
141impl crate::CommandResult for RemoveDomStorageItem {
142 type Result = super::results::RemoveDomStorageItemResult;
143}
144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
145pub struct SetDomStorageItemParams {
146 #[serde(rename = "storageId")]
147 pub storage_id: super::types::StorageId,
148 #[serde(rename = "key")]
149 pub key: String,
150 #[serde(rename = "value")]
151 pub value: String,
152}
153impl SetDomStorageItemParams {
154 pub fn new(
155 storage_id: impl Into<super::types::StorageId>,
156 key: impl Into<String>,
157 value: impl Into<String>,
158 ) -> Self {
159 Self {
160 storage_id: storage_id.into(),
161 key: key.into(),
162 value: value.into(),
163 }
164 }
165}
166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
167pub enum SetDomStorageItemMethod {
168 #[serde(rename = "DOMStorage.setDOMStorageItem")]
169 SetDomStorageItem,
170}
171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
172pub struct SetDomStorageItem {
173 pub method: SetDomStorageItemMethod,
174 pub params: SetDomStorageItemParams,
175}
176impl SetDomStorageItem {
177 pub const IDENTIFIER: &'static str = "DOMStorage.setDOMStorageItem";
178 pub fn identifier(&self) -> &'static str {
179 Self::IDENTIFIER
180 }
181}
182impl crate::CommandResult for SetDomStorageItem {
183 type Result = super::results::SetDomStorageItemResult;
184}
185group_enum ! (DomStorageCommands { Clear (Clear) , Disable (Disable) , Enable (Enable) , GetDomStorageItems (GetDomStorageItems) , RemoveDomStorageItem (RemoveDomStorageItem) , SetDomStorageItem (SetDomStorageItem) } + identifiable);