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
use crate::framework::endpoint::{Endpoint, Method};
#[derive(Debug)]
pub struct WriteBulk<'a> {
pub account_identifier: &'a str,
pub namespace_identifier: &'a str,
pub bulk_key_value_pairs: Vec<KeyValuePair>,
}
impl<'a> Endpoint<(), (), Vec<KeyValuePair>> for WriteBulk<'a> {
fn method(&self) -> Method {
Method::Put
}
fn path(&self) -> String {
format!(
"accounts/{}/storage/kv/namespaces/{}/bulk",
self.account_identifier, self.namespace_identifier
)
}
fn body(&self) -> Option<Vec<KeyValuePair>> {
Some(self.bulk_key_value_pairs.clone())
}
}
#[serde_with::skip_serializing_none]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct KeyValuePair {
pub key: String,
pub value: String,
pub expiration: Option<i64>,
pub expiration_ttl: Option<i64>,
pub base64: Option<bool>,
}