rivet_kv/
model.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// A new entry to insert into the key-value database.
3#[non_exhaustive]
4#[derive(std::clone::Clone, std::cmp::PartialEq)]
5pub struct PutEntry {
6	/// A string reprenting a key in the key-value database. Key path components are split by a slash (e.g. `a/b/c` has the path components `["a", "b", "c"]`). Slashes can be escaped by using a forward slash (e.g. `a/b\/c/d` has the path components `["a", "b/c", "d"]`). See `rivet.api.kv.common#KeyComponents` for the structure of a `rivet.api.kv.common#Key` split by `/`.
7	pub key: std::option::Option<std::string::String>,
8	#[allow(missing_docs)] // documentation missing in model
9	pub value: std::option::Option<aws_smithy_types::Document>,
10}
11impl PutEntry {
12	/// A string reprenting a key in the key-value database. Key path components are split by a slash (e.g. `a/b/c` has the path components `["a", "b", "c"]`). Slashes can be escaped by using a forward slash (e.g. `a/b\/c/d` has the path components `["a", "b/c", "d"]`). See `rivet.api.kv.common#KeyComponents` for the structure of a `rivet.api.kv.common#Key` split by `/`.
13	pub fn key(&self) -> std::option::Option<&str> {
14		self.key.as_deref()
15	}
16	#[allow(missing_docs)] // documentation missing in model
17	pub fn value(&self) -> std::option::Option<&aws_smithy_types::Document> {
18		self.value.as_ref()
19	}
20}
21impl std::fmt::Debug for PutEntry {
22	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23		let mut formatter = f.debug_struct("PutEntry");
24		formatter.field("key", &self.key);
25		formatter.field("value", &self.value);
26		formatter.finish()
27	}
28}
29/// See [`PutEntry`](crate::model::PutEntry)
30pub mod put_entry {
31	/// A builder for [`PutEntry`](crate::model::PutEntry)
32	#[non_exhaustive]
33	#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
34	pub struct Builder {
35		pub(crate) key: std::option::Option<std::string::String>,
36		pub(crate) value: std::option::Option<aws_smithy_types::Document>,
37	}
38	impl Builder {
39		/// A string reprenting a key in the key-value database. Key path components are split by a slash (e.g. `a/b/c` has the path components `["a", "b", "c"]`). Slashes can be escaped by using a forward slash (e.g. `a/b\/c/d` has the path components `["a", "b/c", "d"]`). See `rivet.api.kv.common#KeyComponents` for the structure of a `rivet.api.kv.common#Key` split by `/`.
40		pub fn key(mut self, input: impl Into<std::string::String>) -> Self {
41			self.key = Some(input.into());
42			self
43		}
44		/// A string reprenting a key in the key-value database. Key path components are split by a slash (e.g. `a/b/c` has the path components `["a", "b", "c"]`). Slashes can be escaped by using a forward slash (e.g. `a/b\/c/d` has the path components `["a", "b/c", "d"]`). See `rivet.api.kv.common#KeyComponents` for the structure of a `rivet.api.kv.common#Key` split by `/`.
45		pub fn set_key(mut self, input: std::option::Option<std::string::String>) -> Self {
46			self.key = input;
47			self
48		}
49		#[allow(missing_docs)] // documentation missing in model
50		pub fn value(mut self, input: aws_smithy_types::Document) -> Self {
51			self.value = Some(input);
52			self
53		}
54		#[allow(missing_docs)] // documentation missing in model
55		pub fn set_value(mut self, input: std::option::Option<aws_smithy_types::Document>) -> Self {
56			self.value = input;
57			self
58		}
59		/// Consumes the builder and constructs a [`PutEntry`](crate::model::PutEntry)
60		pub fn build(self) -> crate::model::PutEntry {
61			crate::model::PutEntry {
62				key: self.key,
63				value: self.value,
64			}
65		}
66	}
67}
68impl PutEntry {
69	/// Creates a new builder-style object to manufacture [`PutEntry`](crate::model::PutEntry)
70	pub fn builder() -> crate::model::put_entry::Builder {
71		crate::model::put_entry::Builder::default()
72	}
73}
74
75/// Provided by watchable endpoints used in blocking loops.
76#[non_exhaustive]
77#[derive(std::clone::Clone, std::cmp::PartialEq)]
78pub struct WatchResponse {
79	/// Index indicating the version of the data responded. Pas this to `rivet.common#WatchQuery` to block and wait for the next response.
80	pub index: std::option::Option<std::string::String>,
81}
82impl WatchResponse {
83	/// Index indicating the version of the data responded. Pas this to `rivet.common#WatchQuery` to block and wait for the next response.
84	pub fn index(&self) -> std::option::Option<&str> {
85		self.index.as_deref()
86	}
87}
88impl std::fmt::Debug for WatchResponse {
89	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
90		let mut formatter = f.debug_struct("WatchResponse");
91		formatter.field("index", &self.index);
92		formatter.finish()
93	}
94}
95/// See [`WatchResponse`](crate::model::WatchResponse)
96pub mod watch_response {
97	/// A builder for [`WatchResponse`](crate::model::WatchResponse)
98	#[non_exhaustive]
99	#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
100	pub struct Builder {
101		pub(crate) index: std::option::Option<std::string::String>,
102	}
103	impl Builder {
104		/// Index indicating the version of the data responded. Pas this to `rivet.common#WatchQuery` to block and wait for the next response.
105		pub fn index(mut self, input: impl Into<std::string::String>) -> Self {
106			self.index = Some(input.into());
107			self
108		}
109		/// Index indicating the version of the data responded. Pas this to `rivet.common#WatchQuery` to block and wait for the next response.
110		pub fn set_index(mut self, input: std::option::Option<std::string::String>) -> Self {
111			self.index = input;
112			self
113		}
114		/// Consumes the builder and constructs a [`WatchResponse`](crate::model::WatchResponse)
115		pub fn build(self) -> crate::model::WatchResponse {
116			crate::model::WatchResponse { index: self.index }
117		}
118	}
119}
120impl WatchResponse {
121	/// Creates a new builder-style object to manufacture [`WatchResponse`](crate::model::WatchResponse)
122	pub fn builder() -> crate::model::watch_response::Builder {
123		crate::model::watch_response::Builder::default()
124	}
125}
126
127/// A key-value entry.
128#[non_exhaustive]
129#[derive(std::clone::Clone, std::cmp::PartialEq)]
130pub struct KvEntry {
131	/// A key separated into components.
132	pub key: std::option::Option<std::vec::Vec<std::string::String>>,
133	#[allow(missing_docs)] // documentation missing in model
134	pub value: std::option::Option<aws_smithy_types::Document>,
135	#[allow(missing_docs)] // documentation missing in model
136	pub deleted: std::option::Option<bool>,
137}
138impl KvEntry {
139	/// A key separated into components.
140	pub fn key(&self) -> std::option::Option<&[std::string::String]> {
141		self.key.as_deref()
142	}
143	#[allow(missing_docs)] // documentation missing in model
144	pub fn value(&self) -> std::option::Option<&aws_smithy_types::Document> {
145		self.value.as_ref()
146	}
147	#[allow(missing_docs)] // documentation missing in model
148	pub fn deleted(&self) -> std::option::Option<bool> {
149		self.deleted
150	}
151}
152impl std::fmt::Debug for KvEntry {
153	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
154		let mut formatter = f.debug_struct("KvEntry");
155		formatter.field("key", &self.key);
156		formatter.field("value", &self.value);
157		formatter.field("deleted", &self.deleted);
158		formatter.finish()
159	}
160}
161/// See [`KvEntry`](crate::model::KvEntry)
162pub mod kv_entry {
163	/// A builder for [`KvEntry`](crate::model::KvEntry)
164	#[non_exhaustive]
165	#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
166	pub struct Builder {
167		pub(crate) key: std::option::Option<std::vec::Vec<std::string::String>>,
168		pub(crate) value: std::option::Option<aws_smithy_types::Document>,
169		pub(crate) deleted: std::option::Option<bool>,
170	}
171	impl Builder {
172		/// Appends an item to `key`.
173		///
174		/// To override the contents of this collection use [`set_key`](Self::set_key).
175		///
176		/// A key separated into components.
177		pub fn key(mut self, input: impl Into<std::string::String>) -> Self {
178			let mut v = self.key.unwrap_or_default();
179			v.push(input.into());
180			self.key = Some(v);
181			self
182		}
183		/// A key separated into components.
184		pub fn set_key(
185			mut self,
186			input: std::option::Option<std::vec::Vec<std::string::String>>,
187		) -> Self {
188			self.key = input;
189			self
190		}
191		#[allow(missing_docs)] // documentation missing in model
192		pub fn value(mut self, input: aws_smithy_types::Document) -> Self {
193			self.value = Some(input);
194			self
195		}
196		#[allow(missing_docs)] // documentation missing in model
197		pub fn set_value(mut self, input: std::option::Option<aws_smithy_types::Document>) -> Self {
198			self.value = input;
199			self
200		}
201		#[allow(missing_docs)] // documentation missing in model
202		pub fn deleted(mut self, input: bool) -> Self {
203			self.deleted = Some(input);
204			self
205		}
206		#[allow(missing_docs)] // documentation missing in model
207		pub fn set_deleted(mut self, input: std::option::Option<bool>) -> Self {
208			self.deleted = input;
209			self
210		}
211		/// Consumes the builder and constructs a [`KvEntry`](crate::model::KvEntry)
212		pub fn build(self) -> crate::model::KvEntry {
213			crate::model::KvEntry {
214				key: self.key,
215				value: self.value,
216				deleted: self.deleted,
217			}
218		}
219	}
220}
221impl KvEntry {
222	/// Creates a new builder-style object to manufacture [`KvEntry`](crate::model::KvEntry)
223	pub fn builder() -> crate::model::kv_entry::Builder {
224		crate::model::kv_entry::Builder::default()
225	}
226}