rustenium_cdp_definitions/browser_protocol/cache_storage/
commands.rs1use serde::{Deserialize, Serialize};
2#[doc = "Deletes a cache.\n[deleteCache](https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage/#method-deleteCache)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct DeleteCacheParams {
5 #[doc = "Id of cache for deletion."]
6 #[serde(rename = "cacheId")]
7 pub cache_id: super::types::CacheId,
8}
9impl DeleteCacheParams {
10 pub fn new(cache_id: impl Into<super::types::CacheId>) -> Self {
11 Self {
12 cache_id: cache_id.into(),
13 }
14 }
15}
16#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
17pub enum DeleteCacheMethod {
18 #[serde(rename = "CacheStorage.deleteCache")]
19 DeleteCache,
20}
21#[doc = "Deletes a cache.\n[deleteCache](https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage/#method-deleteCache)"]
22#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
23pub struct DeleteCache {
24 pub method: DeleteCacheMethod,
25 pub params: DeleteCacheParams,
26}
27impl DeleteCache {
28 pub const IDENTIFIER: &'static str = "CacheStorage.deleteCache";
29 pub fn identifier(&self) -> &'static str {
30 Self::IDENTIFIER
31 }
32}
33impl crate::CommandResult for DeleteCache {
34 type Result = super::results::DeleteCacheResult;
35}
36#[doc = "Deletes a cache entry.\n[deleteEntry](https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage/#method-deleteEntry)"]
37#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
38pub struct DeleteEntryParams {
39 #[doc = "Id of cache where the entry will be deleted."]
40 #[serde(rename = "cacheId")]
41 pub cache_id: super::types::CacheId,
42 #[doc = "URL spec of the request."]
43 #[serde(rename = "request")]
44 pub request: String,
45}
46impl DeleteEntryParams {
47 pub fn new(cache_id: impl Into<super::types::CacheId>, request: impl Into<String>) -> Self {
48 Self {
49 cache_id: cache_id.into(),
50 request: request.into(),
51 }
52 }
53}
54#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
55pub enum DeleteEntryMethod {
56 #[serde(rename = "CacheStorage.deleteEntry")]
57 DeleteEntry,
58}
59#[doc = "Deletes a cache entry.\n[deleteEntry](https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage/#method-deleteEntry)"]
60#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
61pub struct DeleteEntry {
62 pub method: DeleteEntryMethod,
63 pub params: DeleteEntryParams,
64}
65impl DeleteEntry {
66 pub const IDENTIFIER: &'static str = "CacheStorage.deleteEntry";
67 pub fn identifier(&self) -> &'static str {
68 Self::IDENTIFIER
69 }
70}
71impl crate::CommandResult for DeleteEntry {
72 type Result = super::results::DeleteEntryResult;
73}
74#[doc = "Requests cache names.\n[requestCacheNames](https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage/#method-requestCacheNames)"]
75#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
76pub struct RequestCacheNamesParams {
77 #[doc = "At least and at most one of securityOrigin, storageKey, storageBucket must be specified.\nSecurity origin."]
78 #[serde(rename = "securityOrigin")]
79 #[serde(skip_serializing_if = "Option::is_none")]
80 #[serde(default)]
81 pub security_origin: Option<String>,
82 #[doc = "Storage key."]
83 #[serde(rename = "storageKey")]
84 #[serde(skip_serializing_if = "Option::is_none")]
85 #[serde(default)]
86 pub storage_key: Option<String>,
87 #[doc = "Storage bucket. If not specified, it uses the default bucket."]
88 #[serde(rename = "storageBucket")]
89 #[serde(skip_serializing_if = "Option::is_none")]
90 #[serde(default)]
91 pub storage_bucket: Option<crate::browser_protocol::storage::types::StorageBucket>,
92}
93#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
94pub enum RequestCacheNamesMethod {
95 #[serde(rename = "CacheStorage.requestCacheNames")]
96 RequestCacheNames,
97}
98#[doc = "Requests cache names.\n[requestCacheNames](https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage/#method-requestCacheNames)"]
99#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
100pub struct RequestCacheNames {
101 pub method: RequestCacheNamesMethod,
102 pub params: RequestCacheNamesParams,
103}
104impl RequestCacheNames {
105 pub const IDENTIFIER: &'static str = "CacheStorage.requestCacheNames";
106 pub fn identifier(&self) -> &'static str {
107 Self::IDENTIFIER
108 }
109}
110impl crate::CommandResult for RequestCacheNames {
111 type Result = super::results::RequestCacheNamesResult;
112}
113#[doc = "Fetches cache entry.\n[requestCachedResponse](https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage/#method-requestCachedResponse)"]
114#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
115pub struct RequestCachedResponseParams {
116 #[doc = "Id of cache that contains the entry."]
117 #[serde(rename = "cacheId")]
118 pub cache_id: super::types::CacheId,
119 #[doc = "URL spec of the request."]
120 #[serde(rename = "requestURL")]
121 pub request_url: String,
122 #[doc = "headers of the request."]
123 #[serde(rename = "requestHeaders")]
124 #[serde(skip_serializing_if = "Vec::is_empty")]
125 pub request_headers: Vec<super::types::Header>,
126}
127impl RequestCachedResponseParams {
128 pub fn new(
129 cache_id: impl Into<super::types::CacheId>,
130 request_url: impl Into<String>,
131 request_headers: Vec<super::types::Header>,
132 ) -> Self {
133 Self {
134 cache_id: cache_id.into(),
135 request_url: request_url.into(),
136 request_headers,
137 }
138 }
139}
140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
141pub enum RequestCachedResponseMethod {
142 #[serde(rename = "CacheStorage.requestCachedResponse")]
143 RequestCachedResponse,
144}
145#[doc = "Fetches cache entry.\n[requestCachedResponse](https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage/#method-requestCachedResponse)"]
146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
147pub struct RequestCachedResponse {
148 pub method: RequestCachedResponseMethod,
149 pub params: RequestCachedResponseParams,
150}
151impl RequestCachedResponse {
152 pub const IDENTIFIER: &'static str = "CacheStorage.requestCachedResponse";
153 pub fn identifier(&self) -> &'static str {
154 Self::IDENTIFIER
155 }
156}
157impl crate::CommandResult for RequestCachedResponse {
158 type Result = super::results::RequestCachedResponseResult;
159}
160#[doc = "Requests data from cache.\n[requestEntries](https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage/#method-requestEntries)"]
161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
162pub struct RequestEntriesParams {
163 #[doc = "ID of cache to get entries from."]
164 #[serde(rename = "cacheId")]
165 pub cache_id: super::types::CacheId,
166 #[doc = "Number of records to skip."]
167 #[serde(rename = "skipCount")]
168 #[serde(skip_serializing_if = "Option::is_none")]
169 #[serde(default)]
170 pub skip_count: Option<i64>,
171 #[doc = "Number of records to fetch."]
172 #[serde(rename = "pageSize")]
173 #[serde(skip_serializing_if = "Option::is_none")]
174 #[serde(default)]
175 pub page_size: Option<i64>,
176 #[doc = "If present, only return the entries containing this substring in the path"]
177 #[serde(rename = "pathFilter")]
178 #[serde(skip_serializing_if = "Option::is_none")]
179 #[serde(default)]
180 pub path_filter: Option<String>,
181}
182impl RequestEntriesParams {
183 pub fn new(cache_id: impl Into<super::types::CacheId>) -> Self {
184 Self {
185 cache_id: cache_id.into(),
186 skip_count: None,
187 page_size: None,
188 path_filter: None,
189 }
190 }
191}
192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
193pub enum RequestEntriesMethod {
194 #[serde(rename = "CacheStorage.requestEntries")]
195 RequestEntries,
196}
197#[doc = "Requests data from cache.\n[requestEntries](https://chromedevtools.github.io/devtools-protocol/tot/CacheStorage/#method-requestEntries)"]
198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
199pub struct RequestEntries {
200 pub method: RequestEntriesMethod,
201 pub params: RequestEntriesParams,
202}
203impl RequestEntries {
204 pub const IDENTIFIER: &'static str = "CacheStorage.requestEntries";
205 pub fn identifier(&self) -> &'static str {
206 Self::IDENTIFIER
207 }
208}
209impl crate::CommandResult for RequestEntries {
210 type Result = super::results::RequestEntriesResult;
211}
212group_enum ! (CacheStorageCommands { DeleteCache (DeleteCache) , DeleteEntry (DeleteEntry) , RequestCacheNames (RequestCacheNames) , RequestCachedResponse (RequestCachedResponse) , RequestEntries (RequestEntries) } + identifiable);