rivet-kv 0.0.8

Rivet service for interacting with the key-value database
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// A new entry to insert into the key-value database.
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct PutEntry {
	/// 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 `/`.
	pub key: std::option::Option<std::string::String>,
	#[allow(missing_docs)] // documentation missing in model
	pub value: std::option::Option<aws_smithy_types::Document>,
}
impl PutEntry {
	/// 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 `/`.
	pub fn key(&self) -> std::option::Option<&str> {
		self.key.as_deref()
	}
	#[allow(missing_docs)] // documentation missing in model
	pub fn value(&self) -> std::option::Option<&aws_smithy_types::Document> {
		self.value.as_ref()
	}
}
impl std::fmt::Debug for PutEntry {
	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
		let mut formatter = f.debug_struct("PutEntry");
		formatter.field("key", &self.key);
		formatter.field("value", &self.value);
		formatter.finish()
	}
}
/// See [`PutEntry`](crate::model::PutEntry)
pub mod put_entry {
	/// A builder for [`PutEntry`](crate::model::PutEntry)
	#[non_exhaustive]
	#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
	pub struct Builder {
		pub(crate) key: std::option::Option<std::string::String>,
		pub(crate) value: std::option::Option<aws_smithy_types::Document>,
	}
	impl Builder {
		/// 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 `/`.
		pub fn key(mut self, input: impl Into<std::string::String>) -> Self {
			self.key = Some(input.into());
			self
		}
		/// 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 `/`.
		pub fn set_key(mut self, input: std::option::Option<std::string::String>) -> Self {
			self.key = input;
			self
		}
		#[allow(missing_docs)] // documentation missing in model
		pub fn value(mut self, input: aws_smithy_types::Document) -> Self {
			self.value = Some(input);
			self
		}
		#[allow(missing_docs)] // documentation missing in model
		pub fn set_value(mut self, input: std::option::Option<aws_smithy_types::Document>) -> Self {
			self.value = input;
			self
		}
		/// Consumes the builder and constructs a [`PutEntry`](crate::model::PutEntry)
		pub fn build(self) -> crate::model::PutEntry {
			crate::model::PutEntry {
				key: self.key,
				value: self.value,
			}
		}
	}
}
impl PutEntry {
	/// Creates a new builder-style object to manufacture [`PutEntry`](crate::model::PutEntry)
	pub fn builder() -> crate::model::put_entry::Builder {
		crate::model::put_entry::Builder::default()
	}
}

/// Provided by watchable endpoints used in blocking loops.
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct WatchResponse {
	/// Index indicating the version of the data responded. Pas this to `rivet.common#WatchQuery` to block and wait for the next response.
	pub index: std::option::Option<std::string::String>,
}
impl WatchResponse {
	/// Index indicating the version of the data responded. Pas this to `rivet.common#WatchQuery` to block and wait for the next response.
	pub fn index(&self) -> std::option::Option<&str> {
		self.index.as_deref()
	}
}
impl std::fmt::Debug for WatchResponse {
	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
		let mut formatter = f.debug_struct("WatchResponse");
		formatter.field("index", &self.index);
		formatter.finish()
	}
}
/// See [`WatchResponse`](crate::model::WatchResponse)
pub mod watch_response {
	/// A builder for [`WatchResponse`](crate::model::WatchResponse)
	#[non_exhaustive]
	#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
	pub struct Builder {
		pub(crate) index: std::option::Option<std::string::String>,
	}
	impl Builder {
		/// Index indicating the version of the data responded. Pas this to `rivet.common#WatchQuery` to block and wait for the next response.
		pub fn index(mut self, input: impl Into<std::string::String>) -> Self {
			self.index = Some(input.into());
			self
		}
		/// Index indicating the version of the data responded. Pas this to `rivet.common#WatchQuery` to block and wait for the next response.
		pub fn set_index(mut self, input: std::option::Option<std::string::String>) -> Self {
			self.index = input;
			self
		}
		/// Consumes the builder and constructs a [`WatchResponse`](crate::model::WatchResponse)
		pub fn build(self) -> crate::model::WatchResponse {
			crate::model::WatchResponse { index: self.index }
		}
	}
}
impl WatchResponse {
	/// Creates a new builder-style object to manufacture [`WatchResponse`](crate::model::WatchResponse)
	pub fn builder() -> crate::model::watch_response::Builder {
		crate::model::watch_response::Builder::default()
	}
}

/// A key-value entry.
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct KvEntry {
	/// A key separated into components.
	pub key: std::option::Option<std::vec::Vec<std::string::String>>,
	#[allow(missing_docs)] // documentation missing in model
	pub value: std::option::Option<aws_smithy_types::Document>,
	#[allow(missing_docs)] // documentation missing in model
	pub deleted: std::option::Option<bool>,
}
impl KvEntry {
	/// A key separated into components.
	pub fn key(&self) -> std::option::Option<&[std::string::String]> {
		self.key.as_deref()
	}
	#[allow(missing_docs)] // documentation missing in model
	pub fn value(&self) -> std::option::Option<&aws_smithy_types::Document> {
		self.value.as_ref()
	}
	#[allow(missing_docs)] // documentation missing in model
	pub fn deleted(&self) -> std::option::Option<bool> {
		self.deleted
	}
}
impl std::fmt::Debug for KvEntry {
	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
		let mut formatter = f.debug_struct("KvEntry");
		formatter.field("key", &self.key);
		formatter.field("value", &self.value);
		formatter.field("deleted", &self.deleted);
		formatter.finish()
	}
}
/// See [`KvEntry`](crate::model::KvEntry)
pub mod kv_entry {
	/// A builder for [`KvEntry`](crate::model::KvEntry)
	#[non_exhaustive]
	#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
	pub struct Builder {
		pub(crate) key: std::option::Option<std::vec::Vec<std::string::String>>,
		pub(crate) value: std::option::Option<aws_smithy_types::Document>,
		pub(crate) deleted: std::option::Option<bool>,
	}
	impl Builder {
		/// Appends an item to `key`.
		///
		/// To override the contents of this collection use [`set_key`](Self::set_key).
		///
		/// A key separated into components.
		pub fn key(mut self, input: impl Into<std::string::String>) -> Self {
			let mut v = self.key.unwrap_or_default();
			v.push(input.into());
			self.key = Some(v);
			self
		}
		/// A key separated into components.
		pub fn set_key(
			mut self,
			input: std::option::Option<std::vec::Vec<std::string::String>>,
		) -> Self {
			self.key = input;
			self
		}
		#[allow(missing_docs)] // documentation missing in model
		pub fn value(mut self, input: aws_smithy_types::Document) -> Self {
			self.value = Some(input);
			self
		}
		#[allow(missing_docs)] // documentation missing in model
		pub fn set_value(mut self, input: std::option::Option<aws_smithy_types::Document>) -> Self {
			self.value = input;
			self
		}
		#[allow(missing_docs)] // documentation missing in model
		pub fn deleted(mut self, input: bool) -> Self {
			self.deleted = Some(input);
			self
		}
		#[allow(missing_docs)] // documentation missing in model
		pub fn set_deleted(mut self, input: std::option::Option<bool>) -> Self {
			self.deleted = input;
			self
		}
		/// Consumes the builder and constructs a [`KvEntry`](crate::model::KvEntry)
		pub fn build(self) -> crate::model::KvEntry {
			crate::model::KvEntry {
				key: self.key,
				value: self.value,
				deleted: self.deleted,
			}
		}
	}
}
impl KvEntry {
	/// Creates a new builder-style object to manufacture [`KvEntry`](crate::model::KvEntry)
	pub fn builder() -> crate::model::kv_entry::Builder {
		crate::model::kv_entry::Builder::default()
	}
}