rivet_chat/
input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2use std::fmt::Write;
3/// See [`GetDirectThreadInput`](crate::input::GetDirectThreadInput)
4pub mod get_direct_thread_input {
5	/// A builder for [`GetDirectThreadInput`](crate::input::GetDirectThreadInput)
6	#[non_exhaustive]
7	#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
8	pub struct Builder {
9		pub(crate) identity_id: std::option::Option<std::string::String>,
10	}
11	impl Builder {
12		/// A universally unique identifier.
13		pub fn identity_id(mut self, input: impl Into<std::string::String>) -> Self {
14			self.identity_id = Some(input.into());
15			self
16		}
17		/// A universally unique identifier.
18		pub fn set_identity_id(mut self, input: std::option::Option<std::string::String>) -> Self {
19			self.identity_id = input;
20			self
21		}
22		/// Consumes the builder and constructs a [`GetDirectThreadInput`](crate::input::GetDirectThreadInput)
23		pub fn build(
24			self,
25		) -> std::result::Result<
26			crate::input::GetDirectThreadInput,
27			aws_smithy_http::operation::BuildError,
28		> {
29			Ok(crate::input::GetDirectThreadInput {
30				identity_id: self.identity_id,
31			})
32		}
33	}
34}
35#[doc(hidden)]
36pub type GetDirectThreadInputOperationOutputAlias = crate::operation::GetDirectThread;
37#[doc(hidden)]
38pub type GetDirectThreadInputOperationRetryAlias = ();
39impl GetDirectThreadInput {
40	/// Consumes the builder and constructs an Operation<[`GetDirectThread`](crate::operation::GetDirectThread)>
41	#[allow(unused_mut)]
42	#[allow(clippy::let_and_return)]
43	#[allow(clippy::needless_borrow)]
44	pub async fn make_operation(
45		&self,
46		_config: &crate::config::Config,
47	) -> std::result::Result<
48		aws_smithy_http::operation::Operation<crate::operation::GetDirectThread, ()>,
49		aws_smithy_http::operation::BuildError,
50	> {
51		let mut request = {
52			fn uri_base(
53				_input: &crate::input::GetDirectThreadInput,
54				output: &mut String,
55			) -> Result<(), aws_smithy_http::operation::BuildError> {
56				let input_1 = &_input.identity_id;
57				let input_1 = input_1.as_ref().ok_or(
58					aws_smithy_http::operation::BuildError::MissingField {
59						field: "identity_id",
60						details: "cannot be empty or unset",
61					},
62				)?;
63				let identity_id = aws_smithy_http::label::fmt_string(input_1, false);
64				if identity_id.is_empty() {
65					return Err(aws_smithy_http::operation::BuildError::MissingField {
66						field: "identity_id",
67						details: "cannot be empty or unset",
68					});
69				}
70				write!(
71					output,
72					"/identities/{identity_id}/thread",
73					identity_id = identity_id
74				)
75				.expect("formatting should succeed");
76				Ok(())
77			}
78			#[allow(clippy::unnecessary_wraps)]
79			fn update_http_builder(
80				input: &crate::input::GetDirectThreadInput,
81				_config: &crate::config::Config,
82				builder: http::request::Builder,
83			) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
84			{
85				let mut _uri = String::new();
86				_uri = format!("{}{}", _config.uri.clone(), _uri);
87				uri_base(input, &mut _uri)?;
88				Ok(builder.method("GET").uri(_uri))
89			}
90			let mut builder = update_http_builder(&self, _config, http::request::Builder::new())?;
91			let mut builder = if let Some(auth) = &_config.auth {
92				builder.header(http::header::AUTHORIZATION, auth.clone())
93			} else {
94				builder
95			};
96			builder
97		};
98		let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
99		#[allow(clippy::useless_conversion)]
100		let body = aws_smithy_http::body::SdkBody::from("");
101		let request = request.body(body).expect("should be valid request");
102		let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
103		request
104			.properties_mut()
105			.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
106		let op = aws_smithy_http::operation::Operation::new(
107			request,
108			crate::operation::GetDirectThread::new(),
109		)
110		.with_metadata(aws_smithy_http::operation::Metadata::new(
111			"GetDirectThread",
112			"ChatService",
113		));
114		Ok(op)
115	}
116	/// Creates a new builder-style object to manufacture [`GetDirectThreadInput`](crate::input::GetDirectThreadInput)
117	pub fn builder() -> crate::input::get_direct_thread_input::Builder {
118		crate::input::get_direct_thread_input::Builder::default()
119	}
120}
121
122/// See [`GetThreadHistoryInput`](crate::input::GetThreadHistoryInput)
123pub mod get_thread_history_input {
124	/// A builder for [`GetThreadHistoryInput`](crate::input::GetThreadHistoryInput)
125	#[non_exhaustive]
126	#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
127	pub struct Builder {
128		pub(crate) thread_id: std::option::Option<std::string::String>,
129		pub(crate) ts: std::option::Option<aws_smithy_types::DateTime>,
130		pub(crate) count: std::option::Option<i32>,
131		pub(crate) query_direction: std::option::Option<crate::model::QueryDirection>,
132	}
133	impl Builder {
134		/// A universally unique identifier.
135		pub fn thread_id(mut self, input: impl Into<std::string::String>) -> Self {
136			self.thread_id = Some(input.into());
137			self
138		}
139		/// A universally unique identifier.
140		pub fn set_thread_id(mut self, input: std::option::Option<std::string::String>) -> Self {
141			self.thread_id = input;
142			self
143		}
144		/// RFC3339 timestamp.
145		pub fn ts(mut self, input: aws_smithy_types::DateTime) -> Self {
146			self.ts = Some(input);
147			self
148		}
149		/// RFC3339 timestamp.
150		pub fn set_ts(mut self, input: std::option::Option<aws_smithy_types::DateTime>) -> Self {
151			self.ts = input;
152			self
153		}
154		/// How many messages to collect in each direction. If querying `rivet.api.chat.common#QueryDirection$before_and_after`, `rivet.api.chat.common#QueryDirection$chat_messages` will be `count * 2`.
155		pub fn count(mut self, input: i32) -> Self {
156			self.count = Some(input);
157			self
158		}
159		/// How many messages to collect in each direction. If querying `rivet.api.chat.common#QueryDirection$before_and_after`, `rivet.api.chat.common#QueryDirection$chat_messages` will be `count * 2`.
160		pub fn set_count(mut self, input: std::option::Option<i32>) -> Self {
161			self.count = input;
162			self
163		}
164		/// Represents which direction to query messages from relative to the given timestamp.
165		pub fn query_direction(mut self, input: crate::model::QueryDirection) -> Self {
166			self.query_direction = Some(input);
167			self
168		}
169		/// Represents which direction to query messages from relative to the given timestamp.
170		pub fn set_query_direction(
171			mut self,
172			input: std::option::Option<crate::model::QueryDirection>,
173		) -> Self {
174			self.query_direction = input;
175			self
176		}
177		/// Consumes the builder and constructs a [`GetThreadHistoryInput`](crate::input::GetThreadHistoryInput)
178		pub fn build(
179			self,
180		) -> std::result::Result<
181			crate::input::GetThreadHistoryInput,
182			aws_smithy_http::operation::BuildError,
183		> {
184			Ok(crate::input::GetThreadHistoryInput {
185				thread_id: self.thread_id,
186				ts: self.ts,
187				count: self.count,
188				query_direction: self.query_direction,
189			})
190		}
191	}
192}
193#[doc(hidden)]
194pub type GetThreadHistoryInputOperationOutputAlias = crate::operation::GetThreadHistory;
195#[doc(hidden)]
196pub type GetThreadHistoryInputOperationRetryAlias = ();
197impl GetThreadHistoryInput {
198	/// Consumes the builder and constructs an Operation<[`GetThreadHistory`](crate::operation::GetThreadHistory)>
199	#[allow(unused_mut)]
200	#[allow(clippy::let_and_return)]
201	#[allow(clippy::needless_borrow)]
202	pub async fn make_operation(
203		&self,
204		_config: &crate::config::Config,
205	) -> std::result::Result<
206		aws_smithy_http::operation::Operation<crate::operation::GetThreadHistory, ()>,
207		aws_smithy_http::operation::BuildError,
208	> {
209		let mut request = {
210			fn uri_base(
211				_input: &crate::input::GetThreadHistoryInput,
212				output: &mut String,
213			) -> Result<(), aws_smithy_http::operation::BuildError> {
214				let input_2 = &_input.thread_id;
215				let input_2 = input_2.as_ref().ok_or(
216					aws_smithy_http::operation::BuildError::MissingField {
217						field: "thread_id",
218						details: "cannot be empty or unset",
219					},
220				)?;
221				let thread_id = aws_smithy_http::label::fmt_string(input_2, false);
222				if thread_id.is_empty() {
223					return Err(aws_smithy_http::operation::BuildError::MissingField {
224						field: "thread_id",
225						details: "cannot be empty or unset",
226					});
227				}
228				write!(
229					output,
230					"/threads/{thread_id}/history",
231					thread_id = thread_id
232				)
233				.expect("formatting should succeed");
234				Ok(())
235			}
236			fn uri_query(
237				_input: &crate::input::GetThreadHistoryInput,
238				mut output: &mut String,
239			) -> Result<(), aws_smithy_http::operation::BuildError> {
240				let mut query = aws_smithy_http::query::Writer::new(&mut output);
241				if let Some(inner_3) = &_input.ts {
242					query.push_kv(
243						"ts",
244						&aws_smithy_http::query::fmt_timestamp(
245							inner_3,
246							aws_smithy_types::date_time::Format::DateTime,
247						)?,
248					);
249				}
250				if let Some(inner_4) = &_input.count {
251					query.push_kv(
252						"count",
253						aws_smithy_types::primitive::Encoder::from(*inner_4).encode(),
254					);
255				}
256				if let Some(inner_5) = &_input.query_direction {
257					query.push_kv(
258						"query_direction",
259						&aws_smithy_http::query::fmt_string(&inner_5),
260					);
261				}
262				Ok(())
263			}
264			#[allow(clippy::unnecessary_wraps)]
265			fn update_http_builder(
266				input: &crate::input::GetThreadHistoryInput,
267				_config: &crate::config::Config,
268				builder: http::request::Builder,
269			) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
270			{
271				let mut _uri = String::new();
272				_uri = format!("{}{}", _config.uri.clone(), _uri);
273				uri_base(input, &mut _uri)?;
274				uri_query(input, &mut _uri)?;
275				Ok(builder.method("GET").uri(_uri))
276			}
277			let mut builder = update_http_builder(&self, _config, http::request::Builder::new())?;
278			let mut builder = if let Some(auth) = &_config.auth {
279				builder.header(http::header::AUTHORIZATION, auth.clone())
280			} else {
281				builder
282			};
283			builder
284		};
285		let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
286		#[allow(clippy::useless_conversion)]
287		let body = aws_smithy_http::body::SdkBody::from("");
288		let request = request.body(body).expect("should be valid request");
289		let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
290		request
291			.properties_mut()
292			.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
293		let op = aws_smithy_http::operation::Operation::new(
294			request,
295			crate::operation::GetThreadHistory::new(),
296		)
297		.with_metadata(aws_smithy_http::operation::Metadata::new(
298			"GetThreadHistory",
299			"ChatService",
300		));
301		Ok(op)
302	}
303	/// Creates a new builder-style object to manufacture [`GetThreadHistoryInput`](crate::input::GetThreadHistoryInput)
304	pub fn builder() -> crate::input::get_thread_history_input::Builder {
305		crate::input::get_thread_history_input::Builder::default()
306	}
307}
308
309/// See [`GetThreadTopicInput`](crate::input::GetThreadTopicInput)
310pub mod get_thread_topic_input {
311	/// A builder for [`GetThreadTopicInput`](crate::input::GetThreadTopicInput)
312	#[non_exhaustive]
313	#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
314	pub struct Builder {
315		pub(crate) thread_id: std::option::Option<std::string::String>,
316	}
317	impl Builder {
318		/// A universally unique identifier.
319		pub fn thread_id(mut self, input: impl Into<std::string::String>) -> Self {
320			self.thread_id = Some(input.into());
321			self
322		}
323		/// A universally unique identifier.
324		pub fn set_thread_id(mut self, input: std::option::Option<std::string::String>) -> Self {
325			self.thread_id = input;
326			self
327		}
328		/// Consumes the builder and constructs a [`GetThreadTopicInput`](crate::input::GetThreadTopicInput)
329		pub fn build(
330			self,
331		) -> std::result::Result<
332			crate::input::GetThreadTopicInput,
333			aws_smithy_http::operation::BuildError,
334		> {
335			Ok(crate::input::GetThreadTopicInput {
336				thread_id: self.thread_id,
337			})
338		}
339	}
340}
341#[doc(hidden)]
342pub type GetThreadTopicInputOperationOutputAlias = crate::operation::GetThreadTopic;
343#[doc(hidden)]
344pub type GetThreadTopicInputOperationRetryAlias = ();
345impl GetThreadTopicInput {
346	/// Consumes the builder and constructs an Operation<[`GetThreadTopic`](crate::operation::GetThreadTopic)>
347	#[allow(unused_mut)]
348	#[allow(clippy::let_and_return)]
349	#[allow(clippy::needless_borrow)]
350	pub async fn make_operation(
351		&self,
352		_config: &crate::config::Config,
353	) -> std::result::Result<
354		aws_smithy_http::operation::Operation<crate::operation::GetThreadTopic, ()>,
355		aws_smithy_http::operation::BuildError,
356	> {
357		let mut request = {
358			fn uri_base(
359				_input: &crate::input::GetThreadTopicInput,
360				output: &mut String,
361			) -> Result<(), aws_smithy_http::operation::BuildError> {
362				let input_6 = &_input.thread_id;
363				let input_6 = input_6.as_ref().ok_or(
364					aws_smithy_http::operation::BuildError::MissingField {
365						field: "thread_id",
366						details: "cannot be empty or unset",
367					},
368				)?;
369				let thread_id = aws_smithy_http::label::fmt_string(input_6, false);
370				if thread_id.is_empty() {
371					return Err(aws_smithy_http::operation::BuildError::MissingField {
372						field: "thread_id",
373						details: "cannot be empty or unset",
374					});
375				}
376				write!(output, "/threads/{thread_id}/topic", thread_id = thread_id)
377					.expect("formatting should succeed");
378				Ok(())
379			}
380			#[allow(clippy::unnecessary_wraps)]
381			fn update_http_builder(
382				input: &crate::input::GetThreadTopicInput,
383				_config: &crate::config::Config,
384				builder: http::request::Builder,
385			) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
386			{
387				let mut _uri = String::new();
388				_uri = format!("{}{}", _config.uri.clone(), _uri);
389				uri_base(input, &mut _uri)?;
390				Ok(builder.method("GET").uri(_uri))
391			}
392			let mut builder = update_http_builder(&self, _config, http::request::Builder::new())?;
393			let mut builder = if let Some(auth) = &_config.auth {
394				builder.header(http::header::AUTHORIZATION, auth.clone())
395			} else {
396				builder
397			};
398			builder
399		};
400		let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
401		#[allow(clippy::useless_conversion)]
402		let body = aws_smithy_http::body::SdkBody::from("");
403		let request = request.body(body).expect("should be valid request");
404		let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
405		request
406			.properties_mut()
407			.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
408		let op = aws_smithy_http::operation::Operation::new(
409			request,
410			crate::operation::GetThreadTopic::new(),
411		)
412		.with_metadata(aws_smithy_http::operation::Metadata::new(
413			"GetThreadTopic",
414			"ChatService",
415		));
416		Ok(op)
417	}
418	/// Creates a new builder-style object to manufacture [`GetThreadTopicInput`](crate::input::GetThreadTopicInput)
419	pub fn builder() -> crate::input::get_thread_topic_input::Builder {
420		crate::input::get_thread_topic_input::Builder::default()
421	}
422}
423
424/// See [`SendChatMessageInput`](crate::input::SendChatMessageInput)
425pub mod send_chat_message_input {
426	/// A builder for [`SendChatMessageInput`](crate::input::SendChatMessageInput)
427	#[non_exhaustive]
428	#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
429	pub struct Builder {
430		pub(crate) topic: std::option::Option<crate::model::SendChatTopic>,
431		pub(crate) message_body: std::option::Option<crate::model::SendMessageBody>,
432	}
433	impl Builder {
434		/// Topic to send a chat message to. If you already know the thread ID, use `thread_id`.
435		pub fn topic(mut self, input: crate::model::SendChatTopic) -> Self {
436			self.topic = Some(input);
437			self
438		}
439		/// Topic to send a chat message to. If you already know the thread ID, use `thread_id`.
440		pub fn set_topic(
441			mut self,
442			input: std::option::Option<crate::model::SendChatTopic>,
443		) -> Self {
444			self.topic = input;
445			self
446		}
447		/// Data to send in a chat message.
448		pub fn message_body(mut self, input: crate::model::SendMessageBody) -> Self {
449			self.message_body = Some(input);
450			self
451		}
452		/// Data to send in a chat message.
453		pub fn set_message_body(
454			mut self,
455			input: std::option::Option<crate::model::SendMessageBody>,
456		) -> Self {
457			self.message_body = input;
458			self
459		}
460		/// Consumes the builder and constructs a [`SendChatMessageInput`](crate::input::SendChatMessageInput)
461		pub fn build(
462			self,
463		) -> std::result::Result<
464			crate::input::SendChatMessageInput,
465			aws_smithy_http::operation::BuildError,
466		> {
467			Ok(crate::input::SendChatMessageInput {
468				topic: self.topic,
469				message_body: self.message_body,
470			})
471		}
472	}
473}
474#[doc(hidden)]
475pub type SendChatMessageInputOperationOutputAlias = crate::operation::SendChatMessage;
476#[doc(hidden)]
477pub type SendChatMessageInputOperationRetryAlias = ();
478impl SendChatMessageInput {
479	/// Consumes the builder and constructs an Operation<[`SendChatMessage`](crate::operation::SendChatMessage)>
480	#[allow(unused_mut)]
481	#[allow(clippy::let_and_return)]
482	#[allow(clippy::needless_borrow)]
483	pub async fn make_operation(
484		&self,
485		_config: &crate::config::Config,
486	) -> std::result::Result<
487		aws_smithy_http::operation::Operation<crate::operation::SendChatMessage, ()>,
488		aws_smithy_http::operation::BuildError,
489	> {
490		let mut request = {
491			fn uri_base(
492				_input: &crate::input::SendChatMessageInput,
493				output: &mut String,
494			) -> Result<(), aws_smithy_http::operation::BuildError> {
495				write!(output, "/messages").expect("formatting should succeed");
496				Ok(())
497			}
498			#[allow(clippy::unnecessary_wraps)]
499			fn update_http_builder(
500				input: &crate::input::SendChatMessageInput,
501				_config: &crate::config::Config,
502				builder: http::request::Builder,
503			) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
504			{
505				let mut _uri = String::new();
506				_uri = format!("{}{}", _config.uri.clone(), _uri);
507				uri_base(input, &mut _uri)?;
508				Ok(builder.method("POST").uri(_uri))
509			}
510			let mut builder = update_http_builder(&self, _config, http::request::Builder::new())?;
511			let mut builder = if let Some(auth) = &_config.auth {
512				builder.header(http::header::AUTHORIZATION, auth.clone())
513			} else {
514				builder
515			};
516			builder = aws_smithy_http::header::set_request_header_if_absent(
517				builder,
518				http::header::CONTENT_TYPE,
519				"application/json",
520			);
521			builder
522		};
523		let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
524		#[allow(clippy::useless_conversion)]
525		let body = aws_smithy_http::body::SdkBody::from(
526			crate::operation_ser::serialize_operation_crate_operation_send_chat_message(&self)?,
527		);
528		if let Some(content_length) = body.content_length() {
529			request = aws_smithy_http::header::set_request_header_if_absent(
530				request,
531				http::header::CONTENT_LENGTH,
532				content_length,
533			);
534		}
535		let request = request.body(body).expect("should be valid request");
536		let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
537		request
538			.properties_mut()
539			.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
540		let op = aws_smithy_http::operation::Operation::new(
541			request,
542			crate::operation::SendChatMessage::new(),
543		)
544		.with_metadata(aws_smithy_http::operation::Metadata::new(
545			"SendChatMessage",
546			"ChatService",
547		));
548		Ok(op)
549	}
550	/// Creates a new builder-style object to manufacture [`SendChatMessageInput`](crate::input::SendChatMessageInput)
551	pub fn builder() -> crate::input::send_chat_message_input::Builder {
552		crate::input::send_chat_message_input::Builder::default()
553	}
554}
555
556/// See [`SetThreadReadInput`](crate::input::SetThreadReadInput)
557pub mod set_thread_read_input {
558	/// A builder for [`SetThreadReadInput`](crate::input::SetThreadReadInput)
559	#[non_exhaustive]
560	#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
561	pub struct Builder {
562		pub(crate) thread_id: std::option::Option<std::string::String>,
563		pub(crate) last_read_ts: std::option::Option<aws_smithy_types::DateTime>,
564	}
565	impl Builder {
566		/// A universally unique identifier.
567		pub fn thread_id(mut self, input: impl Into<std::string::String>) -> Self {
568			self.thread_id = Some(input.into());
569			self
570		}
571		/// A universally unique identifier.
572		pub fn set_thread_id(mut self, input: std::option::Option<std::string::String>) -> Self {
573			self.thread_id = input;
574			self
575		}
576		/// Any messages newer than this timestamp will be marked as unread. This should be the current timestamp (in milliseconds).
577		pub fn last_read_ts(mut self, input: aws_smithy_types::DateTime) -> Self {
578			self.last_read_ts = Some(input);
579			self
580		}
581		/// Any messages newer than this timestamp will be marked as unread. This should be the current timestamp (in milliseconds).
582		pub fn set_last_read_ts(
583			mut self,
584			input: std::option::Option<aws_smithy_types::DateTime>,
585		) -> Self {
586			self.last_read_ts = input;
587			self
588		}
589		/// Consumes the builder and constructs a [`SetThreadReadInput`](crate::input::SetThreadReadInput)
590		pub fn build(
591			self,
592		) -> std::result::Result<
593			crate::input::SetThreadReadInput,
594			aws_smithy_http::operation::BuildError,
595		> {
596			Ok(crate::input::SetThreadReadInput {
597				thread_id: self.thread_id,
598				last_read_ts: self.last_read_ts,
599			})
600		}
601	}
602}
603#[doc(hidden)]
604pub type SetThreadReadInputOperationOutputAlias = crate::operation::SetThreadRead;
605#[doc(hidden)]
606pub type SetThreadReadInputOperationRetryAlias = ();
607impl SetThreadReadInput {
608	/// Consumes the builder and constructs an Operation<[`SetThreadRead`](crate::operation::SetThreadRead)>
609	#[allow(unused_mut)]
610	#[allow(clippy::let_and_return)]
611	#[allow(clippy::needless_borrow)]
612	pub async fn make_operation(
613		&self,
614		_config: &crate::config::Config,
615	) -> std::result::Result<
616		aws_smithy_http::operation::Operation<crate::operation::SetThreadRead, ()>,
617		aws_smithy_http::operation::BuildError,
618	> {
619		let mut request = {
620			fn uri_base(
621				_input: &crate::input::SetThreadReadInput,
622				output: &mut String,
623			) -> Result<(), aws_smithy_http::operation::BuildError> {
624				let input_7 = &_input.thread_id;
625				let input_7 = input_7.as_ref().ok_or(
626					aws_smithy_http::operation::BuildError::MissingField {
627						field: "thread_id",
628						details: "cannot be empty or unset",
629					},
630				)?;
631				let thread_id = aws_smithy_http::label::fmt_string(input_7, false);
632				if thread_id.is_empty() {
633					return Err(aws_smithy_http::operation::BuildError::MissingField {
634						field: "thread_id",
635						details: "cannot be empty or unset",
636					});
637				}
638				write!(output, "/threads/{thread_id}/read", thread_id = thread_id)
639					.expect("formatting should succeed");
640				Ok(())
641			}
642			#[allow(clippy::unnecessary_wraps)]
643			fn update_http_builder(
644				input: &crate::input::SetThreadReadInput,
645				_config: &crate::config::Config,
646				builder: http::request::Builder,
647			) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
648			{
649				let mut _uri = String::new();
650				_uri = format!("{}{}", _config.uri.clone(), _uri);
651				uri_base(input, &mut _uri)?;
652				Ok(builder.method("POST").uri(_uri))
653			}
654			let mut builder = update_http_builder(&self, _config, http::request::Builder::new())?;
655			let mut builder = if let Some(auth) = &_config.auth {
656				builder.header(http::header::AUTHORIZATION, auth.clone())
657			} else {
658				builder
659			};
660			builder = aws_smithy_http::header::set_request_header_if_absent(
661				builder,
662				http::header::CONTENT_TYPE,
663				"application/json",
664			);
665			builder
666		};
667		let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
668		#[allow(clippy::useless_conversion)]
669		let body = aws_smithy_http::body::SdkBody::from(
670			crate::operation_ser::serialize_operation_crate_operation_set_thread_read(&self)?,
671		);
672		if let Some(content_length) = body.content_length() {
673			request = aws_smithy_http::header::set_request_header_if_absent(
674				request,
675				http::header::CONTENT_LENGTH,
676				content_length,
677			);
678		}
679		let request = request.body(body).expect("should be valid request");
680		let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
681		request
682			.properties_mut()
683			.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
684		let op = aws_smithy_http::operation::Operation::new(
685			request,
686			crate::operation::SetThreadRead::new(),
687		)
688		.with_metadata(aws_smithy_http::operation::Metadata::new(
689			"SetThreadRead",
690			"ChatService",
691		));
692		Ok(op)
693	}
694	/// Creates a new builder-style object to manufacture [`SetThreadReadInput`](crate::input::SetThreadReadInput)
695	pub fn builder() -> crate::input::set_thread_read_input::Builder {
696		crate::input::set_thread_read_input::Builder::default()
697	}
698}
699
700/// See [`SetTypingStatusInput`](crate::input::SetTypingStatusInput)
701pub mod set_typing_status_input {
702	/// A builder for [`SetTypingStatusInput`](crate::input::SetTypingStatusInput)
703	#[non_exhaustive]
704	#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
705	pub struct Builder {
706		pub(crate) thread_id: std::option::Option<std::string::String>,
707		pub(crate) status: std::option::Option<crate::model::ChatTypingStatus>,
708	}
709	impl Builder {
710		/// A universally unique identifier.
711		pub fn thread_id(mut self, input: impl Into<std::string::String>) -> Self {
712			self.thread_id = Some(input.into());
713			self
714		}
715		/// A universally unique identifier.
716		pub fn set_thread_id(mut self, input: std::option::Option<std::string::String>) -> Self {
717			self.thread_id = input;
718			self
719		}
720		/// Represents a chat typing status.
721		pub fn status(mut self, input: crate::model::ChatTypingStatus) -> Self {
722			self.status = Some(input);
723			self
724		}
725		/// Represents a chat typing status.
726		pub fn set_status(
727			mut self,
728			input: std::option::Option<crate::model::ChatTypingStatus>,
729		) -> Self {
730			self.status = input;
731			self
732		}
733		/// Consumes the builder and constructs a [`SetTypingStatusInput`](crate::input::SetTypingStatusInput)
734		pub fn build(
735			self,
736		) -> std::result::Result<
737			crate::input::SetTypingStatusInput,
738			aws_smithy_http::operation::BuildError,
739		> {
740			Ok(crate::input::SetTypingStatusInput {
741				thread_id: self.thread_id,
742				status: self.status,
743			})
744		}
745	}
746}
747#[doc(hidden)]
748pub type SetTypingStatusInputOperationOutputAlias = crate::operation::SetTypingStatus;
749#[doc(hidden)]
750pub type SetTypingStatusInputOperationRetryAlias = ();
751impl SetTypingStatusInput {
752	/// Consumes the builder and constructs an Operation<[`SetTypingStatus`](crate::operation::SetTypingStatus)>
753	#[allow(unused_mut)]
754	#[allow(clippy::let_and_return)]
755	#[allow(clippy::needless_borrow)]
756	pub async fn make_operation(
757		&self,
758		_config: &crate::config::Config,
759	) -> std::result::Result<
760		aws_smithy_http::operation::Operation<crate::operation::SetTypingStatus, ()>,
761		aws_smithy_http::operation::BuildError,
762	> {
763		let mut request = {
764			fn uri_base(
765				_input: &crate::input::SetTypingStatusInput,
766				output: &mut String,
767			) -> Result<(), aws_smithy_http::operation::BuildError> {
768				let input_8 = &_input.thread_id;
769				let input_8 = input_8.as_ref().ok_or(
770					aws_smithy_http::operation::BuildError::MissingField {
771						field: "thread_id",
772						details: "cannot be empty or unset",
773					},
774				)?;
775				let thread_id = aws_smithy_http::label::fmt_string(input_8, false);
776				if thread_id.is_empty() {
777					return Err(aws_smithy_http::operation::BuildError::MissingField {
778						field: "thread_id",
779						details: "cannot be empty or unset",
780					});
781				}
782				write!(
783					output,
784					"/threads/{thread_id}/typing-status",
785					thread_id = thread_id
786				)
787				.expect("formatting should succeed");
788				Ok(())
789			}
790			#[allow(clippy::unnecessary_wraps)]
791			fn update_http_builder(
792				input: &crate::input::SetTypingStatusInput,
793				_config: &crate::config::Config,
794				builder: http::request::Builder,
795			) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
796			{
797				let mut _uri = String::new();
798				_uri = format!("{}{}", _config.uri.clone(), _uri);
799				uri_base(input, &mut _uri)?;
800				Ok(builder.method("PUT").uri(_uri))
801			}
802			let mut builder = update_http_builder(&self, _config, http::request::Builder::new())?;
803			let mut builder = if let Some(auth) = &_config.auth {
804				builder.header(http::header::AUTHORIZATION, auth.clone())
805			} else {
806				builder
807			};
808			builder = aws_smithy_http::header::set_request_header_if_absent(
809				builder,
810				http::header::CONTENT_TYPE,
811				"application/json",
812			);
813			builder
814		};
815		let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
816		#[allow(clippy::useless_conversion)]
817		let body = aws_smithy_http::body::SdkBody::from(
818			crate::operation_ser::serialize_operation_crate_operation_set_typing_status(&self)?,
819		);
820		if let Some(content_length) = body.content_length() {
821			request = aws_smithy_http::header::set_request_header_if_absent(
822				request,
823				http::header::CONTENT_LENGTH,
824				content_length,
825			);
826		}
827		let request = request.body(body).expect("should be valid request");
828		let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
829		request
830			.properties_mut()
831			.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
832		let op = aws_smithy_http::operation::Operation::new(
833			request,
834			crate::operation::SetTypingStatus::new(),
835		)
836		.with_metadata(aws_smithy_http::operation::Metadata::new(
837			"SetTypingStatus",
838			"ChatService",
839		));
840		Ok(op)
841	}
842	/// Creates a new builder-style object to manufacture [`SetTypingStatusInput`](crate::input::SetTypingStatusInput)
843	pub fn builder() -> crate::input::set_typing_status_input::Builder {
844		crate::input::set_typing_status_input::Builder::default()
845	}
846}
847
848/// See [`WatchThreadInput`](crate::input::WatchThreadInput)
849pub mod watch_thread_input {
850	/// A builder for [`WatchThreadInput`](crate::input::WatchThreadInput)
851	#[non_exhaustive]
852	#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
853	pub struct Builder {
854		pub(crate) thread_id: std::option::Option<std::string::String>,
855		pub(crate) watch_index: std::option::Option<std::string::String>,
856	}
857	impl Builder {
858		/// A universally unique identifier.
859		pub fn thread_id(mut self, input: impl Into<std::string::String>) -> Self {
860			self.thread_id = Some(input.into());
861			self
862		}
863		/// A universally unique identifier.
864		pub fn set_thread_id(mut self, input: std::option::Option<std::string::String>) -> Self {
865			self.thread_id = input;
866			self
867		}
868		/// A query parameter denoting the requests watch index.
869		pub fn watch_index(mut self, input: impl Into<std::string::String>) -> Self {
870			self.watch_index = Some(input.into());
871			self
872		}
873		/// A query parameter denoting the requests watch index.
874		pub fn set_watch_index(mut self, input: std::option::Option<std::string::String>) -> Self {
875			self.watch_index = input;
876			self
877		}
878		/// Consumes the builder and constructs a [`WatchThreadInput`](crate::input::WatchThreadInput)
879		pub fn build(
880			self,
881		) -> std::result::Result<
882			crate::input::WatchThreadInput,
883			aws_smithy_http::operation::BuildError,
884		> {
885			Ok(crate::input::WatchThreadInput {
886				thread_id: self.thread_id,
887				watch_index: self.watch_index,
888			})
889		}
890	}
891}
892#[doc(hidden)]
893pub type WatchThreadInputOperationOutputAlias = crate::operation::WatchThread;
894#[doc(hidden)]
895pub type WatchThreadInputOperationRetryAlias = ();
896impl WatchThreadInput {
897	/// Consumes the builder and constructs an Operation<[`WatchThread`](crate::operation::WatchThread)>
898	#[allow(unused_mut)]
899	#[allow(clippy::let_and_return)]
900	#[allow(clippy::needless_borrow)]
901	pub async fn make_operation(
902		&self,
903		_config: &crate::config::Config,
904	) -> std::result::Result<
905		aws_smithy_http::operation::Operation<crate::operation::WatchThread, ()>,
906		aws_smithy_http::operation::BuildError,
907	> {
908		let mut request = {
909			fn uri_base(
910				_input: &crate::input::WatchThreadInput,
911				output: &mut String,
912			) -> Result<(), aws_smithy_http::operation::BuildError> {
913				let input_9 = &_input.thread_id;
914				let input_9 = input_9.as_ref().ok_or(
915					aws_smithy_http::operation::BuildError::MissingField {
916						field: "thread_id",
917						details: "cannot be empty or unset",
918					},
919				)?;
920				let thread_id = aws_smithy_http::label::fmt_string(input_9, false);
921				if thread_id.is_empty() {
922					return Err(aws_smithy_http::operation::BuildError::MissingField {
923						field: "thread_id",
924						details: "cannot be empty or unset",
925					});
926				}
927				write!(output, "/threads/{thread_id}/live", thread_id = thread_id)
928					.expect("formatting should succeed");
929				Ok(())
930			}
931			fn uri_query(
932				_input: &crate::input::WatchThreadInput,
933				mut output: &mut String,
934			) -> Result<(), aws_smithy_http::operation::BuildError> {
935				let mut query = aws_smithy_http::query::Writer::new(&mut output);
936				if let Some(inner_10) = &_input.watch_index {
937					query.push_kv(
938						"watch_index",
939						&aws_smithy_http::query::fmt_string(&inner_10),
940					);
941				}
942				Ok(())
943			}
944			#[allow(clippy::unnecessary_wraps)]
945			fn update_http_builder(
946				input: &crate::input::WatchThreadInput,
947				_config: &crate::config::Config,
948				builder: http::request::Builder,
949			) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
950			{
951				let mut _uri = String::new();
952				_uri = format!("{}{}", _config.uri.clone(), _uri);
953				uri_base(input, &mut _uri)?;
954				uri_query(input, &mut _uri)?;
955				Ok(builder.method("GET").uri(_uri))
956			}
957			let mut builder = update_http_builder(&self, _config, http::request::Builder::new())?;
958			let mut builder = if let Some(auth) = &_config.auth {
959				builder.header(http::header::AUTHORIZATION, auth.clone())
960			} else {
961				builder
962			};
963			builder
964		};
965		let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
966		#[allow(clippy::useless_conversion)]
967		let body = aws_smithy_http::body::SdkBody::from("");
968		let request = request.body(body).expect("should be valid request");
969		let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
970		request
971			.properties_mut()
972			.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
973		let op = aws_smithy_http::operation::Operation::new(
974			request,
975			crate::operation::WatchThread::new(),
976		)
977		.with_metadata(aws_smithy_http::operation::Metadata::new(
978			"WatchThread",
979			"ChatService",
980		));
981		Ok(op)
982	}
983	/// Creates a new builder-style object to manufacture [`WatchThreadInput`](crate::input::WatchThreadInput)
984	pub fn builder() -> crate::input::watch_thread_input::Builder {
985		crate::input::watch_thread_input::Builder::default()
986	}
987}
988
989#[allow(missing_docs)] // documentation missing in model
990#[non_exhaustive]
991#[derive(std::clone::Clone, std::cmp::PartialEq)]
992pub struct GetDirectThreadInput {
993	/// A universally unique identifier.
994	pub identity_id: std::option::Option<std::string::String>,
995}
996impl GetDirectThreadInput {
997	/// A universally unique identifier.
998	pub fn identity_id(&self) -> std::option::Option<&str> {
999		self.identity_id.as_deref()
1000	}
1001}
1002impl std::fmt::Debug for GetDirectThreadInput {
1003	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1004		let mut formatter = f.debug_struct("GetDirectThreadInput");
1005		formatter.field("identity_id", &self.identity_id);
1006		formatter.finish()
1007	}
1008}
1009
1010#[allow(missing_docs)] // documentation missing in model
1011#[non_exhaustive]
1012#[derive(std::clone::Clone, std::cmp::PartialEq)]
1013pub struct SendChatMessageInput {
1014	/// Topic to send a chat message to. If you already know the thread ID, use `thread_id`.
1015	pub topic: std::option::Option<crate::model::SendChatTopic>,
1016	/// Data to send in a chat message.
1017	pub message_body: std::option::Option<crate::model::SendMessageBody>,
1018}
1019impl SendChatMessageInput {
1020	/// Topic to send a chat message to. If you already know the thread ID, use `thread_id`.
1021	pub fn topic(&self) -> std::option::Option<&crate::model::SendChatTopic> {
1022		self.topic.as_ref()
1023	}
1024	/// Data to send in a chat message.
1025	pub fn message_body(&self) -> std::option::Option<&crate::model::SendMessageBody> {
1026		self.message_body.as_ref()
1027	}
1028}
1029impl std::fmt::Debug for SendChatMessageInput {
1030	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1031		let mut formatter = f.debug_struct("SendChatMessageInput");
1032		formatter.field("topic", &self.topic);
1033		formatter.field("message_body", &self.message_body);
1034		formatter.finish()
1035	}
1036}
1037
1038#[allow(missing_docs)] // documentation missing in model
1039#[non_exhaustive]
1040#[derive(std::clone::Clone, std::cmp::PartialEq)]
1041pub struct SetTypingStatusInput {
1042	/// A universally unique identifier.
1043	pub thread_id: std::option::Option<std::string::String>,
1044	/// Represents a chat typing status.
1045	pub status: std::option::Option<crate::model::ChatTypingStatus>,
1046}
1047impl SetTypingStatusInput {
1048	/// A universally unique identifier.
1049	pub fn thread_id(&self) -> std::option::Option<&str> {
1050		self.thread_id.as_deref()
1051	}
1052	/// Represents a chat typing status.
1053	pub fn status(&self) -> std::option::Option<&crate::model::ChatTypingStatus> {
1054		self.status.as_ref()
1055	}
1056}
1057impl std::fmt::Debug for SetTypingStatusInput {
1058	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1059		let mut formatter = f.debug_struct("SetTypingStatusInput");
1060		formatter.field("thread_id", &self.thread_id);
1061		formatter.field("status", &self.status);
1062		formatter.finish()
1063	}
1064}
1065
1066#[allow(missing_docs)] // documentation missing in model
1067#[non_exhaustive]
1068#[derive(std::clone::Clone, std::cmp::PartialEq)]
1069pub struct SetThreadReadInput {
1070	/// A universally unique identifier.
1071	pub thread_id: std::option::Option<std::string::String>,
1072	/// Any messages newer than this timestamp will be marked as unread. This should be the current timestamp (in milliseconds).
1073	pub last_read_ts: std::option::Option<aws_smithy_types::DateTime>,
1074}
1075impl SetThreadReadInput {
1076	/// A universally unique identifier.
1077	pub fn thread_id(&self) -> std::option::Option<&str> {
1078		self.thread_id.as_deref()
1079	}
1080	/// Any messages newer than this timestamp will be marked as unread. This should be the current timestamp (in milliseconds).
1081	pub fn last_read_ts(&self) -> std::option::Option<&aws_smithy_types::DateTime> {
1082		self.last_read_ts.as_ref()
1083	}
1084}
1085impl std::fmt::Debug for SetThreadReadInput {
1086	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1087		let mut formatter = f.debug_struct("SetThreadReadInput");
1088		formatter.field("thread_id", &self.thread_id);
1089		formatter.field("last_read_ts", &self.last_read_ts);
1090		formatter.finish()
1091	}
1092}
1093
1094#[allow(missing_docs)] // documentation missing in model
1095#[non_exhaustive]
1096#[derive(std::clone::Clone, std::cmp::PartialEq)]
1097pub struct GetThreadHistoryInput {
1098	/// A universally unique identifier.
1099	pub thread_id: std::option::Option<std::string::String>,
1100	/// RFC3339 timestamp.
1101	pub ts: std::option::Option<aws_smithy_types::DateTime>,
1102	/// How many messages to collect in each direction. If querying `rivet.api.chat.common#QueryDirection$before_and_after`, `rivet.api.chat.common#QueryDirection$chat_messages` will be `count * 2`.
1103	pub count: std::option::Option<i32>,
1104	/// Represents which direction to query messages from relative to the given timestamp.
1105	pub query_direction: std::option::Option<crate::model::QueryDirection>,
1106}
1107impl GetThreadHistoryInput {
1108	/// A universally unique identifier.
1109	pub fn thread_id(&self) -> std::option::Option<&str> {
1110		self.thread_id.as_deref()
1111	}
1112	/// RFC3339 timestamp.
1113	pub fn ts(&self) -> std::option::Option<&aws_smithy_types::DateTime> {
1114		self.ts.as_ref()
1115	}
1116	/// How many messages to collect in each direction. If querying `rivet.api.chat.common#QueryDirection$before_and_after`, `rivet.api.chat.common#QueryDirection$chat_messages` will be `count * 2`.
1117	pub fn count(&self) -> std::option::Option<i32> {
1118		self.count
1119	}
1120	/// Represents which direction to query messages from relative to the given timestamp.
1121	pub fn query_direction(&self) -> std::option::Option<&crate::model::QueryDirection> {
1122		self.query_direction.as_ref()
1123	}
1124}
1125impl std::fmt::Debug for GetThreadHistoryInput {
1126	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1127		let mut formatter = f.debug_struct("GetThreadHistoryInput");
1128		formatter.field("thread_id", &self.thread_id);
1129		formatter.field("ts", &self.ts);
1130		formatter.field("count", &self.count);
1131		formatter.field("query_direction", &self.query_direction);
1132		formatter.finish()
1133	}
1134}
1135
1136#[allow(missing_docs)] // documentation missing in model
1137#[non_exhaustive]
1138#[derive(std::clone::Clone, std::cmp::PartialEq)]
1139pub struct WatchThreadInput {
1140	/// A universally unique identifier.
1141	pub thread_id: std::option::Option<std::string::String>,
1142	/// A query parameter denoting the requests watch index.
1143	pub watch_index: std::option::Option<std::string::String>,
1144}
1145impl WatchThreadInput {
1146	/// A universally unique identifier.
1147	pub fn thread_id(&self) -> std::option::Option<&str> {
1148		self.thread_id.as_deref()
1149	}
1150	/// A query parameter denoting the requests watch index.
1151	pub fn watch_index(&self) -> std::option::Option<&str> {
1152		self.watch_index.as_deref()
1153	}
1154}
1155impl std::fmt::Debug for WatchThreadInput {
1156	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1157		let mut formatter = f.debug_struct("WatchThreadInput");
1158		formatter.field("thread_id", &self.thread_id);
1159		formatter.field("watch_index", &self.watch_index);
1160		formatter.finish()
1161	}
1162}
1163
1164#[allow(missing_docs)] // documentation missing in model
1165#[non_exhaustive]
1166#[derive(std::clone::Clone, std::cmp::PartialEq)]
1167pub struct GetThreadTopicInput {
1168	/// A universally unique identifier.
1169	pub thread_id: std::option::Option<std::string::String>,
1170}
1171impl GetThreadTopicInput {
1172	/// A universally unique identifier.
1173	pub fn thread_id(&self) -> std::option::Option<&str> {
1174		self.thread_id.as_deref()
1175	}
1176}
1177impl std::fmt::Debug for GetThreadTopicInput {
1178	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1179		let mut formatter = f.debug_struct("GetThreadTopicInput");
1180		formatter.field("thread_id", &self.thread_id);
1181		formatter.finish()
1182	}
1183}