1use std::fmt::Write;
3pub mod get_direct_thread_input {
5 #[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 pub fn identity_id(mut self, input: impl Into<std::string::String>) -> Self {
14 self.identity_id = Some(input.into());
15 self
16 }
17 pub fn set_identity_id(mut self, input: std::option::Option<std::string::String>) -> Self {
19 self.identity_id = input;
20 self
21 }
22 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 #[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 pub fn builder() -> crate::input::get_direct_thread_input::Builder {
118 crate::input::get_direct_thread_input::Builder::default()
119 }
120}
121
122pub mod get_thread_history_input {
124 #[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<i32>,
130 pub(crate) count: std::option::Option<i32>,
131 pub(crate) query_direction: std::option::Option<crate::model::QueryDirection>,
132 }
133 impl Builder {
134 pub fn thread_id(mut self, input: impl Into<std::string::String>) -> Self {
136 self.thread_id = Some(input.into());
137 self
138 }
139 pub fn set_thread_id(mut self, input: std::option::Option<std::string::String>) -> Self {
141 self.thread_id = input;
142 self
143 }
144 pub fn ts(mut self, input: i32) -> Self {
146 self.ts = Some(input);
147 self
148 }
149 pub fn set_ts(mut self, input: std::option::Option<i32>) -> Self {
151 self.ts = input;
152 self
153 }
154 pub fn count(mut self, input: i32) -> Self {
156 self.count = Some(input);
157 self
158 }
159 pub fn set_count(mut self, input: std::option::Option<i32>) -> Self {
161 self.count = input;
162 self
163 }
164 pub fn query_direction(mut self, input: crate::model::QueryDirection) -> Self {
166 self.query_direction = Some(input);
167 self
168 }
169 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 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 #[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_types::primitive::Encoder::from(*inner_3).encode(),
245 );
246 }
247 if let Some(inner_4) = &_input.count {
248 query.push_kv(
249 "count",
250 aws_smithy_types::primitive::Encoder::from(*inner_4).encode(),
251 );
252 }
253 if let Some(inner_5) = &_input.query_direction {
254 query.push_kv(
255 "query_direction",
256 &aws_smithy_http::query::fmt_string(&inner_5),
257 );
258 }
259 Ok(())
260 }
261 #[allow(clippy::unnecessary_wraps)]
262 fn update_http_builder(
263 input: &crate::input::GetThreadHistoryInput,
264 _config: &crate::config::Config,
265 builder: http::request::Builder,
266 ) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
267 {
268 let mut _uri = String::new();
269 _uri = format!("{}{}", _config.uri.clone(), _uri);
270 uri_base(input, &mut _uri)?;
271 uri_query(input, &mut _uri)?;
272 Ok(builder.method("GET").uri(_uri))
273 }
274 let mut builder = update_http_builder(&self, _config, http::request::Builder::new())?;
275 let mut builder = if let Some(auth) = &_config.auth {
276 builder.header(http::header::AUTHORIZATION, auth.clone())
277 } else {
278 builder
279 };
280 builder
281 };
282 let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
283 #[allow(clippy::useless_conversion)]
284 let body = aws_smithy_http::body::SdkBody::from("");
285 let request = request.body(body).expect("should be valid request");
286 let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
287 request
288 .properties_mut()
289 .insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
290 let op = aws_smithy_http::operation::Operation::new(
291 request,
292 crate::operation::GetThreadHistory::new(),
293 )
294 .with_metadata(aws_smithy_http::operation::Metadata::new(
295 "GetThreadHistory",
296 "ChatService",
297 ));
298 Ok(op)
299 }
300 pub fn builder() -> crate::input::get_thread_history_input::Builder {
302 crate::input::get_thread_history_input::Builder::default()
303 }
304}
305
306pub mod get_thread_topic_input {
308 #[non_exhaustive]
310 #[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
311 pub struct Builder {
312 pub(crate) thread_id: std::option::Option<std::string::String>,
313 }
314 impl Builder {
315 pub fn thread_id(mut self, input: impl Into<std::string::String>) -> Self {
317 self.thread_id = Some(input.into());
318 self
319 }
320 pub fn set_thread_id(mut self, input: std::option::Option<std::string::String>) -> Self {
322 self.thread_id = input;
323 self
324 }
325 pub fn build(
327 self,
328 ) -> std::result::Result<
329 crate::input::GetThreadTopicInput,
330 aws_smithy_http::operation::BuildError,
331 > {
332 Ok(crate::input::GetThreadTopicInput {
333 thread_id: self.thread_id,
334 })
335 }
336 }
337}
338#[doc(hidden)]
339pub type GetThreadTopicInputOperationOutputAlias = crate::operation::GetThreadTopic;
340#[doc(hidden)]
341pub type GetThreadTopicInputOperationRetryAlias = ();
342impl GetThreadTopicInput {
343 #[allow(unused_mut)]
345 #[allow(clippy::let_and_return)]
346 #[allow(clippy::needless_borrow)]
347 pub async fn make_operation(
348 &self,
349 _config: &crate::config::Config,
350 ) -> std::result::Result<
351 aws_smithy_http::operation::Operation<crate::operation::GetThreadTopic, ()>,
352 aws_smithy_http::operation::BuildError,
353 > {
354 let mut request = {
355 fn uri_base(
356 _input: &crate::input::GetThreadTopicInput,
357 output: &mut String,
358 ) -> Result<(), aws_smithy_http::operation::BuildError> {
359 let input_6 = &_input.thread_id;
360 let input_6 = input_6.as_ref().ok_or(
361 aws_smithy_http::operation::BuildError::MissingField {
362 field: "thread_id",
363 details: "cannot be empty or unset",
364 },
365 )?;
366 let thread_id = aws_smithy_http::label::fmt_string(input_6, false);
367 if thread_id.is_empty() {
368 return Err(aws_smithy_http::operation::BuildError::MissingField {
369 field: "thread_id",
370 details: "cannot be empty or unset",
371 });
372 }
373 write!(output, "/threads/{thread_id}/topic", thread_id = thread_id)
374 .expect("formatting should succeed");
375 Ok(())
376 }
377 #[allow(clippy::unnecessary_wraps)]
378 fn update_http_builder(
379 input: &crate::input::GetThreadTopicInput,
380 _config: &crate::config::Config,
381 builder: http::request::Builder,
382 ) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
383 {
384 let mut _uri = String::new();
385 _uri = format!("{}{}", _config.uri.clone(), _uri);
386 uri_base(input, &mut _uri)?;
387 Ok(builder.method("GET").uri(_uri))
388 }
389 let mut builder = update_http_builder(&self, _config, http::request::Builder::new())?;
390 let mut builder = if let Some(auth) = &_config.auth {
391 builder.header(http::header::AUTHORIZATION, auth.clone())
392 } else {
393 builder
394 };
395 builder
396 };
397 let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
398 #[allow(clippy::useless_conversion)]
399 let body = aws_smithy_http::body::SdkBody::from("");
400 let request = request.body(body).expect("should be valid request");
401 let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
402 request
403 .properties_mut()
404 .insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
405 let op = aws_smithy_http::operation::Operation::new(
406 request,
407 crate::operation::GetThreadTopic::new(),
408 )
409 .with_metadata(aws_smithy_http::operation::Metadata::new(
410 "GetThreadTopic",
411 "ChatService",
412 ));
413 Ok(op)
414 }
415 pub fn builder() -> crate::input::get_thread_topic_input::Builder {
417 crate::input::get_thread_topic_input::Builder::default()
418 }
419}
420
421pub mod send_chat_message_input {
423 #[non_exhaustive]
425 #[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
426 pub struct Builder {
427 pub(crate) topic: std::option::Option<crate::model::SendChatTopic>,
428 pub(crate) message_body: std::option::Option<crate::model::SendMessageBody>,
429 }
430 impl Builder {
431 pub fn topic(mut self, input: crate::model::SendChatTopic) -> Self {
433 self.topic = Some(input);
434 self
435 }
436 pub fn set_topic(
438 mut self,
439 input: std::option::Option<crate::model::SendChatTopic>,
440 ) -> Self {
441 self.topic = input;
442 self
443 }
444 pub fn message_body(mut self, input: crate::model::SendMessageBody) -> Self {
446 self.message_body = Some(input);
447 self
448 }
449 pub fn set_message_body(
451 mut self,
452 input: std::option::Option<crate::model::SendMessageBody>,
453 ) -> Self {
454 self.message_body = input;
455 self
456 }
457 pub fn build(
459 self,
460 ) -> std::result::Result<
461 crate::input::SendChatMessageInput,
462 aws_smithy_http::operation::BuildError,
463 > {
464 Ok(crate::input::SendChatMessageInput {
465 topic: self.topic,
466 message_body: self.message_body,
467 })
468 }
469 }
470}
471#[doc(hidden)]
472pub type SendChatMessageInputOperationOutputAlias = crate::operation::SendChatMessage;
473#[doc(hidden)]
474pub type SendChatMessageInputOperationRetryAlias = ();
475impl SendChatMessageInput {
476 #[allow(unused_mut)]
478 #[allow(clippy::let_and_return)]
479 #[allow(clippy::needless_borrow)]
480 pub async fn make_operation(
481 &self,
482 _config: &crate::config::Config,
483 ) -> std::result::Result<
484 aws_smithy_http::operation::Operation<crate::operation::SendChatMessage, ()>,
485 aws_smithy_http::operation::BuildError,
486 > {
487 let mut request = {
488 fn uri_base(
489 _input: &crate::input::SendChatMessageInput,
490 output: &mut String,
491 ) -> Result<(), aws_smithy_http::operation::BuildError> {
492 write!(output, "/messages").expect("formatting should succeed");
493 Ok(())
494 }
495 #[allow(clippy::unnecessary_wraps)]
496 fn update_http_builder(
497 input: &crate::input::SendChatMessageInput,
498 _config: &crate::config::Config,
499 builder: http::request::Builder,
500 ) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
501 {
502 let mut _uri = String::new();
503 _uri = format!("{}{}", _config.uri.clone(), _uri);
504 uri_base(input, &mut _uri)?;
505 Ok(builder.method("POST").uri(_uri))
506 }
507 let mut builder = update_http_builder(&self, _config, http::request::Builder::new())?;
508 let mut builder = if let Some(auth) = &_config.auth {
509 builder.header(http::header::AUTHORIZATION, auth.clone())
510 } else {
511 builder
512 };
513 builder = aws_smithy_http::header::set_request_header_if_absent(
514 builder,
515 http::header::CONTENT_TYPE,
516 "application/json",
517 );
518 builder
519 };
520 let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
521 #[allow(clippy::useless_conversion)]
522 let body = aws_smithy_http::body::SdkBody::from(
523 crate::operation_ser::serialize_operation_crate_operation_send_chat_message(&self)?,
524 );
525 if let Some(content_length) = body.content_length() {
526 request = aws_smithy_http::header::set_request_header_if_absent(
527 request,
528 http::header::CONTENT_LENGTH,
529 content_length,
530 );
531 }
532 let request = request.body(body).expect("should be valid request");
533 let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
534 request
535 .properties_mut()
536 .insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
537 let op = aws_smithy_http::operation::Operation::new(
538 request,
539 crate::operation::SendChatMessage::new(),
540 )
541 .with_metadata(aws_smithy_http::operation::Metadata::new(
542 "SendChatMessage",
543 "ChatService",
544 ));
545 Ok(op)
546 }
547 pub fn builder() -> crate::input::send_chat_message_input::Builder {
549 crate::input::send_chat_message_input::Builder::default()
550 }
551}
552
553pub mod set_thread_read_input {
555 #[non_exhaustive]
557 #[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
558 pub struct Builder {
559 pub(crate) thread_id: std::option::Option<std::string::String>,
560 pub(crate) last_read_ts: std::option::Option<i64>,
561 }
562 impl Builder {
563 pub fn thread_id(mut self, input: impl Into<std::string::String>) -> Self {
565 self.thread_id = Some(input.into());
566 self
567 }
568 pub fn set_thread_id(mut self, input: std::option::Option<std::string::String>) -> Self {
570 self.thread_id = input;
571 self
572 }
573 pub fn last_read_ts(mut self, input: i64) -> Self {
575 self.last_read_ts = Some(input);
576 self
577 }
578 pub fn set_last_read_ts(mut self, input: std::option::Option<i64>) -> Self {
580 self.last_read_ts = input;
581 self
582 }
583 pub fn build(
585 self,
586 ) -> std::result::Result<
587 crate::input::SetThreadReadInput,
588 aws_smithy_http::operation::BuildError,
589 > {
590 Ok(crate::input::SetThreadReadInput {
591 thread_id: self.thread_id,
592 last_read_ts: self.last_read_ts,
593 })
594 }
595 }
596}
597#[doc(hidden)]
598pub type SetThreadReadInputOperationOutputAlias = crate::operation::SetThreadRead;
599#[doc(hidden)]
600pub type SetThreadReadInputOperationRetryAlias = ();
601impl SetThreadReadInput {
602 #[allow(unused_mut)]
604 #[allow(clippy::let_and_return)]
605 #[allow(clippy::needless_borrow)]
606 pub async fn make_operation(
607 &self,
608 _config: &crate::config::Config,
609 ) -> std::result::Result<
610 aws_smithy_http::operation::Operation<crate::operation::SetThreadRead, ()>,
611 aws_smithy_http::operation::BuildError,
612 > {
613 let mut request = {
614 fn uri_base(
615 _input: &crate::input::SetThreadReadInput,
616 output: &mut String,
617 ) -> Result<(), aws_smithy_http::operation::BuildError> {
618 let input_7 = &_input.thread_id;
619 let input_7 = input_7.as_ref().ok_or(
620 aws_smithy_http::operation::BuildError::MissingField {
621 field: "thread_id",
622 details: "cannot be empty or unset",
623 },
624 )?;
625 let thread_id = aws_smithy_http::label::fmt_string(input_7, false);
626 if thread_id.is_empty() {
627 return Err(aws_smithy_http::operation::BuildError::MissingField {
628 field: "thread_id",
629 details: "cannot be empty or unset",
630 });
631 }
632 write!(output, "/threads/{thread_id}/read", thread_id = thread_id)
633 .expect("formatting should succeed");
634 Ok(())
635 }
636 #[allow(clippy::unnecessary_wraps)]
637 fn update_http_builder(
638 input: &crate::input::SetThreadReadInput,
639 _config: &crate::config::Config,
640 builder: http::request::Builder,
641 ) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
642 {
643 let mut _uri = String::new();
644 _uri = format!("{}{}", _config.uri.clone(), _uri);
645 uri_base(input, &mut _uri)?;
646 Ok(builder.method("POST").uri(_uri))
647 }
648 let mut builder = update_http_builder(&self, _config, http::request::Builder::new())?;
649 let mut builder = if let Some(auth) = &_config.auth {
650 builder.header(http::header::AUTHORIZATION, auth.clone())
651 } else {
652 builder
653 };
654 builder = aws_smithy_http::header::set_request_header_if_absent(
655 builder,
656 http::header::CONTENT_TYPE,
657 "application/json",
658 );
659 builder
660 };
661 let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
662 #[allow(clippy::useless_conversion)]
663 let body = aws_smithy_http::body::SdkBody::from(
664 crate::operation_ser::serialize_operation_crate_operation_set_thread_read(&self)?,
665 );
666 if let Some(content_length) = body.content_length() {
667 request = aws_smithy_http::header::set_request_header_if_absent(
668 request,
669 http::header::CONTENT_LENGTH,
670 content_length,
671 );
672 }
673 let request = request.body(body).expect("should be valid request");
674 let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
675 request
676 .properties_mut()
677 .insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
678 let op = aws_smithy_http::operation::Operation::new(
679 request,
680 crate::operation::SetThreadRead::new(),
681 )
682 .with_metadata(aws_smithy_http::operation::Metadata::new(
683 "SetThreadRead",
684 "ChatService",
685 ));
686 Ok(op)
687 }
688 pub fn builder() -> crate::input::set_thread_read_input::Builder {
690 crate::input::set_thread_read_input::Builder::default()
691 }
692}
693
694pub mod set_typing_status_input {
696 #[non_exhaustive]
698 #[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
699 pub struct Builder {
700 pub(crate) thread_id: std::option::Option<std::string::String>,
701 pub(crate) status: std::option::Option<crate::model::ChatTypingStatus>,
702 }
703 impl Builder {
704 pub fn thread_id(mut self, input: impl Into<std::string::String>) -> Self {
706 self.thread_id = Some(input.into());
707 self
708 }
709 pub fn set_thread_id(mut self, input: std::option::Option<std::string::String>) -> Self {
711 self.thread_id = input;
712 self
713 }
714 pub fn status(mut self, input: crate::model::ChatTypingStatus) -> Self {
716 self.status = Some(input);
717 self
718 }
719 pub fn set_status(
721 mut self,
722 input: std::option::Option<crate::model::ChatTypingStatus>,
723 ) -> Self {
724 self.status = input;
725 self
726 }
727 pub fn build(
729 self,
730 ) -> std::result::Result<
731 crate::input::SetTypingStatusInput,
732 aws_smithy_http::operation::BuildError,
733 > {
734 Ok(crate::input::SetTypingStatusInput {
735 thread_id: self.thread_id,
736 status: self.status,
737 })
738 }
739 }
740}
741#[doc(hidden)]
742pub type SetTypingStatusInputOperationOutputAlias = crate::operation::SetTypingStatus;
743#[doc(hidden)]
744pub type SetTypingStatusInputOperationRetryAlias = ();
745impl SetTypingStatusInput {
746 #[allow(unused_mut)]
748 #[allow(clippy::let_and_return)]
749 #[allow(clippy::needless_borrow)]
750 pub async fn make_operation(
751 &self,
752 _config: &crate::config::Config,
753 ) -> std::result::Result<
754 aws_smithy_http::operation::Operation<crate::operation::SetTypingStatus, ()>,
755 aws_smithy_http::operation::BuildError,
756 > {
757 let mut request = {
758 fn uri_base(
759 _input: &crate::input::SetTypingStatusInput,
760 output: &mut String,
761 ) -> Result<(), aws_smithy_http::operation::BuildError> {
762 let input_8 = &_input.thread_id;
763 let input_8 = input_8.as_ref().ok_or(
764 aws_smithy_http::operation::BuildError::MissingField {
765 field: "thread_id",
766 details: "cannot be empty or unset",
767 },
768 )?;
769 let thread_id = aws_smithy_http::label::fmt_string(input_8, false);
770 if thread_id.is_empty() {
771 return Err(aws_smithy_http::operation::BuildError::MissingField {
772 field: "thread_id",
773 details: "cannot be empty or unset",
774 });
775 }
776 write!(
777 output,
778 "/threads/{thread_id}/typing-status",
779 thread_id = thread_id
780 )
781 .expect("formatting should succeed");
782 Ok(())
783 }
784 #[allow(clippy::unnecessary_wraps)]
785 fn update_http_builder(
786 input: &crate::input::SetTypingStatusInput,
787 _config: &crate::config::Config,
788 builder: http::request::Builder,
789 ) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
790 {
791 let mut _uri = String::new();
792 _uri = format!("{}{}", _config.uri.clone(), _uri);
793 uri_base(input, &mut _uri)?;
794 Ok(builder.method("PUT").uri(_uri))
795 }
796 let mut builder = update_http_builder(&self, _config, http::request::Builder::new())?;
797 let mut builder = if let Some(auth) = &_config.auth {
798 builder.header(http::header::AUTHORIZATION, auth.clone())
799 } else {
800 builder
801 };
802 builder = aws_smithy_http::header::set_request_header_if_absent(
803 builder,
804 http::header::CONTENT_TYPE,
805 "application/json",
806 );
807 builder
808 };
809 let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
810 #[allow(clippy::useless_conversion)]
811 let body = aws_smithy_http::body::SdkBody::from(
812 crate::operation_ser::serialize_operation_crate_operation_set_typing_status(&self)?,
813 );
814 if let Some(content_length) = body.content_length() {
815 request = aws_smithy_http::header::set_request_header_if_absent(
816 request,
817 http::header::CONTENT_LENGTH,
818 content_length,
819 );
820 }
821 let request = request.body(body).expect("should be valid request");
822 let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
823 request
824 .properties_mut()
825 .insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
826 let op = aws_smithy_http::operation::Operation::new(
827 request,
828 crate::operation::SetTypingStatus::new(),
829 )
830 .with_metadata(aws_smithy_http::operation::Metadata::new(
831 "SetTypingStatus",
832 "ChatService",
833 ));
834 Ok(op)
835 }
836 pub fn builder() -> crate::input::set_typing_status_input::Builder {
838 crate::input::set_typing_status_input::Builder::default()
839 }
840}
841
842pub mod watch_thread_input {
844 #[non_exhaustive]
846 #[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
847 pub struct Builder {
848 pub(crate) thread_id: std::option::Option<std::string::String>,
849 pub(crate) watch_index: std::option::Option<std::string::String>,
850 }
851 impl Builder {
852 pub fn thread_id(mut self, input: impl Into<std::string::String>) -> Self {
854 self.thread_id = Some(input.into());
855 self
856 }
857 pub fn set_thread_id(mut self, input: std::option::Option<std::string::String>) -> Self {
859 self.thread_id = input;
860 self
861 }
862 pub fn watch_index(mut self, input: impl Into<std::string::String>) -> Self {
864 self.watch_index = Some(input.into());
865 self
866 }
867 pub fn set_watch_index(mut self, input: std::option::Option<std::string::String>) -> Self {
869 self.watch_index = input;
870 self
871 }
872 pub fn build(
874 self,
875 ) -> std::result::Result<
876 crate::input::WatchThreadInput,
877 aws_smithy_http::operation::BuildError,
878 > {
879 Ok(crate::input::WatchThreadInput {
880 thread_id: self.thread_id,
881 watch_index: self.watch_index,
882 })
883 }
884 }
885}
886#[doc(hidden)]
887pub type WatchThreadInputOperationOutputAlias = crate::operation::WatchThread;
888#[doc(hidden)]
889pub type WatchThreadInputOperationRetryAlias = ();
890impl WatchThreadInput {
891 #[allow(unused_mut)]
893 #[allow(clippy::let_and_return)]
894 #[allow(clippy::needless_borrow)]
895 pub async fn make_operation(
896 &self,
897 _config: &crate::config::Config,
898 ) -> std::result::Result<
899 aws_smithy_http::operation::Operation<crate::operation::WatchThread, ()>,
900 aws_smithy_http::operation::BuildError,
901 > {
902 let mut request = {
903 fn uri_base(
904 _input: &crate::input::WatchThreadInput,
905 output: &mut String,
906 ) -> Result<(), aws_smithy_http::operation::BuildError> {
907 let input_9 = &_input.thread_id;
908 let input_9 = input_9.as_ref().ok_or(
909 aws_smithy_http::operation::BuildError::MissingField {
910 field: "thread_id",
911 details: "cannot be empty or unset",
912 },
913 )?;
914 let thread_id = aws_smithy_http::label::fmt_string(input_9, false);
915 if thread_id.is_empty() {
916 return Err(aws_smithy_http::operation::BuildError::MissingField {
917 field: "thread_id",
918 details: "cannot be empty or unset",
919 });
920 }
921 write!(output, "/threads/{thread_id}/live", thread_id = thread_id)
922 .expect("formatting should succeed");
923 Ok(())
924 }
925 fn uri_query(
926 _input: &crate::input::WatchThreadInput,
927 mut output: &mut String,
928 ) -> Result<(), aws_smithy_http::operation::BuildError> {
929 let mut query = aws_smithy_http::query::Writer::new(&mut output);
930 if let Some(inner_10) = &_input.watch_index {
931 query.push_kv(
932 "watch_index",
933 &aws_smithy_http::query::fmt_string(&inner_10),
934 );
935 }
936 Ok(())
937 }
938 #[allow(clippy::unnecessary_wraps)]
939 fn update_http_builder(
940 input: &crate::input::WatchThreadInput,
941 _config: &crate::config::Config,
942 builder: http::request::Builder,
943 ) -> std::result::Result<http::request::Builder, aws_smithy_http::operation::BuildError>
944 {
945 let mut _uri = String::new();
946 _uri = format!("{}{}", _config.uri.clone(), _uri);
947 uri_base(input, &mut _uri)?;
948 uri_query(input, &mut _uri)?;
949 Ok(builder.method("GET").uri(_uri))
950 }
951 let mut builder = update_http_builder(&self, _config, http::request::Builder::new())?;
952 let mut builder = if let Some(auth) = &_config.auth {
953 builder.header(http::header::AUTHORIZATION, auth.clone())
954 } else {
955 builder
956 };
957 builder
958 };
959 let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
960 #[allow(clippy::useless_conversion)]
961 let body = aws_smithy_http::body::SdkBody::from("");
962 let request = request.body(body).expect("should be valid request");
963 let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
964 request
965 .properties_mut()
966 .insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
967 let op = aws_smithy_http::operation::Operation::new(
968 request,
969 crate::operation::WatchThread::new(),
970 )
971 .with_metadata(aws_smithy_http::operation::Metadata::new(
972 "WatchThread",
973 "ChatService",
974 ));
975 Ok(op)
976 }
977 pub fn builder() -> crate::input::watch_thread_input::Builder {
979 crate::input::watch_thread_input::Builder::default()
980 }
981}
982
983#[allow(missing_docs)] #[non_exhaustive]
985#[derive(std::clone::Clone, std::cmp::PartialEq)]
986pub struct GetDirectThreadInput {
987 pub identity_id: std::option::Option<std::string::String>,
989}
990impl GetDirectThreadInput {
991 pub fn identity_id(&self) -> std::option::Option<&str> {
993 self.identity_id.as_deref()
994 }
995}
996impl std::fmt::Debug for GetDirectThreadInput {
997 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
998 let mut formatter = f.debug_struct("GetDirectThreadInput");
999 formatter.field("identity_id", &self.identity_id);
1000 formatter.finish()
1001 }
1002}
1003
1004#[allow(missing_docs)] #[non_exhaustive]
1006#[derive(std::clone::Clone, std::cmp::PartialEq)]
1007pub struct SendChatMessageInput {
1008 pub topic: std::option::Option<crate::model::SendChatTopic>,
1010 pub message_body: std::option::Option<crate::model::SendMessageBody>,
1012}
1013impl SendChatMessageInput {
1014 pub fn topic(&self) -> std::option::Option<&crate::model::SendChatTopic> {
1016 self.topic.as_ref()
1017 }
1018 pub fn message_body(&self) -> std::option::Option<&crate::model::SendMessageBody> {
1020 self.message_body.as_ref()
1021 }
1022}
1023impl std::fmt::Debug for SendChatMessageInput {
1024 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1025 let mut formatter = f.debug_struct("SendChatMessageInput");
1026 formatter.field("topic", &self.topic);
1027 formatter.field("message_body", &self.message_body);
1028 formatter.finish()
1029 }
1030}
1031
1032#[allow(missing_docs)] #[non_exhaustive]
1034#[derive(std::clone::Clone, std::cmp::PartialEq)]
1035pub struct SetTypingStatusInput {
1036 pub thread_id: std::option::Option<std::string::String>,
1038 pub status: std::option::Option<crate::model::ChatTypingStatus>,
1040}
1041impl SetTypingStatusInput {
1042 pub fn thread_id(&self) -> std::option::Option<&str> {
1044 self.thread_id.as_deref()
1045 }
1046 pub fn status(&self) -> std::option::Option<&crate::model::ChatTypingStatus> {
1048 self.status.as_ref()
1049 }
1050}
1051impl std::fmt::Debug for SetTypingStatusInput {
1052 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1053 let mut formatter = f.debug_struct("SetTypingStatusInput");
1054 formatter.field("thread_id", &self.thread_id);
1055 formatter.field("status", &self.status);
1056 formatter.finish()
1057 }
1058}
1059
1060#[allow(missing_docs)] #[non_exhaustive]
1062#[derive(std::clone::Clone, std::cmp::PartialEq)]
1063pub struct SetThreadReadInput {
1064 pub thread_id: std::option::Option<std::string::String>,
1066 pub last_read_ts: std::option::Option<i64>,
1068}
1069impl SetThreadReadInput {
1070 pub fn thread_id(&self) -> std::option::Option<&str> {
1072 self.thread_id.as_deref()
1073 }
1074 pub fn last_read_ts(&self) -> std::option::Option<i64> {
1076 self.last_read_ts
1077 }
1078}
1079impl std::fmt::Debug for SetThreadReadInput {
1080 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1081 let mut formatter = f.debug_struct("SetThreadReadInput");
1082 formatter.field("thread_id", &self.thread_id);
1083 formatter.field("last_read_ts", &self.last_read_ts);
1084 formatter.finish()
1085 }
1086}
1087
1088#[allow(missing_docs)] #[non_exhaustive]
1090#[derive(std::clone::Clone, std::cmp::PartialEq)]
1091pub struct GetThreadHistoryInput {
1092 pub thread_id: std::option::Option<std::string::String>,
1094 pub ts: std::option::Option<i32>,
1096 pub count: std::option::Option<i32>,
1098 pub query_direction: std::option::Option<crate::model::QueryDirection>,
1100}
1101impl GetThreadHistoryInput {
1102 pub fn thread_id(&self) -> std::option::Option<&str> {
1104 self.thread_id.as_deref()
1105 }
1106 pub fn ts(&self) -> std::option::Option<i32> {
1108 self.ts
1109 }
1110 pub fn count(&self) -> std::option::Option<i32> {
1112 self.count
1113 }
1114 pub fn query_direction(&self) -> std::option::Option<&crate::model::QueryDirection> {
1116 self.query_direction.as_ref()
1117 }
1118}
1119impl std::fmt::Debug for GetThreadHistoryInput {
1120 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1121 let mut formatter = f.debug_struct("GetThreadHistoryInput");
1122 formatter.field("thread_id", &self.thread_id);
1123 formatter.field("ts", &self.ts);
1124 formatter.field("count", &self.count);
1125 formatter.field("query_direction", &self.query_direction);
1126 formatter.finish()
1127 }
1128}
1129
1130#[allow(missing_docs)] #[non_exhaustive]
1132#[derive(std::clone::Clone, std::cmp::PartialEq)]
1133pub struct WatchThreadInput {
1134 pub thread_id: std::option::Option<std::string::String>,
1136 pub watch_index: std::option::Option<std::string::String>,
1138}
1139impl WatchThreadInput {
1140 pub fn thread_id(&self) -> std::option::Option<&str> {
1142 self.thread_id.as_deref()
1143 }
1144 pub fn watch_index(&self) -> std::option::Option<&str> {
1146 self.watch_index.as_deref()
1147 }
1148}
1149impl std::fmt::Debug for WatchThreadInput {
1150 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1151 let mut formatter = f.debug_struct("WatchThreadInput");
1152 formatter.field("thread_id", &self.thread_id);
1153 formatter.field("watch_index", &self.watch_index);
1154 formatter.finish()
1155 }
1156}
1157
1158#[allow(missing_docs)] #[non_exhaustive]
1160#[derive(std::clone::Clone, std::cmp::PartialEq)]
1161pub struct GetThreadTopicInput {
1162 pub thread_id: std::option::Option<std::string::String>,
1164}
1165impl GetThreadTopicInput {
1166 pub fn thread_id(&self) -> std::option::Option<&str> {
1168 self.thread_id.as_deref()
1169 }
1170}
1171impl std::fmt::Debug for GetThreadTopicInput {
1172 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1173 let mut formatter = f.debug_struct("GetThreadTopicInput");
1174 formatter.field("thread_id", &self.thread_id);
1175 formatter.finish()
1176 }
1177}