Skip to main content

cdp_protocol/
cache_storage.rs

1// Auto-generated from Chrome at version 146.0.7680.165 domain: CacheStorage
2#![allow(dead_code)]
3use super::storage;
4#[allow(unused_imports)]
5use super::types::*;
6#[allow(unused_imports)]
7use derive_builder::Builder;
8#[allow(unused_imports)]
9use serde::{Deserialize, Serialize};
10#[allow(unused_imports)]
11use serde_json::Value as Json;
12pub type CacheId = String;
13#[allow(deprecated)]
14#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
15pub enum CachedResponseType {
16    #[serde(rename = "basic")]
17    Basic,
18    #[serde(rename = "cors")]
19    Cors,
20    #[serde(rename = "default")]
21    Default,
22    #[serde(rename = "error")]
23    Error,
24    #[serde(rename = "opaqueResponse")]
25    OpaqueResponse,
26    #[serde(rename = "opaqueRedirect")]
27    OpaqueRedirect,
28}
29#[allow(deprecated)]
30#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
31#[builder(setter(into, strip_option))]
32#[serde(rename_all = "camelCase")]
33#[doc = "Data entry."]
34pub struct DataEntry {
35    #[serde(default)]
36    #[doc = "Request URL."]
37    #[serde(rename = "requestURL")]
38    pub request_url: String,
39    #[serde(default)]
40    #[doc = "Request method."]
41    pub request_method: String,
42    #[doc = "Request headers"]
43    pub request_headers: Vec<Header>,
44    #[serde(default)]
45    #[doc = "Number of seconds since epoch."]
46    pub response_time: JsFloat,
47    #[serde(default)]
48    #[doc = "HTTP response status code."]
49    pub response_status: JsUInt,
50    #[serde(default)]
51    #[doc = "HTTP response status text."]
52    pub response_status_text: String,
53    #[doc = "HTTP response type"]
54    pub response_type: CachedResponseType,
55    #[doc = "Response headers"]
56    pub response_headers: Vec<Header>,
57}
58#[allow(deprecated)]
59#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
60#[builder(setter(into, strip_option))]
61#[serde(rename_all = "camelCase")]
62#[doc = "Cache identifier."]
63pub struct Cache {
64    #[doc = "An opaque unique id of the cache."]
65    pub cache_id: CacheId,
66    #[serde(default)]
67    #[doc = "Security origin of the cache."]
68    pub security_origin: String,
69    #[serde(default)]
70    #[doc = "Storage key of the cache."]
71    pub storage_key: String,
72    #[builder(default)]
73    #[serde(skip_serializing_if = "Option::is_none")]
74    #[doc = "Storage bucket of the cache."]
75    pub storage_bucket: Option<storage::StorageBucket>,
76    #[serde(default)]
77    #[doc = "The name of the cache."]
78    pub cache_name: String,
79}
80#[allow(deprecated)]
81#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
82#[builder(setter(into, strip_option))]
83#[serde(rename_all = "camelCase")]
84pub struct Header {
85    #[serde(default)]
86    pub name: String,
87    #[serde(default)]
88    pub value: String,
89}
90#[allow(deprecated)]
91#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
92#[builder(setter(into, strip_option))]
93#[serde(rename_all = "camelCase")]
94#[doc = "Cached response"]
95pub struct CachedResponse {
96    #[doc = "Entry content, base64-encoded."]
97    pub body: String,
98}
99#[allow(deprecated)]
100#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
101#[builder(setter(into, strip_option))]
102#[serde(rename_all = "camelCase")]
103#[doc = "Deletes a cache."]
104pub struct DeleteCache {
105    #[doc = "Id of cache for deletion."]
106    pub cache_id: CacheId,
107}
108#[allow(deprecated)]
109#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
110#[builder(setter(into, strip_option))]
111#[serde(rename_all = "camelCase")]
112#[doc = "Deletes a cache entry."]
113pub struct DeleteEntry {
114    #[doc = "Id of cache where the entry will be deleted."]
115    pub cache_id: CacheId,
116    #[serde(default)]
117    #[doc = "URL spec of the request."]
118    pub request: String,
119}
120#[allow(deprecated)]
121#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
122#[builder(setter(into, strip_option))]
123#[serde(rename_all = "camelCase")]
124#[doc = "Requests cache names."]
125pub struct RequestCacheNames {
126    #[builder(default)]
127    #[serde(skip_serializing_if = "Option::is_none")]
128    #[serde(default)]
129    #[doc = "At least and at most one of securityOrigin, storageKey, storageBucket must be specified.\n Security origin."]
130    pub security_origin: Option<String>,
131    #[builder(default)]
132    #[serde(skip_serializing_if = "Option::is_none")]
133    #[serde(default)]
134    #[doc = "Storage key."]
135    pub storage_key: Option<String>,
136    #[builder(default)]
137    #[serde(skip_serializing_if = "Option::is_none")]
138    #[doc = "Storage bucket. If not specified, it uses the default bucket."]
139    pub storage_bucket: Option<storage::StorageBucket>,
140}
141#[allow(deprecated)]
142#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
143#[builder(setter(into, strip_option))]
144#[serde(rename_all = "camelCase")]
145#[doc = "Fetches cache entry."]
146pub struct RequestCachedResponse {
147    #[doc = "Id of cache that contains the entry."]
148    pub cache_id: CacheId,
149    #[serde(default)]
150    #[doc = "URL spec of the request."]
151    #[serde(rename = "requestURL")]
152    pub request_url: String,
153    #[doc = "headers of the request."]
154    pub request_headers: Vec<Header>,
155}
156#[allow(deprecated)]
157#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
158#[builder(setter(into, strip_option))]
159#[serde(rename_all = "camelCase")]
160#[doc = "Requests data from cache."]
161pub struct RequestEntries {
162    #[doc = "ID of cache to get entries from."]
163    pub cache_id: CacheId,
164    #[builder(default)]
165    #[serde(skip_serializing_if = "Option::is_none")]
166    #[serde(default)]
167    #[doc = "Number of records to skip."]
168    pub skip_count: Option<JsUInt>,
169    #[builder(default)]
170    #[serde(skip_serializing_if = "Option::is_none")]
171    #[serde(default)]
172    #[doc = "Number of records to fetch."]
173    pub page_size: Option<JsUInt>,
174    #[builder(default)]
175    #[serde(skip_serializing_if = "Option::is_none")]
176    #[serde(default)]
177    #[doc = "If present, only return the entries containing this substring in the path"]
178    pub path_filter: Option<String>,
179}
180#[allow(deprecated)]
181#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
182#[doc = "Deletes a cache."]
183pub struct DeleteCacheReturnObject(pub Option<Json>);
184#[allow(deprecated)]
185#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
186#[doc = "Deletes a cache entry."]
187pub struct DeleteEntryReturnObject(pub Option<Json>);
188#[allow(deprecated)]
189#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
190#[serde(rename_all = "camelCase")]
191#[doc = "Requests cache names."]
192pub struct RequestCacheNamesReturnObject {
193    #[doc = "Caches for the security origin."]
194    pub caches: Vec<Cache>,
195}
196#[allow(deprecated)]
197#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
198#[serde(rename_all = "camelCase")]
199#[doc = "Fetches cache entry."]
200pub struct RequestCachedResponseReturnObject {
201    #[doc = "Response read from the cache."]
202    pub response: CachedResponse,
203}
204#[allow(deprecated)]
205#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
206#[serde(rename_all = "camelCase")]
207#[doc = "Requests data from cache."]
208pub struct RequestEntriesReturnObject {
209    #[doc = "Array of object store data entries."]
210    pub cache_data_entries: Vec<DataEntry>,
211    #[serde(default)]
212    #[doc = "Count of returned entries from this storage. If pathFilter is empty, it\n is the count of all entries from this storage."]
213    pub return_count: JsFloat,
214}
215#[allow(deprecated)]
216impl Method for DeleteCache {
217    const NAME: &'static str = "CacheStorage.deleteCache";
218    type ReturnObject = DeleteCacheReturnObject;
219}
220#[allow(deprecated)]
221impl Method for DeleteEntry {
222    const NAME: &'static str = "CacheStorage.deleteEntry";
223    type ReturnObject = DeleteEntryReturnObject;
224}
225#[allow(deprecated)]
226impl Method for RequestCacheNames {
227    const NAME: &'static str = "CacheStorage.requestCacheNames";
228    type ReturnObject = RequestCacheNamesReturnObject;
229}
230#[allow(deprecated)]
231impl Method for RequestCachedResponse {
232    const NAME: &'static str = "CacheStorage.requestCachedResponse";
233    type ReturnObject = RequestCachedResponseReturnObject;
234}
235#[allow(deprecated)]
236impl Method for RequestEntries {
237    const NAME: &'static str = "CacheStorage.requestEntries";
238    type ReturnObject = RequestEntriesReturnObject;
239}
240#[allow(dead_code)]
241pub mod events {
242    #[allow(unused_imports)]
243    use super::super::types::*;
244    #[allow(unused_imports)]
245    use derive_builder::Builder;
246    #[allow(unused_imports)]
247    use serde::{Deserialize, Serialize};
248    #[allow(unused_imports)]
249    use serde_json::Value as Json;
250}