1#[derive(Default)]
2pub struct QueryOptions {
3 pub region: Option<String>,
4 pub namespace: Option<String>,
5 pub allow_stale: Option<bool>,
6 pub wait_index: Option<u64>,
7 pub wait_time: Option<u64>,
8 pub prefix: Option<String>,
9 pub params: Option<std::collections::HashMap<String, String>>,
10 pub headers: Option<std::collections::HashMap<String, String>>,
11 pub auth_token: Option<String>,
12 pub filter: Option<String>,
13 pub per_page: Option<i32>,
14 pub next_token: Option<String>,
15 pub reverse: Option<bool>,
16}
17
18impl QueryOptions {
19 pub fn new() -> Self {
22 QueryOptions {
23 region: None,
24 namespace: None,
25 allow_stale: None,
26 wait_index: None,
27 wait_time: None,
28 prefix: None,
29 params: None,
30 headers: None,
31 auth_token: None,
32 filter: None,
33 per_page: None,
34 next_token: None,
35 reverse: None,
36 }
37 }
38 pub fn with_region(mut self, region: String) -> Self {
39 self.region = Some(region);
40 self
41 }
42 pub fn with_namespace(mut self, namespace: String) -> Self {
43 self.namespace = Some(namespace);
44 self
45 }
46 pub fn with_allow_stale(mut self, allow_stale: bool) -> Self {
47 self.allow_stale = Some(allow_stale);
48 self
49 }
50 pub fn with_wait_index(mut self, wait_index: u64) -> Self {
51 self.wait_index = Some(wait_index);
52 self
53 }
54 pub fn with_wait_time(mut self, wait_time: u64) -> Self {
55 self.wait_time = Some(wait_time);
56 self
57 }
58 pub fn with_prefix(mut self, prefix: String) -> Self {
59 self.prefix = Some(prefix);
60 self
61 }
62 pub fn with_params(mut self, params: std::collections::HashMap<String, String>) -> Self {
63 self.params = Some(params);
64 self
65 }
66 pub fn with_headers(mut self, headers: std::collections::HashMap<String, String>) -> Self {
67 self.headers = Some(headers);
68 self
69 }
70 pub fn with_auth_token(mut self, auth_token: String) -> Self {
71 self.auth_token = Some(auth_token);
72 self
73 }
74 pub fn with_filter(mut self, filter: String) -> Self {
75 self.filter = Some(filter);
76 self
77 }
78 pub fn with_per_page(mut self, per_page: i32) -> Self {
79 self.per_page = Some(per_page);
80 self
81 }
82 pub fn with_next_token(mut self, next_token: String) -> Self {
83 self.next_token = Some(next_token);
84 self
85 }
86 pub fn with_reverse(mut self, reverse: bool) -> Self {
87 self.reverse = Some(reverse);
88 self
89 }
90}
91
92#[derive(Default)]
93pub struct WriteOptions {
94 pub region: Option<String>,
95 pub namespace: Option<String>,
96 pub auth_token: Option<String>,
97 pub headers: Option<std::collections::HashMap<String, String>>,
98 pub idempotency_token: Option<String>,
99}
100
101impl WriteOptions {
102 pub fn new() -> Self {
105 WriteOptions {
106 region: None,
107 namespace: None,
108 auth_token: None,
109 headers: None,
110 idempotency_token: None,
111 }
112 }
113 pub fn with_region(mut self, region: String) -> Self {
114 self.region = Some(region);
115 self
116 }
117 pub fn with_namespace(mut self, namespace: String) -> Self {
118 self.namespace = Some(namespace);
119 self
120 }
121 pub fn with_auth_token(mut self, auth_token: String) -> Self {
122 self.auth_token = Some(auth_token);
123 self
124 }
125 pub fn with_headers(mut self, headers: std::collections::HashMap<String, String>) -> Self {
126 self.headers = Some(headers);
127 self
128 }
129 pub fn with_idempotency_token(mut self, token: String) -> Self {
130 self.idempotency_token = Some(token);
131 self
132 }
133}