rivet_client_api_chat/
client.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[derive(Debug)]
3pub(crate) struct Handle<C, M, R = aws_smithy_client::retry::Standard> {
4	pub(crate) client: aws_smithy_client::Client<C, M, R>,
5	pub(crate) conf: crate::Config,
6}
7
8/// An ergonomic service client for `ChatService`.
9///
10/// This client allows ergonomic access to a `ChatService`-shaped service.
11/// Each method corresponds to an endpoint defined in the service's Smithy model,
12/// and the request and response shapes are auto-generated from that same model.
13///
14/// # Constructing a Client
15///
16/// To construct a client, you need a few different things:
17///
18/// - A [`Config`](crate::Config) that specifies additional configuration
19///   required by the service.
20/// - A connector (`C`) that specifies how HTTP requests are translated
21///   into HTTP responses. This will typically be an HTTP client (like
22///   `hyper`), though you can also substitute in your own, like a mock
23///   mock connector for testing.
24/// - A "middleware" (`M`) that modifies requests prior to them being
25///   sent to the request. Most commonly, middleware will decide what
26///   endpoint the requests should be sent to, as well as perform
27///   authentication and authorization of requests (such as SigV4).
28///   You can also have middleware that performs request/response
29///   tracing, throttling, or other middleware-like tasks.
30/// - A retry policy (`R`) that dictates the behavior for requests that
31///   fail and should (potentially) be retried. The default type is
32///   generally what you want, as it implements a well-vetted retry
33///   policy implemented in [`RetryMode::Standard`](aws_smithy_types::retry::RetryMode::Standard).
34///
35/// To construct a client, you will generally want to call
36/// [`Client::with_config`], which takes a [`aws_smithy_client::Client`] (a
37/// Smithy client that isn't specialized to a particular service),
38/// and a [`Config`](crate::Config). Both of these are constructed using
39/// the [builder pattern] where you first construct a `Builder` type,
40/// then configure it with the necessary parameters, and then call
41/// `build` to construct the finalized output type. The
42/// [`aws_smithy_client::Client`] builder is re-exported in this crate as
43/// [`Builder`] for convenience.
44///
45/// In _most_ circumstances, you will want to use the following pattern
46/// to construct a client:
47///
48/// ```
49/// use rivet_client_api_chat::{Builder, Client, Config};
50/// let raw_client =
51///     Builder::dyn_https()
52/// #     /*
53///       .middleware(/* discussed below */)
54/// #     */
55/// #     .middleware_fn(|r| r)
56///       .build();
57/// let config = Config::builder().build();
58/// let client = Client::with_config(raw_client, config);
59/// ```
60///
61/// For the middleware, you'll want to use whatever matches the
62/// routing, authentication and authorization required by the target
63/// service. For example, for the standard AWS SDK which uses
64/// [SigV4-signed requests], the middleware looks like this:
65///
66// Ignored as otherwise we'd need to pull in all these dev-dependencies.
67/// ```rust,ignore
68/// use aws_endpoint::AwsEndpointStage;
69/// use aws_http::auth::CredentialsStage;
70/// use aws_http::recursion_detection::RecursionDetectionStage;
71/// use aws_http::user_agent::UserAgentStage;
72/// use aws_sig_auth::middleware::SigV4SigningStage;
73/// use aws_sig_auth::signer::SigV4Signer;
74/// use aws_smithy_client::retry::Config as RetryConfig;
75/// use aws_smithy_http_tower::map_request::{AsyncMapRequestLayer, MapRequestLayer};
76/// use std::fmt::Debug;
77/// use tower::layer::util::{Identity, Stack};
78/// use tower::ServiceBuilder;
79///
80/// type AwsMiddlewareStack = Stack<
81///     MapRequestLayer<RecursionDetectionStage>,
82///     Stack<
83///         MapRequestLayer<SigV4SigningStage>,
84///         Stack<
85///             AsyncMapRequestLayer<CredentialsStage>,
86///             Stack<
87///                 MapRequestLayer<UserAgentStage>,
88///                 Stack<MapRequestLayer<AwsEndpointStage>, Identity>,
89///             >,
90///         >,
91///     >,
92/// >;
93///
94/// /// AWS Middleware Stack
95/// ///
96/// /// This implements the middleware stack for this service. It will:
97/// /// 1. Load credentials asynchronously into the property bag
98/// /// 2. Sign the request with SigV4
99/// /// 3. Resolve an Endpoint for the request
100/// /// 4. Add a user agent to the request
101/// #[derive(Debug, Default, Clone)]
102/// #[non_exhaustive]
103/// pub struct AwsMiddleware;
104///
105/// impl AwsMiddleware {
106///     /// Create a new `AwsMiddleware` stack
107///     ///
108///     /// Note: `AwsMiddleware` holds no state.
109///     pub fn new() -> Self {
110///         AwsMiddleware::default()
111///     }
112/// }
113///
114/// // define the middleware stack in a non-generic location to reduce code bloat.
115/// fn base() -> ServiceBuilder<AwsMiddlewareStack> {
116///     let credential_provider = AsyncMapRequestLayer::for_mapper(CredentialsStage::new());
117///     let signer = MapRequestLayer::for_mapper(SigV4SigningStage::new(SigV4Signer::new()));
118///     let endpoint_resolver = MapRequestLayer::for_mapper(AwsEndpointStage);
119///     let user_agent = MapRequestLayer::for_mapper(UserAgentStage::new());
120///     let recursion_detection = MapRequestLayer::for_mapper(RecursionDetectionStage::new());
121///     // These layers can be considered as occurring in order, that is:
122///     // 1. Resolve an endpoint
123///     // 2. Add a user agent
124///     // 3. Acquire credentials
125///     // 4. Sign with credentials
126///     // (5. Dispatch over the wire)
127///     ServiceBuilder::new()
128///         .layer(endpoint_resolver)
129///         .layer(user_agent)
130///         .layer(credential_provider)
131///         .layer(signer)
132///         .layer(recursion_detection)
133/// }
134///
135/// impl<S> tower::Layer<S> for AwsMiddleware {
136///     type Service = <AwsMiddlewareStack as tower::Layer<S>>::Service;
137///
138///     fn layer(&self, inner: S) -> Self::Service {
139///         base().service(inner)
140///     }
141/// }
142/// ```
143///
144/// # Using a Client
145///
146/// Once you have a client set up, you can access the service's endpoints
147/// by calling the appropriate method on [`Client`]. Each such method
148/// returns a request builder for that endpoint, with methods for setting
149/// the various fields of the request. Once your request is complete, use
150/// the `send` method to send the request. `send` returns a future, which
151/// you then have to `.await` to get the service's response.
152///
153/// [builder pattern]: https://rust-lang.github.io/api-guidelines/type-safety.html#c-builder
154/// [SigV4-signed requests]: https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
155#[derive(std::fmt::Debug)]
156pub struct Client<C, M, R = aws_smithy_client::retry::Standard> {
157	handle: std::sync::Arc<Handle<C, M, R>>,
158}
159
160impl<C, M, R> std::clone::Clone for Client<C, M, R> {
161	fn clone(&self) -> Self {
162		Self {
163			handle: self.handle.clone(),
164		}
165	}
166}
167
168#[doc(inline)]
169pub use aws_smithy_client::Builder;
170
171impl<C, M, R> From<aws_smithy_client::Client<C, M, R>> for Client<C, M, R> {
172	fn from(client: aws_smithy_client::Client<C, M, R>) -> Self {
173		Self::with_config(client, crate::Config::builder().build())
174	}
175}
176
177impl<C, M, R> Client<C, M, R> {
178	/// Creates a client with the given service configuration.
179	pub fn with_config(client: aws_smithy_client::Client<C, M, R>, conf: crate::Config) -> Self {
180		Self {
181			handle: std::sync::Arc::new(Handle { client, conf }),
182		}
183	}
184
185	/// Returns the client's configuration.
186	pub fn conf(&self) -> &crate::Config {
187		&self.handle.conf
188	}
189}
190impl<C, M, R> Client<C, M, R>
191where
192	C: aws_smithy_client::bounds::SmithyConnector,
193	M: aws_smithy_client::bounds::SmithyMiddleware<C>,
194	R: aws_smithy_client::retry::NewRequestPolicy,
195{
196	/// Constructs a fluent builder for the [`GetDirectThread`](crate::client::fluent_builders::GetDirectThread) operation.
197	///
198	/// - The fluent builder is configurable:
199	///   - [`identity_id(impl Into<String>)`](crate::client::fluent_builders::GetDirectThread::identity_id) / [`set_identity_id(Option<String>)`](crate::client::fluent_builders::GetDirectThread::set_identity_id): A universally unique identifier.
200	/// - On success, responds with [`GetDirectThreadOutput`](crate::output::GetDirectThreadOutput) with field(s):
201	///   - [`thread_id(Option<String>)`](crate::output::GetDirectThreadOutput::thread_id): A universally unique identifier.
202	///   - [`identity(Option<IdentityHandle>)`](crate::output::GetDirectThreadOutput::identity): An identity handle.
203	/// - On failure, responds with [`SdkError<GetDirectThreadError>`](crate::error::GetDirectThreadError)
204	pub fn get_direct_thread(&self) -> fluent_builders::GetDirectThread<C, M, R> {
205		fluent_builders::GetDirectThread::new(self.handle.clone())
206	}
207	/// Constructs a fluent builder for the [`GetThreadHistory`](crate::client::fluent_builders::GetThreadHistory) operation.
208	///
209	/// - The fluent builder is configurable:
210	///   - [`thread_id(impl Into<String>)`](crate::client::fluent_builders::GetThreadHistory::thread_id) / [`set_thread_id(Option<String>)`](crate::client::fluent_builders::GetThreadHistory::set_thread_id): A universally unique identifier.
211	///   - [`ts(i32)`](crate::client::fluent_builders::GetThreadHistory::ts) / [`set_ts(Option<i32>)`](crate::client::fluent_builders::GetThreadHistory::set_ts): Unsigned 32 bit integer.
212	///   - [`count(i32)`](crate::client::fluent_builders::GetThreadHistory::count) / [`set_count(Option<i32>)`](crate::client::fluent_builders::GetThreadHistory::set_count): 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`.
213	///   - [`query_direction(QueryDirection)`](crate::client::fluent_builders::GetThreadHistory::query_direction) / [`set_query_direction(Option<QueryDirection>)`](crate::client::fluent_builders::GetThreadHistory::set_query_direction): Represents which direction to query messages from relative to the given timestamp.
214	/// - On success, responds with [`GetThreadHistoryOutput`](crate::output::GetThreadHistoryOutput) with field(s):
215	///   - [`chat_messages(Option<Vec<ChatMessage>>)`](crate::output::GetThreadHistoryOutput::chat_messages): Ordered old to new. If querying `rivet.api.chat.common#before_and_after`, this will be `count * 2` long.
216	/// - On failure, responds with [`SdkError<GetThreadHistoryError>`](crate::error::GetThreadHistoryError)
217	pub fn get_thread_history(&self) -> fluent_builders::GetThreadHistory<C, M, R> {
218		fluent_builders::GetThreadHistory::new(self.handle.clone())
219	}
220	/// Constructs a fluent builder for the [`GetThreadTopic`](crate::client::fluent_builders::GetThreadTopic) operation.
221	///
222	/// - The fluent builder is configurable:
223	///   - [`thread_id(impl Into<String>)`](crate::client::fluent_builders::GetThreadTopic::thread_id) / [`set_thread_id(Option<String>)`](crate::client::fluent_builders::GetThreadTopic::set_thread_id): A universally unique identifier.
224	/// - On success, responds with [`GetThreadTopicOutput`](crate::output::GetThreadTopicOutput) with field(s):
225	///   - [`topic(Option<ChatSimpleTopic>)`](crate::output::GetThreadTopicOutput::topic): Represents a topic of the given chat thread without the associated handles for the topic.
226	/// - On failure, responds with [`SdkError<GetThreadTopicError>`](crate::error::GetThreadTopicError)
227	pub fn get_thread_topic(&self) -> fluent_builders::GetThreadTopic<C, M, R> {
228		fluent_builders::GetThreadTopic::new(self.handle.clone())
229	}
230	/// Constructs a fluent builder for the [`SendChatMessage`](crate::client::fluent_builders::SendChatMessage) operation.
231	///
232	/// - The fluent builder is configurable:
233	///   - [`topic(SendChatTopic)`](crate::client::fluent_builders::SendChatMessage::topic) / [`set_topic(Option<SendChatTopic>)`](crate::client::fluent_builders::SendChatMessage::set_topic): Topic to send a chat message to. If you already know the thread ID, use `thread_id`.
234	///   - [`message_body(SendMessageBody)`](crate::client::fluent_builders::SendChatMessage::message_body) / [`set_message_body(Option<SendMessageBody>)`](crate::client::fluent_builders::SendChatMessage::set_message_body): Data to send in a chat message.
235	/// - On success, responds with [`SendChatMessageOutput`](crate::output::SendChatMessageOutput) with field(s):
236	///   - [`chat_message_id(Option<String>)`](crate::output::SendChatMessageOutput::chat_message_id): A universally unique identifier.
237	/// - On failure, responds with [`SdkError<SendChatMessageError>`](crate::error::SendChatMessageError)
238	pub fn send_chat_message(&self) -> fluent_builders::SendChatMessage<C, M, R> {
239		fluent_builders::SendChatMessage::new(self.handle.clone())
240	}
241	/// Constructs a fluent builder for the [`SetThreadRead`](crate::client::fluent_builders::SetThreadRead) operation.
242	///
243	/// - The fluent builder is configurable:
244	///   - [`thread_id(impl Into<String>)`](crate::client::fluent_builders::SetThreadRead::thread_id) / [`set_thread_id(Option<String>)`](crate::client::fluent_builders::SetThreadRead::set_thread_id): A universally unique identifier.
245	///   - [`last_read_ts(i64)`](crate::client::fluent_builders::SetThreadRead::last_read_ts) / [`set_last_read_ts(Option<i64>)`](crate::client::fluent_builders::SetThreadRead::set_last_read_ts): Any messages newer than this timestamp will be marked as unread. This should be the current timestamp (in milliseconds).
246	/// - On success, responds with [`SetThreadReadOutput`](crate::output::SetThreadReadOutput)
247
248	/// - On failure, responds with [`SdkError<SetThreadReadError>`](crate::error::SetThreadReadError)
249	pub fn set_thread_read(&self) -> fluent_builders::SetThreadRead<C, M, R> {
250		fluent_builders::SetThreadRead::new(self.handle.clone())
251	}
252	/// Constructs a fluent builder for the [`SetTypingStatus`](crate::client::fluent_builders::SetTypingStatus) operation.
253	///
254	/// - The fluent builder is configurable:
255	///   - [`thread_id(impl Into<String>)`](crate::client::fluent_builders::SetTypingStatus::thread_id) / [`set_thread_id(Option<String>)`](crate::client::fluent_builders::SetTypingStatus::set_thread_id): A universally unique identifier.
256	///   - [`status(ChatTypingStatus)`](crate::client::fluent_builders::SetTypingStatus::status) / [`set_status(Option<ChatTypingStatus>)`](crate::client::fluent_builders::SetTypingStatus::set_status): Represents a chat typing status.
257	/// - On success, responds with [`SetTypingStatusOutput`](crate::output::SetTypingStatusOutput)
258
259	/// - On failure, responds with [`SdkError<SetTypingStatusError>`](crate::error::SetTypingStatusError)
260	pub fn set_typing_status(&self) -> fluent_builders::SetTypingStatus<C, M, R> {
261		fluent_builders::SetTypingStatus::new(self.handle.clone())
262	}
263	/// Constructs a fluent builder for the [`WatchThread`](crate::client::fluent_builders::WatchThread) operation.
264	///
265	/// - The fluent builder is configurable:
266	///   - [`thread_id(impl Into<String>)`](crate::client::fluent_builders::WatchThread::thread_id) / [`set_thread_id(Option<String>)`](crate::client::fluent_builders::WatchThread::set_thread_id): A universally unique identifier.
267	///   - [`watch_index(impl Into<String>)`](crate::client::fluent_builders::WatchThread::watch_index) / [`set_watch_index(Option<String>)`](crate::client::fluent_builders::WatchThread::set_watch_index): A query parameter denoting the requests watch index.
268	/// - On success, responds with [`WatchThreadOutput`](crate::output::WatchThreadOutput) with field(s):
269	///   - [`chat_messages(Option<Vec<ChatMessage>>)`](crate::output::WatchThreadOutput::chat_messages): All messages new messages posted to this thread. Ordered old to new.
270	///   - [`typing_statuses(Option<Vec<ChatIdentityTypingStatus>>)`](crate::output::WatchThreadOutput::typing_statuses): All identities that are currently typing in this thread.
271	///   - [`watch(Option<WatchResponse>)`](crate::output::WatchThreadOutput::watch): Provided by watchable endpoints used in blocking loops.
272	/// - On failure, responds with [`SdkError<WatchThreadError>`](crate::error::WatchThreadError)
273	pub fn watch_thread(&self) -> fluent_builders::WatchThread<C, M, R> {
274		fluent_builders::WatchThread::new(self.handle.clone())
275	}
276}
277pub mod fluent_builders {
278	//!
279	//! Utilities to ergonomically construct a request to the service.
280	//!
281	//! Fluent builders are created through the [`Client`](crate::client::Client) by calling
282	//! one if its operation methods. After parameters are set using the builder methods,
283	//! the `send` method can be called to initiate the request.
284	//!
285	/// Fluent builder constructing a request to `GetDirectThread`.
286	///
287	/// Returns a thread ID with a given identity.
288	#[derive(std::clone::Clone, std::fmt::Debug)]
289	pub struct GetDirectThread<C, M, R = aws_smithy_client::retry::Standard> {
290		handle: std::sync::Arc<super::Handle<C, M, R>>,
291		inner: crate::input::get_direct_thread_input::Builder,
292	}
293	impl<C, M, R> GetDirectThread<C, M, R>
294	where
295		C: aws_smithy_client::bounds::SmithyConnector,
296		M: aws_smithy_client::bounds::SmithyMiddleware<C>,
297		R: aws_smithy_client::retry::NewRequestPolicy,
298	{
299		/// Creates a new `GetDirectThread`.
300		pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
301			Self {
302				handle,
303				inner: Default::default(),
304			}
305		}
306
307		/// Sends the request and returns the response.
308		///
309		/// If an error occurs, an `SdkError` will be returned with additional details that
310		/// can be matched against.
311		///
312		/// By default, any retryable failures will be retried twice. Retry behavior
313		/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
314		/// set when configuring the client.
315		pub async fn send(
316			self,
317		) -> std::result::Result<
318			crate::output::GetDirectThreadOutput,
319			aws_smithy_http::result::SdkError<crate::error::GetDirectThreadError>,
320		>
321		where
322			R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
323				crate::input::GetDirectThreadInputOperationOutputAlias,
324				crate::output::GetDirectThreadOutput,
325				crate::error::GetDirectThreadError,
326				crate::input::GetDirectThreadInputOperationRetryAlias,
327			>,
328		{
329			let op = self
330				.inner
331				.build()
332				.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
333				.make_operation(&self.handle.conf)
334				.await
335				.map_err(|err| {
336					aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
337				})?;
338			self.handle.client.call(op).await
339		}
340		/// A universally unique identifier.
341		pub fn identity_id(mut self, input: impl Into<std::string::String>) -> Self {
342			self.inner = self.inner.identity_id(input.into());
343			self
344		}
345		/// A universally unique identifier.
346		pub fn set_identity_id(mut self, input: std::option::Option<std::string::String>) -> Self {
347			self.inner = self.inner.set_identity_id(input);
348			self
349		}
350	}
351	/// Fluent builder constructing a request to `GetThreadHistory`.
352	///
353	/// Returns message history for a given thread in a certain direction. Defaults to querying messages before ts.
354	#[derive(std::clone::Clone, std::fmt::Debug)]
355	pub struct GetThreadHistory<C, M, R = aws_smithy_client::retry::Standard> {
356		handle: std::sync::Arc<super::Handle<C, M, R>>,
357		inner: crate::input::get_thread_history_input::Builder,
358	}
359	impl<C, M, R> GetThreadHistory<C, M, R>
360	where
361		C: aws_smithy_client::bounds::SmithyConnector,
362		M: aws_smithy_client::bounds::SmithyMiddleware<C>,
363		R: aws_smithy_client::retry::NewRequestPolicy,
364	{
365		/// Creates a new `GetThreadHistory`.
366		pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
367			Self {
368				handle,
369				inner: Default::default(),
370			}
371		}
372
373		/// Sends the request and returns the response.
374		///
375		/// If an error occurs, an `SdkError` will be returned with additional details that
376		/// can be matched against.
377		///
378		/// By default, any retryable failures will be retried twice. Retry behavior
379		/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
380		/// set when configuring the client.
381		pub async fn send(
382			self,
383		) -> std::result::Result<
384			crate::output::GetThreadHistoryOutput,
385			aws_smithy_http::result::SdkError<crate::error::GetThreadHistoryError>,
386		>
387		where
388			R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
389				crate::input::GetThreadHistoryInputOperationOutputAlias,
390				crate::output::GetThreadHistoryOutput,
391				crate::error::GetThreadHistoryError,
392				crate::input::GetThreadHistoryInputOperationRetryAlias,
393			>,
394		{
395			let op = self
396				.inner
397				.build()
398				.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
399				.make_operation(&self.handle.conf)
400				.await
401				.map_err(|err| {
402					aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
403				})?;
404			self.handle.client.call(op).await
405		}
406		/// A universally unique identifier.
407		pub fn thread_id(mut self, input: impl Into<std::string::String>) -> Self {
408			self.inner = self.inner.thread_id(input.into());
409			self
410		}
411		/// A universally unique identifier.
412		pub fn set_thread_id(mut self, input: std::option::Option<std::string::String>) -> Self {
413			self.inner = self.inner.set_thread_id(input);
414			self
415		}
416		/// Unsigned 32 bit integer.
417		pub fn ts(mut self, input: i32) -> Self {
418			self.inner = self.inner.ts(input);
419			self
420		}
421		/// Unsigned 32 bit integer.
422		pub fn set_ts(mut self, input: std::option::Option<i32>) -> Self {
423			self.inner = self.inner.set_ts(input);
424			self
425		}
426		/// 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`.
427		pub fn count(mut self, input: i32) -> Self {
428			self.inner = self.inner.count(input);
429			self
430		}
431		/// 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`.
432		pub fn set_count(mut self, input: std::option::Option<i32>) -> Self {
433			self.inner = self.inner.set_count(input);
434			self
435		}
436		/// Represents which direction to query messages from relative to the given timestamp.
437		pub fn query_direction(mut self, input: crate::model::QueryDirection) -> Self {
438			self.inner = self.inner.query_direction(input);
439			self
440		}
441		/// Represents which direction to query messages from relative to the given timestamp.
442		pub fn set_query_direction(
443			mut self,
444			input: std::option::Option<crate::model::QueryDirection>,
445		) -> Self {
446			self.inner = self.inner.set_query_direction(input);
447			self
448		}
449	}
450	/// Fluent builder constructing a request to `GetThreadTopic`.
451	///
452	/// Fetches the topic of a thread.
453	#[derive(std::clone::Clone, std::fmt::Debug)]
454	pub struct GetThreadTopic<C, M, R = aws_smithy_client::retry::Standard> {
455		handle: std::sync::Arc<super::Handle<C, M, R>>,
456		inner: crate::input::get_thread_topic_input::Builder,
457	}
458	impl<C, M, R> GetThreadTopic<C, M, R>
459	where
460		C: aws_smithy_client::bounds::SmithyConnector,
461		M: aws_smithy_client::bounds::SmithyMiddleware<C>,
462		R: aws_smithy_client::retry::NewRequestPolicy,
463	{
464		/// Creates a new `GetThreadTopic`.
465		pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
466			Self {
467				handle,
468				inner: Default::default(),
469			}
470		}
471
472		/// Sends the request and returns the response.
473		///
474		/// If an error occurs, an `SdkError` will be returned with additional details that
475		/// can be matched against.
476		///
477		/// By default, any retryable failures will be retried twice. Retry behavior
478		/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
479		/// set when configuring the client.
480		pub async fn send(
481			self,
482		) -> std::result::Result<
483			crate::output::GetThreadTopicOutput,
484			aws_smithy_http::result::SdkError<crate::error::GetThreadTopicError>,
485		>
486		where
487			R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
488				crate::input::GetThreadTopicInputOperationOutputAlias,
489				crate::output::GetThreadTopicOutput,
490				crate::error::GetThreadTopicError,
491				crate::input::GetThreadTopicInputOperationRetryAlias,
492			>,
493		{
494			let op = self
495				.inner
496				.build()
497				.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
498				.make_operation(&self.handle.conf)
499				.await
500				.map_err(|err| {
501					aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
502				})?;
503			self.handle.client.call(op).await
504		}
505		/// A universally unique identifier.
506		pub fn thread_id(mut self, input: impl Into<std::string::String>) -> Self {
507			self.inner = self.inner.thread_id(input.into());
508			self
509		}
510		/// A universally unique identifier.
511		pub fn set_thread_id(mut self, input: std::option::Option<std::string::String>) -> Self {
512			self.inner = self.inner.set_thread_id(input);
513			self
514		}
515	}
516	/// Fluent builder constructing a request to `SendChatMessage`.
517	///
518	/// Sends a chat message to a given topic.
519	#[derive(std::clone::Clone, std::fmt::Debug)]
520	pub struct SendChatMessage<C, M, R = aws_smithy_client::retry::Standard> {
521		handle: std::sync::Arc<super::Handle<C, M, R>>,
522		inner: crate::input::send_chat_message_input::Builder,
523	}
524	impl<C, M, R> SendChatMessage<C, M, R>
525	where
526		C: aws_smithy_client::bounds::SmithyConnector,
527		M: aws_smithy_client::bounds::SmithyMiddleware<C>,
528		R: aws_smithy_client::retry::NewRequestPolicy,
529	{
530		/// Creates a new `SendChatMessage`.
531		pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
532			Self {
533				handle,
534				inner: Default::default(),
535			}
536		}
537
538		/// Sends the request and returns the response.
539		///
540		/// If an error occurs, an `SdkError` will be returned with additional details that
541		/// can be matched against.
542		///
543		/// By default, any retryable failures will be retried twice. Retry behavior
544		/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
545		/// set when configuring the client.
546		pub async fn send(
547			self,
548		) -> std::result::Result<
549			crate::output::SendChatMessageOutput,
550			aws_smithy_http::result::SdkError<crate::error::SendChatMessageError>,
551		>
552		where
553			R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
554				crate::input::SendChatMessageInputOperationOutputAlias,
555				crate::output::SendChatMessageOutput,
556				crate::error::SendChatMessageError,
557				crate::input::SendChatMessageInputOperationRetryAlias,
558			>,
559		{
560			let op = self
561				.inner
562				.build()
563				.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
564				.make_operation(&self.handle.conf)
565				.await
566				.map_err(|err| {
567					aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
568				})?;
569			self.handle.client.call(op).await
570		}
571		/// Topic to send a chat message to. If you already know the thread ID, use `thread_id`.
572		pub fn topic(mut self, input: crate::model::SendChatTopic) -> Self {
573			self.inner = self.inner.topic(input);
574			self
575		}
576		/// Topic to send a chat message to. If you already know the thread ID, use `thread_id`.
577		pub fn set_topic(
578			mut self,
579			input: std::option::Option<crate::model::SendChatTopic>,
580		) -> Self {
581			self.inner = self.inner.set_topic(input);
582			self
583		}
584		/// Data to send in a chat message.
585		pub fn message_body(mut self, input: crate::model::SendMessageBody) -> Self {
586			self.inner = self.inner.message_body(input);
587			self
588		}
589		/// Data to send in a chat message.
590		pub fn set_message_body(
591			mut self,
592			input: std::option::Option<crate::model::SendMessageBody>,
593		) -> Self {
594			self.inner = self.inner.set_message_body(input);
595			self
596		}
597	}
598	/// Fluent builder constructing a request to `SetThreadRead`.
599	///
600	/// Updates the current identity's last read timestamp in the given thread.
601	#[derive(std::clone::Clone, std::fmt::Debug)]
602	pub struct SetThreadRead<C, M, R = aws_smithy_client::retry::Standard> {
603		handle: std::sync::Arc<super::Handle<C, M, R>>,
604		inner: crate::input::set_thread_read_input::Builder,
605	}
606	impl<C, M, R> SetThreadRead<C, M, R>
607	where
608		C: aws_smithy_client::bounds::SmithyConnector,
609		M: aws_smithy_client::bounds::SmithyMiddleware<C>,
610		R: aws_smithy_client::retry::NewRequestPolicy,
611	{
612		/// Creates a new `SetThreadRead`.
613		pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
614			Self {
615				handle,
616				inner: Default::default(),
617			}
618		}
619
620		/// Sends the request and returns the response.
621		///
622		/// If an error occurs, an `SdkError` will be returned with additional details that
623		/// can be matched against.
624		///
625		/// By default, any retryable failures will be retried twice. Retry behavior
626		/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
627		/// set when configuring the client.
628		pub async fn send(
629			self,
630		) -> std::result::Result<
631			crate::output::SetThreadReadOutput,
632			aws_smithy_http::result::SdkError<crate::error::SetThreadReadError>,
633		>
634		where
635			R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
636				crate::input::SetThreadReadInputOperationOutputAlias,
637				crate::output::SetThreadReadOutput,
638				crate::error::SetThreadReadError,
639				crate::input::SetThreadReadInputOperationRetryAlias,
640			>,
641		{
642			let op = self
643				.inner
644				.build()
645				.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
646				.make_operation(&self.handle.conf)
647				.await
648				.map_err(|err| {
649					aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
650				})?;
651			self.handle.client.call(op).await
652		}
653		/// A universally unique identifier.
654		pub fn thread_id(mut self, input: impl Into<std::string::String>) -> Self {
655			self.inner = self.inner.thread_id(input.into());
656			self
657		}
658		/// A universally unique identifier.
659		pub fn set_thread_id(mut self, input: std::option::Option<std::string::String>) -> Self {
660			self.inner = self.inner.set_thread_id(input);
661			self
662		}
663		/// Any messages newer than this timestamp will be marked as unread. This should be the current timestamp (in milliseconds).
664		pub fn last_read_ts(mut self, input: i64) -> Self {
665			self.inner = self.inner.last_read_ts(input);
666			self
667		}
668		/// Any messages newer than this timestamp will be marked as unread. This should be the current timestamp (in milliseconds).
669		pub fn set_last_read_ts(mut self, input: std::option::Option<i64>) -> Self {
670			self.inner = self.inner.set_last_read_ts(input);
671			self
672		}
673	}
674	/// Fluent builder constructing a request to `SetTypingStatus`.
675	///
676	/// Updates the current identity's typing status in the given thread.
677	#[derive(std::clone::Clone, std::fmt::Debug)]
678	pub struct SetTypingStatus<C, M, R = aws_smithy_client::retry::Standard> {
679		handle: std::sync::Arc<super::Handle<C, M, R>>,
680		inner: crate::input::set_typing_status_input::Builder,
681	}
682	impl<C, M, R> SetTypingStatus<C, M, R>
683	where
684		C: aws_smithy_client::bounds::SmithyConnector,
685		M: aws_smithy_client::bounds::SmithyMiddleware<C>,
686		R: aws_smithy_client::retry::NewRequestPolicy,
687	{
688		/// Creates a new `SetTypingStatus`.
689		pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
690			Self {
691				handle,
692				inner: Default::default(),
693			}
694		}
695
696		/// Sends the request and returns the response.
697		///
698		/// If an error occurs, an `SdkError` will be returned with additional details that
699		/// can be matched against.
700		///
701		/// By default, any retryable failures will be retried twice. Retry behavior
702		/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
703		/// set when configuring the client.
704		pub async fn send(
705			self,
706		) -> std::result::Result<
707			crate::output::SetTypingStatusOutput,
708			aws_smithy_http::result::SdkError<crate::error::SetTypingStatusError>,
709		>
710		where
711			R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
712				crate::input::SetTypingStatusInputOperationOutputAlias,
713				crate::output::SetTypingStatusOutput,
714				crate::error::SetTypingStatusError,
715				crate::input::SetTypingStatusInputOperationRetryAlias,
716			>,
717		{
718			let op = self
719				.inner
720				.build()
721				.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
722				.make_operation(&self.handle.conf)
723				.await
724				.map_err(|err| {
725					aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
726				})?;
727			self.handle.client.call(op).await
728		}
729		/// A universally unique identifier.
730		pub fn thread_id(mut self, input: impl Into<std::string::String>) -> Self {
731			self.inner = self.inner.thread_id(input.into());
732			self
733		}
734		/// A universally unique identifier.
735		pub fn set_thread_id(mut self, input: std::option::Option<std::string::String>) -> Self {
736			self.inner = self.inner.set_thread_id(input);
737			self
738		}
739		/// Represents a chat typing status.
740		pub fn status(mut self, input: crate::model::ChatTypingStatus) -> Self {
741			self.inner = self.inner.status(input);
742			self
743		}
744		/// Represents a chat typing status.
745		pub fn set_status(
746			mut self,
747			input: std::option::Option<crate::model::ChatTypingStatus>,
748		) -> Self {
749			self.inner = self.inner.set_status(input);
750			self
751		}
752	}
753	/// Fluent builder constructing a request to `WatchThread`.
754	///
755	/// Fetches all relevant changes from a thread that have happened since the given watch index.
756	#[derive(std::clone::Clone, std::fmt::Debug)]
757	pub struct WatchThread<C, M, R = aws_smithy_client::retry::Standard> {
758		handle: std::sync::Arc<super::Handle<C, M, R>>,
759		inner: crate::input::watch_thread_input::Builder,
760	}
761	impl<C, M, R> WatchThread<C, M, R>
762	where
763		C: aws_smithy_client::bounds::SmithyConnector,
764		M: aws_smithy_client::bounds::SmithyMiddleware<C>,
765		R: aws_smithy_client::retry::NewRequestPolicy,
766	{
767		/// Creates a new `WatchThread`.
768		pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
769			Self {
770				handle,
771				inner: Default::default(),
772			}
773		}
774
775		/// Sends the request and returns the response.
776		///
777		/// If an error occurs, an `SdkError` will be returned with additional details that
778		/// can be matched against.
779		///
780		/// By default, any retryable failures will be retried twice. Retry behavior
781		/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
782		/// set when configuring the client.
783		pub async fn send(
784			self,
785		) -> std::result::Result<
786			crate::output::WatchThreadOutput,
787			aws_smithy_http::result::SdkError<crate::error::WatchThreadError>,
788		>
789		where
790			R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
791				crate::input::WatchThreadInputOperationOutputAlias,
792				crate::output::WatchThreadOutput,
793				crate::error::WatchThreadError,
794				crate::input::WatchThreadInputOperationRetryAlias,
795			>,
796		{
797			let op = self
798				.inner
799				.build()
800				.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
801				.make_operation(&self.handle.conf)
802				.await
803				.map_err(|err| {
804					aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
805				})?;
806			self.handle.client.call(op).await
807		}
808		/// A universally unique identifier.
809		pub fn thread_id(mut self, input: impl Into<std::string::String>) -> Self {
810			self.inner = self.inner.thread_id(input.into());
811			self
812		}
813		/// A universally unique identifier.
814		pub fn set_thread_id(mut self, input: std::option::Option<std::string::String>) -> Self {
815			self.inner = self.inner.set_thread_id(input);
816			self
817		}
818		/// A query parameter denoting the requests watch index.
819		pub fn watch_index(mut self, input: impl Into<std::string::String>) -> Self {
820			self.inner = self.inner.watch_index(input.into());
821			self
822		}
823		/// A query parameter denoting the requests watch index.
824		pub fn set_watch_index(mut self, input: std::option::Option<std::string::String>) -> Self {
825			self.inner = self.inner.set_watch_index(input);
826			self
827		}
828	}
829}