google_chat_v1/model.rs
1// Copyright 2026 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_apps_card_v1;
26extern crate google_cloud_gax;
27extern crate google_cloud_rpc;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// Represents the status for a request to either invoke or submit a
40/// [dialog](https://developers.google.com/workspace/chat/dialogs).
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct ActionStatus {
44 /// The status code.
45 pub status_code: google_cloud_rpc::model::Code,
46
47 /// The message to send users about the status of their request.
48 /// If unset, a generic message based on the `status_code` is sent.
49 pub user_facing_message: std::string::String,
50
51 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
52}
53
54impl ActionStatus {
55 /// Creates a new default instance.
56 pub fn new() -> Self {
57 std::default::Default::default()
58 }
59
60 /// Sets the value of [status_code][crate::model::ActionStatus::status_code].
61 ///
62 /// # Example
63 /// ```ignore,no_run
64 /// # use google_chat_v1::model::ActionStatus;
65 /// use google_cloud_rpc::model::Code;
66 /// let x0 = ActionStatus::new().set_status_code(Code::Cancelled);
67 /// let x1 = ActionStatus::new().set_status_code(Code::Unknown);
68 /// let x2 = ActionStatus::new().set_status_code(Code::InvalidArgument);
69 /// ```
70 pub fn set_status_code<T: std::convert::Into<google_cloud_rpc::model::Code>>(
71 mut self,
72 v: T,
73 ) -> Self {
74 self.status_code = v.into();
75 self
76 }
77
78 /// Sets the value of [user_facing_message][crate::model::ActionStatus::user_facing_message].
79 ///
80 /// # Example
81 /// ```ignore,no_run
82 /// # use google_chat_v1::model::ActionStatus;
83 /// let x = ActionStatus::new().set_user_facing_message("example");
84 /// ```
85 pub fn set_user_facing_message<T: std::convert::Into<std::string::String>>(
86 mut self,
87 v: T,
88 ) -> Self {
89 self.user_facing_message = v.into();
90 self
91 }
92}
93
94impl wkt::message::Message for ActionStatus {
95 fn typename() -> &'static str {
96 "type.googleapis.com/google.chat.v1.ActionStatus"
97 }
98}
99
100/// Output only. Annotations can be associated with the plain-text body of the
101/// message or with chips that link to Google Workspace resources like Google
102/// Docs or Sheets with `start_index` and `length` of 0. To add basic formatting
103/// to a text message, see [Format text
104/// messages](https://developers.google.com/workspace/chat/format-messages).
105///
106/// Example plain-text message body:
107///
108/// ```norust
109/// Hello @FooBot how are you!"
110/// ```
111///
112/// The corresponding annotations metadata:
113///
114/// ```norust
115/// "annotations":[{
116/// "type":"USER_MENTION",
117/// "startIndex":6,
118/// "length":7,
119/// "userMention": {
120/// "user": {
121/// "name":"users/{user}",
122/// "displayName":"FooBot",
123/// "avatarUrl":"https://goo.gl/aeDtrS",
124/// "type":"BOT"
125/// },
126/// "type":"MENTION"
127/// }
128/// }]
129/// ```
130#[derive(Clone, Default, PartialEq)]
131#[non_exhaustive]
132pub struct Annotation {
133 /// The type of this annotation.
134 pub r#type: crate::model::AnnotationType,
135
136 /// Start index (0-based, inclusive) in the plain-text message body this
137 /// annotation corresponds to.
138 pub start_index: std::option::Option<i32>,
139
140 /// Length of the substring in the plain-text message body this annotation
141 /// corresponds to. If not present, indicates a length of 0.
142 pub length: i32,
143
144 /// Additional metadata about the annotation.
145 pub metadata: std::option::Option<crate::model::annotation::Metadata>,
146
147 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
148}
149
150impl Annotation {
151 /// Creates a new default instance.
152 pub fn new() -> Self {
153 std::default::Default::default()
154 }
155
156 /// Sets the value of [r#type][crate::model::Annotation::type].
157 ///
158 /// # Example
159 /// ```ignore,no_run
160 /// # use google_chat_v1::model::Annotation;
161 /// use google_chat_v1::model::AnnotationType;
162 /// let x0 = Annotation::new().set_type(AnnotationType::UserMention);
163 /// let x1 = Annotation::new().set_type(AnnotationType::SlashCommand);
164 /// let x2 = Annotation::new().set_type(AnnotationType::RichLink);
165 /// ```
166 pub fn set_type<T: std::convert::Into<crate::model::AnnotationType>>(mut self, v: T) -> Self {
167 self.r#type = v.into();
168 self
169 }
170
171 /// Sets the value of [start_index][crate::model::Annotation::start_index].
172 ///
173 /// # Example
174 /// ```ignore,no_run
175 /// # use google_chat_v1::model::Annotation;
176 /// let x = Annotation::new().set_start_index(42);
177 /// ```
178 pub fn set_start_index<T>(mut self, v: T) -> Self
179 where
180 T: std::convert::Into<i32>,
181 {
182 self.start_index = std::option::Option::Some(v.into());
183 self
184 }
185
186 /// Sets or clears the value of [start_index][crate::model::Annotation::start_index].
187 ///
188 /// # Example
189 /// ```ignore,no_run
190 /// # use google_chat_v1::model::Annotation;
191 /// let x = Annotation::new().set_or_clear_start_index(Some(42));
192 /// let x = Annotation::new().set_or_clear_start_index(None::<i32>);
193 /// ```
194 pub fn set_or_clear_start_index<T>(mut self, v: std::option::Option<T>) -> Self
195 where
196 T: std::convert::Into<i32>,
197 {
198 self.start_index = v.map(|x| x.into());
199 self
200 }
201
202 /// Sets the value of [length][crate::model::Annotation::length].
203 ///
204 /// # Example
205 /// ```ignore,no_run
206 /// # use google_chat_v1::model::Annotation;
207 /// let x = Annotation::new().set_length(42);
208 /// ```
209 pub fn set_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
210 self.length = v.into();
211 self
212 }
213
214 /// Sets the value of [metadata][crate::model::Annotation::metadata].
215 ///
216 /// Note that all the setters affecting `metadata` are mutually
217 /// exclusive.
218 ///
219 /// # Example
220 /// ```ignore,no_run
221 /// # use google_chat_v1::model::Annotation;
222 /// use google_chat_v1::model::UserMentionMetadata;
223 /// let x = Annotation::new().set_metadata(Some(
224 /// google_chat_v1::model::annotation::Metadata::UserMention(UserMentionMetadata::default().into())));
225 /// ```
226 pub fn set_metadata<
227 T: std::convert::Into<std::option::Option<crate::model::annotation::Metadata>>,
228 >(
229 mut self,
230 v: T,
231 ) -> Self {
232 self.metadata = v.into();
233 self
234 }
235
236 /// The value of [metadata][crate::model::Annotation::metadata]
237 /// if it holds a `UserMention`, `None` if the field is not set or
238 /// holds a different branch.
239 pub fn user_mention(
240 &self,
241 ) -> std::option::Option<&std::boxed::Box<crate::model::UserMentionMetadata>> {
242 #[allow(unreachable_patterns)]
243 self.metadata.as_ref().and_then(|v| match v {
244 crate::model::annotation::Metadata::UserMention(v) => std::option::Option::Some(v),
245 _ => std::option::Option::None,
246 })
247 }
248
249 /// Sets the value of [metadata][crate::model::Annotation::metadata]
250 /// to hold a `UserMention`.
251 ///
252 /// Note that all the setters affecting `metadata` are
253 /// mutually exclusive.
254 ///
255 /// # Example
256 /// ```ignore,no_run
257 /// # use google_chat_v1::model::Annotation;
258 /// use google_chat_v1::model::UserMentionMetadata;
259 /// let x = Annotation::new().set_user_mention(UserMentionMetadata::default()/* use setters */);
260 /// assert!(x.user_mention().is_some());
261 /// assert!(x.slash_command().is_none());
262 /// assert!(x.rich_link_metadata().is_none());
263 /// assert!(x.custom_emoji_metadata().is_none());
264 /// ```
265 pub fn set_user_mention<
266 T: std::convert::Into<std::boxed::Box<crate::model::UserMentionMetadata>>,
267 >(
268 mut self,
269 v: T,
270 ) -> Self {
271 self.metadata =
272 std::option::Option::Some(crate::model::annotation::Metadata::UserMention(v.into()));
273 self
274 }
275
276 /// The value of [metadata][crate::model::Annotation::metadata]
277 /// if it holds a `SlashCommand`, `None` if the field is not set or
278 /// holds a different branch.
279 pub fn slash_command(
280 &self,
281 ) -> std::option::Option<&std::boxed::Box<crate::model::SlashCommandMetadata>> {
282 #[allow(unreachable_patterns)]
283 self.metadata.as_ref().and_then(|v| match v {
284 crate::model::annotation::Metadata::SlashCommand(v) => std::option::Option::Some(v),
285 _ => std::option::Option::None,
286 })
287 }
288
289 /// Sets the value of [metadata][crate::model::Annotation::metadata]
290 /// to hold a `SlashCommand`.
291 ///
292 /// Note that all the setters affecting `metadata` are
293 /// mutually exclusive.
294 ///
295 /// # Example
296 /// ```ignore,no_run
297 /// # use google_chat_v1::model::Annotation;
298 /// use google_chat_v1::model::SlashCommandMetadata;
299 /// let x = Annotation::new().set_slash_command(SlashCommandMetadata::default()/* use setters */);
300 /// assert!(x.slash_command().is_some());
301 /// assert!(x.user_mention().is_none());
302 /// assert!(x.rich_link_metadata().is_none());
303 /// assert!(x.custom_emoji_metadata().is_none());
304 /// ```
305 pub fn set_slash_command<
306 T: std::convert::Into<std::boxed::Box<crate::model::SlashCommandMetadata>>,
307 >(
308 mut self,
309 v: T,
310 ) -> Self {
311 self.metadata =
312 std::option::Option::Some(crate::model::annotation::Metadata::SlashCommand(v.into()));
313 self
314 }
315
316 /// The value of [metadata][crate::model::Annotation::metadata]
317 /// if it holds a `RichLinkMetadata`, `None` if the field is not set or
318 /// holds a different branch.
319 pub fn rich_link_metadata(
320 &self,
321 ) -> std::option::Option<&std::boxed::Box<crate::model::RichLinkMetadata>> {
322 #[allow(unreachable_patterns)]
323 self.metadata.as_ref().and_then(|v| match v {
324 crate::model::annotation::Metadata::RichLinkMetadata(v) => std::option::Option::Some(v),
325 _ => std::option::Option::None,
326 })
327 }
328
329 /// Sets the value of [metadata][crate::model::Annotation::metadata]
330 /// to hold a `RichLinkMetadata`.
331 ///
332 /// Note that all the setters affecting `metadata` are
333 /// mutually exclusive.
334 ///
335 /// # Example
336 /// ```ignore,no_run
337 /// # use google_chat_v1::model::Annotation;
338 /// use google_chat_v1::model::RichLinkMetadata;
339 /// let x = Annotation::new().set_rich_link_metadata(RichLinkMetadata::default()/* use setters */);
340 /// assert!(x.rich_link_metadata().is_some());
341 /// assert!(x.user_mention().is_none());
342 /// assert!(x.slash_command().is_none());
343 /// assert!(x.custom_emoji_metadata().is_none());
344 /// ```
345 pub fn set_rich_link_metadata<
346 T: std::convert::Into<std::boxed::Box<crate::model::RichLinkMetadata>>,
347 >(
348 mut self,
349 v: T,
350 ) -> Self {
351 self.metadata = std::option::Option::Some(
352 crate::model::annotation::Metadata::RichLinkMetadata(v.into()),
353 );
354 self
355 }
356
357 /// The value of [metadata][crate::model::Annotation::metadata]
358 /// if it holds a `CustomEmojiMetadata`, `None` if the field is not set or
359 /// holds a different branch.
360 pub fn custom_emoji_metadata(
361 &self,
362 ) -> std::option::Option<&std::boxed::Box<crate::model::CustomEmojiMetadata>> {
363 #[allow(unreachable_patterns)]
364 self.metadata.as_ref().and_then(|v| match v {
365 crate::model::annotation::Metadata::CustomEmojiMetadata(v) => {
366 std::option::Option::Some(v)
367 }
368 _ => std::option::Option::None,
369 })
370 }
371
372 /// Sets the value of [metadata][crate::model::Annotation::metadata]
373 /// to hold a `CustomEmojiMetadata`.
374 ///
375 /// Note that all the setters affecting `metadata` are
376 /// mutually exclusive.
377 ///
378 /// # Example
379 /// ```ignore,no_run
380 /// # use google_chat_v1::model::Annotation;
381 /// use google_chat_v1::model::CustomEmojiMetadata;
382 /// let x = Annotation::new().set_custom_emoji_metadata(CustomEmojiMetadata::default()/* use setters */);
383 /// assert!(x.custom_emoji_metadata().is_some());
384 /// assert!(x.user_mention().is_none());
385 /// assert!(x.slash_command().is_none());
386 /// assert!(x.rich_link_metadata().is_none());
387 /// ```
388 pub fn set_custom_emoji_metadata<
389 T: std::convert::Into<std::boxed::Box<crate::model::CustomEmojiMetadata>>,
390 >(
391 mut self,
392 v: T,
393 ) -> Self {
394 self.metadata = std::option::Option::Some(
395 crate::model::annotation::Metadata::CustomEmojiMetadata(v.into()),
396 );
397 self
398 }
399}
400
401impl wkt::message::Message for Annotation {
402 fn typename() -> &'static str {
403 "type.googleapis.com/google.chat.v1.Annotation"
404 }
405}
406
407/// Defines additional types related to [Annotation].
408pub mod annotation {
409 #[allow(unused_imports)]
410 use super::*;
411
412 /// Additional metadata about the annotation.
413 #[derive(Clone, Debug, PartialEq)]
414 #[non_exhaustive]
415 pub enum Metadata {
416 /// The metadata of user mention.
417 UserMention(std::boxed::Box<crate::model::UserMentionMetadata>),
418 /// The metadata for a slash command.
419 SlashCommand(std::boxed::Box<crate::model::SlashCommandMetadata>),
420 /// The metadata for a rich link.
421 RichLinkMetadata(std::boxed::Box<crate::model::RichLinkMetadata>),
422 /// The metadata for a custom emoji.
423 CustomEmojiMetadata(std::boxed::Box<crate::model::CustomEmojiMetadata>),
424 }
425}
426
427/// Annotation metadata for user mentions (@).
428#[derive(Clone, Default, PartialEq)]
429#[non_exhaustive]
430pub struct UserMentionMetadata {
431 /// The user mentioned.
432 pub user: std::option::Option<crate::model::User>,
433
434 /// The type of user mention.
435 pub r#type: crate::model::user_mention_metadata::Type,
436
437 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
438}
439
440impl UserMentionMetadata {
441 /// Creates a new default instance.
442 pub fn new() -> Self {
443 std::default::Default::default()
444 }
445
446 /// Sets the value of [user][crate::model::UserMentionMetadata::user].
447 ///
448 /// # Example
449 /// ```ignore,no_run
450 /// # use google_chat_v1::model::UserMentionMetadata;
451 /// use google_chat_v1::model::User;
452 /// let x = UserMentionMetadata::new().set_user(User::default()/* use setters */);
453 /// ```
454 pub fn set_user<T>(mut self, v: T) -> Self
455 where
456 T: std::convert::Into<crate::model::User>,
457 {
458 self.user = std::option::Option::Some(v.into());
459 self
460 }
461
462 /// Sets or clears the value of [user][crate::model::UserMentionMetadata::user].
463 ///
464 /// # Example
465 /// ```ignore,no_run
466 /// # use google_chat_v1::model::UserMentionMetadata;
467 /// use google_chat_v1::model::User;
468 /// let x = UserMentionMetadata::new().set_or_clear_user(Some(User::default()/* use setters */));
469 /// let x = UserMentionMetadata::new().set_or_clear_user(None::<User>);
470 /// ```
471 pub fn set_or_clear_user<T>(mut self, v: std::option::Option<T>) -> Self
472 where
473 T: std::convert::Into<crate::model::User>,
474 {
475 self.user = v.map(|x| x.into());
476 self
477 }
478
479 /// Sets the value of [r#type][crate::model::UserMentionMetadata::type].
480 ///
481 /// # Example
482 /// ```ignore,no_run
483 /// # use google_chat_v1::model::UserMentionMetadata;
484 /// use google_chat_v1::model::user_mention_metadata::Type;
485 /// let x0 = UserMentionMetadata::new().set_type(Type::Add);
486 /// let x1 = UserMentionMetadata::new().set_type(Type::Mention);
487 /// ```
488 pub fn set_type<T: std::convert::Into<crate::model::user_mention_metadata::Type>>(
489 mut self,
490 v: T,
491 ) -> Self {
492 self.r#type = v.into();
493 self
494 }
495}
496
497impl wkt::message::Message for UserMentionMetadata {
498 fn typename() -> &'static str {
499 "type.googleapis.com/google.chat.v1.UserMentionMetadata"
500 }
501}
502
503/// Defines additional types related to [UserMentionMetadata].
504pub mod user_mention_metadata {
505 #[allow(unused_imports)]
506 use super::*;
507
508 /// Enum for [Type].
509 ///
510 /// # Working with unknown values
511 ///
512 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
513 /// additional enum variants at any time. Adding new variants is not considered
514 /// a breaking change. Applications should write their code in anticipation of:
515 ///
516 /// - New values appearing in future releases of the client library, **and**
517 /// - New values received dynamically, without application changes.
518 ///
519 /// Please consult the [Working with enums] section in the user guide for some
520 /// guidelines.
521 ///
522 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
523 #[derive(Clone, Debug, PartialEq)]
524 #[non_exhaustive]
525 pub enum Type {
526 /// Default value for the enum. Don't use.
527 Unspecified,
528 /// Add user to space.
529 Add,
530 /// Mention user in space.
531 Mention,
532 /// If set, the enum was initialized with an unknown value.
533 ///
534 /// Applications can examine the value using [Type::value] or
535 /// [Type::name].
536 UnknownValue(r#type::UnknownValue),
537 }
538
539 #[doc(hidden)]
540 pub mod r#type {
541 #[allow(unused_imports)]
542 use super::*;
543 #[derive(Clone, Debug, PartialEq)]
544 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
545 }
546
547 impl Type {
548 /// Gets the enum value.
549 ///
550 /// Returns `None` if the enum contains an unknown value deserialized from
551 /// the string representation of enums.
552 pub fn value(&self) -> std::option::Option<i32> {
553 match self {
554 Self::Unspecified => std::option::Option::Some(0),
555 Self::Add => std::option::Option::Some(1),
556 Self::Mention => std::option::Option::Some(2),
557 Self::UnknownValue(u) => u.0.value(),
558 }
559 }
560
561 /// Gets the enum value as a string.
562 ///
563 /// Returns `None` if the enum contains an unknown value deserialized from
564 /// the integer representation of enums.
565 pub fn name(&self) -> std::option::Option<&str> {
566 match self {
567 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
568 Self::Add => std::option::Option::Some("ADD"),
569 Self::Mention => std::option::Option::Some("MENTION"),
570 Self::UnknownValue(u) => u.0.name(),
571 }
572 }
573 }
574
575 impl std::default::Default for Type {
576 fn default() -> Self {
577 use std::convert::From;
578 Self::from(0)
579 }
580 }
581
582 impl std::fmt::Display for Type {
583 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
584 wkt::internal::display_enum(f, self.name(), self.value())
585 }
586 }
587
588 impl std::convert::From<i32> for Type {
589 fn from(value: i32) -> Self {
590 match value {
591 0 => Self::Unspecified,
592 1 => Self::Add,
593 2 => Self::Mention,
594 _ => Self::UnknownValue(r#type::UnknownValue(
595 wkt::internal::UnknownEnumValue::Integer(value),
596 )),
597 }
598 }
599 }
600
601 impl std::convert::From<&str> for Type {
602 fn from(value: &str) -> Self {
603 use std::string::ToString;
604 match value {
605 "TYPE_UNSPECIFIED" => Self::Unspecified,
606 "ADD" => Self::Add,
607 "MENTION" => Self::Mention,
608 _ => Self::UnknownValue(r#type::UnknownValue(
609 wkt::internal::UnknownEnumValue::String(value.to_string()),
610 )),
611 }
612 }
613 }
614
615 impl serde::ser::Serialize for Type {
616 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
617 where
618 S: serde::Serializer,
619 {
620 match self {
621 Self::Unspecified => serializer.serialize_i32(0),
622 Self::Add => serializer.serialize_i32(1),
623 Self::Mention => serializer.serialize_i32(2),
624 Self::UnknownValue(u) => u.0.serialize(serializer),
625 }
626 }
627 }
628
629 impl<'de> serde::de::Deserialize<'de> for Type {
630 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
631 where
632 D: serde::Deserializer<'de>,
633 {
634 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
635 ".google.chat.v1.UserMentionMetadata.Type",
636 ))
637 }
638 }
639}
640
641/// Annotation metadata for slash commands (/).
642#[derive(Clone, Default, PartialEq)]
643#[non_exhaustive]
644pub struct SlashCommandMetadata {
645 /// The Chat app whose command was invoked.
646 pub bot: std::option::Option<crate::model::User>,
647
648 /// The type of slash command.
649 pub r#type: crate::model::slash_command_metadata::Type,
650
651 /// The name of the invoked slash command.
652 pub command_name: std::string::String,
653
654 /// The command ID of the invoked slash command.
655 pub command_id: i64,
656
657 /// Indicates whether the slash command is for a dialog.
658 pub triggers_dialog: bool,
659
660 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
661}
662
663impl SlashCommandMetadata {
664 /// Creates a new default instance.
665 pub fn new() -> Self {
666 std::default::Default::default()
667 }
668
669 /// Sets the value of [bot][crate::model::SlashCommandMetadata::bot].
670 ///
671 /// # Example
672 /// ```ignore,no_run
673 /// # use google_chat_v1::model::SlashCommandMetadata;
674 /// use google_chat_v1::model::User;
675 /// let x = SlashCommandMetadata::new().set_bot(User::default()/* use setters */);
676 /// ```
677 pub fn set_bot<T>(mut self, v: T) -> Self
678 where
679 T: std::convert::Into<crate::model::User>,
680 {
681 self.bot = std::option::Option::Some(v.into());
682 self
683 }
684
685 /// Sets or clears the value of [bot][crate::model::SlashCommandMetadata::bot].
686 ///
687 /// # Example
688 /// ```ignore,no_run
689 /// # use google_chat_v1::model::SlashCommandMetadata;
690 /// use google_chat_v1::model::User;
691 /// let x = SlashCommandMetadata::new().set_or_clear_bot(Some(User::default()/* use setters */));
692 /// let x = SlashCommandMetadata::new().set_or_clear_bot(None::<User>);
693 /// ```
694 pub fn set_or_clear_bot<T>(mut self, v: std::option::Option<T>) -> Self
695 where
696 T: std::convert::Into<crate::model::User>,
697 {
698 self.bot = v.map(|x| x.into());
699 self
700 }
701
702 /// Sets the value of [r#type][crate::model::SlashCommandMetadata::type].
703 ///
704 /// # Example
705 /// ```ignore,no_run
706 /// # use google_chat_v1::model::SlashCommandMetadata;
707 /// use google_chat_v1::model::slash_command_metadata::Type;
708 /// let x0 = SlashCommandMetadata::new().set_type(Type::Add);
709 /// let x1 = SlashCommandMetadata::new().set_type(Type::Invoke);
710 /// ```
711 pub fn set_type<T: std::convert::Into<crate::model::slash_command_metadata::Type>>(
712 mut self,
713 v: T,
714 ) -> Self {
715 self.r#type = v.into();
716 self
717 }
718
719 /// Sets the value of [command_name][crate::model::SlashCommandMetadata::command_name].
720 ///
721 /// # Example
722 /// ```ignore,no_run
723 /// # use google_chat_v1::model::SlashCommandMetadata;
724 /// let x = SlashCommandMetadata::new().set_command_name("example");
725 /// ```
726 pub fn set_command_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
727 self.command_name = v.into();
728 self
729 }
730
731 /// Sets the value of [command_id][crate::model::SlashCommandMetadata::command_id].
732 ///
733 /// # Example
734 /// ```ignore,no_run
735 /// # use google_chat_v1::model::SlashCommandMetadata;
736 /// let x = SlashCommandMetadata::new().set_command_id(42);
737 /// ```
738 pub fn set_command_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
739 self.command_id = v.into();
740 self
741 }
742
743 /// Sets the value of [triggers_dialog][crate::model::SlashCommandMetadata::triggers_dialog].
744 ///
745 /// # Example
746 /// ```ignore,no_run
747 /// # use google_chat_v1::model::SlashCommandMetadata;
748 /// let x = SlashCommandMetadata::new().set_triggers_dialog(true);
749 /// ```
750 pub fn set_triggers_dialog<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
751 self.triggers_dialog = v.into();
752 self
753 }
754}
755
756impl wkt::message::Message for SlashCommandMetadata {
757 fn typename() -> &'static str {
758 "type.googleapis.com/google.chat.v1.SlashCommandMetadata"
759 }
760}
761
762/// Defines additional types related to [SlashCommandMetadata].
763pub mod slash_command_metadata {
764 #[allow(unused_imports)]
765 use super::*;
766
767 /// Enum for [Type].
768 ///
769 /// # Working with unknown values
770 ///
771 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
772 /// additional enum variants at any time. Adding new variants is not considered
773 /// a breaking change. Applications should write their code in anticipation of:
774 ///
775 /// - New values appearing in future releases of the client library, **and**
776 /// - New values received dynamically, without application changes.
777 ///
778 /// Please consult the [Working with enums] section in the user guide for some
779 /// guidelines.
780 ///
781 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
782 #[derive(Clone, Debug, PartialEq)]
783 #[non_exhaustive]
784 pub enum Type {
785 /// Default value for the enum. Don't use.
786 Unspecified,
787 /// Add Chat app to space.
788 Add,
789 /// Invoke slash command in space.
790 Invoke,
791 /// If set, the enum was initialized with an unknown value.
792 ///
793 /// Applications can examine the value using [Type::value] or
794 /// [Type::name].
795 UnknownValue(r#type::UnknownValue),
796 }
797
798 #[doc(hidden)]
799 pub mod r#type {
800 #[allow(unused_imports)]
801 use super::*;
802 #[derive(Clone, Debug, PartialEq)]
803 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
804 }
805
806 impl Type {
807 /// Gets the enum value.
808 ///
809 /// Returns `None` if the enum contains an unknown value deserialized from
810 /// the string representation of enums.
811 pub fn value(&self) -> std::option::Option<i32> {
812 match self {
813 Self::Unspecified => std::option::Option::Some(0),
814 Self::Add => std::option::Option::Some(1),
815 Self::Invoke => std::option::Option::Some(2),
816 Self::UnknownValue(u) => u.0.value(),
817 }
818 }
819
820 /// Gets the enum value as a string.
821 ///
822 /// Returns `None` if the enum contains an unknown value deserialized from
823 /// the integer representation of enums.
824 pub fn name(&self) -> std::option::Option<&str> {
825 match self {
826 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
827 Self::Add => std::option::Option::Some("ADD"),
828 Self::Invoke => std::option::Option::Some("INVOKE"),
829 Self::UnknownValue(u) => u.0.name(),
830 }
831 }
832 }
833
834 impl std::default::Default for Type {
835 fn default() -> Self {
836 use std::convert::From;
837 Self::from(0)
838 }
839 }
840
841 impl std::fmt::Display for Type {
842 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
843 wkt::internal::display_enum(f, self.name(), self.value())
844 }
845 }
846
847 impl std::convert::From<i32> for Type {
848 fn from(value: i32) -> Self {
849 match value {
850 0 => Self::Unspecified,
851 1 => Self::Add,
852 2 => Self::Invoke,
853 _ => Self::UnknownValue(r#type::UnknownValue(
854 wkt::internal::UnknownEnumValue::Integer(value),
855 )),
856 }
857 }
858 }
859
860 impl std::convert::From<&str> for Type {
861 fn from(value: &str) -> Self {
862 use std::string::ToString;
863 match value {
864 "TYPE_UNSPECIFIED" => Self::Unspecified,
865 "ADD" => Self::Add,
866 "INVOKE" => Self::Invoke,
867 _ => Self::UnknownValue(r#type::UnknownValue(
868 wkt::internal::UnknownEnumValue::String(value.to_string()),
869 )),
870 }
871 }
872 }
873
874 impl serde::ser::Serialize for Type {
875 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
876 where
877 S: serde::Serializer,
878 {
879 match self {
880 Self::Unspecified => serializer.serialize_i32(0),
881 Self::Add => serializer.serialize_i32(1),
882 Self::Invoke => serializer.serialize_i32(2),
883 Self::UnknownValue(u) => u.0.serialize(serializer),
884 }
885 }
886 }
887
888 impl<'de> serde::de::Deserialize<'de> for Type {
889 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
890 where
891 D: serde::Deserializer<'de>,
892 {
893 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
894 ".google.chat.v1.SlashCommandMetadata.Type",
895 ))
896 }
897 }
898}
899
900/// A rich link to a resource. Rich links can be associated with the plain-text
901/// body of the message or represent chips that link to Google Workspace
902/// resources like Google Docs or Sheets with `start_index` and `length`
903/// of 0.
904#[derive(Clone, Default, PartialEq)]
905#[non_exhaustive]
906pub struct RichLinkMetadata {
907 /// The URI of this link.
908 pub uri: std::string::String,
909
910 /// The rich link type.
911 pub rich_link_type: crate::model::rich_link_metadata::RichLinkType,
912
913 /// Data for the linked resource.
914 pub data: std::option::Option<crate::model::rich_link_metadata::Data>,
915
916 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
917}
918
919impl RichLinkMetadata {
920 /// Creates a new default instance.
921 pub fn new() -> Self {
922 std::default::Default::default()
923 }
924
925 /// Sets the value of [uri][crate::model::RichLinkMetadata::uri].
926 ///
927 /// # Example
928 /// ```ignore,no_run
929 /// # use google_chat_v1::model::RichLinkMetadata;
930 /// let x = RichLinkMetadata::new().set_uri("example");
931 /// ```
932 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
933 self.uri = v.into();
934 self
935 }
936
937 /// Sets the value of [rich_link_type][crate::model::RichLinkMetadata::rich_link_type].
938 ///
939 /// # Example
940 /// ```ignore,no_run
941 /// # use google_chat_v1::model::RichLinkMetadata;
942 /// use google_chat_v1::model::rich_link_metadata::RichLinkType;
943 /// let x0 = RichLinkMetadata::new().set_rich_link_type(RichLinkType::DriveFile);
944 /// let x1 = RichLinkMetadata::new().set_rich_link_type(RichLinkType::ChatSpace);
945 /// let x2 = RichLinkMetadata::new().set_rich_link_type(RichLinkType::GmailMessage);
946 /// ```
947 pub fn set_rich_link_type<
948 T: std::convert::Into<crate::model::rich_link_metadata::RichLinkType>,
949 >(
950 mut self,
951 v: T,
952 ) -> Self {
953 self.rich_link_type = v.into();
954 self
955 }
956
957 /// Sets the value of [data][crate::model::RichLinkMetadata::data].
958 ///
959 /// Note that all the setters affecting `data` are mutually
960 /// exclusive.
961 ///
962 /// # Example
963 /// ```ignore,no_run
964 /// # use google_chat_v1::model::RichLinkMetadata;
965 /// use google_chat_v1::model::DriveLinkData;
966 /// let x = RichLinkMetadata::new().set_data(Some(
967 /// google_chat_v1::model::rich_link_metadata::Data::DriveLinkData(DriveLinkData::default().into())));
968 /// ```
969 pub fn set_data<
970 T: std::convert::Into<std::option::Option<crate::model::rich_link_metadata::Data>>,
971 >(
972 mut self,
973 v: T,
974 ) -> Self {
975 self.data = v.into();
976 self
977 }
978
979 /// The value of [data][crate::model::RichLinkMetadata::data]
980 /// if it holds a `DriveLinkData`, `None` if the field is not set or
981 /// holds a different branch.
982 pub fn drive_link_data(
983 &self,
984 ) -> std::option::Option<&std::boxed::Box<crate::model::DriveLinkData>> {
985 #[allow(unreachable_patterns)]
986 self.data.as_ref().and_then(|v| match v {
987 crate::model::rich_link_metadata::Data::DriveLinkData(v) => {
988 std::option::Option::Some(v)
989 }
990 _ => std::option::Option::None,
991 })
992 }
993
994 /// Sets the value of [data][crate::model::RichLinkMetadata::data]
995 /// to hold a `DriveLinkData`.
996 ///
997 /// Note that all the setters affecting `data` are
998 /// mutually exclusive.
999 ///
1000 /// # Example
1001 /// ```ignore,no_run
1002 /// # use google_chat_v1::model::RichLinkMetadata;
1003 /// use google_chat_v1::model::DriveLinkData;
1004 /// let x = RichLinkMetadata::new().set_drive_link_data(DriveLinkData::default()/* use setters */);
1005 /// assert!(x.drive_link_data().is_some());
1006 /// assert!(x.chat_space_link_data().is_none());
1007 /// assert!(x.meet_space_link_data().is_none());
1008 /// assert!(x.calendar_event_link_data().is_none());
1009 /// ```
1010 pub fn set_drive_link_data<
1011 T: std::convert::Into<std::boxed::Box<crate::model::DriveLinkData>>,
1012 >(
1013 mut self,
1014 v: T,
1015 ) -> Self {
1016 self.data = std::option::Option::Some(
1017 crate::model::rich_link_metadata::Data::DriveLinkData(v.into()),
1018 );
1019 self
1020 }
1021
1022 /// The value of [data][crate::model::RichLinkMetadata::data]
1023 /// if it holds a `ChatSpaceLinkData`, `None` if the field is not set or
1024 /// holds a different branch.
1025 pub fn chat_space_link_data(
1026 &self,
1027 ) -> std::option::Option<&std::boxed::Box<crate::model::ChatSpaceLinkData>> {
1028 #[allow(unreachable_patterns)]
1029 self.data.as_ref().and_then(|v| match v {
1030 crate::model::rich_link_metadata::Data::ChatSpaceLinkData(v) => {
1031 std::option::Option::Some(v)
1032 }
1033 _ => std::option::Option::None,
1034 })
1035 }
1036
1037 /// Sets the value of [data][crate::model::RichLinkMetadata::data]
1038 /// to hold a `ChatSpaceLinkData`.
1039 ///
1040 /// Note that all the setters affecting `data` are
1041 /// mutually exclusive.
1042 ///
1043 /// # Example
1044 /// ```ignore,no_run
1045 /// # use google_chat_v1::model::RichLinkMetadata;
1046 /// use google_chat_v1::model::ChatSpaceLinkData;
1047 /// let x = RichLinkMetadata::new().set_chat_space_link_data(ChatSpaceLinkData::default()/* use setters */);
1048 /// assert!(x.chat_space_link_data().is_some());
1049 /// assert!(x.drive_link_data().is_none());
1050 /// assert!(x.meet_space_link_data().is_none());
1051 /// assert!(x.calendar_event_link_data().is_none());
1052 /// ```
1053 pub fn set_chat_space_link_data<
1054 T: std::convert::Into<std::boxed::Box<crate::model::ChatSpaceLinkData>>,
1055 >(
1056 mut self,
1057 v: T,
1058 ) -> Self {
1059 self.data = std::option::Option::Some(
1060 crate::model::rich_link_metadata::Data::ChatSpaceLinkData(v.into()),
1061 );
1062 self
1063 }
1064
1065 /// The value of [data][crate::model::RichLinkMetadata::data]
1066 /// if it holds a `MeetSpaceLinkData`, `None` if the field is not set or
1067 /// holds a different branch.
1068 pub fn meet_space_link_data(
1069 &self,
1070 ) -> std::option::Option<&std::boxed::Box<crate::model::MeetSpaceLinkData>> {
1071 #[allow(unreachable_patterns)]
1072 self.data.as_ref().and_then(|v| match v {
1073 crate::model::rich_link_metadata::Data::MeetSpaceLinkData(v) => {
1074 std::option::Option::Some(v)
1075 }
1076 _ => std::option::Option::None,
1077 })
1078 }
1079
1080 /// Sets the value of [data][crate::model::RichLinkMetadata::data]
1081 /// to hold a `MeetSpaceLinkData`.
1082 ///
1083 /// Note that all the setters affecting `data` are
1084 /// mutually exclusive.
1085 ///
1086 /// # Example
1087 /// ```ignore,no_run
1088 /// # use google_chat_v1::model::RichLinkMetadata;
1089 /// use google_chat_v1::model::MeetSpaceLinkData;
1090 /// let x = RichLinkMetadata::new().set_meet_space_link_data(MeetSpaceLinkData::default()/* use setters */);
1091 /// assert!(x.meet_space_link_data().is_some());
1092 /// assert!(x.drive_link_data().is_none());
1093 /// assert!(x.chat_space_link_data().is_none());
1094 /// assert!(x.calendar_event_link_data().is_none());
1095 /// ```
1096 pub fn set_meet_space_link_data<
1097 T: std::convert::Into<std::boxed::Box<crate::model::MeetSpaceLinkData>>,
1098 >(
1099 mut self,
1100 v: T,
1101 ) -> Self {
1102 self.data = std::option::Option::Some(
1103 crate::model::rich_link_metadata::Data::MeetSpaceLinkData(v.into()),
1104 );
1105 self
1106 }
1107
1108 /// The value of [data][crate::model::RichLinkMetadata::data]
1109 /// if it holds a `CalendarEventLinkData`, `None` if the field is not set or
1110 /// holds a different branch.
1111 pub fn calendar_event_link_data(
1112 &self,
1113 ) -> std::option::Option<&std::boxed::Box<crate::model::CalendarEventLinkData>> {
1114 #[allow(unreachable_patterns)]
1115 self.data.as_ref().and_then(|v| match v {
1116 crate::model::rich_link_metadata::Data::CalendarEventLinkData(v) => {
1117 std::option::Option::Some(v)
1118 }
1119 _ => std::option::Option::None,
1120 })
1121 }
1122
1123 /// Sets the value of [data][crate::model::RichLinkMetadata::data]
1124 /// to hold a `CalendarEventLinkData`.
1125 ///
1126 /// Note that all the setters affecting `data` are
1127 /// mutually exclusive.
1128 ///
1129 /// # Example
1130 /// ```ignore,no_run
1131 /// # use google_chat_v1::model::RichLinkMetadata;
1132 /// use google_chat_v1::model::CalendarEventLinkData;
1133 /// let x = RichLinkMetadata::new().set_calendar_event_link_data(CalendarEventLinkData::default()/* use setters */);
1134 /// assert!(x.calendar_event_link_data().is_some());
1135 /// assert!(x.drive_link_data().is_none());
1136 /// assert!(x.chat_space_link_data().is_none());
1137 /// assert!(x.meet_space_link_data().is_none());
1138 /// ```
1139 pub fn set_calendar_event_link_data<
1140 T: std::convert::Into<std::boxed::Box<crate::model::CalendarEventLinkData>>,
1141 >(
1142 mut self,
1143 v: T,
1144 ) -> Self {
1145 self.data = std::option::Option::Some(
1146 crate::model::rich_link_metadata::Data::CalendarEventLinkData(v.into()),
1147 );
1148 self
1149 }
1150}
1151
1152impl wkt::message::Message for RichLinkMetadata {
1153 fn typename() -> &'static str {
1154 "type.googleapis.com/google.chat.v1.RichLinkMetadata"
1155 }
1156}
1157
1158/// Defines additional types related to [RichLinkMetadata].
1159pub mod rich_link_metadata {
1160 #[allow(unused_imports)]
1161 use super::*;
1162
1163 /// The rich link type. More types might be added in the future.
1164 ///
1165 /// # Working with unknown values
1166 ///
1167 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1168 /// additional enum variants at any time. Adding new variants is not considered
1169 /// a breaking change. Applications should write their code in anticipation of:
1170 ///
1171 /// - New values appearing in future releases of the client library, **and**
1172 /// - New values received dynamically, without application changes.
1173 ///
1174 /// Please consult the [Working with enums] section in the user guide for some
1175 /// guidelines.
1176 ///
1177 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1178 #[derive(Clone, Debug, PartialEq)]
1179 #[non_exhaustive]
1180 pub enum RichLinkType {
1181 /// Default value for the enum. Don't use.
1182 Unspecified,
1183 /// A Google Drive rich link type.
1184 DriveFile,
1185 /// A Chat space rich link type. For example, a space smart chip.
1186 ChatSpace,
1187 /// A Gmail message rich link type. Specifically, a Gmail chip from [Share to
1188 /// Chat](https://support.google.com/chat?p=chat_gmail). The API only
1189 /// supports reading messages with GMAIL_MESSAGE rich links.
1190 GmailMessage,
1191 /// A Meet message rich link type. For example, a Meet chip.
1192 MeetSpace,
1193 /// A Calendar message rich link type. For example, a Calendar chip.
1194 CalendarEvent,
1195 /// If set, the enum was initialized with an unknown value.
1196 ///
1197 /// Applications can examine the value using [RichLinkType::value] or
1198 /// [RichLinkType::name].
1199 UnknownValue(rich_link_type::UnknownValue),
1200 }
1201
1202 #[doc(hidden)]
1203 pub mod rich_link_type {
1204 #[allow(unused_imports)]
1205 use super::*;
1206 #[derive(Clone, Debug, PartialEq)]
1207 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1208 }
1209
1210 impl RichLinkType {
1211 /// Gets the enum value.
1212 ///
1213 /// Returns `None` if the enum contains an unknown value deserialized from
1214 /// the string representation of enums.
1215 pub fn value(&self) -> std::option::Option<i32> {
1216 match self {
1217 Self::Unspecified => std::option::Option::Some(0),
1218 Self::DriveFile => std::option::Option::Some(1),
1219 Self::ChatSpace => std::option::Option::Some(2),
1220 Self::GmailMessage => std::option::Option::Some(3),
1221 Self::MeetSpace => std::option::Option::Some(4),
1222 Self::CalendarEvent => std::option::Option::Some(5),
1223 Self::UnknownValue(u) => u.0.value(),
1224 }
1225 }
1226
1227 /// Gets the enum value as a string.
1228 ///
1229 /// Returns `None` if the enum contains an unknown value deserialized from
1230 /// the integer representation of enums.
1231 pub fn name(&self) -> std::option::Option<&str> {
1232 match self {
1233 Self::Unspecified => std::option::Option::Some("RICH_LINK_TYPE_UNSPECIFIED"),
1234 Self::DriveFile => std::option::Option::Some("DRIVE_FILE"),
1235 Self::ChatSpace => std::option::Option::Some("CHAT_SPACE"),
1236 Self::GmailMessage => std::option::Option::Some("GMAIL_MESSAGE"),
1237 Self::MeetSpace => std::option::Option::Some("MEET_SPACE"),
1238 Self::CalendarEvent => std::option::Option::Some("CALENDAR_EVENT"),
1239 Self::UnknownValue(u) => u.0.name(),
1240 }
1241 }
1242 }
1243
1244 impl std::default::Default for RichLinkType {
1245 fn default() -> Self {
1246 use std::convert::From;
1247 Self::from(0)
1248 }
1249 }
1250
1251 impl std::fmt::Display for RichLinkType {
1252 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1253 wkt::internal::display_enum(f, self.name(), self.value())
1254 }
1255 }
1256
1257 impl std::convert::From<i32> for RichLinkType {
1258 fn from(value: i32) -> Self {
1259 match value {
1260 0 => Self::Unspecified,
1261 1 => Self::DriveFile,
1262 2 => Self::ChatSpace,
1263 3 => Self::GmailMessage,
1264 4 => Self::MeetSpace,
1265 5 => Self::CalendarEvent,
1266 _ => Self::UnknownValue(rich_link_type::UnknownValue(
1267 wkt::internal::UnknownEnumValue::Integer(value),
1268 )),
1269 }
1270 }
1271 }
1272
1273 impl std::convert::From<&str> for RichLinkType {
1274 fn from(value: &str) -> Self {
1275 use std::string::ToString;
1276 match value {
1277 "RICH_LINK_TYPE_UNSPECIFIED" => Self::Unspecified,
1278 "DRIVE_FILE" => Self::DriveFile,
1279 "CHAT_SPACE" => Self::ChatSpace,
1280 "GMAIL_MESSAGE" => Self::GmailMessage,
1281 "MEET_SPACE" => Self::MeetSpace,
1282 "CALENDAR_EVENT" => Self::CalendarEvent,
1283 _ => Self::UnknownValue(rich_link_type::UnknownValue(
1284 wkt::internal::UnknownEnumValue::String(value.to_string()),
1285 )),
1286 }
1287 }
1288 }
1289
1290 impl serde::ser::Serialize for RichLinkType {
1291 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1292 where
1293 S: serde::Serializer,
1294 {
1295 match self {
1296 Self::Unspecified => serializer.serialize_i32(0),
1297 Self::DriveFile => serializer.serialize_i32(1),
1298 Self::ChatSpace => serializer.serialize_i32(2),
1299 Self::GmailMessage => serializer.serialize_i32(3),
1300 Self::MeetSpace => serializer.serialize_i32(4),
1301 Self::CalendarEvent => serializer.serialize_i32(5),
1302 Self::UnknownValue(u) => u.0.serialize(serializer),
1303 }
1304 }
1305 }
1306
1307 impl<'de> serde::de::Deserialize<'de> for RichLinkType {
1308 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1309 where
1310 D: serde::Deserializer<'de>,
1311 {
1312 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RichLinkType>::new(
1313 ".google.chat.v1.RichLinkMetadata.RichLinkType",
1314 ))
1315 }
1316 }
1317
1318 /// Data for the linked resource.
1319 #[derive(Clone, Debug, PartialEq)]
1320 #[non_exhaustive]
1321 pub enum Data {
1322 /// Data for a drive link.
1323 DriveLinkData(std::boxed::Box<crate::model::DriveLinkData>),
1324 /// Data for a chat space link.
1325 ChatSpaceLinkData(std::boxed::Box<crate::model::ChatSpaceLinkData>),
1326 /// Data for a Meet space link.
1327 MeetSpaceLinkData(std::boxed::Box<crate::model::MeetSpaceLinkData>),
1328 /// Data for a Calendar event link.
1329 CalendarEventLinkData(std::boxed::Box<crate::model::CalendarEventLinkData>),
1330 }
1331}
1332
1333/// Annotation metadata for custom emoji.
1334#[derive(Clone, Default, PartialEq)]
1335#[non_exhaustive]
1336pub struct CustomEmojiMetadata {
1337 /// The custom emoji.
1338 pub custom_emoji: std::option::Option<crate::model::CustomEmoji>,
1339
1340 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1341}
1342
1343impl CustomEmojiMetadata {
1344 /// Creates a new default instance.
1345 pub fn new() -> Self {
1346 std::default::Default::default()
1347 }
1348
1349 /// Sets the value of [custom_emoji][crate::model::CustomEmojiMetadata::custom_emoji].
1350 ///
1351 /// # Example
1352 /// ```ignore,no_run
1353 /// # use google_chat_v1::model::CustomEmojiMetadata;
1354 /// use google_chat_v1::model::CustomEmoji;
1355 /// let x = CustomEmojiMetadata::new().set_custom_emoji(CustomEmoji::default()/* use setters */);
1356 /// ```
1357 pub fn set_custom_emoji<T>(mut self, v: T) -> Self
1358 where
1359 T: std::convert::Into<crate::model::CustomEmoji>,
1360 {
1361 self.custom_emoji = std::option::Option::Some(v.into());
1362 self
1363 }
1364
1365 /// Sets or clears the value of [custom_emoji][crate::model::CustomEmojiMetadata::custom_emoji].
1366 ///
1367 /// # Example
1368 /// ```ignore,no_run
1369 /// # use google_chat_v1::model::CustomEmojiMetadata;
1370 /// use google_chat_v1::model::CustomEmoji;
1371 /// let x = CustomEmojiMetadata::new().set_or_clear_custom_emoji(Some(CustomEmoji::default()/* use setters */));
1372 /// let x = CustomEmojiMetadata::new().set_or_clear_custom_emoji(None::<CustomEmoji>);
1373 /// ```
1374 pub fn set_or_clear_custom_emoji<T>(mut self, v: std::option::Option<T>) -> Self
1375 where
1376 T: std::convert::Into<crate::model::CustomEmoji>,
1377 {
1378 self.custom_emoji = v.map(|x| x.into());
1379 self
1380 }
1381}
1382
1383impl wkt::message::Message for CustomEmojiMetadata {
1384 fn typename() -> &'static str {
1385 "type.googleapis.com/google.chat.v1.CustomEmojiMetadata"
1386 }
1387}
1388
1389/// Data for Google Drive links.
1390#[derive(Clone, Default, PartialEq)]
1391#[non_exhaustive]
1392pub struct DriveLinkData {
1393 /// A
1394 /// [DriveDataRef](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages.attachments#drivedataref)
1395 /// which references a Google Drive file.
1396 pub drive_data_ref: std::option::Option<crate::model::DriveDataRef>,
1397
1398 /// The mime type of the linked Google Drive resource.
1399 pub mime_type: std::string::String,
1400
1401 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1402}
1403
1404impl DriveLinkData {
1405 /// Creates a new default instance.
1406 pub fn new() -> Self {
1407 std::default::Default::default()
1408 }
1409
1410 /// Sets the value of [drive_data_ref][crate::model::DriveLinkData::drive_data_ref].
1411 ///
1412 /// # Example
1413 /// ```ignore,no_run
1414 /// # use google_chat_v1::model::DriveLinkData;
1415 /// use google_chat_v1::model::DriveDataRef;
1416 /// let x = DriveLinkData::new().set_drive_data_ref(DriveDataRef::default()/* use setters */);
1417 /// ```
1418 pub fn set_drive_data_ref<T>(mut self, v: T) -> Self
1419 where
1420 T: std::convert::Into<crate::model::DriveDataRef>,
1421 {
1422 self.drive_data_ref = std::option::Option::Some(v.into());
1423 self
1424 }
1425
1426 /// Sets or clears the value of [drive_data_ref][crate::model::DriveLinkData::drive_data_ref].
1427 ///
1428 /// # Example
1429 /// ```ignore,no_run
1430 /// # use google_chat_v1::model::DriveLinkData;
1431 /// use google_chat_v1::model::DriveDataRef;
1432 /// let x = DriveLinkData::new().set_or_clear_drive_data_ref(Some(DriveDataRef::default()/* use setters */));
1433 /// let x = DriveLinkData::new().set_or_clear_drive_data_ref(None::<DriveDataRef>);
1434 /// ```
1435 pub fn set_or_clear_drive_data_ref<T>(mut self, v: std::option::Option<T>) -> Self
1436 where
1437 T: std::convert::Into<crate::model::DriveDataRef>,
1438 {
1439 self.drive_data_ref = v.map(|x| x.into());
1440 self
1441 }
1442
1443 /// Sets the value of [mime_type][crate::model::DriveLinkData::mime_type].
1444 ///
1445 /// # Example
1446 /// ```ignore,no_run
1447 /// # use google_chat_v1::model::DriveLinkData;
1448 /// let x = DriveLinkData::new().set_mime_type("example");
1449 /// ```
1450 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1451 self.mime_type = v.into();
1452 self
1453 }
1454}
1455
1456impl wkt::message::Message for DriveLinkData {
1457 fn typename() -> &'static str {
1458 "type.googleapis.com/google.chat.v1.DriveLinkData"
1459 }
1460}
1461
1462/// Data for Chat space links.
1463#[derive(Clone, Default, PartialEq)]
1464#[non_exhaustive]
1465pub struct ChatSpaceLinkData {
1466 /// The space of the linked Chat space resource.
1467 ///
1468 /// Format: `spaces/{space}`
1469 pub space: std::string::String,
1470
1471 /// The thread of the linked Chat space resource.
1472 ///
1473 /// Format: `spaces/{space}/threads/{thread}`
1474 pub thread: std::string::String,
1475
1476 /// The message of the linked Chat space resource.
1477 ///
1478 /// Format: `spaces/{space}/messages/{message}`
1479 pub message: std::string::String,
1480
1481 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1482}
1483
1484impl ChatSpaceLinkData {
1485 /// Creates a new default instance.
1486 pub fn new() -> Self {
1487 std::default::Default::default()
1488 }
1489
1490 /// Sets the value of [space][crate::model::ChatSpaceLinkData::space].
1491 ///
1492 /// # Example
1493 /// ```ignore,no_run
1494 /// # use google_chat_v1::model::ChatSpaceLinkData;
1495 /// # let space_id = "space_id";
1496 /// let x = ChatSpaceLinkData::new().set_space(format!("spaces/{space_id}"));
1497 /// ```
1498 pub fn set_space<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1499 self.space = v.into();
1500 self
1501 }
1502
1503 /// Sets the value of [thread][crate::model::ChatSpaceLinkData::thread].
1504 ///
1505 /// # Example
1506 /// ```ignore,no_run
1507 /// # use google_chat_v1::model::ChatSpaceLinkData;
1508 /// # let space_id = "space_id";
1509 /// # let thread_id = "thread_id";
1510 /// let x = ChatSpaceLinkData::new().set_thread(format!("spaces/{space_id}/threads/{thread_id}"));
1511 /// ```
1512 pub fn set_thread<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1513 self.thread = v.into();
1514 self
1515 }
1516
1517 /// Sets the value of [message][crate::model::ChatSpaceLinkData::message].
1518 ///
1519 /// # Example
1520 /// ```ignore,no_run
1521 /// # use google_chat_v1::model::ChatSpaceLinkData;
1522 /// # let space_id = "space_id";
1523 /// # let message_id = "message_id";
1524 /// let x = ChatSpaceLinkData::new().set_message(format!("spaces/{space_id}/messages/{message_id}"));
1525 /// ```
1526 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1527 self.message = v.into();
1528 self
1529 }
1530}
1531
1532impl wkt::message::Message for ChatSpaceLinkData {
1533 fn typename() -> &'static str {
1534 "type.googleapis.com/google.chat.v1.ChatSpaceLinkData"
1535 }
1536}
1537
1538/// Data for Meet space links.
1539#[derive(Clone, Default, PartialEq)]
1540#[non_exhaustive]
1541pub struct MeetSpaceLinkData {
1542 /// Meeting code of the linked Meet space.
1543 pub meeting_code: std::string::String,
1544
1545 /// Indicates the type of the Meet space.
1546 pub r#type: crate::model::meet_space_link_data::Type,
1547
1548 /// Optional. Output only. If the Meet is a Huddle, indicates the status of the
1549 /// huddle. Otherwise, this is unset.
1550 pub huddle_status: crate::model::meet_space_link_data::HuddleStatus,
1551
1552 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1553}
1554
1555impl MeetSpaceLinkData {
1556 /// Creates a new default instance.
1557 pub fn new() -> Self {
1558 std::default::Default::default()
1559 }
1560
1561 /// Sets the value of [meeting_code][crate::model::MeetSpaceLinkData::meeting_code].
1562 ///
1563 /// # Example
1564 /// ```ignore,no_run
1565 /// # use google_chat_v1::model::MeetSpaceLinkData;
1566 /// let x = MeetSpaceLinkData::new().set_meeting_code("example");
1567 /// ```
1568 pub fn set_meeting_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1569 self.meeting_code = v.into();
1570 self
1571 }
1572
1573 /// Sets the value of [r#type][crate::model::MeetSpaceLinkData::type].
1574 ///
1575 /// # Example
1576 /// ```ignore,no_run
1577 /// # use google_chat_v1::model::MeetSpaceLinkData;
1578 /// use google_chat_v1::model::meet_space_link_data::Type;
1579 /// let x0 = MeetSpaceLinkData::new().set_type(Type::Meeting);
1580 /// let x1 = MeetSpaceLinkData::new().set_type(Type::Huddle);
1581 /// ```
1582 pub fn set_type<T: std::convert::Into<crate::model::meet_space_link_data::Type>>(
1583 mut self,
1584 v: T,
1585 ) -> Self {
1586 self.r#type = v.into();
1587 self
1588 }
1589
1590 /// Sets the value of [huddle_status][crate::model::MeetSpaceLinkData::huddle_status].
1591 ///
1592 /// # Example
1593 /// ```ignore,no_run
1594 /// # use google_chat_v1::model::MeetSpaceLinkData;
1595 /// use google_chat_v1::model::meet_space_link_data::HuddleStatus;
1596 /// let x0 = MeetSpaceLinkData::new().set_huddle_status(HuddleStatus::Started);
1597 /// let x1 = MeetSpaceLinkData::new().set_huddle_status(HuddleStatus::Ended);
1598 /// let x2 = MeetSpaceLinkData::new().set_huddle_status(HuddleStatus::Missed);
1599 /// ```
1600 pub fn set_huddle_status<
1601 T: std::convert::Into<crate::model::meet_space_link_data::HuddleStatus>,
1602 >(
1603 mut self,
1604 v: T,
1605 ) -> Self {
1606 self.huddle_status = v.into();
1607 self
1608 }
1609}
1610
1611impl wkt::message::Message for MeetSpaceLinkData {
1612 fn typename() -> &'static str {
1613 "type.googleapis.com/google.chat.v1.MeetSpaceLinkData"
1614 }
1615}
1616
1617/// Defines additional types related to [MeetSpaceLinkData].
1618pub mod meet_space_link_data {
1619 #[allow(unused_imports)]
1620 use super::*;
1621
1622 /// The type of the Meet space.
1623 ///
1624 /// # Working with unknown values
1625 ///
1626 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1627 /// additional enum variants at any time. Adding new variants is not considered
1628 /// a breaking change. Applications should write their code in anticipation of:
1629 ///
1630 /// - New values appearing in future releases of the client library, **and**
1631 /// - New values received dynamically, without application changes.
1632 ///
1633 /// Please consult the [Working with enums] section in the user guide for some
1634 /// guidelines.
1635 ///
1636 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1637 #[derive(Clone, Debug, PartialEq)]
1638 #[non_exhaustive]
1639 pub enum Type {
1640 /// Default value for the enum. Don't use.
1641 Unspecified,
1642 /// The Meet space is a meeting.
1643 Meeting,
1644 /// The Meet space is a huddle.
1645 Huddle,
1646 /// If set, the enum was initialized with an unknown value.
1647 ///
1648 /// Applications can examine the value using [Type::value] or
1649 /// [Type::name].
1650 UnknownValue(r#type::UnknownValue),
1651 }
1652
1653 #[doc(hidden)]
1654 pub mod r#type {
1655 #[allow(unused_imports)]
1656 use super::*;
1657 #[derive(Clone, Debug, PartialEq)]
1658 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1659 }
1660
1661 impl Type {
1662 /// Gets the enum value.
1663 ///
1664 /// Returns `None` if the enum contains an unknown value deserialized from
1665 /// the string representation of enums.
1666 pub fn value(&self) -> std::option::Option<i32> {
1667 match self {
1668 Self::Unspecified => std::option::Option::Some(0),
1669 Self::Meeting => std::option::Option::Some(1),
1670 Self::Huddle => std::option::Option::Some(2),
1671 Self::UnknownValue(u) => u.0.value(),
1672 }
1673 }
1674
1675 /// Gets the enum value as a string.
1676 ///
1677 /// Returns `None` if the enum contains an unknown value deserialized from
1678 /// the integer representation of enums.
1679 pub fn name(&self) -> std::option::Option<&str> {
1680 match self {
1681 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
1682 Self::Meeting => std::option::Option::Some("MEETING"),
1683 Self::Huddle => std::option::Option::Some("HUDDLE"),
1684 Self::UnknownValue(u) => u.0.name(),
1685 }
1686 }
1687 }
1688
1689 impl std::default::Default for Type {
1690 fn default() -> Self {
1691 use std::convert::From;
1692 Self::from(0)
1693 }
1694 }
1695
1696 impl std::fmt::Display for Type {
1697 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1698 wkt::internal::display_enum(f, self.name(), self.value())
1699 }
1700 }
1701
1702 impl std::convert::From<i32> for Type {
1703 fn from(value: i32) -> Self {
1704 match value {
1705 0 => Self::Unspecified,
1706 1 => Self::Meeting,
1707 2 => Self::Huddle,
1708 _ => Self::UnknownValue(r#type::UnknownValue(
1709 wkt::internal::UnknownEnumValue::Integer(value),
1710 )),
1711 }
1712 }
1713 }
1714
1715 impl std::convert::From<&str> for Type {
1716 fn from(value: &str) -> Self {
1717 use std::string::ToString;
1718 match value {
1719 "TYPE_UNSPECIFIED" => Self::Unspecified,
1720 "MEETING" => Self::Meeting,
1721 "HUDDLE" => Self::Huddle,
1722 _ => Self::UnknownValue(r#type::UnknownValue(
1723 wkt::internal::UnknownEnumValue::String(value.to_string()),
1724 )),
1725 }
1726 }
1727 }
1728
1729 impl serde::ser::Serialize for Type {
1730 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1731 where
1732 S: serde::Serializer,
1733 {
1734 match self {
1735 Self::Unspecified => serializer.serialize_i32(0),
1736 Self::Meeting => serializer.serialize_i32(1),
1737 Self::Huddle => serializer.serialize_i32(2),
1738 Self::UnknownValue(u) => u.0.serialize(serializer),
1739 }
1740 }
1741 }
1742
1743 impl<'de> serde::de::Deserialize<'de> for Type {
1744 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1745 where
1746 D: serde::Deserializer<'de>,
1747 {
1748 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
1749 ".google.chat.v1.MeetSpaceLinkData.Type",
1750 ))
1751 }
1752 }
1753
1754 /// The status of the huddle
1755 ///
1756 /// # Working with unknown values
1757 ///
1758 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1759 /// additional enum variants at any time. Adding new variants is not considered
1760 /// a breaking change. Applications should write their code in anticipation of:
1761 ///
1762 /// - New values appearing in future releases of the client library, **and**
1763 /// - New values received dynamically, without application changes.
1764 ///
1765 /// Please consult the [Working with enums] section in the user guide for some
1766 /// guidelines.
1767 ///
1768 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1769 #[derive(Clone, Debug, PartialEq)]
1770 #[non_exhaustive]
1771 pub enum HuddleStatus {
1772 /// Default value for the enum. Don't use.
1773 Unspecified,
1774 /// The huddle has started.
1775 Started,
1776 /// The huddle has ended. In this case the Meet space URI and identifiers
1777 /// will no longer be valid.
1778 Ended,
1779 /// The huddle has been missed. In this case the Meet space URI and
1780 /// identifiers will no longer be valid.
1781 Missed,
1782 /// If set, the enum was initialized with an unknown value.
1783 ///
1784 /// Applications can examine the value using [HuddleStatus::value] or
1785 /// [HuddleStatus::name].
1786 UnknownValue(huddle_status::UnknownValue),
1787 }
1788
1789 #[doc(hidden)]
1790 pub mod huddle_status {
1791 #[allow(unused_imports)]
1792 use super::*;
1793 #[derive(Clone, Debug, PartialEq)]
1794 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1795 }
1796
1797 impl HuddleStatus {
1798 /// Gets the enum value.
1799 ///
1800 /// Returns `None` if the enum contains an unknown value deserialized from
1801 /// the string representation of enums.
1802 pub fn value(&self) -> std::option::Option<i32> {
1803 match self {
1804 Self::Unspecified => std::option::Option::Some(0),
1805 Self::Started => std::option::Option::Some(1),
1806 Self::Ended => std::option::Option::Some(2),
1807 Self::Missed => std::option::Option::Some(3),
1808 Self::UnknownValue(u) => u.0.value(),
1809 }
1810 }
1811
1812 /// Gets the enum value as a string.
1813 ///
1814 /// Returns `None` if the enum contains an unknown value deserialized from
1815 /// the integer representation of enums.
1816 pub fn name(&self) -> std::option::Option<&str> {
1817 match self {
1818 Self::Unspecified => std::option::Option::Some("HUDDLE_STATUS_UNSPECIFIED"),
1819 Self::Started => std::option::Option::Some("STARTED"),
1820 Self::Ended => std::option::Option::Some("ENDED"),
1821 Self::Missed => std::option::Option::Some("MISSED"),
1822 Self::UnknownValue(u) => u.0.name(),
1823 }
1824 }
1825 }
1826
1827 impl std::default::Default for HuddleStatus {
1828 fn default() -> Self {
1829 use std::convert::From;
1830 Self::from(0)
1831 }
1832 }
1833
1834 impl std::fmt::Display for HuddleStatus {
1835 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1836 wkt::internal::display_enum(f, self.name(), self.value())
1837 }
1838 }
1839
1840 impl std::convert::From<i32> for HuddleStatus {
1841 fn from(value: i32) -> Self {
1842 match value {
1843 0 => Self::Unspecified,
1844 1 => Self::Started,
1845 2 => Self::Ended,
1846 3 => Self::Missed,
1847 _ => Self::UnknownValue(huddle_status::UnknownValue(
1848 wkt::internal::UnknownEnumValue::Integer(value),
1849 )),
1850 }
1851 }
1852 }
1853
1854 impl std::convert::From<&str> for HuddleStatus {
1855 fn from(value: &str) -> Self {
1856 use std::string::ToString;
1857 match value {
1858 "HUDDLE_STATUS_UNSPECIFIED" => Self::Unspecified,
1859 "STARTED" => Self::Started,
1860 "ENDED" => Self::Ended,
1861 "MISSED" => Self::Missed,
1862 _ => Self::UnknownValue(huddle_status::UnknownValue(
1863 wkt::internal::UnknownEnumValue::String(value.to_string()),
1864 )),
1865 }
1866 }
1867 }
1868
1869 impl serde::ser::Serialize for HuddleStatus {
1870 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1871 where
1872 S: serde::Serializer,
1873 {
1874 match self {
1875 Self::Unspecified => serializer.serialize_i32(0),
1876 Self::Started => serializer.serialize_i32(1),
1877 Self::Ended => serializer.serialize_i32(2),
1878 Self::Missed => serializer.serialize_i32(3),
1879 Self::UnknownValue(u) => u.0.serialize(serializer),
1880 }
1881 }
1882 }
1883
1884 impl<'de> serde::de::Deserialize<'de> for HuddleStatus {
1885 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1886 where
1887 D: serde::Deserializer<'de>,
1888 {
1889 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HuddleStatus>::new(
1890 ".google.chat.v1.MeetSpaceLinkData.HuddleStatus",
1891 ))
1892 }
1893 }
1894}
1895
1896/// Data for Calendar event links.
1897#[derive(Clone, Default, PartialEq)]
1898#[non_exhaustive]
1899pub struct CalendarEventLinkData {
1900 /// The [Calendar
1901 /// identifier](https://developers.google.com/workspace/calendar/api/v3/reference/calendars)
1902 /// of the linked Calendar.
1903 pub calendar_id: std::string::String,
1904
1905 /// The [Event
1906 /// identifier](https://developers.google.com/workspace/calendar/api/v3/reference/events)
1907 /// of the linked Calendar event.
1908 pub event_id: std::string::String,
1909
1910 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1911}
1912
1913impl CalendarEventLinkData {
1914 /// Creates a new default instance.
1915 pub fn new() -> Self {
1916 std::default::Default::default()
1917 }
1918
1919 /// Sets the value of [calendar_id][crate::model::CalendarEventLinkData::calendar_id].
1920 ///
1921 /// # Example
1922 /// ```ignore,no_run
1923 /// # use google_chat_v1::model::CalendarEventLinkData;
1924 /// let x = CalendarEventLinkData::new().set_calendar_id("example");
1925 /// ```
1926 pub fn set_calendar_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1927 self.calendar_id = v.into();
1928 self
1929 }
1930
1931 /// Sets the value of [event_id][crate::model::CalendarEventLinkData::event_id].
1932 ///
1933 /// # Example
1934 /// ```ignore,no_run
1935 /// # use google_chat_v1::model::CalendarEventLinkData;
1936 /// let x = CalendarEventLinkData::new().set_event_id("example");
1937 /// ```
1938 pub fn set_event_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1939 self.event_id = v.into();
1940 self
1941 }
1942}
1943
1944impl wkt::message::Message for CalendarEventLinkData {
1945 fn typename() -> &'static str {
1946 "type.googleapis.com/google.chat.v1.CalendarEventLinkData"
1947 }
1948}
1949
1950/// An attachment in Google Chat.
1951#[derive(Clone, Default, PartialEq)]
1952#[non_exhaustive]
1953pub struct Attachment {
1954 /// Identifier. Resource name of the attachment.
1955 ///
1956 /// Format: `spaces/{space}/messages/{message}/attachments/{attachment}`.
1957 pub name: std::string::String,
1958
1959 /// Output only. The original file name for the content, not the full path.
1960 pub content_name: std::string::String,
1961
1962 /// Output only. The content type (MIME type) of the file.
1963 pub content_type: std::string::String,
1964
1965 /// Output only. The thumbnail URL which should be used to preview the
1966 /// attachment to a human user. Chat apps shouldn't use this URL to download
1967 /// attachment content.
1968 pub thumbnail_uri: std::string::String,
1969
1970 /// Output only. The download URL which should be used to allow a human user to
1971 /// download the attachment. Chat apps shouldn't use this URL to download
1972 /// attachment content.
1973 pub download_uri: std::string::String,
1974
1975 /// Output only. The source of the attachment.
1976 pub source: crate::model::attachment::Source,
1977
1978 /// The data reference to the attachment.
1979 pub data_ref: std::option::Option<crate::model::attachment::DataRef>,
1980
1981 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1982}
1983
1984impl Attachment {
1985 /// Creates a new default instance.
1986 pub fn new() -> Self {
1987 std::default::Default::default()
1988 }
1989
1990 /// Sets the value of [name][crate::model::Attachment::name].
1991 ///
1992 /// # Example
1993 /// ```ignore,no_run
1994 /// # use google_chat_v1::model::Attachment;
1995 /// # let space_id = "space_id";
1996 /// # let message_id = "message_id";
1997 /// # let attachment_id = "attachment_id";
1998 /// let x = Attachment::new().set_name(format!("spaces/{space_id}/messages/{message_id}/attachments/{attachment_id}"));
1999 /// ```
2000 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2001 self.name = v.into();
2002 self
2003 }
2004
2005 /// Sets the value of [content_name][crate::model::Attachment::content_name].
2006 ///
2007 /// # Example
2008 /// ```ignore,no_run
2009 /// # use google_chat_v1::model::Attachment;
2010 /// let x = Attachment::new().set_content_name("example");
2011 /// ```
2012 pub fn set_content_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2013 self.content_name = v.into();
2014 self
2015 }
2016
2017 /// Sets the value of [content_type][crate::model::Attachment::content_type].
2018 ///
2019 /// # Example
2020 /// ```ignore,no_run
2021 /// # use google_chat_v1::model::Attachment;
2022 /// let x = Attachment::new().set_content_type("example");
2023 /// ```
2024 pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2025 self.content_type = v.into();
2026 self
2027 }
2028
2029 /// Sets the value of [thumbnail_uri][crate::model::Attachment::thumbnail_uri].
2030 ///
2031 /// # Example
2032 /// ```ignore,no_run
2033 /// # use google_chat_v1::model::Attachment;
2034 /// let x = Attachment::new().set_thumbnail_uri("example");
2035 /// ```
2036 pub fn set_thumbnail_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2037 self.thumbnail_uri = v.into();
2038 self
2039 }
2040
2041 /// Sets the value of [download_uri][crate::model::Attachment::download_uri].
2042 ///
2043 /// # Example
2044 /// ```ignore,no_run
2045 /// # use google_chat_v1::model::Attachment;
2046 /// let x = Attachment::new().set_download_uri("example");
2047 /// ```
2048 pub fn set_download_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2049 self.download_uri = v.into();
2050 self
2051 }
2052
2053 /// Sets the value of [source][crate::model::Attachment::source].
2054 ///
2055 /// # Example
2056 /// ```ignore,no_run
2057 /// # use google_chat_v1::model::Attachment;
2058 /// use google_chat_v1::model::attachment::Source;
2059 /// let x0 = Attachment::new().set_source(Source::DriveFile);
2060 /// let x1 = Attachment::new().set_source(Source::UploadedContent);
2061 /// ```
2062 pub fn set_source<T: std::convert::Into<crate::model::attachment::Source>>(
2063 mut self,
2064 v: T,
2065 ) -> Self {
2066 self.source = v.into();
2067 self
2068 }
2069
2070 /// Sets the value of [data_ref][crate::model::Attachment::data_ref].
2071 ///
2072 /// Note that all the setters affecting `data_ref` are mutually
2073 /// exclusive.
2074 ///
2075 /// # Example
2076 /// ```ignore,no_run
2077 /// # use google_chat_v1::model::Attachment;
2078 /// use google_chat_v1::model::AttachmentDataRef;
2079 /// let x = Attachment::new().set_data_ref(Some(
2080 /// google_chat_v1::model::attachment::DataRef::AttachmentDataRef(AttachmentDataRef::default().into())));
2081 /// ```
2082 pub fn set_data_ref<
2083 T: std::convert::Into<std::option::Option<crate::model::attachment::DataRef>>,
2084 >(
2085 mut self,
2086 v: T,
2087 ) -> Self {
2088 self.data_ref = v.into();
2089 self
2090 }
2091
2092 /// The value of [data_ref][crate::model::Attachment::data_ref]
2093 /// if it holds a `AttachmentDataRef`, `None` if the field is not set or
2094 /// holds a different branch.
2095 pub fn attachment_data_ref(
2096 &self,
2097 ) -> std::option::Option<&std::boxed::Box<crate::model::AttachmentDataRef>> {
2098 #[allow(unreachable_patterns)]
2099 self.data_ref.as_ref().and_then(|v| match v {
2100 crate::model::attachment::DataRef::AttachmentDataRef(v) => std::option::Option::Some(v),
2101 _ => std::option::Option::None,
2102 })
2103 }
2104
2105 /// Sets the value of [data_ref][crate::model::Attachment::data_ref]
2106 /// to hold a `AttachmentDataRef`.
2107 ///
2108 /// Note that all the setters affecting `data_ref` are
2109 /// mutually exclusive.
2110 ///
2111 /// # Example
2112 /// ```ignore,no_run
2113 /// # use google_chat_v1::model::Attachment;
2114 /// use google_chat_v1::model::AttachmentDataRef;
2115 /// let x = Attachment::new().set_attachment_data_ref(AttachmentDataRef::default()/* use setters */);
2116 /// assert!(x.attachment_data_ref().is_some());
2117 /// assert!(x.drive_data_ref().is_none());
2118 /// ```
2119 pub fn set_attachment_data_ref<
2120 T: std::convert::Into<std::boxed::Box<crate::model::AttachmentDataRef>>,
2121 >(
2122 mut self,
2123 v: T,
2124 ) -> Self {
2125 self.data_ref = std::option::Option::Some(
2126 crate::model::attachment::DataRef::AttachmentDataRef(v.into()),
2127 );
2128 self
2129 }
2130
2131 /// The value of [data_ref][crate::model::Attachment::data_ref]
2132 /// if it holds a `DriveDataRef`, `None` if the field is not set or
2133 /// holds a different branch.
2134 pub fn drive_data_ref(
2135 &self,
2136 ) -> std::option::Option<&std::boxed::Box<crate::model::DriveDataRef>> {
2137 #[allow(unreachable_patterns)]
2138 self.data_ref.as_ref().and_then(|v| match v {
2139 crate::model::attachment::DataRef::DriveDataRef(v) => std::option::Option::Some(v),
2140 _ => std::option::Option::None,
2141 })
2142 }
2143
2144 /// Sets the value of [data_ref][crate::model::Attachment::data_ref]
2145 /// to hold a `DriveDataRef`.
2146 ///
2147 /// Note that all the setters affecting `data_ref` are
2148 /// mutually exclusive.
2149 ///
2150 /// # Example
2151 /// ```ignore,no_run
2152 /// # use google_chat_v1::model::Attachment;
2153 /// use google_chat_v1::model::DriveDataRef;
2154 /// let x = Attachment::new().set_drive_data_ref(DriveDataRef::default()/* use setters */);
2155 /// assert!(x.drive_data_ref().is_some());
2156 /// assert!(x.attachment_data_ref().is_none());
2157 /// ```
2158 pub fn set_drive_data_ref<
2159 T: std::convert::Into<std::boxed::Box<crate::model::DriveDataRef>>,
2160 >(
2161 mut self,
2162 v: T,
2163 ) -> Self {
2164 self.data_ref =
2165 std::option::Option::Some(crate::model::attachment::DataRef::DriveDataRef(v.into()));
2166 self
2167 }
2168}
2169
2170impl wkt::message::Message for Attachment {
2171 fn typename() -> &'static str {
2172 "type.googleapis.com/google.chat.v1.Attachment"
2173 }
2174}
2175
2176/// Defines additional types related to [Attachment].
2177pub mod attachment {
2178 #[allow(unused_imports)]
2179 use super::*;
2180
2181 /// The source of the attachment.
2182 ///
2183 /// # Working with unknown values
2184 ///
2185 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2186 /// additional enum variants at any time. Adding new variants is not considered
2187 /// a breaking change. Applications should write their code in anticipation of:
2188 ///
2189 /// - New values appearing in future releases of the client library, **and**
2190 /// - New values received dynamically, without application changes.
2191 ///
2192 /// Please consult the [Working with enums] section in the user guide for some
2193 /// guidelines.
2194 ///
2195 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2196 #[derive(Clone, Debug, PartialEq)]
2197 #[non_exhaustive]
2198 pub enum Source {
2199 /// Reserved.
2200 Unspecified,
2201 /// The file is a Google Drive file.
2202 DriveFile,
2203 /// The file is uploaded to Chat.
2204 UploadedContent,
2205 /// If set, the enum was initialized with an unknown value.
2206 ///
2207 /// Applications can examine the value using [Source::value] or
2208 /// [Source::name].
2209 UnknownValue(source::UnknownValue),
2210 }
2211
2212 #[doc(hidden)]
2213 pub mod source {
2214 #[allow(unused_imports)]
2215 use super::*;
2216 #[derive(Clone, Debug, PartialEq)]
2217 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2218 }
2219
2220 impl Source {
2221 /// Gets the enum value.
2222 ///
2223 /// Returns `None` if the enum contains an unknown value deserialized from
2224 /// the string representation of enums.
2225 pub fn value(&self) -> std::option::Option<i32> {
2226 match self {
2227 Self::Unspecified => std::option::Option::Some(0),
2228 Self::DriveFile => std::option::Option::Some(1),
2229 Self::UploadedContent => std::option::Option::Some(2),
2230 Self::UnknownValue(u) => u.0.value(),
2231 }
2232 }
2233
2234 /// Gets the enum value as a string.
2235 ///
2236 /// Returns `None` if the enum contains an unknown value deserialized from
2237 /// the integer representation of enums.
2238 pub fn name(&self) -> std::option::Option<&str> {
2239 match self {
2240 Self::Unspecified => std::option::Option::Some("SOURCE_UNSPECIFIED"),
2241 Self::DriveFile => std::option::Option::Some("DRIVE_FILE"),
2242 Self::UploadedContent => std::option::Option::Some("UPLOADED_CONTENT"),
2243 Self::UnknownValue(u) => u.0.name(),
2244 }
2245 }
2246 }
2247
2248 impl std::default::Default for Source {
2249 fn default() -> Self {
2250 use std::convert::From;
2251 Self::from(0)
2252 }
2253 }
2254
2255 impl std::fmt::Display for Source {
2256 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2257 wkt::internal::display_enum(f, self.name(), self.value())
2258 }
2259 }
2260
2261 impl std::convert::From<i32> for Source {
2262 fn from(value: i32) -> Self {
2263 match value {
2264 0 => Self::Unspecified,
2265 1 => Self::DriveFile,
2266 2 => Self::UploadedContent,
2267 _ => Self::UnknownValue(source::UnknownValue(
2268 wkt::internal::UnknownEnumValue::Integer(value),
2269 )),
2270 }
2271 }
2272 }
2273
2274 impl std::convert::From<&str> for Source {
2275 fn from(value: &str) -> Self {
2276 use std::string::ToString;
2277 match value {
2278 "SOURCE_UNSPECIFIED" => Self::Unspecified,
2279 "DRIVE_FILE" => Self::DriveFile,
2280 "UPLOADED_CONTENT" => Self::UploadedContent,
2281 _ => Self::UnknownValue(source::UnknownValue(
2282 wkt::internal::UnknownEnumValue::String(value.to_string()),
2283 )),
2284 }
2285 }
2286 }
2287
2288 impl serde::ser::Serialize for Source {
2289 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2290 where
2291 S: serde::Serializer,
2292 {
2293 match self {
2294 Self::Unspecified => serializer.serialize_i32(0),
2295 Self::DriveFile => serializer.serialize_i32(1),
2296 Self::UploadedContent => serializer.serialize_i32(2),
2297 Self::UnknownValue(u) => u.0.serialize(serializer),
2298 }
2299 }
2300 }
2301
2302 impl<'de> serde::de::Deserialize<'de> for Source {
2303 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2304 where
2305 D: serde::Deserializer<'de>,
2306 {
2307 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Source>::new(
2308 ".google.chat.v1.Attachment.Source",
2309 ))
2310 }
2311 }
2312
2313 /// The data reference to the attachment.
2314 #[derive(Clone, Debug, PartialEq)]
2315 #[non_exhaustive]
2316 pub enum DataRef {
2317 /// Optional. A reference to the attachment data. This field is used to
2318 /// create or update messages with attachments, or with the media API to
2319 /// download the attachment data.
2320 AttachmentDataRef(std::boxed::Box<crate::model::AttachmentDataRef>),
2321 /// Output only. A reference to the Google Drive attachment. This field is
2322 /// used with the Google Drive API.
2323 DriveDataRef(std::boxed::Box<crate::model::DriveDataRef>),
2324 }
2325}
2326
2327/// A reference to the data of a drive attachment.
2328#[derive(Clone, Default, PartialEq)]
2329#[non_exhaustive]
2330pub struct DriveDataRef {
2331 /// The ID for the drive file. Use with the Drive API.
2332 pub drive_file_id: std::string::String,
2333
2334 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2335}
2336
2337impl DriveDataRef {
2338 /// Creates a new default instance.
2339 pub fn new() -> Self {
2340 std::default::Default::default()
2341 }
2342
2343 /// Sets the value of [drive_file_id][crate::model::DriveDataRef::drive_file_id].
2344 ///
2345 /// # Example
2346 /// ```ignore,no_run
2347 /// # use google_chat_v1::model::DriveDataRef;
2348 /// let x = DriveDataRef::new().set_drive_file_id("example");
2349 /// ```
2350 pub fn set_drive_file_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2351 self.drive_file_id = v.into();
2352 self
2353 }
2354}
2355
2356impl wkt::message::Message for DriveDataRef {
2357 fn typename() -> &'static str {
2358 "type.googleapis.com/google.chat.v1.DriveDataRef"
2359 }
2360}
2361
2362/// A reference to the attachment data.
2363#[derive(Clone, Default, PartialEq)]
2364#[non_exhaustive]
2365pub struct AttachmentDataRef {
2366 /// Optional. The resource name of the attachment data. This field is used with
2367 /// the media API to download the attachment data.
2368 pub resource_name: std::string::String,
2369
2370 /// Optional. Opaque token containing a reference to an uploaded attachment.
2371 /// Treated by clients as an opaque string and used to create or update Chat
2372 /// messages with attachments.
2373 pub attachment_upload_token: std::string::String,
2374
2375 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2376}
2377
2378impl AttachmentDataRef {
2379 /// Creates a new default instance.
2380 pub fn new() -> Self {
2381 std::default::Default::default()
2382 }
2383
2384 /// Sets the value of [resource_name][crate::model::AttachmentDataRef::resource_name].
2385 ///
2386 /// # Example
2387 /// ```ignore,no_run
2388 /// # use google_chat_v1::model::AttachmentDataRef;
2389 /// let x = AttachmentDataRef::new().set_resource_name("example");
2390 /// ```
2391 pub fn set_resource_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2392 self.resource_name = v.into();
2393 self
2394 }
2395
2396 /// Sets the value of [attachment_upload_token][crate::model::AttachmentDataRef::attachment_upload_token].
2397 ///
2398 /// # Example
2399 /// ```ignore,no_run
2400 /// # use google_chat_v1::model::AttachmentDataRef;
2401 /// let x = AttachmentDataRef::new().set_attachment_upload_token("example");
2402 /// ```
2403 pub fn set_attachment_upload_token<T: std::convert::Into<std::string::String>>(
2404 mut self,
2405 v: T,
2406 ) -> Self {
2407 self.attachment_upload_token = v.into();
2408 self
2409 }
2410}
2411
2412impl wkt::message::Message for AttachmentDataRef {
2413 fn typename() -> &'static str {
2414 "type.googleapis.com/google.chat.v1.AttachmentDataRef"
2415 }
2416}
2417
2418/// Request to get an attachment.
2419#[derive(Clone, Default, PartialEq)]
2420#[non_exhaustive]
2421pub struct GetAttachmentRequest {
2422 /// Required. Resource name of the attachment, in the form
2423 /// `spaces/{space}/messages/{message}/attachments/{attachment}`.
2424 pub name: std::string::String,
2425
2426 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2427}
2428
2429impl GetAttachmentRequest {
2430 /// Creates a new default instance.
2431 pub fn new() -> Self {
2432 std::default::Default::default()
2433 }
2434
2435 /// Sets the value of [name][crate::model::GetAttachmentRequest::name].
2436 ///
2437 /// # Example
2438 /// ```ignore,no_run
2439 /// # use google_chat_v1::model::GetAttachmentRequest;
2440 /// # let space_id = "space_id";
2441 /// # let message_id = "message_id";
2442 /// # let attachment_id = "attachment_id";
2443 /// let x = GetAttachmentRequest::new().set_name(format!("spaces/{space_id}/messages/{message_id}/attachments/{attachment_id}"));
2444 /// ```
2445 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2446 self.name = v.into();
2447 self
2448 }
2449}
2450
2451impl wkt::message::Message for GetAttachmentRequest {
2452 fn typename() -> &'static str {
2453 "type.googleapis.com/google.chat.v1.GetAttachmentRequest"
2454 }
2455}
2456
2457/// Request to upload an attachment.
2458#[derive(Clone, Default, PartialEq)]
2459#[non_exhaustive]
2460pub struct UploadAttachmentRequest {
2461 /// Required. Resource name of the Chat space in which the attachment is
2462 /// uploaded. Format "spaces/{space}".
2463 pub parent: std::string::String,
2464
2465 /// Required. The filename of the attachment, including the file extension.
2466 pub filename: std::string::String,
2467
2468 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2469}
2470
2471impl UploadAttachmentRequest {
2472 /// Creates a new default instance.
2473 pub fn new() -> Self {
2474 std::default::Default::default()
2475 }
2476
2477 /// Sets the value of [parent][crate::model::UploadAttachmentRequest::parent].
2478 ///
2479 /// # Example
2480 /// ```ignore,no_run
2481 /// # use google_chat_v1::model::UploadAttachmentRequest;
2482 /// # let space_id = "space_id";
2483 /// let x = UploadAttachmentRequest::new().set_parent(format!("spaces/{space_id}"));
2484 /// ```
2485 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2486 self.parent = v.into();
2487 self
2488 }
2489
2490 /// Sets the value of [filename][crate::model::UploadAttachmentRequest::filename].
2491 ///
2492 /// # Example
2493 /// ```ignore,no_run
2494 /// # use google_chat_v1::model::UploadAttachmentRequest;
2495 /// let x = UploadAttachmentRequest::new().set_filename("example");
2496 /// ```
2497 pub fn set_filename<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2498 self.filename = v.into();
2499 self
2500 }
2501}
2502
2503impl wkt::message::Message for UploadAttachmentRequest {
2504 fn typename() -> &'static str {
2505 "type.googleapis.com/google.chat.v1.UploadAttachmentRequest"
2506 }
2507}
2508
2509/// Response of uploading an attachment.
2510#[derive(Clone, Default, PartialEq)]
2511#[non_exhaustive]
2512pub struct UploadAttachmentResponse {
2513 /// Reference to the uploaded attachment.
2514 pub attachment_data_ref: std::option::Option<crate::model::AttachmentDataRef>,
2515
2516 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2517}
2518
2519impl UploadAttachmentResponse {
2520 /// Creates a new default instance.
2521 pub fn new() -> Self {
2522 std::default::Default::default()
2523 }
2524
2525 /// Sets the value of [attachment_data_ref][crate::model::UploadAttachmentResponse::attachment_data_ref].
2526 ///
2527 /// # Example
2528 /// ```ignore,no_run
2529 /// # use google_chat_v1::model::UploadAttachmentResponse;
2530 /// use google_chat_v1::model::AttachmentDataRef;
2531 /// let x = UploadAttachmentResponse::new().set_attachment_data_ref(AttachmentDataRef::default()/* use setters */);
2532 /// ```
2533 pub fn set_attachment_data_ref<T>(mut self, v: T) -> Self
2534 where
2535 T: std::convert::Into<crate::model::AttachmentDataRef>,
2536 {
2537 self.attachment_data_ref = std::option::Option::Some(v.into());
2538 self
2539 }
2540
2541 /// Sets or clears the value of [attachment_data_ref][crate::model::UploadAttachmentResponse::attachment_data_ref].
2542 ///
2543 /// # Example
2544 /// ```ignore,no_run
2545 /// # use google_chat_v1::model::UploadAttachmentResponse;
2546 /// use google_chat_v1::model::AttachmentDataRef;
2547 /// let x = UploadAttachmentResponse::new().set_or_clear_attachment_data_ref(Some(AttachmentDataRef::default()/* use setters */));
2548 /// let x = UploadAttachmentResponse::new().set_or_clear_attachment_data_ref(None::<AttachmentDataRef>);
2549 /// ```
2550 pub fn set_or_clear_attachment_data_ref<T>(mut self, v: std::option::Option<T>) -> Self
2551 where
2552 T: std::convert::Into<crate::model::AttachmentDataRef>,
2553 {
2554 self.attachment_data_ref = v.map(|x| x.into());
2555 self
2556 }
2557}
2558
2559impl wkt::message::Message for UploadAttachmentResponse {
2560 fn typename() -> &'static str {
2561 "type.googleapis.com/google.chat.v1.UploadAttachmentResponse"
2562 }
2563}
2564
2565/// A target audience in Google Chat. A target audience represents a group of
2566/// users within a Google Workspace organization, defined by an administrator.
2567/// Target audiences are used to configure access and visibility settings for
2568/// resources, such as making a space discoverable to a specific group of users.
2569///
2570/// For more details, see [Target
2571/// audiences](https://support.google.com/a/answer/9934697) and [Make a space
2572/// discoverable to a target
2573/// audience](https://developers.google.com/workspace/chat/space-target-audience).
2574#[derive(Clone, Default, PartialEq)]
2575#[non_exhaustive]
2576pub struct Audience {
2577 /// The resource name of the [target
2578 /// audience](https://support.google.com/a/answer/9934697) who can discover
2579 /// or join the space. For details, see [Make a space
2580 /// discoverable to a target
2581 /// audience](https://developers.google.com/workspace/chat/space-target-audience).
2582 /// Format: `audiences/{audience}`
2583 ///
2584 /// To use the default target audience for the Google Workspace organization,
2585 /// set to `audiences/default`.
2586 pub name: std::string::String,
2587
2588 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2589}
2590
2591impl Audience {
2592 /// Creates a new default instance.
2593 pub fn new() -> Self {
2594 std::default::Default::default()
2595 }
2596
2597 /// Sets the value of [name][crate::model::Audience::name].
2598 ///
2599 /// # Example
2600 /// ```ignore,no_run
2601 /// # use google_chat_v1::model::Audience;
2602 /// let x = Audience::new().set_name("example");
2603 /// ```
2604 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2605 self.name = v.into();
2606 self
2607 }
2608}
2609
2610impl wkt::message::Message for Audience {
2611 fn typename() -> &'static str {
2612 "type.googleapis.com/google.chat.v1.Audience"
2613 }
2614}
2615
2616/// Represents a user's current availability information in Google Chat,
2617/// including their state (for example, Active, Away, Do Not Disturb) and any
2618/// custom status.
2619#[derive(Clone, Default, PartialEq)]
2620#[non_exhaustive]
2621pub struct Availability {
2622 /// Identifier. Resource name of the user's availability.
2623 ///
2624 /// Format: `users/{user}/availability`
2625 ///
2626 /// `{user}` is the id for the Person in the People API or Admin SDK directory
2627 /// API. For example, `users/123456789`.
2628 ///
2629 /// The user's email address or `me` can also be used as an alias to refer to
2630 /// the caller. For example, `users/user@example.com` or `users/me`.
2631 pub name: std::string::String,
2632
2633 /// Output only. The user's current availability state.
2634 pub state: crate::model::availability::State,
2635
2636 /// Optional. The user's custom status.
2637 pub custom_status: std::option::Option<crate::model::CustomStatus>,
2638
2639 /// Additional metadata associated with the user's availability state.
2640 pub state_metadata: std::option::Option<crate::model::availability::StateMetadata>,
2641
2642 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2643}
2644
2645impl Availability {
2646 /// Creates a new default instance.
2647 pub fn new() -> Self {
2648 std::default::Default::default()
2649 }
2650
2651 /// Sets the value of [name][crate::model::Availability::name].
2652 ///
2653 /// # Example
2654 /// ```ignore,no_run
2655 /// # use google_chat_v1::model::Availability;
2656 /// # let user_id = "user_id";
2657 /// let x = Availability::new().set_name(format!("users/{user_id}/availability"));
2658 /// ```
2659 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2660 self.name = v.into();
2661 self
2662 }
2663
2664 /// Sets the value of [state][crate::model::Availability::state].
2665 ///
2666 /// # Example
2667 /// ```ignore,no_run
2668 /// # use google_chat_v1::model::Availability;
2669 /// use google_chat_v1::model::availability::State;
2670 /// let x0 = Availability::new().set_state(State::Active);
2671 /// let x1 = Availability::new().set_state(State::Idle);
2672 /// let x2 = Availability::new().set_state(State::Away);
2673 /// ```
2674 pub fn set_state<T: std::convert::Into<crate::model::availability::State>>(
2675 mut self,
2676 v: T,
2677 ) -> Self {
2678 self.state = v.into();
2679 self
2680 }
2681
2682 /// Sets the value of [custom_status][crate::model::Availability::custom_status].
2683 ///
2684 /// # Example
2685 /// ```ignore,no_run
2686 /// # use google_chat_v1::model::Availability;
2687 /// use google_chat_v1::model::CustomStatus;
2688 /// let x = Availability::new().set_custom_status(CustomStatus::default()/* use setters */);
2689 /// ```
2690 pub fn set_custom_status<T>(mut self, v: T) -> Self
2691 where
2692 T: std::convert::Into<crate::model::CustomStatus>,
2693 {
2694 self.custom_status = std::option::Option::Some(v.into());
2695 self
2696 }
2697
2698 /// Sets or clears the value of [custom_status][crate::model::Availability::custom_status].
2699 ///
2700 /// # Example
2701 /// ```ignore,no_run
2702 /// # use google_chat_v1::model::Availability;
2703 /// use google_chat_v1::model::CustomStatus;
2704 /// let x = Availability::new().set_or_clear_custom_status(Some(CustomStatus::default()/* use setters */));
2705 /// let x = Availability::new().set_or_clear_custom_status(None::<CustomStatus>);
2706 /// ```
2707 pub fn set_or_clear_custom_status<T>(mut self, v: std::option::Option<T>) -> Self
2708 where
2709 T: std::convert::Into<crate::model::CustomStatus>,
2710 {
2711 self.custom_status = v.map(|x| x.into());
2712 self
2713 }
2714
2715 /// Sets the value of [state_metadata][crate::model::Availability::state_metadata].
2716 ///
2717 /// Note that all the setters affecting `state_metadata` are mutually
2718 /// exclusive.
2719 ///
2720 /// # Example
2721 /// ```ignore,no_run
2722 /// # use google_chat_v1::model::Availability;
2723 /// use google_chat_v1::model::DoNotDisturbMetadata;
2724 /// let x = Availability::new().set_state_metadata(Some(
2725 /// google_chat_v1::model::availability::StateMetadata::DoNotDisturbMetadata(DoNotDisturbMetadata::default().into())));
2726 /// ```
2727 pub fn set_state_metadata<
2728 T: std::convert::Into<std::option::Option<crate::model::availability::StateMetadata>>,
2729 >(
2730 mut self,
2731 v: T,
2732 ) -> Self {
2733 self.state_metadata = v.into();
2734 self
2735 }
2736
2737 /// The value of [state_metadata][crate::model::Availability::state_metadata]
2738 /// if it holds a `DoNotDisturbMetadata`, `None` if the field is not set or
2739 /// holds a different branch.
2740 pub fn do_not_disturb_metadata(
2741 &self,
2742 ) -> std::option::Option<&std::boxed::Box<crate::model::DoNotDisturbMetadata>> {
2743 #[allow(unreachable_patterns)]
2744 self.state_metadata.as_ref().and_then(|v| match v {
2745 crate::model::availability::StateMetadata::DoNotDisturbMetadata(v) => {
2746 std::option::Option::Some(v)
2747 }
2748 _ => std::option::Option::None,
2749 })
2750 }
2751
2752 /// Sets the value of [state_metadata][crate::model::Availability::state_metadata]
2753 /// to hold a `DoNotDisturbMetadata`.
2754 ///
2755 /// Note that all the setters affecting `state_metadata` are
2756 /// mutually exclusive.
2757 ///
2758 /// # Example
2759 /// ```ignore,no_run
2760 /// # use google_chat_v1::model::Availability;
2761 /// use google_chat_v1::model::DoNotDisturbMetadata;
2762 /// let x = Availability::new().set_do_not_disturb_metadata(DoNotDisturbMetadata::default()/* use setters */);
2763 /// assert!(x.do_not_disturb_metadata().is_some());
2764 /// ```
2765 pub fn set_do_not_disturb_metadata<
2766 T: std::convert::Into<std::boxed::Box<crate::model::DoNotDisturbMetadata>>,
2767 >(
2768 mut self,
2769 v: T,
2770 ) -> Self {
2771 self.state_metadata = std::option::Option::Some(
2772 crate::model::availability::StateMetadata::DoNotDisturbMetadata(v.into()),
2773 );
2774 self
2775 }
2776}
2777
2778impl wkt::message::Message for Availability {
2779 fn typename() -> &'static str {
2780 "type.googleapis.com/google.chat.v1.Availability"
2781 }
2782}
2783
2784/// Defines additional types related to [Availability].
2785pub mod availability {
2786 #[allow(unused_imports)]
2787 use super::*;
2788
2789 /// Represents the current availability state of the user.
2790 ///
2791 /// # Working with unknown values
2792 ///
2793 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2794 /// additional enum variants at any time. Adding new variants is not considered
2795 /// a breaking change. Applications should write their code in anticipation of:
2796 ///
2797 /// - New values appearing in future releases of the client library, **and**
2798 /// - New values received dynamically, without application changes.
2799 ///
2800 /// Please consult the [Working with enums] section in the user guide for some
2801 /// guidelines.
2802 ///
2803 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2804 #[derive(Clone, Debug, PartialEq)]
2805 #[non_exhaustive]
2806 pub enum State {
2807 /// Default value. The state is unspecified.
2808 Unspecified,
2809 /// The user is currently active, based on recent activity.
2810 Active,
2811 /// The user is currently idle. This state indicates a period of inactivity
2812 /// after being ACTIVE, before potentially transitioning to AWAY.
2813 Idle,
2814 /// The user is currently away. This can be either automatically set after
2815 /// a period of inactivity in ACTIVE or IDLE state, or it can be manually set
2816 /// by the user. When manually set via `MarkAsAway`, this state persists
2817 /// regardless of user activity.
2818 Away,
2819 /// The user is in Do Not Disturb state, which is manually set.
2820 DoNotDisturb,
2821 /// If set, the enum was initialized with an unknown value.
2822 ///
2823 /// Applications can examine the value using [State::value] or
2824 /// [State::name].
2825 UnknownValue(state::UnknownValue),
2826 }
2827
2828 #[doc(hidden)]
2829 pub mod state {
2830 #[allow(unused_imports)]
2831 use super::*;
2832 #[derive(Clone, Debug, PartialEq)]
2833 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2834 }
2835
2836 impl State {
2837 /// Gets the enum value.
2838 ///
2839 /// Returns `None` if the enum contains an unknown value deserialized from
2840 /// the string representation of enums.
2841 pub fn value(&self) -> std::option::Option<i32> {
2842 match self {
2843 Self::Unspecified => std::option::Option::Some(0),
2844 Self::Active => std::option::Option::Some(1),
2845 Self::Idle => std::option::Option::Some(2),
2846 Self::Away => std::option::Option::Some(3),
2847 Self::DoNotDisturb => std::option::Option::Some(4),
2848 Self::UnknownValue(u) => u.0.value(),
2849 }
2850 }
2851
2852 /// Gets the enum value as a string.
2853 ///
2854 /// Returns `None` if the enum contains an unknown value deserialized from
2855 /// the integer representation of enums.
2856 pub fn name(&self) -> std::option::Option<&str> {
2857 match self {
2858 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2859 Self::Active => std::option::Option::Some("ACTIVE"),
2860 Self::Idle => std::option::Option::Some("IDLE"),
2861 Self::Away => std::option::Option::Some("AWAY"),
2862 Self::DoNotDisturb => std::option::Option::Some("DO_NOT_DISTURB"),
2863 Self::UnknownValue(u) => u.0.name(),
2864 }
2865 }
2866 }
2867
2868 impl std::default::Default for State {
2869 fn default() -> Self {
2870 use std::convert::From;
2871 Self::from(0)
2872 }
2873 }
2874
2875 impl std::fmt::Display for State {
2876 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2877 wkt::internal::display_enum(f, self.name(), self.value())
2878 }
2879 }
2880
2881 impl std::convert::From<i32> for State {
2882 fn from(value: i32) -> Self {
2883 match value {
2884 0 => Self::Unspecified,
2885 1 => Self::Active,
2886 2 => Self::Idle,
2887 3 => Self::Away,
2888 4 => Self::DoNotDisturb,
2889 _ => Self::UnknownValue(state::UnknownValue(
2890 wkt::internal::UnknownEnumValue::Integer(value),
2891 )),
2892 }
2893 }
2894 }
2895
2896 impl std::convert::From<&str> for State {
2897 fn from(value: &str) -> Self {
2898 use std::string::ToString;
2899 match value {
2900 "STATE_UNSPECIFIED" => Self::Unspecified,
2901 "ACTIVE" => Self::Active,
2902 "IDLE" => Self::Idle,
2903 "AWAY" => Self::Away,
2904 "DO_NOT_DISTURB" => Self::DoNotDisturb,
2905 _ => Self::UnknownValue(state::UnknownValue(
2906 wkt::internal::UnknownEnumValue::String(value.to_string()),
2907 )),
2908 }
2909 }
2910 }
2911
2912 impl serde::ser::Serialize for State {
2913 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2914 where
2915 S: serde::Serializer,
2916 {
2917 match self {
2918 Self::Unspecified => serializer.serialize_i32(0),
2919 Self::Active => serializer.serialize_i32(1),
2920 Self::Idle => serializer.serialize_i32(2),
2921 Self::Away => serializer.serialize_i32(3),
2922 Self::DoNotDisturb => serializer.serialize_i32(4),
2923 Self::UnknownValue(u) => u.0.serialize(serializer),
2924 }
2925 }
2926 }
2927
2928 impl<'de> serde::de::Deserialize<'de> for State {
2929 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2930 where
2931 D: serde::Deserializer<'de>,
2932 {
2933 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2934 ".google.chat.v1.Availability.State",
2935 ))
2936 }
2937 }
2938
2939 /// Additional metadata associated with the user's availability state.
2940 #[derive(Clone, Debug, PartialEq)]
2941 #[non_exhaustive]
2942 pub enum StateMetadata {
2943 /// Output only. Metadata if the user state is set to DO_NOT_DISTURB.
2944 DoNotDisturbMetadata(std::boxed::Box<crate::model::DoNotDisturbMetadata>),
2945 }
2946}
2947
2948/// Represents a user's custom status in Google Chat.
2949/// This includes a short text message with an optional emoji that a user sets to
2950/// give more context about their availability.
2951#[derive(Clone, Default, PartialEq)]
2952#[non_exhaustive]
2953pub struct CustomStatus {
2954 /// Required. The text of the custom status. This will be a string with maximum
2955 /// length of 64.
2956 pub text: std::string::String,
2957
2958 /// Required. The emoji of the custom status. Only Unicode emojis are
2959 /// supported; custom emojis are not supported.
2960 pub emoji: std::option::Option<crate::model::Emoji>,
2961
2962 /// The expiration time of the custom status. It can be specified as either
2963 /// an absolute timestamp or a time-to-live duration.
2964 pub expiration: std::option::Option<crate::model::custom_status::Expiration>,
2965
2966 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2967}
2968
2969impl CustomStatus {
2970 /// Creates a new default instance.
2971 pub fn new() -> Self {
2972 std::default::Default::default()
2973 }
2974
2975 /// Sets the value of [text][crate::model::CustomStatus::text].
2976 ///
2977 /// # Example
2978 /// ```ignore,no_run
2979 /// # use google_chat_v1::model::CustomStatus;
2980 /// let x = CustomStatus::new().set_text("example");
2981 /// ```
2982 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2983 self.text = v.into();
2984 self
2985 }
2986
2987 /// Sets the value of [emoji][crate::model::CustomStatus::emoji].
2988 ///
2989 /// # Example
2990 /// ```ignore,no_run
2991 /// # use google_chat_v1::model::CustomStatus;
2992 /// use google_chat_v1::model::Emoji;
2993 /// let x = CustomStatus::new().set_emoji(Emoji::default()/* use setters */);
2994 /// ```
2995 pub fn set_emoji<T>(mut self, v: T) -> Self
2996 where
2997 T: std::convert::Into<crate::model::Emoji>,
2998 {
2999 self.emoji = std::option::Option::Some(v.into());
3000 self
3001 }
3002
3003 /// Sets or clears the value of [emoji][crate::model::CustomStatus::emoji].
3004 ///
3005 /// # Example
3006 /// ```ignore,no_run
3007 /// # use google_chat_v1::model::CustomStatus;
3008 /// use google_chat_v1::model::Emoji;
3009 /// let x = CustomStatus::new().set_or_clear_emoji(Some(Emoji::default()/* use setters */));
3010 /// let x = CustomStatus::new().set_or_clear_emoji(None::<Emoji>);
3011 /// ```
3012 pub fn set_or_clear_emoji<T>(mut self, v: std::option::Option<T>) -> Self
3013 where
3014 T: std::convert::Into<crate::model::Emoji>,
3015 {
3016 self.emoji = v.map(|x| x.into());
3017 self
3018 }
3019
3020 /// Sets the value of [expiration][crate::model::CustomStatus::expiration].
3021 ///
3022 /// Note that all the setters affecting `expiration` are mutually
3023 /// exclusive.
3024 ///
3025 /// # Example
3026 /// ```ignore,no_run
3027 /// # use google_chat_v1::model::CustomStatus;
3028 /// use wkt::Timestamp;
3029 /// let x = CustomStatus::new().set_expiration(Some(
3030 /// google_chat_v1::model::custom_status::Expiration::ExpireTime(Timestamp::default().into())));
3031 /// ```
3032 pub fn set_expiration<
3033 T: std::convert::Into<std::option::Option<crate::model::custom_status::Expiration>>,
3034 >(
3035 mut self,
3036 v: T,
3037 ) -> Self {
3038 self.expiration = v.into();
3039 self
3040 }
3041
3042 /// The value of [expiration][crate::model::CustomStatus::expiration]
3043 /// if it holds a `ExpireTime`, `None` if the field is not set or
3044 /// holds a different branch.
3045 pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
3046 #[allow(unreachable_patterns)]
3047 self.expiration.as_ref().and_then(|v| match v {
3048 crate::model::custom_status::Expiration::ExpireTime(v) => std::option::Option::Some(v),
3049 _ => std::option::Option::None,
3050 })
3051 }
3052
3053 /// Sets the value of [expiration][crate::model::CustomStatus::expiration]
3054 /// to hold a `ExpireTime`.
3055 ///
3056 /// Note that all the setters affecting `expiration` are
3057 /// mutually exclusive.
3058 ///
3059 /// # Example
3060 /// ```ignore,no_run
3061 /// # use google_chat_v1::model::CustomStatus;
3062 /// use wkt::Timestamp;
3063 /// let x = CustomStatus::new().set_expire_time(Timestamp::default()/* use setters */);
3064 /// assert!(x.expire_time().is_some());
3065 /// assert!(x.ttl().is_none());
3066 /// ```
3067 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
3068 mut self,
3069 v: T,
3070 ) -> Self {
3071 self.expiration = std::option::Option::Some(
3072 crate::model::custom_status::Expiration::ExpireTime(v.into()),
3073 );
3074 self
3075 }
3076
3077 /// The value of [expiration][crate::model::CustomStatus::expiration]
3078 /// if it holds a `Ttl`, `None` if the field is not set or
3079 /// holds a different branch.
3080 pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
3081 #[allow(unreachable_patterns)]
3082 self.expiration.as_ref().and_then(|v| match v {
3083 crate::model::custom_status::Expiration::Ttl(v) => std::option::Option::Some(v),
3084 _ => std::option::Option::None,
3085 })
3086 }
3087
3088 /// Sets the value of [expiration][crate::model::CustomStatus::expiration]
3089 /// to hold a `Ttl`.
3090 ///
3091 /// Note that all the setters affecting `expiration` are
3092 /// mutually exclusive.
3093 ///
3094 /// # Example
3095 /// ```ignore,no_run
3096 /// # use google_chat_v1::model::CustomStatus;
3097 /// use wkt::Duration;
3098 /// let x = CustomStatus::new().set_ttl(Duration::default()/* use setters */);
3099 /// assert!(x.ttl().is_some());
3100 /// assert!(x.expire_time().is_none());
3101 /// ```
3102 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
3103 self.expiration =
3104 std::option::Option::Some(crate::model::custom_status::Expiration::Ttl(v.into()));
3105 self
3106 }
3107}
3108
3109impl wkt::message::Message for CustomStatus {
3110 fn typename() -> &'static str {
3111 "type.googleapis.com/google.chat.v1.CustomStatus"
3112 }
3113}
3114
3115/// Defines additional types related to [CustomStatus].
3116pub mod custom_status {
3117 #[allow(unused_imports)]
3118 use super::*;
3119
3120 /// The expiration time of the custom status. It can be specified as either
3121 /// an absolute timestamp or a time-to-live duration.
3122 #[derive(Clone, Debug, PartialEq)]
3123 #[non_exhaustive]
3124 pub enum Expiration {
3125 /// The timestamp when the custom status expires.
3126 ExpireTime(std::boxed::Box<wkt::Timestamp>),
3127 /// Input only. The time-to-live duration after which the custom status
3128 /// expires.
3129 Ttl(std::boxed::Box<wkt::Duration>),
3130 }
3131}
3132
3133/// Metadata associated with the `DO_NOT_DISTURB` availability state,
3134/// specifying when the state is set to expire.
3135#[derive(Clone, Default, PartialEq)]
3136#[non_exhaustive]
3137pub struct DoNotDisturbMetadata {
3138 /// Output only. Timestamp until which the user should be marked as
3139 /// DO_NOT_DISTURB. This can be maximum of 1 year in the future.
3140 pub expiration_time: std::option::Option<wkt::Timestamp>,
3141
3142 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3143}
3144
3145impl DoNotDisturbMetadata {
3146 /// Creates a new default instance.
3147 pub fn new() -> Self {
3148 std::default::Default::default()
3149 }
3150
3151 /// Sets the value of [expiration_time][crate::model::DoNotDisturbMetadata::expiration_time].
3152 ///
3153 /// # Example
3154 /// ```ignore,no_run
3155 /// # use google_chat_v1::model::DoNotDisturbMetadata;
3156 /// use wkt::Timestamp;
3157 /// let x = DoNotDisturbMetadata::new().set_expiration_time(Timestamp::default()/* use setters */);
3158 /// ```
3159 pub fn set_expiration_time<T>(mut self, v: T) -> Self
3160 where
3161 T: std::convert::Into<wkt::Timestamp>,
3162 {
3163 self.expiration_time = std::option::Option::Some(v.into());
3164 self
3165 }
3166
3167 /// Sets or clears the value of [expiration_time][crate::model::DoNotDisturbMetadata::expiration_time].
3168 ///
3169 /// # Example
3170 /// ```ignore,no_run
3171 /// # use google_chat_v1::model::DoNotDisturbMetadata;
3172 /// use wkt::Timestamp;
3173 /// let x = DoNotDisturbMetadata::new().set_or_clear_expiration_time(Some(Timestamp::default()/* use setters */));
3174 /// let x = DoNotDisturbMetadata::new().set_or_clear_expiration_time(None::<Timestamp>);
3175 /// ```
3176 pub fn set_or_clear_expiration_time<T>(mut self, v: std::option::Option<T>) -> Self
3177 where
3178 T: std::convert::Into<wkt::Timestamp>,
3179 {
3180 self.expiration_time = v.map(|x| x.into());
3181 self
3182 }
3183}
3184
3185impl wkt::message::Message for DoNotDisturbMetadata {
3186 fn typename() -> &'static str {
3187 "type.googleapis.com/google.chat.v1.DoNotDisturbMetadata"
3188 }
3189}
3190
3191/// Request message for the `GetAvailability` method.
3192#[derive(Clone, Default, PartialEq)]
3193#[non_exhaustive]
3194pub struct GetAvailabilityRequest {
3195 /// Required. The resource name of the availability to retrieve.
3196 ///
3197 /// Format: users/{user}/availability
3198 ///
3199 /// `{user}` is the id for the Person in the People API or Admin SDK directory
3200 /// API. For example, `users/123456789`.
3201 ///
3202 /// The user's email address or `me` can also be used as an alias to refer to
3203 /// the caller. For example, `users/user@example.com` or `users/me`.
3204 pub name: std::string::String,
3205
3206 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3207}
3208
3209impl GetAvailabilityRequest {
3210 /// Creates a new default instance.
3211 pub fn new() -> Self {
3212 std::default::Default::default()
3213 }
3214
3215 /// Sets the value of [name][crate::model::GetAvailabilityRequest::name].
3216 ///
3217 /// # Example
3218 /// ```ignore,no_run
3219 /// # use google_chat_v1::model::GetAvailabilityRequest;
3220 /// # let user_id = "user_id";
3221 /// let x = GetAvailabilityRequest::new().set_name(format!("users/{user_id}/availability"));
3222 /// ```
3223 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3224 self.name = v.into();
3225 self
3226 }
3227}
3228
3229impl wkt::message::Message for GetAvailabilityRequest {
3230 fn typename() -> &'static str {
3231 "type.googleapis.com/google.chat.v1.GetAvailabilityRequest"
3232 }
3233}
3234
3235/// Request message for the `UpdateAvailability` method.
3236#[derive(Clone, Default, PartialEq)]
3237#[non_exhaustive]
3238pub struct UpdateAvailabilityRequest {
3239 /// Required. The availability to update.
3240 pub availability: std::option::Option<crate::model::Availability>,
3241
3242 /// Required. The list of fields to update.
3243 /// The only field that can be updated is `custom_status`.
3244 pub update_mask: std::option::Option<wkt::FieldMask>,
3245
3246 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3247}
3248
3249impl UpdateAvailabilityRequest {
3250 /// Creates a new default instance.
3251 pub fn new() -> Self {
3252 std::default::Default::default()
3253 }
3254
3255 /// Sets the value of [availability][crate::model::UpdateAvailabilityRequest::availability].
3256 ///
3257 /// # Example
3258 /// ```ignore,no_run
3259 /// # use google_chat_v1::model::UpdateAvailabilityRequest;
3260 /// use google_chat_v1::model::Availability;
3261 /// let x = UpdateAvailabilityRequest::new().set_availability(Availability::default()/* use setters */);
3262 /// ```
3263 pub fn set_availability<T>(mut self, v: T) -> Self
3264 where
3265 T: std::convert::Into<crate::model::Availability>,
3266 {
3267 self.availability = std::option::Option::Some(v.into());
3268 self
3269 }
3270
3271 /// Sets or clears the value of [availability][crate::model::UpdateAvailabilityRequest::availability].
3272 ///
3273 /// # Example
3274 /// ```ignore,no_run
3275 /// # use google_chat_v1::model::UpdateAvailabilityRequest;
3276 /// use google_chat_v1::model::Availability;
3277 /// let x = UpdateAvailabilityRequest::new().set_or_clear_availability(Some(Availability::default()/* use setters */));
3278 /// let x = UpdateAvailabilityRequest::new().set_or_clear_availability(None::<Availability>);
3279 /// ```
3280 pub fn set_or_clear_availability<T>(mut self, v: std::option::Option<T>) -> Self
3281 where
3282 T: std::convert::Into<crate::model::Availability>,
3283 {
3284 self.availability = v.map(|x| x.into());
3285 self
3286 }
3287
3288 /// Sets the value of [update_mask][crate::model::UpdateAvailabilityRequest::update_mask].
3289 ///
3290 /// # Example
3291 /// ```ignore,no_run
3292 /// # use google_chat_v1::model::UpdateAvailabilityRequest;
3293 /// use wkt::FieldMask;
3294 /// let x = UpdateAvailabilityRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3295 /// ```
3296 pub fn set_update_mask<T>(mut self, v: T) -> Self
3297 where
3298 T: std::convert::Into<wkt::FieldMask>,
3299 {
3300 self.update_mask = std::option::Option::Some(v.into());
3301 self
3302 }
3303
3304 /// Sets or clears the value of [update_mask][crate::model::UpdateAvailabilityRequest::update_mask].
3305 ///
3306 /// # Example
3307 /// ```ignore,no_run
3308 /// # use google_chat_v1::model::UpdateAvailabilityRequest;
3309 /// use wkt::FieldMask;
3310 /// let x = UpdateAvailabilityRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3311 /// let x = UpdateAvailabilityRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3312 /// ```
3313 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3314 where
3315 T: std::convert::Into<wkt::FieldMask>,
3316 {
3317 self.update_mask = v.map(|x| x.into());
3318 self
3319 }
3320}
3321
3322impl wkt::message::Message for UpdateAvailabilityRequest {
3323 fn typename() -> &'static str {
3324 "type.googleapis.com/google.chat.v1.UpdateAvailabilityRequest"
3325 }
3326}
3327
3328/// Request message for the `MarkAsActive` method.
3329#[derive(Clone, Default, PartialEq)]
3330#[non_exhaustive]
3331pub struct MarkAsActiveRequest {
3332 /// Required. The resource name of the availability to mark as active.
3333 /// Format: users/{user}/availability
3334 ///
3335 /// `{user}` is the id for the Person in the People API or Admin SDK directory
3336 /// API. For example, `users/123456789`.
3337 ///
3338 /// The user's email address or `me` can also be used as an alias to refer to
3339 /// the caller. For example, `users/user@example.com` or `users/me`.
3340 pub name: std::string::String,
3341
3342 /// The expiration for the ACTIVE availability state. The user will
3343 /// be marked as Away after expiration. If no expiration is provided, the
3344 /// ACTIVE state will expire 30 minutes from the current time.
3345 pub expiration: std::option::Option<crate::model::mark_as_active_request::Expiration>,
3346
3347 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3348}
3349
3350impl MarkAsActiveRequest {
3351 /// Creates a new default instance.
3352 pub fn new() -> Self {
3353 std::default::Default::default()
3354 }
3355
3356 /// Sets the value of [name][crate::model::MarkAsActiveRequest::name].
3357 ///
3358 /// # Example
3359 /// ```ignore,no_run
3360 /// # use google_chat_v1::model::MarkAsActiveRequest;
3361 /// # let user_id = "user_id";
3362 /// let x = MarkAsActiveRequest::new().set_name(format!("users/{user_id}/availability"));
3363 /// ```
3364 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3365 self.name = v.into();
3366 self
3367 }
3368
3369 /// Sets the value of [expiration][crate::model::MarkAsActiveRequest::expiration].
3370 ///
3371 /// Note that all the setters affecting `expiration` are mutually
3372 /// exclusive.
3373 ///
3374 /// # Example
3375 /// ```ignore,no_run
3376 /// # use google_chat_v1::model::MarkAsActiveRequest;
3377 /// use wkt::Timestamp;
3378 /// let x = MarkAsActiveRequest::new().set_expiration(Some(
3379 /// google_chat_v1::model::mark_as_active_request::Expiration::ExpireTime(Timestamp::default().into())));
3380 /// ```
3381 pub fn set_expiration<
3382 T: std::convert::Into<std::option::Option<crate::model::mark_as_active_request::Expiration>>,
3383 >(
3384 mut self,
3385 v: T,
3386 ) -> Self {
3387 self.expiration = v.into();
3388 self
3389 }
3390
3391 /// The value of [expiration][crate::model::MarkAsActiveRequest::expiration]
3392 /// if it holds a `ExpireTime`, `None` if the field is not set or
3393 /// holds a different branch.
3394 pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
3395 #[allow(unreachable_patterns)]
3396 self.expiration.as_ref().and_then(|v| match v {
3397 crate::model::mark_as_active_request::Expiration::ExpireTime(v) => {
3398 std::option::Option::Some(v)
3399 }
3400 _ => std::option::Option::None,
3401 })
3402 }
3403
3404 /// Sets the value of [expiration][crate::model::MarkAsActiveRequest::expiration]
3405 /// to hold a `ExpireTime`.
3406 ///
3407 /// Note that all the setters affecting `expiration` are
3408 /// mutually exclusive.
3409 ///
3410 /// # Example
3411 /// ```ignore,no_run
3412 /// # use google_chat_v1::model::MarkAsActiveRequest;
3413 /// use wkt::Timestamp;
3414 /// let x = MarkAsActiveRequest::new().set_expire_time(Timestamp::default()/* use setters */);
3415 /// assert!(x.expire_time().is_some());
3416 /// assert!(x.ttl().is_none());
3417 /// ```
3418 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
3419 mut self,
3420 v: T,
3421 ) -> Self {
3422 self.expiration = std::option::Option::Some(
3423 crate::model::mark_as_active_request::Expiration::ExpireTime(v.into()),
3424 );
3425 self
3426 }
3427
3428 /// The value of [expiration][crate::model::MarkAsActiveRequest::expiration]
3429 /// if it holds a `Ttl`, `None` if the field is not set or
3430 /// holds a different branch.
3431 pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
3432 #[allow(unreachable_patterns)]
3433 self.expiration.as_ref().and_then(|v| match v {
3434 crate::model::mark_as_active_request::Expiration::Ttl(v) => {
3435 std::option::Option::Some(v)
3436 }
3437 _ => std::option::Option::None,
3438 })
3439 }
3440
3441 /// Sets the value of [expiration][crate::model::MarkAsActiveRequest::expiration]
3442 /// to hold a `Ttl`.
3443 ///
3444 /// Note that all the setters affecting `expiration` are
3445 /// mutually exclusive.
3446 ///
3447 /// # Example
3448 /// ```ignore,no_run
3449 /// # use google_chat_v1::model::MarkAsActiveRequest;
3450 /// use wkt::Duration;
3451 /// let x = MarkAsActiveRequest::new().set_ttl(Duration::default()/* use setters */);
3452 /// assert!(x.ttl().is_some());
3453 /// assert!(x.expire_time().is_none());
3454 /// ```
3455 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
3456 self.expiration = std::option::Option::Some(
3457 crate::model::mark_as_active_request::Expiration::Ttl(v.into()),
3458 );
3459 self
3460 }
3461}
3462
3463impl wkt::message::Message for MarkAsActiveRequest {
3464 fn typename() -> &'static str {
3465 "type.googleapis.com/google.chat.v1.MarkAsActiveRequest"
3466 }
3467}
3468
3469/// Defines additional types related to [MarkAsActiveRequest].
3470pub mod mark_as_active_request {
3471 #[allow(unused_imports)]
3472 use super::*;
3473
3474 /// The expiration for the ACTIVE availability state. The user will
3475 /// be marked as Away after expiration. If no expiration is provided, the
3476 /// ACTIVE state will expire 30 minutes from the current time.
3477 #[derive(Clone, Debug, PartialEq)]
3478 #[non_exhaustive]
3479 pub enum Expiration {
3480 /// The absolute timestamp when the ACTIVE state expires.
3481 ExpireTime(std::boxed::Box<wkt::Timestamp>),
3482 /// The duration from the current time until the ACTIVE state expires.
3483 /// Using a short TTL can effectively reset the user's state to be based
3484 /// on activity after this brief duration.
3485 Ttl(std::boxed::Box<wkt::Duration>),
3486 }
3487}
3488
3489/// Request message for the `MarkAsAway` method.
3490#[derive(Clone, Default, PartialEq)]
3491#[non_exhaustive]
3492pub struct MarkAsAwayRequest {
3493 /// Required. The resource name of the availability to mark as away.
3494 /// Format: users/{user}/availability
3495 ///
3496 /// `{user}` is the id for the Person in the People API or Admin SDK directory
3497 /// API. For example, `users/123456789`.
3498 ///
3499 /// The user's email address or `me` can also be used as an alias to refer to
3500 /// the caller. For example, `users/user@example.com` or `users/me`.
3501 pub name: std::string::String,
3502
3503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3504}
3505
3506impl MarkAsAwayRequest {
3507 /// Creates a new default instance.
3508 pub fn new() -> Self {
3509 std::default::Default::default()
3510 }
3511
3512 /// Sets the value of [name][crate::model::MarkAsAwayRequest::name].
3513 ///
3514 /// # Example
3515 /// ```ignore,no_run
3516 /// # use google_chat_v1::model::MarkAsAwayRequest;
3517 /// # let user_id = "user_id";
3518 /// let x = MarkAsAwayRequest::new().set_name(format!("users/{user_id}/availability"));
3519 /// ```
3520 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3521 self.name = v.into();
3522 self
3523 }
3524}
3525
3526impl wkt::message::Message for MarkAsAwayRequest {
3527 fn typename() -> &'static str {
3528 "type.googleapis.com/google.chat.v1.MarkAsAwayRequest"
3529 }
3530}
3531
3532/// Request message for the `MarkAsDoNotDisturb` method.
3533#[derive(Clone, Default, PartialEq)]
3534#[non_exhaustive]
3535pub struct MarkAsDoNotDisturbRequest {
3536 /// Required. The resource name of the availability to mark as Do Not Disturb.
3537 /// Format: users/{user}/availability
3538 ///
3539 /// `{user}` is the id for the Person in the People API or Admin SDK directory
3540 /// API. For example, `users/123456789`.
3541 ///
3542 /// The user's email address or `me` can also be used as an alias to refer to
3543 /// the caller. For example, `users/user@example.com` or `users/me`.
3544 pub name: std::string::String,
3545
3546 /// Required. The expiration for the DND availability state. The user will be
3547 /// marked as Away after expiration. This can be at most 1 year from the
3548 /// current time.
3549 pub expiration: std::option::Option<crate::model::mark_as_do_not_disturb_request::Expiration>,
3550
3551 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3552}
3553
3554impl MarkAsDoNotDisturbRequest {
3555 /// Creates a new default instance.
3556 pub fn new() -> Self {
3557 std::default::Default::default()
3558 }
3559
3560 /// Sets the value of [name][crate::model::MarkAsDoNotDisturbRequest::name].
3561 ///
3562 /// # Example
3563 /// ```ignore,no_run
3564 /// # use google_chat_v1::model::MarkAsDoNotDisturbRequest;
3565 /// # let user_id = "user_id";
3566 /// let x = MarkAsDoNotDisturbRequest::new().set_name(format!("users/{user_id}/availability"));
3567 /// ```
3568 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3569 self.name = v.into();
3570 self
3571 }
3572
3573 /// Sets the value of [expiration][crate::model::MarkAsDoNotDisturbRequest::expiration].
3574 ///
3575 /// Note that all the setters affecting `expiration` are mutually
3576 /// exclusive.
3577 ///
3578 /// # Example
3579 /// ```ignore,no_run
3580 /// # use google_chat_v1::model::MarkAsDoNotDisturbRequest;
3581 /// use wkt::Timestamp;
3582 /// let x = MarkAsDoNotDisturbRequest::new().set_expiration(Some(
3583 /// google_chat_v1::model::mark_as_do_not_disturb_request::Expiration::ExpireTime(Timestamp::default().into())));
3584 /// ```
3585 pub fn set_expiration<
3586 T: std::convert::Into<
3587 std::option::Option<crate::model::mark_as_do_not_disturb_request::Expiration>,
3588 >,
3589 >(
3590 mut self,
3591 v: T,
3592 ) -> Self {
3593 self.expiration = v.into();
3594 self
3595 }
3596
3597 /// The value of [expiration][crate::model::MarkAsDoNotDisturbRequest::expiration]
3598 /// if it holds a `ExpireTime`, `None` if the field is not set or
3599 /// holds a different branch.
3600 pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
3601 #[allow(unreachable_patterns)]
3602 self.expiration.as_ref().and_then(|v| match v {
3603 crate::model::mark_as_do_not_disturb_request::Expiration::ExpireTime(v) => {
3604 std::option::Option::Some(v)
3605 }
3606 _ => std::option::Option::None,
3607 })
3608 }
3609
3610 /// Sets the value of [expiration][crate::model::MarkAsDoNotDisturbRequest::expiration]
3611 /// to hold a `ExpireTime`.
3612 ///
3613 /// Note that all the setters affecting `expiration` are
3614 /// mutually exclusive.
3615 ///
3616 /// # Example
3617 /// ```ignore,no_run
3618 /// # use google_chat_v1::model::MarkAsDoNotDisturbRequest;
3619 /// use wkt::Timestamp;
3620 /// let x = MarkAsDoNotDisturbRequest::new().set_expire_time(Timestamp::default()/* use setters */);
3621 /// assert!(x.expire_time().is_some());
3622 /// assert!(x.ttl().is_none());
3623 /// ```
3624 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
3625 mut self,
3626 v: T,
3627 ) -> Self {
3628 self.expiration = std::option::Option::Some(
3629 crate::model::mark_as_do_not_disturb_request::Expiration::ExpireTime(v.into()),
3630 );
3631 self
3632 }
3633
3634 /// The value of [expiration][crate::model::MarkAsDoNotDisturbRequest::expiration]
3635 /// if it holds a `Ttl`, `None` if the field is not set or
3636 /// holds a different branch.
3637 pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
3638 #[allow(unreachable_patterns)]
3639 self.expiration.as_ref().and_then(|v| match v {
3640 crate::model::mark_as_do_not_disturb_request::Expiration::Ttl(v) => {
3641 std::option::Option::Some(v)
3642 }
3643 _ => std::option::Option::None,
3644 })
3645 }
3646
3647 /// Sets the value of [expiration][crate::model::MarkAsDoNotDisturbRequest::expiration]
3648 /// to hold a `Ttl`.
3649 ///
3650 /// Note that all the setters affecting `expiration` are
3651 /// mutually exclusive.
3652 ///
3653 /// # Example
3654 /// ```ignore,no_run
3655 /// # use google_chat_v1::model::MarkAsDoNotDisturbRequest;
3656 /// use wkt::Duration;
3657 /// let x = MarkAsDoNotDisturbRequest::new().set_ttl(Duration::default()/* use setters */);
3658 /// assert!(x.ttl().is_some());
3659 /// assert!(x.expire_time().is_none());
3660 /// ```
3661 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
3662 self.expiration = std::option::Option::Some(
3663 crate::model::mark_as_do_not_disturb_request::Expiration::Ttl(v.into()),
3664 );
3665 self
3666 }
3667}
3668
3669impl wkt::message::Message for MarkAsDoNotDisturbRequest {
3670 fn typename() -> &'static str {
3671 "type.googleapis.com/google.chat.v1.MarkAsDoNotDisturbRequest"
3672 }
3673}
3674
3675/// Defines additional types related to [MarkAsDoNotDisturbRequest].
3676pub mod mark_as_do_not_disturb_request {
3677 #[allow(unused_imports)]
3678 use super::*;
3679
3680 /// Required. The expiration for the DND availability state. The user will be
3681 /// marked as Away after expiration. This can be at most 1 year from the
3682 /// current time.
3683 #[derive(Clone, Debug, PartialEq)]
3684 #[non_exhaustive]
3685 pub enum Expiration {
3686 /// The absolute timestamp when the DND state expires.
3687 ExpireTime(std::boxed::Box<wkt::Timestamp>),
3688 /// The duration from the current time until the DND state expires.
3689 Ttl(std::boxed::Box<wkt::Duration>),
3690 }
3691}
3692
3693/// The markup for developers to specify the contents of a contextual AddOn.
3694#[derive(Clone, Default, PartialEq)]
3695#[non_exhaustive]
3696pub struct ContextualAddOnMarkup {
3697 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3698}
3699
3700impl ContextualAddOnMarkup {
3701 /// Creates a new default instance.
3702 pub fn new() -> Self {
3703 std::default::Default::default()
3704 }
3705}
3706
3707impl wkt::message::Message for ContextualAddOnMarkup {
3708 fn typename() -> &'static str {
3709 "type.googleapis.com/google.chat.v1.ContextualAddOnMarkup"
3710 }
3711}
3712
3713/// Defines additional types related to [ContextualAddOnMarkup].
3714pub mod contextual_add_on_markup {
3715 #[allow(unused_imports)]
3716 use super::*;
3717
3718 /// A card is a UI element that can contain UI widgets such as text and
3719 /// images.
3720 #[derive(Clone, Default, PartialEq)]
3721 #[non_exhaustive]
3722 pub struct Card {
3723 /// The header of the card. A header usually contains a title and an image.
3724 pub header: std::option::Option<crate::model::contextual_add_on_markup::card::CardHeader>,
3725
3726 /// Sections are separated by a line divider.
3727 pub sections: std::vec::Vec<crate::model::contextual_add_on_markup::card::Section>,
3728
3729 /// The actions of this card.
3730 pub card_actions: std::vec::Vec<crate::model::contextual_add_on_markup::card::CardAction>,
3731
3732 /// Name of the card.
3733 pub name: std::string::String,
3734
3735 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3736 }
3737
3738 impl Card {
3739 /// Creates a new default instance.
3740 pub fn new() -> Self {
3741 std::default::Default::default()
3742 }
3743
3744 /// Sets the value of [header][crate::model::contextual_add_on_markup::Card::header].
3745 ///
3746 /// # Example
3747 /// ```ignore,no_run
3748 /// # use google_chat_v1::model::contextual_add_on_markup::Card;
3749 /// use google_chat_v1::model::contextual_add_on_markup::card::CardHeader;
3750 /// let x = Card::new().set_header(CardHeader::default()/* use setters */);
3751 /// ```
3752 pub fn set_header<T>(mut self, v: T) -> Self
3753 where
3754 T: std::convert::Into<crate::model::contextual_add_on_markup::card::CardHeader>,
3755 {
3756 self.header = std::option::Option::Some(v.into());
3757 self
3758 }
3759
3760 /// Sets or clears the value of [header][crate::model::contextual_add_on_markup::Card::header].
3761 ///
3762 /// # Example
3763 /// ```ignore,no_run
3764 /// # use google_chat_v1::model::contextual_add_on_markup::Card;
3765 /// use google_chat_v1::model::contextual_add_on_markup::card::CardHeader;
3766 /// let x = Card::new().set_or_clear_header(Some(CardHeader::default()/* use setters */));
3767 /// let x = Card::new().set_or_clear_header(None::<CardHeader>);
3768 /// ```
3769 pub fn set_or_clear_header<T>(mut self, v: std::option::Option<T>) -> Self
3770 where
3771 T: std::convert::Into<crate::model::contextual_add_on_markup::card::CardHeader>,
3772 {
3773 self.header = v.map(|x| x.into());
3774 self
3775 }
3776
3777 /// Sets the value of [sections][crate::model::contextual_add_on_markup::Card::sections].
3778 ///
3779 /// # Example
3780 /// ```ignore,no_run
3781 /// # use google_chat_v1::model::contextual_add_on_markup::Card;
3782 /// use google_chat_v1::model::contextual_add_on_markup::card::Section;
3783 /// let x = Card::new()
3784 /// .set_sections([
3785 /// Section::default()/* use setters */,
3786 /// Section::default()/* use (different) setters */,
3787 /// ]);
3788 /// ```
3789 pub fn set_sections<T, V>(mut self, v: T) -> Self
3790 where
3791 T: std::iter::IntoIterator<Item = V>,
3792 V: std::convert::Into<crate::model::contextual_add_on_markup::card::Section>,
3793 {
3794 use std::iter::Iterator;
3795 self.sections = v.into_iter().map(|i| i.into()).collect();
3796 self
3797 }
3798
3799 /// Sets the value of [card_actions][crate::model::contextual_add_on_markup::Card::card_actions].
3800 ///
3801 /// # Example
3802 /// ```ignore,no_run
3803 /// # use google_chat_v1::model::contextual_add_on_markup::Card;
3804 /// use google_chat_v1::model::contextual_add_on_markup::card::CardAction;
3805 /// let x = Card::new()
3806 /// .set_card_actions([
3807 /// CardAction::default()/* use setters */,
3808 /// CardAction::default()/* use (different) setters */,
3809 /// ]);
3810 /// ```
3811 pub fn set_card_actions<T, V>(mut self, v: T) -> Self
3812 where
3813 T: std::iter::IntoIterator<Item = V>,
3814 V: std::convert::Into<crate::model::contextual_add_on_markup::card::CardAction>,
3815 {
3816 use std::iter::Iterator;
3817 self.card_actions = v.into_iter().map(|i| i.into()).collect();
3818 self
3819 }
3820
3821 /// Sets the value of [name][crate::model::contextual_add_on_markup::Card::name].
3822 ///
3823 /// # Example
3824 /// ```ignore,no_run
3825 /// # use google_chat_v1::model::contextual_add_on_markup::Card;
3826 /// let x = Card::new().set_name("example");
3827 /// ```
3828 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3829 self.name = v.into();
3830 self
3831 }
3832 }
3833
3834 impl wkt::message::Message for Card {
3835 fn typename() -> &'static str {
3836 "type.googleapis.com/google.chat.v1.ContextualAddOnMarkup.Card"
3837 }
3838 }
3839
3840 /// Defines additional types related to [Card].
3841 pub mod card {
3842 #[allow(unused_imports)]
3843 use super::*;
3844
3845 #[allow(missing_docs)]
3846 #[derive(Clone, Default, PartialEq)]
3847 #[non_exhaustive]
3848 pub struct CardHeader {
3849 /// The title must be specified. The header has a fixed height: if both a
3850 /// title and subtitle is specified, each takes up one line. If only the
3851 /// title is specified, it takes up both lines.
3852 pub title: std::string::String,
3853
3854 /// The subtitle of the card header.
3855 pub subtitle: std::string::String,
3856
3857 /// The image's type (for example, square border or circular border).
3858 pub image_style: crate::model::contextual_add_on_markup::card::card_header::ImageStyle,
3859
3860 /// The URL of the image in the card header.
3861 pub image_url: std::string::String,
3862
3863 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3864 }
3865
3866 impl CardHeader {
3867 /// Creates a new default instance.
3868 pub fn new() -> Self {
3869 std::default::Default::default()
3870 }
3871
3872 /// Sets the value of [title][crate::model::contextual_add_on_markup::card::CardHeader::title].
3873 ///
3874 /// # Example
3875 /// ```ignore,no_run
3876 /// # use google_chat_v1::model::contextual_add_on_markup::card::CardHeader;
3877 /// let x = CardHeader::new().set_title("example");
3878 /// ```
3879 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3880 self.title = v.into();
3881 self
3882 }
3883
3884 /// Sets the value of [subtitle][crate::model::contextual_add_on_markup::card::CardHeader::subtitle].
3885 ///
3886 /// # Example
3887 /// ```ignore,no_run
3888 /// # use google_chat_v1::model::contextual_add_on_markup::card::CardHeader;
3889 /// let x = CardHeader::new().set_subtitle("example");
3890 /// ```
3891 pub fn set_subtitle<T: std::convert::Into<std::string::String>>(
3892 mut self,
3893 v: T,
3894 ) -> Self {
3895 self.subtitle = v.into();
3896 self
3897 }
3898
3899 /// Sets the value of [image_style][crate::model::contextual_add_on_markup::card::CardHeader::image_style].
3900 ///
3901 /// # Example
3902 /// ```ignore,no_run
3903 /// # use google_chat_v1::model::contextual_add_on_markup::card::CardHeader;
3904 /// use google_chat_v1::model::contextual_add_on_markup::card::card_header::ImageStyle;
3905 /// let x0 = CardHeader::new().set_image_style(ImageStyle::Image);
3906 /// let x1 = CardHeader::new().set_image_style(ImageStyle::Avatar);
3907 /// ```
3908 pub fn set_image_style<
3909 T: std::convert::Into<
3910 crate::model::contextual_add_on_markup::card::card_header::ImageStyle,
3911 >,
3912 >(
3913 mut self,
3914 v: T,
3915 ) -> Self {
3916 self.image_style = v.into();
3917 self
3918 }
3919
3920 /// Sets the value of [image_url][crate::model::contextual_add_on_markup::card::CardHeader::image_url].
3921 ///
3922 /// # Example
3923 /// ```ignore,no_run
3924 /// # use google_chat_v1::model::contextual_add_on_markup::card::CardHeader;
3925 /// let x = CardHeader::new().set_image_url("example");
3926 /// ```
3927 pub fn set_image_url<T: std::convert::Into<std::string::String>>(
3928 mut self,
3929 v: T,
3930 ) -> Self {
3931 self.image_url = v.into();
3932 self
3933 }
3934 }
3935
3936 impl wkt::message::Message for CardHeader {
3937 fn typename() -> &'static str {
3938 "type.googleapis.com/google.chat.v1.ContextualAddOnMarkup.Card.CardHeader"
3939 }
3940 }
3941
3942 /// Defines additional types related to [CardHeader].
3943 pub mod card_header {
3944 #[allow(unused_imports)]
3945 use super::*;
3946
3947 /// Enum for [ImageStyle].
3948 ///
3949 /// # Working with unknown values
3950 ///
3951 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3952 /// additional enum variants at any time. Adding new variants is not considered
3953 /// a breaking change. Applications should write their code in anticipation of:
3954 ///
3955 /// - New values appearing in future releases of the client library, **and**
3956 /// - New values received dynamically, without application changes.
3957 ///
3958 /// Please consult the [Working with enums] section in the user guide for some
3959 /// guidelines.
3960 ///
3961 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3962 #[derive(Clone, Debug, PartialEq)]
3963 #[non_exhaustive]
3964 pub enum ImageStyle {
3965 #[allow(missing_docs)]
3966 Unspecified,
3967 /// Square border.
3968 Image,
3969 /// Circular border.
3970 Avatar,
3971 /// If set, the enum was initialized with an unknown value.
3972 ///
3973 /// Applications can examine the value using [ImageStyle::value] or
3974 /// [ImageStyle::name].
3975 UnknownValue(image_style::UnknownValue),
3976 }
3977
3978 #[doc(hidden)]
3979 pub mod image_style {
3980 #[allow(unused_imports)]
3981 use super::*;
3982 #[derive(Clone, Debug, PartialEq)]
3983 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3984 }
3985
3986 impl ImageStyle {
3987 /// Gets the enum value.
3988 ///
3989 /// Returns `None` if the enum contains an unknown value deserialized from
3990 /// the string representation of enums.
3991 pub fn value(&self) -> std::option::Option<i32> {
3992 match self {
3993 Self::Unspecified => std::option::Option::Some(0),
3994 Self::Image => std::option::Option::Some(1),
3995 Self::Avatar => std::option::Option::Some(2),
3996 Self::UnknownValue(u) => u.0.value(),
3997 }
3998 }
3999
4000 /// Gets the enum value as a string.
4001 ///
4002 /// Returns `None` if the enum contains an unknown value deserialized from
4003 /// the integer representation of enums.
4004 pub fn name(&self) -> std::option::Option<&str> {
4005 match self {
4006 Self::Unspecified => std::option::Option::Some("IMAGE_STYLE_UNSPECIFIED"),
4007 Self::Image => std::option::Option::Some("IMAGE"),
4008 Self::Avatar => std::option::Option::Some("AVATAR"),
4009 Self::UnknownValue(u) => u.0.name(),
4010 }
4011 }
4012 }
4013
4014 impl std::default::Default for ImageStyle {
4015 fn default() -> Self {
4016 use std::convert::From;
4017 Self::from(0)
4018 }
4019 }
4020
4021 impl std::fmt::Display for ImageStyle {
4022 fn fmt(
4023 &self,
4024 f: &mut std::fmt::Formatter<'_>,
4025 ) -> std::result::Result<(), std::fmt::Error> {
4026 wkt::internal::display_enum(f, self.name(), self.value())
4027 }
4028 }
4029
4030 impl std::convert::From<i32> for ImageStyle {
4031 fn from(value: i32) -> Self {
4032 match value {
4033 0 => Self::Unspecified,
4034 1 => Self::Image,
4035 2 => Self::Avatar,
4036 _ => Self::UnknownValue(image_style::UnknownValue(
4037 wkt::internal::UnknownEnumValue::Integer(value),
4038 )),
4039 }
4040 }
4041 }
4042
4043 impl std::convert::From<&str> for ImageStyle {
4044 fn from(value: &str) -> Self {
4045 use std::string::ToString;
4046 match value {
4047 "IMAGE_STYLE_UNSPECIFIED" => Self::Unspecified,
4048 "IMAGE" => Self::Image,
4049 "AVATAR" => Self::Avatar,
4050 _ => Self::UnknownValue(image_style::UnknownValue(
4051 wkt::internal::UnknownEnumValue::String(value.to_string()),
4052 )),
4053 }
4054 }
4055 }
4056
4057 impl serde::ser::Serialize for ImageStyle {
4058 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4059 where
4060 S: serde::Serializer,
4061 {
4062 match self {
4063 Self::Unspecified => serializer.serialize_i32(0),
4064 Self::Image => serializer.serialize_i32(1),
4065 Self::Avatar => serializer.serialize_i32(2),
4066 Self::UnknownValue(u) => u.0.serialize(serializer),
4067 }
4068 }
4069 }
4070
4071 impl<'de> serde::de::Deserialize<'de> for ImageStyle {
4072 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4073 where
4074 D: serde::Deserializer<'de>,
4075 {
4076 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImageStyle>::new(
4077 ".google.chat.v1.ContextualAddOnMarkup.Card.CardHeader.ImageStyle",
4078 ))
4079 }
4080 }
4081 }
4082
4083 /// A section contains a collection of widgets that are rendered
4084 /// (vertically) in the order that they are specified. Across all platforms,
4085 /// cards have a narrow fixed width, so
4086 /// there's currently no need for layout properties (for example, float).
4087 #[derive(Clone, Default, PartialEq)]
4088 #[non_exhaustive]
4089 pub struct Section {
4090 /// The header of the section. Formatted text is
4091 /// supported. For more information
4092 /// about formatting text, see
4093 /// [Formatting text in Google Chat
4094 /// apps](https://developers.google.com/workspace/chat/format-messages#card-formatting)
4095 /// and
4096 /// [Formatting
4097 /// text in Google Workspace
4098 /// Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting).
4099 pub header: std::string::String,
4100
4101 /// A section must contain at least one widget.
4102 pub widgets: std::vec::Vec<crate::model::WidgetMarkup>,
4103
4104 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4105 }
4106
4107 impl Section {
4108 /// Creates a new default instance.
4109 pub fn new() -> Self {
4110 std::default::Default::default()
4111 }
4112
4113 /// Sets the value of [header][crate::model::contextual_add_on_markup::card::Section::header].
4114 ///
4115 /// # Example
4116 /// ```ignore,no_run
4117 /// # use google_chat_v1::model::contextual_add_on_markup::card::Section;
4118 /// let x = Section::new().set_header("example");
4119 /// ```
4120 pub fn set_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4121 self.header = v.into();
4122 self
4123 }
4124
4125 /// Sets the value of [widgets][crate::model::contextual_add_on_markup::card::Section::widgets].
4126 ///
4127 /// # Example
4128 /// ```ignore,no_run
4129 /// # use google_chat_v1::model::contextual_add_on_markup::card::Section;
4130 /// use google_chat_v1::model::WidgetMarkup;
4131 /// let x = Section::new()
4132 /// .set_widgets([
4133 /// WidgetMarkup::default()/* use setters */,
4134 /// WidgetMarkup::default()/* use (different) setters */,
4135 /// ]);
4136 /// ```
4137 pub fn set_widgets<T, V>(mut self, v: T) -> Self
4138 where
4139 T: std::iter::IntoIterator<Item = V>,
4140 V: std::convert::Into<crate::model::WidgetMarkup>,
4141 {
4142 use std::iter::Iterator;
4143 self.widgets = v.into_iter().map(|i| i.into()).collect();
4144 self
4145 }
4146 }
4147
4148 impl wkt::message::Message for Section {
4149 fn typename() -> &'static str {
4150 "type.googleapis.com/google.chat.v1.ContextualAddOnMarkup.Card.Section"
4151 }
4152 }
4153
4154 /// A card action is
4155 /// the action associated with the card. For an invoice card, a
4156 /// typical action would be: delete invoice, email invoice or open the
4157 /// invoice in browser.
4158 ///
4159 /// Not supported by Google Chat apps.
4160 #[derive(Clone, Default, PartialEq)]
4161 #[non_exhaustive]
4162 pub struct CardAction {
4163 /// The label used to be displayed in the action menu item.
4164 pub action_label: std::string::String,
4165
4166 /// The onclick action for this action item.
4167 pub on_click: std::option::Option<crate::model::widget_markup::OnClick>,
4168
4169 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4170 }
4171
4172 impl CardAction {
4173 /// Creates a new default instance.
4174 pub fn new() -> Self {
4175 std::default::Default::default()
4176 }
4177
4178 /// Sets the value of [action_label][crate::model::contextual_add_on_markup::card::CardAction::action_label].
4179 ///
4180 /// # Example
4181 /// ```ignore,no_run
4182 /// # use google_chat_v1::model::contextual_add_on_markup::card::CardAction;
4183 /// let x = CardAction::new().set_action_label("example");
4184 /// ```
4185 pub fn set_action_label<T: std::convert::Into<std::string::String>>(
4186 mut self,
4187 v: T,
4188 ) -> Self {
4189 self.action_label = v.into();
4190 self
4191 }
4192
4193 /// Sets the value of [on_click][crate::model::contextual_add_on_markup::card::CardAction::on_click].
4194 ///
4195 /// # Example
4196 /// ```ignore,no_run
4197 /// # use google_chat_v1::model::contextual_add_on_markup::card::CardAction;
4198 /// use google_chat_v1::model::widget_markup::OnClick;
4199 /// let x = CardAction::new().set_on_click(OnClick::default()/* use setters */);
4200 /// ```
4201 pub fn set_on_click<T>(mut self, v: T) -> Self
4202 where
4203 T: std::convert::Into<crate::model::widget_markup::OnClick>,
4204 {
4205 self.on_click = std::option::Option::Some(v.into());
4206 self
4207 }
4208
4209 /// Sets or clears the value of [on_click][crate::model::contextual_add_on_markup::card::CardAction::on_click].
4210 ///
4211 /// # Example
4212 /// ```ignore,no_run
4213 /// # use google_chat_v1::model::contextual_add_on_markup::card::CardAction;
4214 /// use google_chat_v1::model::widget_markup::OnClick;
4215 /// let x = CardAction::new().set_or_clear_on_click(Some(OnClick::default()/* use setters */));
4216 /// let x = CardAction::new().set_or_clear_on_click(None::<OnClick>);
4217 /// ```
4218 pub fn set_or_clear_on_click<T>(mut self, v: std::option::Option<T>) -> Self
4219 where
4220 T: std::convert::Into<crate::model::widget_markup::OnClick>,
4221 {
4222 self.on_click = v.map(|x| x.into());
4223 self
4224 }
4225 }
4226
4227 impl wkt::message::Message for CardAction {
4228 fn typename() -> &'static str {
4229 "type.googleapis.com/google.chat.v1.ContextualAddOnMarkup.Card.CardAction"
4230 }
4231 }
4232 }
4233}
4234
4235/// Information about a deleted message. A message is deleted when `delete_time`
4236/// is set.
4237#[derive(Clone, Default, PartialEq)]
4238#[non_exhaustive]
4239pub struct DeletionMetadata {
4240 /// Indicates who deleted the message.
4241 pub deletion_type: crate::model::deletion_metadata::DeletionType,
4242
4243 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4244}
4245
4246impl DeletionMetadata {
4247 /// Creates a new default instance.
4248 pub fn new() -> Self {
4249 std::default::Default::default()
4250 }
4251
4252 /// Sets the value of [deletion_type][crate::model::DeletionMetadata::deletion_type].
4253 ///
4254 /// # Example
4255 /// ```ignore,no_run
4256 /// # use google_chat_v1::model::DeletionMetadata;
4257 /// use google_chat_v1::model::deletion_metadata::DeletionType;
4258 /// let x0 = DeletionMetadata::new().set_deletion_type(DeletionType::Creator);
4259 /// let x1 = DeletionMetadata::new().set_deletion_type(DeletionType::SpaceOwner);
4260 /// let x2 = DeletionMetadata::new().set_deletion_type(DeletionType::Admin);
4261 /// ```
4262 pub fn set_deletion_type<
4263 T: std::convert::Into<crate::model::deletion_metadata::DeletionType>,
4264 >(
4265 mut self,
4266 v: T,
4267 ) -> Self {
4268 self.deletion_type = v.into();
4269 self
4270 }
4271}
4272
4273impl wkt::message::Message for DeletionMetadata {
4274 fn typename() -> &'static str {
4275 "type.googleapis.com/google.chat.v1.DeletionMetadata"
4276 }
4277}
4278
4279/// Defines additional types related to [DeletionMetadata].
4280pub mod deletion_metadata {
4281 #[allow(unused_imports)]
4282 use super::*;
4283
4284 /// Who deleted the message and how it was deleted. More values may be added in
4285 /// the future. See [Edit or delete a message in Google
4286 /// Chat](https://support.google.com/chat/answer/7653281) for details on when
4287 /// messages can be deleted.
4288 ///
4289 /// # Working with unknown values
4290 ///
4291 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4292 /// additional enum variants at any time. Adding new variants is not considered
4293 /// a breaking change. Applications should write their code in anticipation of:
4294 ///
4295 /// - New values appearing in future releases of the client library, **and**
4296 /// - New values received dynamically, without application changes.
4297 ///
4298 /// Please consult the [Working with enums] section in the user guide for some
4299 /// guidelines.
4300 ///
4301 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4302 #[derive(Clone, Debug, PartialEq)]
4303 #[non_exhaustive]
4304 pub enum DeletionType {
4305 /// This value is unused.
4306 Unspecified,
4307 /// User deleted their own message.
4308 Creator,
4309 /// An owner or manager deleted the message.
4310 SpaceOwner,
4311 /// A Google Workspace administrator deleted the message. Administrators can
4312 /// delete any message in the space, including messages sent by any space
4313 /// member or Chat app.
4314 Admin,
4315 /// A Chat app deleted its own message when it expired.
4316 AppMessageExpiry,
4317 /// A Chat app deleted the message on behalf of the creator (using user
4318 /// authentication).
4319 CreatorViaApp,
4320 /// A Chat app deleted the message on behalf of a space manager (using user
4321 /// authentication).
4322 SpaceOwnerViaApp,
4323 /// A member of the space deleted the message. Users can delete messages sent
4324 /// by apps.
4325 SpaceMember,
4326 /// If set, the enum was initialized with an unknown value.
4327 ///
4328 /// Applications can examine the value using [DeletionType::value] or
4329 /// [DeletionType::name].
4330 UnknownValue(deletion_type::UnknownValue),
4331 }
4332
4333 #[doc(hidden)]
4334 pub mod deletion_type {
4335 #[allow(unused_imports)]
4336 use super::*;
4337 #[derive(Clone, Debug, PartialEq)]
4338 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4339 }
4340
4341 impl DeletionType {
4342 /// Gets the enum value.
4343 ///
4344 /// Returns `None` if the enum contains an unknown value deserialized from
4345 /// the string representation of enums.
4346 pub fn value(&self) -> std::option::Option<i32> {
4347 match self {
4348 Self::Unspecified => std::option::Option::Some(0),
4349 Self::Creator => std::option::Option::Some(1),
4350 Self::SpaceOwner => std::option::Option::Some(2),
4351 Self::Admin => std::option::Option::Some(3),
4352 Self::AppMessageExpiry => std::option::Option::Some(4),
4353 Self::CreatorViaApp => std::option::Option::Some(5),
4354 Self::SpaceOwnerViaApp => std::option::Option::Some(6),
4355 Self::SpaceMember => std::option::Option::Some(7),
4356 Self::UnknownValue(u) => u.0.value(),
4357 }
4358 }
4359
4360 /// Gets the enum value as a string.
4361 ///
4362 /// Returns `None` if the enum contains an unknown value deserialized from
4363 /// the integer representation of enums.
4364 pub fn name(&self) -> std::option::Option<&str> {
4365 match self {
4366 Self::Unspecified => std::option::Option::Some("DELETION_TYPE_UNSPECIFIED"),
4367 Self::Creator => std::option::Option::Some("CREATOR"),
4368 Self::SpaceOwner => std::option::Option::Some("SPACE_OWNER"),
4369 Self::Admin => std::option::Option::Some("ADMIN"),
4370 Self::AppMessageExpiry => std::option::Option::Some("APP_MESSAGE_EXPIRY"),
4371 Self::CreatorViaApp => std::option::Option::Some("CREATOR_VIA_APP"),
4372 Self::SpaceOwnerViaApp => std::option::Option::Some("SPACE_OWNER_VIA_APP"),
4373 Self::SpaceMember => std::option::Option::Some("SPACE_MEMBER"),
4374 Self::UnknownValue(u) => u.0.name(),
4375 }
4376 }
4377 }
4378
4379 impl std::default::Default for DeletionType {
4380 fn default() -> Self {
4381 use std::convert::From;
4382 Self::from(0)
4383 }
4384 }
4385
4386 impl std::fmt::Display for DeletionType {
4387 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4388 wkt::internal::display_enum(f, self.name(), self.value())
4389 }
4390 }
4391
4392 impl std::convert::From<i32> for DeletionType {
4393 fn from(value: i32) -> Self {
4394 match value {
4395 0 => Self::Unspecified,
4396 1 => Self::Creator,
4397 2 => Self::SpaceOwner,
4398 3 => Self::Admin,
4399 4 => Self::AppMessageExpiry,
4400 5 => Self::CreatorViaApp,
4401 6 => Self::SpaceOwnerViaApp,
4402 7 => Self::SpaceMember,
4403 _ => Self::UnknownValue(deletion_type::UnknownValue(
4404 wkt::internal::UnknownEnumValue::Integer(value),
4405 )),
4406 }
4407 }
4408 }
4409
4410 impl std::convert::From<&str> for DeletionType {
4411 fn from(value: &str) -> Self {
4412 use std::string::ToString;
4413 match value {
4414 "DELETION_TYPE_UNSPECIFIED" => Self::Unspecified,
4415 "CREATOR" => Self::Creator,
4416 "SPACE_OWNER" => Self::SpaceOwner,
4417 "ADMIN" => Self::Admin,
4418 "APP_MESSAGE_EXPIRY" => Self::AppMessageExpiry,
4419 "CREATOR_VIA_APP" => Self::CreatorViaApp,
4420 "SPACE_OWNER_VIA_APP" => Self::SpaceOwnerViaApp,
4421 "SPACE_MEMBER" => Self::SpaceMember,
4422 _ => Self::UnknownValue(deletion_type::UnknownValue(
4423 wkt::internal::UnknownEnumValue::String(value.to_string()),
4424 )),
4425 }
4426 }
4427 }
4428
4429 impl serde::ser::Serialize for DeletionType {
4430 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4431 where
4432 S: serde::Serializer,
4433 {
4434 match self {
4435 Self::Unspecified => serializer.serialize_i32(0),
4436 Self::Creator => serializer.serialize_i32(1),
4437 Self::SpaceOwner => serializer.serialize_i32(2),
4438 Self::Admin => serializer.serialize_i32(3),
4439 Self::AppMessageExpiry => serializer.serialize_i32(4),
4440 Self::CreatorViaApp => serializer.serialize_i32(5),
4441 Self::SpaceOwnerViaApp => serializer.serialize_i32(6),
4442 Self::SpaceMember => serializer.serialize_i32(7),
4443 Self::UnknownValue(u) => u.0.serialize(serializer),
4444 }
4445 }
4446 }
4447
4448 impl<'de> serde::de::Deserialize<'de> for DeletionType {
4449 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4450 where
4451 D: serde::Deserializer<'de>,
4452 {
4453 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DeletionType>::new(
4454 ".google.chat.v1.DeletionMetadata.DeletionType",
4455 ))
4456 }
4457 }
4458}
4459
4460/// Event payload for a new membership.
4461///
4462/// Event type: `google.workspace.chat.membership.v1.created`.
4463#[derive(Clone, Default, PartialEq)]
4464#[non_exhaustive]
4465pub struct MembershipCreatedEventData {
4466 /// The new membership.
4467 pub membership: std::option::Option<crate::model::Membership>,
4468
4469 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4470}
4471
4472impl MembershipCreatedEventData {
4473 /// Creates a new default instance.
4474 pub fn new() -> Self {
4475 std::default::Default::default()
4476 }
4477
4478 /// Sets the value of [membership][crate::model::MembershipCreatedEventData::membership].
4479 ///
4480 /// # Example
4481 /// ```ignore,no_run
4482 /// # use google_chat_v1::model::MembershipCreatedEventData;
4483 /// use google_chat_v1::model::Membership;
4484 /// let x = MembershipCreatedEventData::new().set_membership(Membership::default()/* use setters */);
4485 /// ```
4486 pub fn set_membership<T>(mut self, v: T) -> Self
4487 where
4488 T: std::convert::Into<crate::model::Membership>,
4489 {
4490 self.membership = std::option::Option::Some(v.into());
4491 self
4492 }
4493
4494 /// Sets or clears the value of [membership][crate::model::MembershipCreatedEventData::membership].
4495 ///
4496 /// # Example
4497 /// ```ignore,no_run
4498 /// # use google_chat_v1::model::MembershipCreatedEventData;
4499 /// use google_chat_v1::model::Membership;
4500 /// let x = MembershipCreatedEventData::new().set_or_clear_membership(Some(Membership::default()/* use setters */));
4501 /// let x = MembershipCreatedEventData::new().set_or_clear_membership(None::<Membership>);
4502 /// ```
4503 pub fn set_or_clear_membership<T>(mut self, v: std::option::Option<T>) -> Self
4504 where
4505 T: std::convert::Into<crate::model::Membership>,
4506 {
4507 self.membership = v.map(|x| x.into());
4508 self
4509 }
4510}
4511
4512impl wkt::message::Message for MembershipCreatedEventData {
4513 fn typename() -> &'static str {
4514 "type.googleapis.com/google.chat.v1.MembershipCreatedEventData"
4515 }
4516}
4517
4518/// Event payload for a deleted membership.
4519///
4520/// Event type: `google.workspace.chat.membership.v1.deleted`
4521#[derive(Clone, Default, PartialEq)]
4522#[non_exhaustive]
4523pub struct MembershipDeletedEventData {
4524 /// The deleted membership. Only the `name` and `state` fields are populated.
4525 pub membership: std::option::Option<crate::model::Membership>,
4526
4527 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4528}
4529
4530impl MembershipDeletedEventData {
4531 /// Creates a new default instance.
4532 pub fn new() -> Self {
4533 std::default::Default::default()
4534 }
4535
4536 /// Sets the value of [membership][crate::model::MembershipDeletedEventData::membership].
4537 ///
4538 /// # Example
4539 /// ```ignore,no_run
4540 /// # use google_chat_v1::model::MembershipDeletedEventData;
4541 /// use google_chat_v1::model::Membership;
4542 /// let x = MembershipDeletedEventData::new().set_membership(Membership::default()/* use setters */);
4543 /// ```
4544 pub fn set_membership<T>(mut self, v: T) -> Self
4545 where
4546 T: std::convert::Into<crate::model::Membership>,
4547 {
4548 self.membership = std::option::Option::Some(v.into());
4549 self
4550 }
4551
4552 /// Sets or clears the value of [membership][crate::model::MembershipDeletedEventData::membership].
4553 ///
4554 /// # Example
4555 /// ```ignore,no_run
4556 /// # use google_chat_v1::model::MembershipDeletedEventData;
4557 /// use google_chat_v1::model::Membership;
4558 /// let x = MembershipDeletedEventData::new().set_or_clear_membership(Some(Membership::default()/* use setters */));
4559 /// let x = MembershipDeletedEventData::new().set_or_clear_membership(None::<Membership>);
4560 /// ```
4561 pub fn set_or_clear_membership<T>(mut self, v: std::option::Option<T>) -> Self
4562 where
4563 T: std::convert::Into<crate::model::Membership>,
4564 {
4565 self.membership = v.map(|x| x.into());
4566 self
4567 }
4568}
4569
4570impl wkt::message::Message for MembershipDeletedEventData {
4571 fn typename() -> &'static str {
4572 "type.googleapis.com/google.chat.v1.MembershipDeletedEventData"
4573 }
4574}
4575
4576/// Event payload for an updated membership.
4577///
4578/// Event type: `google.workspace.chat.membership.v1.updated`
4579#[derive(Clone, Default, PartialEq)]
4580#[non_exhaustive]
4581pub struct MembershipUpdatedEventData {
4582 /// The updated membership.
4583 pub membership: std::option::Option<crate::model::Membership>,
4584
4585 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4586}
4587
4588impl MembershipUpdatedEventData {
4589 /// Creates a new default instance.
4590 pub fn new() -> Self {
4591 std::default::Default::default()
4592 }
4593
4594 /// Sets the value of [membership][crate::model::MembershipUpdatedEventData::membership].
4595 ///
4596 /// # Example
4597 /// ```ignore,no_run
4598 /// # use google_chat_v1::model::MembershipUpdatedEventData;
4599 /// use google_chat_v1::model::Membership;
4600 /// let x = MembershipUpdatedEventData::new().set_membership(Membership::default()/* use setters */);
4601 /// ```
4602 pub fn set_membership<T>(mut self, v: T) -> Self
4603 where
4604 T: std::convert::Into<crate::model::Membership>,
4605 {
4606 self.membership = std::option::Option::Some(v.into());
4607 self
4608 }
4609
4610 /// Sets or clears the value of [membership][crate::model::MembershipUpdatedEventData::membership].
4611 ///
4612 /// # Example
4613 /// ```ignore,no_run
4614 /// # use google_chat_v1::model::MembershipUpdatedEventData;
4615 /// use google_chat_v1::model::Membership;
4616 /// let x = MembershipUpdatedEventData::new().set_or_clear_membership(Some(Membership::default()/* use setters */));
4617 /// let x = MembershipUpdatedEventData::new().set_or_clear_membership(None::<Membership>);
4618 /// ```
4619 pub fn set_or_clear_membership<T>(mut self, v: std::option::Option<T>) -> Self
4620 where
4621 T: std::convert::Into<crate::model::Membership>,
4622 {
4623 self.membership = v.map(|x| x.into());
4624 self
4625 }
4626}
4627
4628impl wkt::message::Message for MembershipUpdatedEventData {
4629 fn typename() -> &'static str {
4630 "type.googleapis.com/google.chat.v1.MembershipUpdatedEventData"
4631 }
4632}
4633
4634/// Event payload for multiple new memberships.
4635///
4636/// Event type: `google.workspace.chat.membership.v1.batchCreated`
4637#[derive(Clone, Default, PartialEq)]
4638#[non_exhaustive]
4639pub struct MembershipBatchCreatedEventData {
4640 /// A list of new memberships.
4641 pub memberships: std::vec::Vec<crate::model::MembershipCreatedEventData>,
4642
4643 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4644}
4645
4646impl MembershipBatchCreatedEventData {
4647 /// Creates a new default instance.
4648 pub fn new() -> Self {
4649 std::default::Default::default()
4650 }
4651
4652 /// Sets the value of [memberships][crate::model::MembershipBatchCreatedEventData::memberships].
4653 ///
4654 /// # Example
4655 /// ```ignore,no_run
4656 /// # use google_chat_v1::model::MembershipBatchCreatedEventData;
4657 /// use google_chat_v1::model::MembershipCreatedEventData;
4658 /// let x = MembershipBatchCreatedEventData::new()
4659 /// .set_memberships([
4660 /// MembershipCreatedEventData::default()/* use setters */,
4661 /// MembershipCreatedEventData::default()/* use (different) setters */,
4662 /// ]);
4663 /// ```
4664 pub fn set_memberships<T, V>(mut self, v: T) -> Self
4665 where
4666 T: std::iter::IntoIterator<Item = V>,
4667 V: std::convert::Into<crate::model::MembershipCreatedEventData>,
4668 {
4669 use std::iter::Iterator;
4670 self.memberships = v.into_iter().map(|i| i.into()).collect();
4671 self
4672 }
4673}
4674
4675impl wkt::message::Message for MembershipBatchCreatedEventData {
4676 fn typename() -> &'static str {
4677 "type.googleapis.com/google.chat.v1.MembershipBatchCreatedEventData"
4678 }
4679}
4680
4681/// Event payload for multiple updated memberships.
4682///
4683/// Event type: `google.workspace.chat.membership.v1.batchUpdated`
4684#[derive(Clone, Default, PartialEq)]
4685#[non_exhaustive]
4686pub struct MembershipBatchUpdatedEventData {
4687 /// A list of updated memberships.
4688 pub memberships: std::vec::Vec<crate::model::MembershipUpdatedEventData>,
4689
4690 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4691}
4692
4693impl MembershipBatchUpdatedEventData {
4694 /// Creates a new default instance.
4695 pub fn new() -> Self {
4696 std::default::Default::default()
4697 }
4698
4699 /// Sets the value of [memberships][crate::model::MembershipBatchUpdatedEventData::memberships].
4700 ///
4701 /// # Example
4702 /// ```ignore,no_run
4703 /// # use google_chat_v1::model::MembershipBatchUpdatedEventData;
4704 /// use google_chat_v1::model::MembershipUpdatedEventData;
4705 /// let x = MembershipBatchUpdatedEventData::new()
4706 /// .set_memberships([
4707 /// MembershipUpdatedEventData::default()/* use setters */,
4708 /// MembershipUpdatedEventData::default()/* use (different) setters */,
4709 /// ]);
4710 /// ```
4711 pub fn set_memberships<T, V>(mut self, v: T) -> Self
4712 where
4713 T: std::iter::IntoIterator<Item = V>,
4714 V: std::convert::Into<crate::model::MembershipUpdatedEventData>,
4715 {
4716 use std::iter::Iterator;
4717 self.memberships = v.into_iter().map(|i| i.into()).collect();
4718 self
4719 }
4720}
4721
4722impl wkt::message::Message for MembershipBatchUpdatedEventData {
4723 fn typename() -> &'static str {
4724 "type.googleapis.com/google.chat.v1.MembershipBatchUpdatedEventData"
4725 }
4726}
4727
4728/// Event payload for multiple deleted memberships.
4729///
4730/// Event type: `google.workspace.chat.membership.v1.batchDeleted`
4731#[derive(Clone, Default, PartialEq)]
4732#[non_exhaustive]
4733pub struct MembershipBatchDeletedEventData {
4734 /// A list of deleted memberships.
4735 pub memberships: std::vec::Vec<crate::model::MembershipDeletedEventData>,
4736
4737 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4738}
4739
4740impl MembershipBatchDeletedEventData {
4741 /// Creates a new default instance.
4742 pub fn new() -> Self {
4743 std::default::Default::default()
4744 }
4745
4746 /// Sets the value of [memberships][crate::model::MembershipBatchDeletedEventData::memberships].
4747 ///
4748 /// # Example
4749 /// ```ignore,no_run
4750 /// # use google_chat_v1::model::MembershipBatchDeletedEventData;
4751 /// use google_chat_v1::model::MembershipDeletedEventData;
4752 /// let x = MembershipBatchDeletedEventData::new()
4753 /// .set_memberships([
4754 /// MembershipDeletedEventData::default()/* use setters */,
4755 /// MembershipDeletedEventData::default()/* use (different) setters */,
4756 /// ]);
4757 /// ```
4758 pub fn set_memberships<T, V>(mut self, v: T) -> Self
4759 where
4760 T: std::iter::IntoIterator<Item = V>,
4761 V: std::convert::Into<crate::model::MembershipDeletedEventData>,
4762 {
4763 use std::iter::Iterator;
4764 self.memberships = v.into_iter().map(|i| i.into()).collect();
4765 self
4766 }
4767}
4768
4769impl wkt::message::Message for MembershipBatchDeletedEventData {
4770 fn typename() -> &'static str {
4771 "type.googleapis.com/google.chat.v1.MembershipBatchDeletedEventData"
4772 }
4773}
4774
4775/// Event payload for a new message.
4776///
4777/// Event type: `google.workspace.chat.message.v1.created`
4778#[derive(Clone, Default, PartialEq)]
4779#[non_exhaustive]
4780pub struct MessageCreatedEventData {
4781 /// The new message.
4782 pub message: std::option::Option<crate::model::Message>,
4783
4784 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4785}
4786
4787impl MessageCreatedEventData {
4788 /// Creates a new default instance.
4789 pub fn new() -> Self {
4790 std::default::Default::default()
4791 }
4792
4793 /// Sets the value of [message][crate::model::MessageCreatedEventData::message].
4794 ///
4795 /// # Example
4796 /// ```ignore,no_run
4797 /// # use google_chat_v1::model::MessageCreatedEventData;
4798 /// use google_chat_v1::model::Message;
4799 /// let x = MessageCreatedEventData::new().set_message(Message::default()/* use setters */);
4800 /// ```
4801 pub fn set_message<T>(mut self, v: T) -> Self
4802 where
4803 T: std::convert::Into<crate::model::Message>,
4804 {
4805 self.message = std::option::Option::Some(v.into());
4806 self
4807 }
4808
4809 /// Sets or clears the value of [message][crate::model::MessageCreatedEventData::message].
4810 ///
4811 /// # Example
4812 /// ```ignore,no_run
4813 /// # use google_chat_v1::model::MessageCreatedEventData;
4814 /// use google_chat_v1::model::Message;
4815 /// let x = MessageCreatedEventData::new().set_or_clear_message(Some(Message::default()/* use setters */));
4816 /// let x = MessageCreatedEventData::new().set_or_clear_message(None::<Message>);
4817 /// ```
4818 pub fn set_or_clear_message<T>(mut self, v: std::option::Option<T>) -> Self
4819 where
4820 T: std::convert::Into<crate::model::Message>,
4821 {
4822 self.message = v.map(|x| x.into());
4823 self
4824 }
4825}
4826
4827impl wkt::message::Message for MessageCreatedEventData {
4828 fn typename() -> &'static str {
4829 "type.googleapis.com/google.chat.v1.MessageCreatedEventData"
4830 }
4831}
4832
4833/// Event payload for an updated message.
4834///
4835/// Event type: `google.workspace.chat.message.v1.updated`
4836#[derive(Clone, Default, PartialEq)]
4837#[non_exhaustive]
4838pub struct MessageUpdatedEventData {
4839 /// The updated message.
4840 pub message: std::option::Option<crate::model::Message>,
4841
4842 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4843}
4844
4845impl MessageUpdatedEventData {
4846 /// Creates a new default instance.
4847 pub fn new() -> Self {
4848 std::default::Default::default()
4849 }
4850
4851 /// Sets the value of [message][crate::model::MessageUpdatedEventData::message].
4852 ///
4853 /// # Example
4854 /// ```ignore,no_run
4855 /// # use google_chat_v1::model::MessageUpdatedEventData;
4856 /// use google_chat_v1::model::Message;
4857 /// let x = MessageUpdatedEventData::new().set_message(Message::default()/* use setters */);
4858 /// ```
4859 pub fn set_message<T>(mut self, v: T) -> Self
4860 where
4861 T: std::convert::Into<crate::model::Message>,
4862 {
4863 self.message = std::option::Option::Some(v.into());
4864 self
4865 }
4866
4867 /// Sets or clears the value of [message][crate::model::MessageUpdatedEventData::message].
4868 ///
4869 /// # Example
4870 /// ```ignore,no_run
4871 /// # use google_chat_v1::model::MessageUpdatedEventData;
4872 /// use google_chat_v1::model::Message;
4873 /// let x = MessageUpdatedEventData::new().set_or_clear_message(Some(Message::default()/* use setters */));
4874 /// let x = MessageUpdatedEventData::new().set_or_clear_message(None::<Message>);
4875 /// ```
4876 pub fn set_or_clear_message<T>(mut self, v: std::option::Option<T>) -> Self
4877 where
4878 T: std::convert::Into<crate::model::Message>,
4879 {
4880 self.message = v.map(|x| x.into());
4881 self
4882 }
4883}
4884
4885impl wkt::message::Message for MessageUpdatedEventData {
4886 fn typename() -> &'static str {
4887 "type.googleapis.com/google.chat.v1.MessageUpdatedEventData"
4888 }
4889}
4890
4891/// Event payload for a deleted message.
4892///
4893/// Event type: `google.workspace.chat.message.v1.deleted`
4894#[derive(Clone, Default, PartialEq)]
4895#[non_exhaustive]
4896pub struct MessageDeletedEventData {
4897 /// The deleted message. Only the `name`, `createTime`, and
4898 /// `deletionMetadata` fields are populated.
4899 pub message: std::option::Option<crate::model::Message>,
4900
4901 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4902}
4903
4904impl MessageDeletedEventData {
4905 /// Creates a new default instance.
4906 pub fn new() -> Self {
4907 std::default::Default::default()
4908 }
4909
4910 /// Sets the value of [message][crate::model::MessageDeletedEventData::message].
4911 ///
4912 /// # Example
4913 /// ```ignore,no_run
4914 /// # use google_chat_v1::model::MessageDeletedEventData;
4915 /// use google_chat_v1::model::Message;
4916 /// let x = MessageDeletedEventData::new().set_message(Message::default()/* use setters */);
4917 /// ```
4918 pub fn set_message<T>(mut self, v: T) -> Self
4919 where
4920 T: std::convert::Into<crate::model::Message>,
4921 {
4922 self.message = std::option::Option::Some(v.into());
4923 self
4924 }
4925
4926 /// Sets or clears the value of [message][crate::model::MessageDeletedEventData::message].
4927 ///
4928 /// # Example
4929 /// ```ignore,no_run
4930 /// # use google_chat_v1::model::MessageDeletedEventData;
4931 /// use google_chat_v1::model::Message;
4932 /// let x = MessageDeletedEventData::new().set_or_clear_message(Some(Message::default()/* use setters */));
4933 /// let x = MessageDeletedEventData::new().set_or_clear_message(None::<Message>);
4934 /// ```
4935 pub fn set_or_clear_message<T>(mut self, v: std::option::Option<T>) -> Self
4936 where
4937 T: std::convert::Into<crate::model::Message>,
4938 {
4939 self.message = v.map(|x| x.into());
4940 self
4941 }
4942}
4943
4944impl wkt::message::Message for MessageDeletedEventData {
4945 fn typename() -> &'static str {
4946 "type.googleapis.com/google.chat.v1.MessageDeletedEventData"
4947 }
4948}
4949
4950/// Event payload for multiple new messages.
4951///
4952/// Event type: `google.workspace.chat.message.v1.batchCreated`
4953#[derive(Clone, Default, PartialEq)]
4954#[non_exhaustive]
4955pub struct MessageBatchCreatedEventData {
4956 /// A list of new messages.
4957 pub messages: std::vec::Vec<crate::model::MessageCreatedEventData>,
4958
4959 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4960}
4961
4962impl MessageBatchCreatedEventData {
4963 /// Creates a new default instance.
4964 pub fn new() -> Self {
4965 std::default::Default::default()
4966 }
4967
4968 /// Sets the value of [messages][crate::model::MessageBatchCreatedEventData::messages].
4969 ///
4970 /// # Example
4971 /// ```ignore,no_run
4972 /// # use google_chat_v1::model::MessageBatchCreatedEventData;
4973 /// use google_chat_v1::model::MessageCreatedEventData;
4974 /// let x = MessageBatchCreatedEventData::new()
4975 /// .set_messages([
4976 /// MessageCreatedEventData::default()/* use setters */,
4977 /// MessageCreatedEventData::default()/* use (different) setters */,
4978 /// ]);
4979 /// ```
4980 pub fn set_messages<T, V>(mut self, v: T) -> Self
4981 where
4982 T: std::iter::IntoIterator<Item = V>,
4983 V: std::convert::Into<crate::model::MessageCreatedEventData>,
4984 {
4985 use std::iter::Iterator;
4986 self.messages = v.into_iter().map(|i| i.into()).collect();
4987 self
4988 }
4989}
4990
4991impl wkt::message::Message for MessageBatchCreatedEventData {
4992 fn typename() -> &'static str {
4993 "type.googleapis.com/google.chat.v1.MessageBatchCreatedEventData"
4994 }
4995}
4996
4997/// Event payload for multiple updated messages.
4998///
4999/// Event type: `google.workspace.chat.message.v1.batchUpdated`
5000#[derive(Clone, Default, PartialEq)]
5001#[non_exhaustive]
5002pub struct MessageBatchUpdatedEventData {
5003 /// A list of updated messages.
5004 pub messages: std::vec::Vec<crate::model::MessageUpdatedEventData>,
5005
5006 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5007}
5008
5009impl MessageBatchUpdatedEventData {
5010 /// Creates a new default instance.
5011 pub fn new() -> Self {
5012 std::default::Default::default()
5013 }
5014
5015 /// Sets the value of [messages][crate::model::MessageBatchUpdatedEventData::messages].
5016 ///
5017 /// # Example
5018 /// ```ignore,no_run
5019 /// # use google_chat_v1::model::MessageBatchUpdatedEventData;
5020 /// use google_chat_v1::model::MessageUpdatedEventData;
5021 /// let x = MessageBatchUpdatedEventData::new()
5022 /// .set_messages([
5023 /// MessageUpdatedEventData::default()/* use setters */,
5024 /// MessageUpdatedEventData::default()/* use (different) setters */,
5025 /// ]);
5026 /// ```
5027 pub fn set_messages<T, V>(mut self, v: T) -> Self
5028 where
5029 T: std::iter::IntoIterator<Item = V>,
5030 V: std::convert::Into<crate::model::MessageUpdatedEventData>,
5031 {
5032 use std::iter::Iterator;
5033 self.messages = v.into_iter().map(|i| i.into()).collect();
5034 self
5035 }
5036}
5037
5038impl wkt::message::Message for MessageBatchUpdatedEventData {
5039 fn typename() -> &'static str {
5040 "type.googleapis.com/google.chat.v1.MessageBatchUpdatedEventData"
5041 }
5042}
5043
5044/// Event payload for multiple deleted messages.
5045///
5046/// Event type: `google.workspace.chat.message.v1.batchDeleted`
5047#[derive(Clone, Default, PartialEq)]
5048#[non_exhaustive]
5049pub struct MessageBatchDeletedEventData {
5050 /// A list of deleted messages.
5051 pub messages: std::vec::Vec<crate::model::MessageDeletedEventData>,
5052
5053 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5054}
5055
5056impl MessageBatchDeletedEventData {
5057 /// Creates a new default instance.
5058 pub fn new() -> Self {
5059 std::default::Default::default()
5060 }
5061
5062 /// Sets the value of [messages][crate::model::MessageBatchDeletedEventData::messages].
5063 ///
5064 /// # Example
5065 /// ```ignore,no_run
5066 /// # use google_chat_v1::model::MessageBatchDeletedEventData;
5067 /// use google_chat_v1::model::MessageDeletedEventData;
5068 /// let x = MessageBatchDeletedEventData::new()
5069 /// .set_messages([
5070 /// MessageDeletedEventData::default()/* use setters */,
5071 /// MessageDeletedEventData::default()/* use (different) setters */,
5072 /// ]);
5073 /// ```
5074 pub fn set_messages<T, V>(mut self, v: T) -> Self
5075 where
5076 T: std::iter::IntoIterator<Item = V>,
5077 V: std::convert::Into<crate::model::MessageDeletedEventData>,
5078 {
5079 use std::iter::Iterator;
5080 self.messages = v.into_iter().map(|i| i.into()).collect();
5081 self
5082 }
5083}
5084
5085impl wkt::message::Message for MessageBatchDeletedEventData {
5086 fn typename() -> &'static str {
5087 "type.googleapis.com/google.chat.v1.MessageBatchDeletedEventData"
5088 }
5089}
5090
5091/// Event payload for an updated space.
5092///
5093/// Event type: `google.workspace.chat.space.v1.updated`
5094#[derive(Clone, Default, PartialEq)]
5095#[non_exhaustive]
5096pub struct SpaceUpdatedEventData {
5097 /// The updated space.
5098 pub space: std::option::Option<crate::model::Space>,
5099
5100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5101}
5102
5103impl SpaceUpdatedEventData {
5104 /// Creates a new default instance.
5105 pub fn new() -> Self {
5106 std::default::Default::default()
5107 }
5108
5109 /// Sets the value of [space][crate::model::SpaceUpdatedEventData::space].
5110 ///
5111 /// # Example
5112 /// ```ignore,no_run
5113 /// # use google_chat_v1::model::SpaceUpdatedEventData;
5114 /// use google_chat_v1::model::Space;
5115 /// let x = SpaceUpdatedEventData::new().set_space(Space::default()/* use setters */);
5116 /// ```
5117 pub fn set_space<T>(mut self, v: T) -> Self
5118 where
5119 T: std::convert::Into<crate::model::Space>,
5120 {
5121 self.space = std::option::Option::Some(v.into());
5122 self
5123 }
5124
5125 /// Sets or clears the value of [space][crate::model::SpaceUpdatedEventData::space].
5126 ///
5127 /// # Example
5128 /// ```ignore,no_run
5129 /// # use google_chat_v1::model::SpaceUpdatedEventData;
5130 /// use google_chat_v1::model::Space;
5131 /// let x = SpaceUpdatedEventData::new().set_or_clear_space(Some(Space::default()/* use setters */));
5132 /// let x = SpaceUpdatedEventData::new().set_or_clear_space(None::<Space>);
5133 /// ```
5134 pub fn set_or_clear_space<T>(mut self, v: std::option::Option<T>) -> Self
5135 where
5136 T: std::convert::Into<crate::model::Space>,
5137 {
5138 self.space = v.map(|x| x.into());
5139 self
5140 }
5141}
5142
5143impl wkt::message::Message for SpaceUpdatedEventData {
5144 fn typename() -> &'static str {
5145 "type.googleapis.com/google.chat.v1.SpaceUpdatedEventData"
5146 }
5147}
5148
5149/// Event payload for multiple updates to a space.
5150///
5151/// Event type: `google.workspace.chat.space.v1.batchUpdated`
5152#[derive(Clone, Default, PartialEq)]
5153#[non_exhaustive]
5154pub struct SpaceBatchUpdatedEventData {
5155 /// A list of updated spaces.
5156 pub spaces: std::vec::Vec<crate::model::SpaceUpdatedEventData>,
5157
5158 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5159}
5160
5161impl SpaceBatchUpdatedEventData {
5162 /// Creates a new default instance.
5163 pub fn new() -> Self {
5164 std::default::Default::default()
5165 }
5166
5167 /// Sets the value of [spaces][crate::model::SpaceBatchUpdatedEventData::spaces].
5168 ///
5169 /// # Example
5170 /// ```ignore,no_run
5171 /// # use google_chat_v1::model::SpaceBatchUpdatedEventData;
5172 /// use google_chat_v1::model::SpaceUpdatedEventData;
5173 /// let x = SpaceBatchUpdatedEventData::new()
5174 /// .set_spaces([
5175 /// SpaceUpdatedEventData::default()/* use setters */,
5176 /// SpaceUpdatedEventData::default()/* use (different) setters */,
5177 /// ]);
5178 /// ```
5179 pub fn set_spaces<T, V>(mut self, v: T) -> Self
5180 where
5181 T: std::iter::IntoIterator<Item = V>,
5182 V: std::convert::Into<crate::model::SpaceUpdatedEventData>,
5183 {
5184 use std::iter::Iterator;
5185 self.spaces = v.into_iter().map(|i| i.into()).collect();
5186 self
5187 }
5188}
5189
5190impl wkt::message::Message for SpaceBatchUpdatedEventData {
5191 fn typename() -> &'static str {
5192 "type.googleapis.com/google.chat.v1.SpaceBatchUpdatedEventData"
5193 }
5194}
5195
5196/// Event payload for a new reaction.
5197///
5198/// Event type: `google.workspace.chat.reaction.v1.created`
5199#[derive(Clone, Default, PartialEq)]
5200#[non_exhaustive]
5201pub struct ReactionCreatedEventData {
5202 /// The new reaction.
5203 pub reaction: std::option::Option<crate::model::Reaction>,
5204
5205 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5206}
5207
5208impl ReactionCreatedEventData {
5209 /// Creates a new default instance.
5210 pub fn new() -> Self {
5211 std::default::Default::default()
5212 }
5213
5214 /// Sets the value of [reaction][crate::model::ReactionCreatedEventData::reaction].
5215 ///
5216 /// # Example
5217 /// ```ignore,no_run
5218 /// # use google_chat_v1::model::ReactionCreatedEventData;
5219 /// use google_chat_v1::model::Reaction;
5220 /// let x = ReactionCreatedEventData::new().set_reaction(Reaction::default()/* use setters */);
5221 /// ```
5222 pub fn set_reaction<T>(mut self, v: T) -> Self
5223 where
5224 T: std::convert::Into<crate::model::Reaction>,
5225 {
5226 self.reaction = std::option::Option::Some(v.into());
5227 self
5228 }
5229
5230 /// Sets or clears the value of [reaction][crate::model::ReactionCreatedEventData::reaction].
5231 ///
5232 /// # Example
5233 /// ```ignore,no_run
5234 /// # use google_chat_v1::model::ReactionCreatedEventData;
5235 /// use google_chat_v1::model::Reaction;
5236 /// let x = ReactionCreatedEventData::new().set_or_clear_reaction(Some(Reaction::default()/* use setters */));
5237 /// let x = ReactionCreatedEventData::new().set_or_clear_reaction(None::<Reaction>);
5238 /// ```
5239 pub fn set_or_clear_reaction<T>(mut self, v: std::option::Option<T>) -> Self
5240 where
5241 T: std::convert::Into<crate::model::Reaction>,
5242 {
5243 self.reaction = v.map(|x| x.into());
5244 self
5245 }
5246}
5247
5248impl wkt::message::Message for ReactionCreatedEventData {
5249 fn typename() -> &'static str {
5250 "type.googleapis.com/google.chat.v1.ReactionCreatedEventData"
5251 }
5252}
5253
5254/// Event payload for a deleted reaction.
5255///
5256/// Type: `google.workspace.chat.reaction.v1.deleted`
5257#[derive(Clone, Default, PartialEq)]
5258#[non_exhaustive]
5259pub struct ReactionDeletedEventData {
5260 /// The deleted reaction.
5261 pub reaction: std::option::Option<crate::model::Reaction>,
5262
5263 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5264}
5265
5266impl ReactionDeletedEventData {
5267 /// Creates a new default instance.
5268 pub fn new() -> Self {
5269 std::default::Default::default()
5270 }
5271
5272 /// Sets the value of [reaction][crate::model::ReactionDeletedEventData::reaction].
5273 ///
5274 /// # Example
5275 /// ```ignore,no_run
5276 /// # use google_chat_v1::model::ReactionDeletedEventData;
5277 /// use google_chat_v1::model::Reaction;
5278 /// let x = ReactionDeletedEventData::new().set_reaction(Reaction::default()/* use setters */);
5279 /// ```
5280 pub fn set_reaction<T>(mut self, v: T) -> Self
5281 where
5282 T: std::convert::Into<crate::model::Reaction>,
5283 {
5284 self.reaction = std::option::Option::Some(v.into());
5285 self
5286 }
5287
5288 /// Sets or clears the value of [reaction][crate::model::ReactionDeletedEventData::reaction].
5289 ///
5290 /// # Example
5291 /// ```ignore,no_run
5292 /// # use google_chat_v1::model::ReactionDeletedEventData;
5293 /// use google_chat_v1::model::Reaction;
5294 /// let x = ReactionDeletedEventData::new().set_or_clear_reaction(Some(Reaction::default()/* use setters */));
5295 /// let x = ReactionDeletedEventData::new().set_or_clear_reaction(None::<Reaction>);
5296 /// ```
5297 pub fn set_or_clear_reaction<T>(mut self, v: std::option::Option<T>) -> Self
5298 where
5299 T: std::convert::Into<crate::model::Reaction>,
5300 {
5301 self.reaction = v.map(|x| x.into());
5302 self
5303 }
5304}
5305
5306impl wkt::message::Message for ReactionDeletedEventData {
5307 fn typename() -> &'static str {
5308 "type.googleapis.com/google.chat.v1.ReactionDeletedEventData"
5309 }
5310}
5311
5312/// Event payload for multiple new reactions.
5313///
5314/// Event type: `google.workspace.chat.reaction.v1.batchCreated`
5315#[derive(Clone, Default, PartialEq)]
5316#[non_exhaustive]
5317pub struct ReactionBatchCreatedEventData {
5318 /// A list of new reactions.
5319 pub reactions: std::vec::Vec<crate::model::ReactionCreatedEventData>,
5320
5321 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5322}
5323
5324impl ReactionBatchCreatedEventData {
5325 /// Creates a new default instance.
5326 pub fn new() -> Self {
5327 std::default::Default::default()
5328 }
5329
5330 /// Sets the value of [reactions][crate::model::ReactionBatchCreatedEventData::reactions].
5331 ///
5332 /// # Example
5333 /// ```ignore,no_run
5334 /// # use google_chat_v1::model::ReactionBatchCreatedEventData;
5335 /// use google_chat_v1::model::ReactionCreatedEventData;
5336 /// let x = ReactionBatchCreatedEventData::new()
5337 /// .set_reactions([
5338 /// ReactionCreatedEventData::default()/* use setters */,
5339 /// ReactionCreatedEventData::default()/* use (different) setters */,
5340 /// ]);
5341 /// ```
5342 pub fn set_reactions<T, V>(mut self, v: T) -> Self
5343 where
5344 T: std::iter::IntoIterator<Item = V>,
5345 V: std::convert::Into<crate::model::ReactionCreatedEventData>,
5346 {
5347 use std::iter::Iterator;
5348 self.reactions = v.into_iter().map(|i| i.into()).collect();
5349 self
5350 }
5351}
5352
5353impl wkt::message::Message for ReactionBatchCreatedEventData {
5354 fn typename() -> &'static str {
5355 "type.googleapis.com/google.chat.v1.ReactionBatchCreatedEventData"
5356 }
5357}
5358
5359/// Event payload for multiple deleted reactions.
5360///
5361/// Event type: `google.workspace.chat.reaction.v1.batchDeleted`
5362#[derive(Clone, Default, PartialEq)]
5363#[non_exhaustive]
5364pub struct ReactionBatchDeletedEventData {
5365 /// A list of deleted reactions.
5366 pub reactions: std::vec::Vec<crate::model::ReactionDeletedEventData>,
5367
5368 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5369}
5370
5371impl ReactionBatchDeletedEventData {
5372 /// Creates a new default instance.
5373 pub fn new() -> Self {
5374 std::default::Default::default()
5375 }
5376
5377 /// Sets the value of [reactions][crate::model::ReactionBatchDeletedEventData::reactions].
5378 ///
5379 /// # Example
5380 /// ```ignore,no_run
5381 /// # use google_chat_v1::model::ReactionBatchDeletedEventData;
5382 /// use google_chat_v1::model::ReactionDeletedEventData;
5383 /// let x = ReactionBatchDeletedEventData::new()
5384 /// .set_reactions([
5385 /// ReactionDeletedEventData::default()/* use setters */,
5386 /// ReactionDeletedEventData::default()/* use (different) setters */,
5387 /// ]);
5388 /// ```
5389 pub fn set_reactions<T, V>(mut self, v: T) -> Self
5390 where
5391 T: std::iter::IntoIterator<Item = V>,
5392 V: std::convert::Into<crate::model::ReactionDeletedEventData>,
5393 {
5394 use std::iter::Iterator;
5395 self.reactions = v.into_iter().map(|i| i.into()).collect();
5396 self
5397 }
5398}
5399
5400impl wkt::message::Message for ReactionBatchDeletedEventData {
5401 fn typename() -> &'static str {
5402 "type.googleapis.com/google.chat.v1.ReactionBatchDeletedEventData"
5403 }
5404}
5405
5406/// A Google Group in Google Chat.
5407#[derive(Clone, Default, PartialEq)]
5408#[non_exhaustive]
5409pub struct Group {
5410 /// Resource name for a Google Group.
5411 ///
5412 /// Represents a
5413 /// [group](https://cloud.google.com/identity/docs/reference/rest/v1/groups) in
5414 /// Cloud Identity Groups API.
5415 ///
5416 /// Format: groups/{group}
5417 pub name: std::string::String,
5418
5419 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5420}
5421
5422impl Group {
5423 /// Creates a new default instance.
5424 pub fn new() -> Self {
5425 std::default::Default::default()
5426 }
5427
5428 /// Sets the value of [name][crate::model::Group::name].
5429 ///
5430 /// # Example
5431 /// ```ignore,no_run
5432 /// # use google_chat_v1::model::Group;
5433 /// let x = Group::new().set_name("example");
5434 /// ```
5435 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5436 self.name = v.into();
5437 self
5438 }
5439}
5440
5441impl wkt::message::Message for Group {
5442 fn typename() -> &'static str {
5443 "type.googleapis.com/google.chat.v1.Group"
5444 }
5445}
5446
5447/// A matched URL in a Chat message. Chat apps can preview matched URLs. For more
5448/// information, see [Preview
5449/// links](https://developers.google.com/chat/how-tos/preview-links).
5450#[derive(Clone, Default, PartialEq)]
5451#[non_exhaustive]
5452pub struct MatchedUrl {
5453 /// Output only. The URL that was matched.
5454 pub url: std::string::String,
5455
5456 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5457}
5458
5459impl MatchedUrl {
5460 /// Creates a new default instance.
5461 pub fn new() -> Self {
5462 std::default::Default::default()
5463 }
5464
5465 /// Sets the value of [url][crate::model::MatchedUrl::url].
5466 ///
5467 /// # Example
5468 /// ```ignore,no_run
5469 /// # use google_chat_v1::model::MatchedUrl;
5470 /// let x = MatchedUrl::new().set_url("example");
5471 /// ```
5472 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5473 self.url = v.into();
5474 self
5475 }
5476}
5477
5478impl wkt::message::Message for MatchedUrl {
5479 fn typename() -> &'static str {
5480 "type.googleapis.com/google.chat.v1.MatchedUrl"
5481 }
5482}
5483
5484/// Represents a membership relation in Google Chat, such as whether a user or
5485/// Chat app is invited to, part of, or absent from a space.
5486#[derive(Clone, Default, PartialEq)]
5487#[non_exhaustive]
5488pub struct Membership {
5489 /// Identifier. Resource name of the membership, assigned by the server.
5490 ///
5491 /// Format: `spaces/{space}/members/{member}`
5492 pub name: std::string::String,
5493
5494 /// Output only. State of the membership.
5495 pub state: crate::model::membership::MembershipState,
5496
5497 /// Optional. User's role within a Chat space, which determines their permitted
5498 /// actions in the space.
5499 ///
5500 /// This field can only be used as input in `UpdateMembership`.
5501 pub role: crate::model::membership::MembershipRole,
5502
5503 /// Optional. Immutable. The creation time of the membership, such as when a
5504 /// member joined or was invited to join a space. This field is output only,
5505 /// except when used to import historical memberships in import mode spaces.
5506 pub create_time: std::option::Option<wkt::Timestamp>,
5507
5508 /// Optional. Immutable. The deletion time of the membership, such as when a
5509 /// member left or was removed from a space. This field is output only, except
5510 /// when used to import historical memberships in import mode spaces.
5511 pub delete_time: std::option::Option<wkt::Timestamp>,
5512
5513 /// Output only. A user's relationship to the Workspace organization that owns
5514 /// the space. In spaces owned by consumer accounts, the affiliation of all
5515 /// members is `EXTERNAL`.
5516 pub affiliation: crate::model::membership::Affiliation,
5517
5518 /// Member associated with this membership. Other member types might be
5519 /// supported in the future.
5520 pub member_type: std::option::Option<crate::model::membership::MemberType>,
5521
5522 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5523}
5524
5525impl Membership {
5526 /// Creates a new default instance.
5527 pub fn new() -> Self {
5528 std::default::Default::default()
5529 }
5530
5531 /// Sets the value of [name][crate::model::Membership::name].
5532 ///
5533 /// # Example
5534 /// ```ignore,no_run
5535 /// # use google_chat_v1::model::Membership;
5536 /// # let space_id = "space_id";
5537 /// # let member_id = "member_id";
5538 /// let x = Membership::new().set_name(format!("spaces/{space_id}/members/{member_id}"));
5539 /// ```
5540 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5541 self.name = v.into();
5542 self
5543 }
5544
5545 /// Sets the value of [state][crate::model::Membership::state].
5546 ///
5547 /// # Example
5548 /// ```ignore,no_run
5549 /// # use google_chat_v1::model::Membership;
5550 /// use google_chat_v1::model::membership::MembershipState;
5551 /// let x0 = Membership::new().set_state(MembershipState::Joined);
5552 /// let x1 = Membership::new().set_state(MembershipState::Invited);
5553 /// let x2 = Membership::new().set_state(MembershipState::NotAMember);
5554 /// ```
5555 pub fn set_state<T: std::convert::Into<crate::model::membership::MembershipState>>(
5556 mut self,
5557 v: T,
5558 ) -> Self {
5559 self.state = v.into();
5560 self
5561 }
5562
5563 /// Sets the value of [role][crate::model::Membership::role].
5564 ///
5565 /// # Example
5566 /// ```ignore,no_run
5567 /// # use google_chat_v1::model::Membership;
5568 /// use google_chat_v1::model::membership::MembershipRole;
5569 /// let x0 = Membership::new().set_role(MembershipRole::RoleMember);
5570 /// let x1 = Membership::new().set_role(MembershipRole::RoleManager);
5571 /// let x2 = Membership::new().set_role(MembershipRole::RoleAssistantManager);
5572 /// ```
5573 pub fn set_role<T: std::convert::Into<crate::model::membership::MembershipRole>>(
5574 mut self,
5575 v: T,
5576 ) -> Self {
5577 self.role = v.into();
5578 self
5579 }
5580
5581 /// Sets the value of [create_time][crate::model::Membership::create_time].
5582 ///
5583 /// # Example
5584 /// ```ignore,no_run
5585 /// # use google_chat_v1::model::Membership;
5586 /// use wkt::Timestamp;
5587 /// let x = Membership::new().set_create_time(Timestamp::default()/* use setters */);
5588 /// ```
5589 pub fn set_create_time<T>(mut self, v: T) -> Self
5590 where
5591 T: std::convert::Into<wkt::Timestamp>,
5592 {
5593 self.create_time = std::option::Option::Some(v.into());
5594 self
5595 }
5596
5597 /// Sets or clears the value of [create_time][crate::model::Membership::create_time].
5598 ///
5599 /// # Example
5600 /// ```ignore,no_run
5601 /// # use google_chat_v1::model::Membership;
5602 /// use wkt::Timestamp;
5603 /// let x = Membership::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5604 /// let x = Membership::new().set_or_clear_create_time(None::<Timestamp>);
5605 /// ```
5606 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5607 where
5608 T: std::convert::Into<wkt::Timestamp>,
5609 {
5610 self.create_time = v.map(|x| x.into());
5611 self
5612 }
5613
5614 /// Sets the value of [delete_time][crate::model::Membership::delete_time].
5615 ///
5616 /// # Example
5617 /// ```ignore,no_run
5618 /// # use google_chat_v1::model::Membership;
5619 /// use wkt::Timestamp;
5620 /// let x = Membership::new().set_delete_time(Timestamp::default()/* use setters */);
5621 /// ```
5622 pub fn set_delete_time<T>(mut self, v: T) -> Self
5623 where
5624 T: std::convert::Into<wkt::Timestamp>,
5625 {
5626 self.delete_time = std::option::Option::Some(v.into());
5627 self
5628 }
5629
5630 /// Sets or clears the value of [delete_time][crate::model::Membership::delete_time].
5631 ///
5632 /// # Example
5633 /// ```ignore,no_run
5634 /// # use google_chat_v1::model::Membership;
5635 /// use wkt::Timestamp;
5636 /// let x = Membership::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
5637 /// let x = Membership::new().set_or_clear_delete_time(None::<Timestamp>);
5638 /// ```
5639 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
5640 where
5641 T: std::convert::Into<wkt::Timestamp>,
5642 {
5643 self.delete_time = v.map(|x| x.into());
5644 self
5645 }
5646
5647 /// Sets the value of [affiliation][crate::model::Membership::affiliation].
5648 ///
5649 /// # Example
5650 /// ```ignore,no_run
5651 /// # use google_chat_v1::model::Membership;
5652 /// use google_chat_v1::model::membership::Affiliation;
5653 /// let x0 = Membership::new().set_affiliation(Affiliation::Internal);
5654 /// let x1 = Membership::new().set_affiliation(Affiliation::External);
5655 /// let x2 = Membership::new().set_affiliation(Affiliation::ManagedExternal);
5656 /// ```
5657 pub fn set_affiliation<T: std::convert::Into<crate::model::membership::Affiliation>>(
5658 mut self,
5659 v: T,
5660 ) -> Self {
5661 self.affiliation = v.into();
5662 self
5663 }
5664
5665 /// Sets the value of [member_type][crate::model::Membership::member_type].
5666 ///
5667 /// Note that all the setters affecting `member_type` are mutually
5668 /// exclusive.
5669 ///
5670 /// # Example
5671 /// ```ignore,no_run
5672 /// # use google_chat_v1::model::Membership;
5673 /// use google_chat_v1::model::User;
5674 /// let x = Membership::new().set_member_type(Some(
5675 /// google_chat_v1::model::membership::MemberType::Member(User::default().into())));
5676 /// ```
5677 pub fn set_member_type<
5678 T: std::convert::Into<std::option::Option<crate::model::membership::MemberType>>,
5679 >(
5680 mut self,
5681 v: T,
5682 ) -> Self {
5683 self.member_type = v.into();
5684 self
5685 }
5686
5687 /// The value of [member_type][crate::model::Membership::member_type]
5688 /// if it holds a `Member`, `None` if the field is not set or
5689 /// holds a different branch.
5690 pub fn member(&self) -> std::option::Option<&std::boxed::Box<crate::model::User>> {
5691 #[allow(unreachable_patterns)]
5692 self.member_type.as_ref().and_then(|v| match v {
5693 crate::model::membership::MemberType::Member(v) => std::option::Option::Some(v),
5694 _ => std::option::Option::None,
5695 })
5696 }
5697
5698 /// Sets the value of [member_type][crate::model::Membership::member_type]
5699 /// to hold a `Member`.
5700 ///
5701 /// Note that all the setters affecting `member_type` are
5702 /// mutually exclusive.
5703 ///
5704 /// # Example
5705 /// ```ignore,no_run
5706 /// # use google_chat_v1::model::Membership;
5707 /// use google_chat_v1::model::User;
5708 /// let x = Membership::new().set_member(User::default()/* use setters */);
5709 /// assert!(x.member().is_some());
5710 /// assert!(x.group_member().is_none());
5711 /// ```
5712 pub fn set_member<T: std::convert::Into<std::boxed::Box<crate::model::User>>>(
5713 mut self,
5714 v: T,
5715 ) -> Self {
5716 self.member_type =
5717 std::option::Option::Some(crate::model::membership::MemberType::Member(v.into()));
5718 self
5719 }
5720
5721 /// The value of [member_type][crate::model::Membership::member_type]
5722 /// if it holds a `GroupMember`, `None` if the field is not set or
5723 /// holds a different branch.
5724 pub fn group_member(&self) -> std::option::Option<&std::boxed::Box<crate::model::Group>> {
5725 #[allow(unreachable_patterns)]
5726 self.member_type.as_ref().and_then(|v| match v {
5727 crate::model::membership::MemberType::GroupMember(v) => std::option::Option::Some(v),
5728 _ => std::option::Option::None,
5729 })
5730 }
5731
5732 /// Sets the value of [member_type][crate::model::Membership::member_type]
5733 /// to hold a `GroupMember`.
5734 ///
5735 /// Note that all the setters affecting `member_type` are
5736 /// mutually exclusive.
5737 ///
5738 /// # Example
5739 /// ```ignore,no_run
5740 /// # use google_chat_v1::model::Membership;
5741 /// use google_chat_v1::model::Group;
5742 /// let x = Membership::new().set_group_member(Group::default()/* use setters */);
5743 /// assert!(x.group_member().is_some());
5744 /// assert!(x.member().is_none());
5745 /// ```
5746 pub fn set_group_member<T: std::convert::Into<std::boxed::Box<crate::model::Group>>>(
5747 mut self,
5748 v: T,
5749 ) -> Self {
5750 self.member_type =
5751 std::option::Option::Some(crate::model::membership::MemberType::GroupMember(v.into()));
5752 self
5753 }
5754}
5755
5756impl wkt::message::Message for Membership {
5757 fn typename() -> &'static str {
5758 "type.googleapis.com/google.chat.v1.Membership"
5759 }
5760}
5761
5762/// Defines additional types related to [Membership].
5763pub mod membership {
5764 #[allow(unused_imports)]
5765 use super::*;
5766
5767 /// Specifies the member's relationship with a space. Other membership states
5768 /// might be supported in the future.
5769 ///
5770 /// # Working with unknown values
5771 ///
5772 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5773 /// additional enum variants at any time. Adding new variants is not considered
5774 /// a breaking change. Applications should write their code in anticipation of:
5775 ///
5776 /// - New values appearing in future releases of the client library, **and**
5777 /// - New values received dynamically, without application changes.
5778 ///
5779 /// Please consult the [Working with enums] section in the user guide for some
5780 /// guidelines.
5781 ///
5782 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5783 #[derive(Clone, Debug, PartialEq)]
5784 #[non_exhaustive]
5785 pub enum MembershipState {
5786 /// Default value. Don't use.
5787 Unspecified,
5788 /// The user is added to the space, and can participate in the space.
5789 Joined,
5790 /// The user is invited to join the space, but hasn't joined it.
5791 Invited,
5792 /// The user doesn't belong to the space and doesn't have a pending
5793 /// invitation to join the space.
5794 NotAMember,
5795 /// If set, the enum was initialized with an unknown value.
5796 ///
5797 /// Applications can examine the value using [MembershipState::value] or
5798 /// [MembershipState::name].
5799 UnknownValue(membership_state::UnknownValue),
5800 }
5801
5802 #[doc(hidden)]
5803 pub mod membership_state {
5804 #[allow(unused_imports)]
5805 use super::*;
5806 #[derive(Clone, Debug, PartialEq)]
5807 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5808 }
5809
5810 impl MembershipState {
5811 /// Gets the enum value.
5812 ///
5813 /// Returns `None` if the enum contains an unknown value deserialized from
5814 /// the string representation of enums.
5815 pub fn value(&self) -> std::option::Option<i32> {
5816 match self {
5817 Self::Unspecified => std::option::Option::Some(0),
5818 Self::Joined => std::option::Option::Some(1),
5819 Self::Invited => std::option::Option::Some(2),
5820 Self::NotAMember => std::option::Option::Some(3),
5821 Self::UnknownValue(u) => u.0.value(),
5822 }
5823 }
5824
5825 /// Gets the enum value as a string.
5826 ///
5827 /// Returns `None` if the enum contains an unknown value deserialized from
5828 /// the integer representation of enums.
5829 pub fn name(&self) -> std::option::Option<&str> {
5830 match self {
5831 Self::Unspecified => std::option::Option::Some("MEMBERSHIP_STATE_UNSPECIFIED"),
5832 Self::Joined => std::option::Option::Some("JOINED"),
5833 Self::Invited => std::option::Option::Some("INVITED"),
5834 Self::NotAMember => std::option::Option::Some("NOT_A_MEMBER"),
5835 Self::UnknownValue(u) => u.0.name(),
5836 }
5837 }
5838 }
5839
5840 impl std::default::Default for MembershipState {
5841 fn default() -> Self {
5842 use std::convert::From;
5843 Self::from(0)
5844 }
5845 }
5846
5847 impl std::fmt::Display for MembershipState {
5848 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5849 wkt::internal::display_enum(f, self.name(), self.value())
5850 }
5851 }
5852
5853 impl std::convert::From<i32> for MembershipState {
5854 fn from(value: i32) -> Self {
5855 match value {
5856 0 => Self::Unspecified,
5857 1 => Self::Joined,
5858 2 => Self::Invited,
5859 3 => Self::NotAMember,
5860 _ => Self::UnknownValue(membership_state::UnknownValue(
5861 wkt::internal::UnknownEnumValue::Integer(value),
5862 )),
5863 }
5864 }
5865 }
5866
5867 impl std::convert::From<&str> for MembershipState {
5868 fn from(value: &str) -> Self {
5869 use std::string::ToString;
5870 match value {
5871 "MEMBERSHIP_STATE_UNSPECIFIED" => Self::Unspecified,
5872 "JOINED" => Self::Joined,
5873 "INVITED" => Self::Invited,
5874 "NOT_A_MEMBER" => Self::NotAMember,
5875 _ => Self::UnknownValue(membership_state::UnknownValue(
5876 wkt::internal::UnknownEnumValue::String(value.to_string()),
5877 )),
5878 }
5879 }
5880 }
5881
5882 impl serde::ser::Serialize for MembershipState {
5883 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5884 where
5885 S: serde::Serializer,
5886 {
5887 match self {
5888 Self::Unspecified => serializer.serialize_i32(0),
5889 Self::Joined => serializer.serialize_i32(1),
5890 Self::Invited => serializer.serialize_i32(2),
5891 Self::NotAMember => serializer.serialize_i32(3),
5892 Self::UnknownValue(u) => u.0.serialize(serializer),
5893 }
5894 }
5895 }
5896
5897 impl<'de> serde::de::Deserialize<'de> for MembershipState {
5898 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5899 where
5900 D: serde::Deserializer<'de>,
5901 {
5902 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MembershipState>::new(
5903 ".google.chat.v1.Membership.MembershipState",
5904 ))
5905 }
5906 }
5907
5908 /// Represents a user's permitted actions in a Chat space. More enum values
5909 /// might be added in the future.
5910 ///
5911 /// # Working with unknown values
5912 ///
5913 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5914 /// additional enum variants at any time. Adding new variants is not considered
5915 /// a breaking change. Applications should write their code in anticipation of:
5916 ///
5917 /// - New values appearing in future releases of the client library, **and**
5918 /// - New values received dynamically, without application changes.
5919 ///
5920 /// Please consult the [Working with enums] section in the user guide for some
5921 /// guidelines.
5922 ///
5923 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5924 #[derive(Clone, Debug, PartialEq)]
5925 #[non_exhaustive]
5926 pub enum MembershipRole {
5927 /// Default value. For [users][google.chat.v1.Membership.member]: they
5928 /// aren't a member of the space, but can be invited. For
5929 /// [Google Groups][google.chat.v1.Membership.group_member]: they're always
5930 /// assigned this role (other enum values might be used in the future).
5931 ///
5932 /// [google.chat.v1.Membership.group_member]: crate::model::Membership::member_type
5933 /// [google.chat.v1.Membership.member]: crate::model::Membership::member_type
5934 Unspecified,
5935 /// A member of the space. In the Chat UI, this role is called Member.
5936 ///
5937 /// The user has basic permissions, like sending
5938 /// messages to the space.
5939 /// Managers and owners can grant members additional permissions in a space,
5940 /// including:
5941 ///
5942 /// - Add or remove members.
5943 /// - Modify space details.
5944 /// - Turn history on or off.
5945 /// - Mention everyone in the space with `@all`.
5946 /// - Manage Chat apps and webhooks installed in the space.
5947 ///
5948 /// In direct messages and unnamed group conversations, everyone
5949 /// has this role.
5950 RoleMember,
5951 /// A space owner. In the Chat UI, this role is called Owner.
5952 ///
5953 /// The user has the complete set of space permissions to manage the space,
5954 /// including:
5955 ///
5956 /// - Change the role of other members in the space to member, manager, or
5957 /// owner.
5958 /// - Delete the space.
5959 ///
5960 /// Only supported in
5961 /// [SpaceType.SPACE][google.chat.v1.Space.SpaceType] (named spaces).
5962 ///
5963 /// To learn more, see
5964 /// [Learn more about your role as a space
5965 /// owner or manager](https://support.google.com/chat/answer/11833441).
5966 ///
5967 /// [google.chat.v1.Space.SpaceType]: crate::model::space::SpaceType
5968 RoleManager,
5969 /// A space manager. In the Chat UI, this role is called Manager.
5970 ///
5971 /// The user has all basic permissions of `ROLE_MEMBER`,
5972 /// and can be granted a subset of administrative permissions by an owner.
5973 /// By default, managers have all the permissions of an owner except for the
5974 /// ability to:
5975 ///
5976 /// - Delete the space.
5977 /// - Make another space member an owner.
5978 /// - Change an owner's role.
5979 ///
5980 /// By default, managers permissions include but aren't limited to:
5981 ///
5982 /// - Make another member a manager.
5983 /// - Delete messages in the space.
5984 /// - Manage space permissions.
5985 /// - Receive notifications for requests to join the space if the manager
5986 /// has the "manage members" permission in the space settings.
5987 /// - Make a space discoverable.
5988 ///
5989 /// Only supported in
5990 /// [SpaceType.SPACE][google.chat.v1.Space.SpaceType] (named spaces).
5991 ///
5992 /// To learn more, see
5993 /// [Manage space settings](https://support.google.com/chat/answer/13340792).
5994 ///
5995 /// [google.chat.v1.Space.SpaceType]: crate::model::space::SpaceType
5996 RoleAssistantManager,
5997 /// If set, the enum was initialized with an unknown value.
5998 ///
5999 /// Applications can examine the value using [MembershipRole::value] or
6000 /// [MembershipRole::name].
6001 UnknownValue(membership_role::UnknownValue),
6002 }
6003
6004 #[doc(hidden)]
6005 pub mod membership_role {
6006 #[allow(unused_imports)]
6007 use super::*;
6008 #[derive(Clone, Debug, PartialEq)]
6009 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6010 }
6011
6012 impl MembershipRole {
6013 /// Gets the enum value.
6014 ///
6015 /// Returns `None` if the enum contains an unknown value deserialized from
6016 /// the string representation of enums.
6017 pub fn value(&self) -> std::option::Option<i32> {
6018 match self {
6019 Self::Unspecified => std::option::Option::Some(0),
6020 Self::RoleMember => std::option::Option::Some(1),
6021 Self::RoleManager => std::option::Option::Some(2),
6022 Self::RoleAssistantManager => std::option::Option::Some(4),
6023 Self::UnknownValue(u) => u.0.value(),
6024 }
6025 }
6026
6027 /// Gets the enum value as a string.
6028 ///
6029 /// Returns `None` if the enum contains an unknown value deserialized from
6030 /// the integer representation of enums.
6031 pub fn name(&self) -> std::option::Option<&str> {
6032 match self {
6033 Self::Unspecified => std::option::Option::Some("MEMBERSHIP_ROLE_UNSPECIFIED"),
6034 Self::RoleMember => std::option::Option::Some("ROLE_MEMBER"),
6035 Self::RoleManager => std::option::Option::Some("ROLE_MANAGER"),
6036 Self::RoleAssistantManager => std::option::Option::Some("ROLE_ASSISTANT_MANAGER"),
6037 Self::UnknownValue(u) => u.0.name(),
6038 }
6039 }
6040 }
6041
6042 impl std::default::Default for MembershipRole {
6043 fn default() -> Self {
6044 use std::convert::From;
6045 Self::from(0)
6046 }
6047 }
6048
6049 impl std::fmt::Display for MembershipRole {
6050 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6051 wkt::internal::display_enum(f, self.name(), self.value())
6052 }
6053 }
6054
6055 impl std::convert::From<i32> for MembershipRole {
6056 fn from(value: i32) -> Self {
6057 match value {
6058 0 => Self::Unspecified,
6059 1 => Self::RoleMember,
6060 2 => Self::RoleManager,
6061 4 => Self::RoleAssistantManager,
6062 _ => Self::UnknownValue(membership_role::UnknownValue(
6063 wkt::internal::UnknownEnumValue::Integer(value),
6064 )),
6065 }
6066 }
6067 }
6068
6069 impl std::convert::From<&str> for MembershipRole {
6070 fn from(value: &str) -> Self {
6071 use std::string::ToString;
6072 match value {
6073 "MEMBERSHIP_ROLE_UNSPECIFIED" => Self::Unspecified,
6074 "ROLE_MEMBER" => Self::RoleMember,
6075 "ROLE_MANAGER" => Self::RoleManager,
6076 "ROLE_ASSISTANT_MANAGER" => Self::RoleAssistantManager,
6077 _ => Self::UnknownValue(membership_role::UnknownValue(
6078 wkt::internal::UnknownEnumValue::String(value.to_string()),
6079 )),
6080 }
6081 }
6082 }
6083
6084 impl serde::ser::Serialize for MembershipRole {
6085 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6086 where
6087 S: serde::Serializer,
6088 {
6089 match self {
6090 Self::Unspecified => serializer.serialize_i32(0),
6091 Self::RoleMember => serializer.serialize_i32(1),
6092 Self::RoleManager => serializer.serialize_i32(2),
6093 Self::RoleAssistantManager => serializer.serialize_i32(4),
6094 Self::UnknownValue(u) => u.0.serialize(serializer),
6095 }
6096 }
6097 }
6098
6099 impl<'de> serde::de::Deserialize<'de> for MembershipRole {
6100 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6101 where
6102 D: serde::Deserializer<'de>,
6103 {
6104 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MembershipRole>::new(
6105 ".google.chat.v1.Membership.MembershipRole",
6106 ))
6107 }
6108 }
6109
6110 /// Represents the affiliation of a user to the Google Workspace organization
6111 /// that owns the space. This enum may have more values added in the future.
6112 ///
6113 /// # Working with unknown values
6114 ///
6115 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6116 /// additional enum variants at any time. Adding new variants is not considered
6117 /// a breaking change. Applications should write their code in anticipation of:
6118 ///
6119 /// - New values appearing in future releases of the client library, **and**
6120 /// - New values received dynamically, without application changes.
6121 ///
6122 /// Please consult the [Working with enums] section in the user guide for some
6123 /// guidelines.
6124 ///
6125 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6126 #[derive(Clone, Debug, PartialEq)]
6127 #[non_exhaustive]
6128 pub enum Affiliation {
6129 /// Default value. This value is unused.
6130 Unspecified,
6131 /// An account managed by the same Google Workspace organization that owns
6132 /// the space.
6133 Internal,
6134 /// An account external to the Google Workspace organization that owns the
6135 /// space (e.g., a consumer account, or an account managed by a different
6136 /// Workspace organization).
6137 External,
6138 /// An account managed by the Workspace organization that owns the space,
6139 /// but provisioned for a user who is external to the organization (e.g., a
6140 /// Guest user). To learn more about guests, see
6141 /// <https://support.google.com/chat/answer/16997417>.
6142 ManagedExternal,
6143 /// If set, the enum was initialized with an unknown value.
6144 ///
6145 /// Applications can examine the value using [Affiliation::value] or
6146 /// [Affiliation::name].
6147 UnknownValue(affiliation::UnknownValue),
6148 }
6149
6150 #[doc(hidden)]
6151 pub mod affiliation {
6152 #[allow(unused_imports)]
6153 use super::*;
6154 #[derive(Clone, Debug, PartialEq)]
6155 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6156 }
6157
6158 impl Affiliation {
6159 /// Gets the enum value.
6160 ///
6161 /// Returns `None` if the enum contains an unknown value deserialized from
6162 /// the string representation of enums.
6163 pub fn value(&self) -> std::option::Option<i32> {
6164 match self {
6165 Self::Unspecified => std::option::Option::Some(0),
6166 Self::Internal => std::option::Option::Some(1),
6167 Self::External => std::option::Option::Some(2),
6168 Self::ManagedExternal => std::option::Option::Some(3),
6169 Self::UnknownValue(u) => u.0.value(),
6170 }
6171 }
6172
6173 /// Gets the enum value as a string.
6174 ///
6175 /// Returns `None` if the enum contains an unknown value deserialized from
6176 /// the integer representation of enums.
6177 pub fn name(&self) -> std::option::Option<&str> {
6178 match self {
6179 Self::Unspecified => std::option::Option::Some("AFFILIATION_UNSPECIFIED"),
6180 Self::Internal => std::option::Option::Some("INTERNAL"),
6181 Self::External => std::option::Option::Some("EXTERNAL"),
6182 Self::ManagedExternal => std::option::Option::Some("MANAGED_EXTERNAL"),
6183 Self::UnknownValue(u) => u.0.name(),
6184 }
6185 }
6186 }
6187
6188 impl std::default::Default for Affiliation {
6189 fn default() -> Self {
6190 use std::convert::From;
6191 Self::from(0)
6192 }
6193 }
6194
6195 impl std::fmt::Display for Affiliation {
6196 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6197 wkt::internal::display_enum(f, self.name(), self.value())
6198 }
6199 }
6200
6201 impl std::convert::From<i32> for Affiliation {
6202 fn from(value: i32) -> Self {
6203 match value {
6204 0 => Self::Unspecified,
6205 1 => Self::Internal,
6206 2 => Self::External,
6207 3 => Self::ManagedExternal,
6208 _ => Self::UnknownValue(affiliation::UnknownValue(
6209 wkt::internal::UnknownEnumValue::Integer(value),
6210 )),
6211 }
6212 }
6213 }
6214
6215 impl std::convert::From<&str> for Affiliation {
6216 fn from(value: &str) -> Self {
6217 use std::string::ToString;
6218 match value {
6219 "AFFILIATION_UNSPECIFIED" => Self::Unspecified,
6220 "INTERNAL" => Self::Internal,
6221 "EXTERNAL" => Self::External,
6222 "MANAGED_EXTERNAL" => Self::ManagedExternal,
6223 _ => Self::UnknownValue(affiliation::UnknownValue(
6224 wkt::internal::UnknownEnumValue::String(value.to_string()),
6225 )),
6226 }
6227 }
6228 }
6229
6230 impl serde::ser::Serialize for Affiliation {
6231 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6232 where
6233 S: serde::Serializer,
6234 {
6235 match self {
6236 Self::Unspecified => serializer.serialize_i32(0),
6237 Self::Internal => serializer.serialize_i32(1),
6238 Self::External => serializer.serialize_i32(2),
6239 Self::ManagedExternal => serializer.serialize_i32(3),
6240 Self::UnknownValue(u) => u.0.serialize(serializer),
6241 }
6242 }
6243 }
6244
6245 impl<'de> serde::de::Deserialize<'de> for Affiliation {
6246 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6247 where
6248 D: serde::Deserializer<'de>,
6249 {
6250 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Affiliation>::new(
6251 ".google.chat.v1.Membership.Affiliation",
6252 ))
6253 }
6254 }
6255
6256 /// Member associated with this membership. Other member types might be
6257 /// supported in the future.
6258 #[derive(Clone, Debug, PartialEq)]
6259 #[non_exhaustive]
6260 pub enum MemberType {
6261 /// Optional. The Google Chat user or app the membership corresponds to.
6262 /// If your Chat app [authenticates as a
6263 /// user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
6264 /// the output populates the
6265 /// [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User)
6266 /// `name` and `type`.
6267 Member(std::boxed::Box<crate::model::User>),
6268 /// Optional. The Google Group the membership corresponds to.
6269 ///
6270 /// Reading or mutating memberships for Google Groups requires [user
6271 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
6272 GroupMember(std::boxed::Box<crate::model::Group>),
6273 }
6274}
6275
6276/// Request message for creating a membership.
6277#[derive(Clone, Default, PartialEq)]
6278#[non_exhaustive]
6279pub struct CreateMembershipRequest {
6280 /// Required. The resource name of the space for which to create the
6281 /// membership.
6282 ///
6283 /// Format: spaces/{space}
6284 pub parent: std::string::String,
6285
6286 /// Required. The membership relation to create.
6287 ///
6288 /// The `memberType` field must contain a user with the `user.name` and
6289 /// `user.type` fields populated. The server will assign a resource name
6290 /// and overwrite anything specified.
6291 ///
6292 /// When a Chat app creates a membership relation for a human user, it must use
6293 /// certain authorization scopes and set specific values for certain fields:
6294 ///
6295 /// - When [authenticating as a
6296 /// user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
6297 /// the `chat.memberships` authorization scope is required.
6298 ///
6299 /// - When [authenticating as an
6300 /// app](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app),
6301 /// the `chat.app.memberships` authorization scope is required.
6302 ///
6303 /// - Set `user.type` to `HUMAN`, and set `user.name` with format
6304 /// `users/{user}`, where `{user}` can be the email address for the user. For
6305 /// users in the same Workspace organization `{user}` can also be the `id` of
6306 /// the [person](https://developers.google.com/people/api/rest/v1/people) from
6307 /// the People API, or the `id` for the user in the Directory API. For example,
6308 /// if the People API Person profile ID for `user@example.com` is `123456789`,
6309 /// you can add the user to the space by setting the `membership.member.name`
6310 /// to `users/user@example.com` or `users/123456789`.
6311 ///
6312 ///
6313 /// Inviting users external to the Workspace organization that owns the space
6314 /// requires [user
6315 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
6316 ///
6317 /// When a Chat app creates a membership relation for itself, it must
6318 /// [authenticate as a
6319 /// user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
6320 /// and use the `chat.memberships.app` scope, set `user.type` to `BOT`, and set
6321 /// `user.name` to `users/app`.
6322 pub membership: std::option::Option<crate::model::Membership>,
6323
6324 /// Optional. When `true`, the method runs using the user's Google Workspace
6325 /// administrator privileges.
6326 ///
6327 /// The calling user must be a Google Workspace administrator with the
6328 /// [manage chat and spaces conversations
6329 /// privilege](https://support.google.com/a/answer/13369245).
6330 ///
6331 /// Requires the `chat.admin.memberships` [OAuth 2.0
6332 /// scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).
6333 ///
6334 /// Creating app memberships or creating memberships for users outside the
6335 /// administrator's Google Workspace organization isn't supported using admin
6336 /// access.
6337 pub use_admin_access: bool,
6338
6339 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6340}
6341
6342impl CreateMembershipRequest {
6343 /// Creates a new default instance.
6344 pub fn new() -> Self {
6345 std::default::Default::default()
6346 }
6347
6348 /// Sets the value of [parent][crate::model::CreateMembershipRequest::parent].
6349 ///
6350 /// # Example
6351 /// ```ignore,no_run
6352 /// # use google_chat_v1::model::CreateMembershipRequest;
6353 /// # let space_id = "space_id";
6354 /// let x = CreateMembershipRequest::new().set_parent(format!("spaces/{space_id}"));
6355 /// ```
6356 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6357 self.parent = v.into();
6358 self
6359 }
6360
6361 /// Sets the value of [membership][crate::model::CreateMembershipRequest::membership].
6362 ///
6363 /// # Example
6364 /// ```ignore,no_run
6365 /// # use google_chat_v1::model::CreateMembershipRequest;
6366 /// use google_chat_v1::model::Membership;
6367 /// let x = CreateMembershipRequest::new().set_membership(Membership::default()/* use setters */);
6368 /// ```
6369 pub fn set_membership<T>(mut self, v: T) -> Self
6370 where
6371 T: std::convert::Into<crate::model::Membership>,
6372 {
6373 self.membership = std::option::Option::Some(v.into());
6374 self
6375 }
6376
6377 /// Sets or clears the value of [membership][crate::model::CreateMembershipRequest::membership].
6378 ///
6379 /// # Example
6380 /// ```ignore,no_run
6381 /// # use google_chat_v1::model::CreateMembershipRequest;
6382 /// use google_chat_v1::model::Membership;
6383 /// let x = CreateMembershipRequest::new().set_or_clear_membership(Some(Membership::default()/* use setters */));
6384 /// let x = CreateMembershipRequest::new().set_or_clear_membership(None::<Membership>);
6385 /// ```
6386 pub fn set_or_clear_membership<T>(mut self, v: std::option::Option<T>) -> Self
6387 where
6388 T: std::convert::Into<crate::model::Membership>,
6389 {
6390 self.membership = v.map(|x| x.into());
6391 self
6392 }
6393
6394 /// Sets the value of [use_admin_access][crate::model::CreateMembershipRequest::use_admin_access].
6395 ///
6396 /// # Example
6397 /// ```ignore,no_run
6398 /// # use google_chat_v1::model::CreateMembershipRequest;
6399 /// let x = CreateMembershipRequest::new().set_use_admin_access(true);
6400 /// ```
6401 pub fn set_use_admin_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6402 self.use_admin_access = v.into();
6403 self
6404 }
6405}
6406
6407impl wkt::message::Message for CreateMembershipRequest {
6408 fn typename() -> &'static str {
6409 "type.googleapis.com/google.chat.v1.CreateMembershipRequest"
6410 }
6411}
6412
6413/// Request message for updating a membership.
6414#[derive(Clone, Default, PartialEq)]
6415#[non_exhaustive]
6416pub struct UpdateMembershipRequest {
6417 /// Required. The membership to update. Only fields specified by `update_mask`
6418 /// are updated.
6419 pub membership: std::option::Option<crate::model::Membership>,
6420
6421 /// Required. The field paths to update. Separate multiple values with commas
6422 /// or use `*` to update all field paths.
6423 ///
6424 /// Currently supported field paths:
6425 ///
6426 /// - `role`
6427 pub update_mask: std::option::Option<wkt::FieldMask>,
6428
6429 /// Optional. When `true`, the method runs using the user's Google Workspace
6430 /// administrator privileges.
6431 ///
6432 /// The calling user must be a Google Workspace administrator with the
6433 /// [manage chat and spaces conversations
6434 /// privilege](https://support.google.com/a/answer/13369245).
6435 ///
6436 /// Requires the `chat.admin.memberships` [OAuth 2.0
6437 /// scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).
6438 pub use_admin_access: bool,
6439
6440 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6441}
6442
6443impl UpdateMembershipRequest {
6444 /// Creates a new default instance.
6445 pub fn new() -> Self {
6446 std::default::Default::default()
6447 }
6448
6449 /// Sets the value of [membership][crate::model::UpdateMembershipRequest::membership].
6450 ///
6451 /// # Example
6452 /// ```ignore,no_run
6453 /// # use google_chat_v1::model::UpdateMembershipRequest;
6454 /// use google_chat_v1::model::Membership;
6455 /// let x = UpdateMembershipRequest::new().set_membership(Membership::default()/* use setters */);
6456 /// ```
6457 pub fn set_membership<T>(mut self, v: T) -> Self
6458 where
6459 T: std::convert::Into<crate::model::Membership>,
6460 {
6461 self.membership = std::option::Option::Some(v.into());
6462 self
6463 }
6464
6465 /// Sets or clears the value of [membership][crate::model::UpdateMembershipRequest::membership].
6466 ///
6467 /// # Example
6468 /// ```ignore,no_run
6469 /// # use google_chat_v1::model::UpdateMembershipRequest;
6470 /// use google_chat_v1::model::Membership;
6471 /// let x = UpdateMembershipRequest::new().set_or_clear_membership(Some(Membership::default()/* use setters */));
6472 /// let x = UpdateMembershipRequest::new().set_or_clear_membership(None::<Membership>);
6473 /// ```
6474 pub fn set_or_clear_membership<T>(mut self, v: std::option::Option<T>) -> Self
6475 where
6476 T: std::convert::Into<crate::model::Membership>,
6477 {
6478 self.membership = v.map(|x| x.into());
6479 self
6480 }
6481
6482 /// Sets the value of [update_mask][crate::model::UpdateMembershipRequest::update_mask].
6483 ///
6484 /// # Example
6485 /// ```ignore,no_run
6486 /// # use google_chat_v1::model::UpdateMembershipRequest;
6487 /// use wkt::FieldMask;
6488 /// let x = UpdateMembershipRequest::new().set_update_mask(FieldMask::default()/* use setters */);
6489 /// ```
6490 pub fn set_update_mask<T>(mut self, v: T) -> Self
6491 where
6492 T: std::convert::Into<wkt::FieldMask>,
6493 {
6494 self.update_mask = std::option::Option::Some(v.into());
6495 self
6496 }
6497
6498 /// Sets or clears the value of [update_mask][crate::model::UpdateMembershipRequest::update_mask].
6499 ///
6500 /// # Example
6501 /// ```ignore,no_run
6502 /// # use google_chat_v1::model::UpdateMembershipRequest;
6503 /// use wkt::FieldMask;
6504 /// let x = UpdateMembershipRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
6505 /// let x = UpdateMembershipRequest::new().set_or_clear_update_mask(None::<FieldMask>);
6506 /// ```
6507 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6508 where
6509 T: std::convert::Into<wkt::FieldMask>,
6510 {
6511 self.update_mask = v.map(|x| x.into());
6512 self
6513 }
6514
6515 /// Sets the value of [use_admin_access][crate::model::UpdateMembershipRequest::use_admin_access].
6516 ///
6517 /// # Example
6518 /// ```ignore,no_run
6519 /// # use google_chat_v1::model::UpdateMembershipRequest;
6520 /// let x = UpdateMembershipRequest::new().set_use_admin_access(true);
6521 /// ```
6522 pub fn set_use_admin_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6523 self.use_admin_access = v.into();
6524 self
6525 }
6526}
6527
6528impl wkt::message::Message for UpdateMembershipRequest {
6529 fn typename() -> &'static str {
6530 "type.googleapis.com/google.chat.v1.UpdateMembershipRequest"
6531 }
6532}
6533
6534/// Request message for listing memberships.
6535#[derive(Clone, Default, PartialEq)]
6536#[non_exhaustive]
6537pub struct ListMembershipsRequest {
6538 /// Required. The resource name of the space for which to fetch a membership
6539 /// list.
6540 ///
6541 /// Format: spaces/{space}
6542 pub parent: std::string::String,
6543
6544 /// Optional. The maximum number of memberships to return. The service might
6545 /// return fewer than this value.
6546 ///
6547 /// If unspecified, at most 100 memberships are returned.
6548 ///
6549 /// The maximum value is 1000. If you use a value more than 1000, it's
6550 /// automatically changed to 1000.
6551 ///
6552 /// Negative values return an `INVALID_ARGUMENT` error.
6553 pub page_size: i32,
6554
6555 /// Optional. A page token, received from a previous call to list memberships.
6556 /// Provide this parameter to retrieve the subsequent page.
6557 ///
6558 /// When paginating, all other parameters provided should match the call that
6559 /// provided the page token. Passing different values to the other parameters
6560 /// might lead to unexpected results.
6561 pub page_token: std::string::String,
6562
6563 /// Optional. A query filter.
6564 ///
6565 /// You can filter memberships by a member's role
6566 /// ([`role`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#membershiprole))
6567 /// and type
6568 /// ([`member.type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/User#type)).
6569 ///
6570 /// To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`.
6571 ///
6572 /// To filter by type, set `member.type` to `HUMAN` or `BOT`. You can also
6573 /// filter for `member.type` using the `!=` operator.
6574 ///
6575 /// To filter by both role and type, use the `AND` operator. To filter by
6576 /// either role or type, use the `OR` operator.
6577 ///
6578 /// Either `member.type = "HUMAN"` or `member.type != "BOT"` is required
6579 /// when `use_admin_access` is set to true. Other member type filters will be
6580 /// rejected.
6581 ///
6582 /// For example, the following queries are valid:
6583 ///
6584 /// ```norust
6585 /// role = "ROLE_MANAGER" OR role = "ROLE_MEMBER"
6586 /// member.type = "HUMAN" AND role = "ROLE_MANAGER"
6587 ///
6588 /// member.type != "BOT"
6589 /// ```
6590 ///
6591 /// The following queries are invalid:
6592 ///
6593 /// ```norust
6594 /// member.type = "HUMAN" AND member.type = "BOT"
6595 /// role = "ROLE_MANAGER" AND role = "ROLE_MEMBER"
6596 /// ```
6597 ///
6598 /// Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
6599 /// error.
6600 pub filter: std::string::String,
6601
6602 /// Optional. When `true`, also returns memberships associated with a
6603 /// [Google Group][google.chat.v1.Membership.group_member], in
6604 /// addition to other types of memberships. If a
6605 /// [filter][google.chat.v1.ListMembershipsRequest.filter] is set,
6606 /// [Google Group][google.chat.v1.Membership.group_member]
6607 /// memberships that don't match the filter criteria aren't returned.
6608 ///
6609 /// [google.chat.v1.ListMembershipsRequest.filter]: crate::model::ListMembershipsRequest::filter
6610 /// [google.chat.v1.Membership.group_member]: crate::model::Membership::member_type
6611 pub show_groups: bool,
6612
6613 /// Optional. When `true`, also returns memberships associated with
6614 /// [invited][google.chat.v1.Membership.MembershipState.INVITED] members, in
6615 /// addition to other types of memberships. If a
6616 /// filter is set,
6617 /// [invited][google.chat.v1.Membership.MembershipState.INVITED] memberships
6618 /// that don't match the filter criteria aren't returned.
6619 ///
6620 /// Currently requires [user
6621 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
6622 ///
6623 /// [google.chat.v1.Membership.MembershipState.INVITED]: crate::model::membership::MembershipState::Invited
6624 pub show_invited: bool,
6625
6626 /// Optional. When `true`, the method runs using the user's Google Workspace
6627 /// administrator privileges.
6628 ///
6629 /// The calling user must be a Google Workspace administrator with the
6630 /// [manage chat and spaces conversations
6631 /// privilege](https://support.google.com/a/answer/13369245).
6632 ///
6633 /// Requires either the `chat.admin.memberships.readonly` or
6634 /// `chat.admin.memberships` [OAuth 2.0
6635 /// scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).
6636 ///
6637 /// Listing app memberships in a space isn't supported when using admin access.
6638 pub use_admin_access: bool,
6639
6640 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6641}
6642
6643impl ListMembershipsRequest {
6644 /// Creates a new default instance.
6645 pub fn new() -> Self {
6646 std::default::Default::default()
6647 }
6648
6649 /// Sets the value of [parent][crate::model::ListMembershipsRequest::parent].
6650 ///
6651 /// # Example
6652 /// ```ignore,no_run
6653 /// # use google_chat_v1::model::ListMembershipsRequest;
6654 /// # let space_id = "space_id";
6655 /// let x = ListMembershipsRequest::new().set_parent(format!("spaces/{space_id}"));
6656 /// ```
6657 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6658 self.parent = v.into();
6659 self
6660 }
6661
6662 /// Sets the value of [page_size][crate::model::ListMembershipsRequest::page_size].
6663 ///
6664 /// # Example
6665 /// ```ignore,no_run
6666 /// # use google_chat_v1::model::ListMembershipsRequest;
6667 /// let x = ListMembershipsRequest::new().set_page_size(42);
6668 /// ```
6669 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6670 self.page_size = v.into();
6671 self
6672 }
6673
6674 /// Sets the value of [page_token][crate::model::ListMembershipsRequest::page_token].
6675 ///
6676 /// # Example
6677 /// ```ignore,no_run
6678 /// # use google_chat_v1::model::ListMembershipsRequest;
6679 /// let x = ListMembershipsRequest::new().set_page_token("example");
6680 /// ```
6681 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6682 self.page_token = v.into();
6683 self
6684 }
6685
6686 /// Sets the value of [filter][crate::model::ListMembershipsRequest::filter].
6687 ///
6688 /// # Example
6689 /// ```ignore,no_run
6690 /// # use google_chat_v1::model::ListMembershipsRequest;
6691 /// let x = ListMembershipsRequest::new().set_filter("example");
6692 /// ```
6693 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6694 self.filter = v.into();
6695 self
6696 }
6697
6698 /// Sets the value of [show_groups][crate::model::ListMembershipsRequest::show_groups].
6699 ///
6700 /// # Example
6701 /// ```ignore,no_run
6702 /// # use google_chat_v1::model::ListMembershipsRequest;
6703 /// let x = ListMembershipsRequest::new().set_show_groups(true);
6704 /// ```
6705 pub fn set_show_groups<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6706 self.show_groups = v.into();
6707 self
6708 }
6709
6710 /// Sets the value of [show_invited][crate::model::ListMembershipsRequest::show_invited].
6711 ///
6712 /// # Example
6713 /// ```ignore,no_run
6714 /// # use google_chat_v1::model::ListMembershipsRequest;
6715 /// let x = ListMembershipsRequest::new().set_show_invited(true);
6716 /// ```
6717 pub fn set_show_invited<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6718 self.show_invited = v.into();
6719 self
6720 }
6721
6722 /// Sets the value of [use_admin_access][crate::model::ListMembershipsRequest::use_admin_access].
6723 ///
6724 /// # Example
6725 /// ```ignore,no_run
6726 /// # use google_chat_v1::model::ListMembershipsRequest;
6727 /// let x = ListMembershipsRequest::new().set_use_admin_access(true);
6728 /// ```
6729 pub fn set_use_admin_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6730 self.use_admin_access = v.into();
6731 self
6732 }
6733}
6734
6735impl wkt::message::Message for ListMembershipsRequest {
6736 fn typename() -> &'static str {
6737 "type.googleapis.com/google.chat.v1.ListMembershipsRequest"
6738 }
6739}
6740
6741/// Response to list memberships of the space.
6742#[derive(Clone, Default, PartialEq)]
6743#[non_exhaustive]
6744pub struct ListMembershipsResponse {
6745 /// Unordered list. List of memberships in the requested (or first) page.
6746 pub memberships: std::vec::Vec<crate::model::Membership>,
6747
6748 /// A token that you can send as `pageToken` to retrieve the next page of
6749 /// results. If empty, there are no subsequent pages.
6750 pub next_page_token: std::string::String,
6751
6752 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6753}
6754
6755impl ListMembershipsResponse {
6756 /// Creates a new default instance.
6757 pub fn new() -> Self {
6758 std::default::Default::default()
6759 }
6760
6761 /// Sets the value of [memberships][crate::model::ListMembershipsResponse::memberships].
6762 ///
6763 /// # Example
6764 /// ```ignore,no_run
6765 /// # use google_chat_v1::model::ListMembershipsResponse;
6766 /// use google_chat_v1::model::Membership;
6767 /// let x = ListMembershipsResponse::new()
6768 /// .set_memberships([
6769 /// Membership::default()/* use setters */,
6770 /// Membership::default()/* use (different) setters */,
6771 /// ]);
6772 /// ```
6773 pub fn set_memberships<T, V>(mut self, v: T) -> Self
6774 where
6775 T: std::iter::IntoIterator<Item = V>,
6776 V: std::convert::Into<crate::model::Membership>,
6777 {
6778 use std::iter::Iterator;
6779 self.memberships = v.into_iter().map(|i| i.into()).collect();
6780 self
6781 }
6782
6783 /// Sets the value of [next_page_token][crate::model::ListMembershipsResponse::next_page_token].
6784 ///
6785 /// # Example
6786 /// ```ignore,no_run
6787 /// # use google_chat_v1::model::ListMembershipsResponse;
6788 /// let x = ListMembershipsResponse::new().set_next_page_token("example");
6789 /// ```
6790 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6791 self.next_page_token = v.into();
6792 self
6793 }
6794}
6795
6796impl wkt::message::Message for ListMembershipsResponse {
6797 fn typename() -> &'static str {
6798 "type.googleapis.com/google.chat.v1.ListMembershipsResponse"
6799 }
6800}
6801
6802#[doc(hidden)]
6803impl google_cloud_gax::paginator::internal::PageableResponse for ListMembershipsResponse {
6804 type PageItem = crate::model::Membership;
6805
6806 fn items(self) -> std::vec::Vec<Self::PageItem> {
6807 self.memberships
6808 }
6809
6810 fn next_page_token(&self) -> std::string::String {
6811 use std::clone::Clone;
6812 self.next_page_token.clone()
6813 }
6814}
6815
6816/// Request to get a membership of a space.
6817#[derive(Clone, Default, PartialEq)]
6818#[non_exhaustive]
6819pub struct GetMembershipRequest {
6820 /// Required. Resource name of the membership to retrieve.
6821 ///
6822 /// To get the app's own membership [by using user
6823 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
6824 /// you can optionally use `spaces/{space}/members/app`.
6825 ///
6826 /// Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`
6827 ///
6828 /// You can use the user's email as an alias for `{member}`. For example,
6829 /// `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the
6830 /// email of the Google Chat user.
6831 pub name: std::string::String,
6832
6833 /// Optional. When `true`, the method runs using the user's Google Workspace
6834 /// administrator privileges.
6835 ///
6836 /// The calling user must be a Google Workspace administrator with the
6837 /// [manage chat and spaces conversations
6838 /// privilege](https://support.google.com/a/answer/13369245).
6839 ///
6840 /// Requires the `chat.admin.memberships` or `chat.admin.memberships.readonly`
6841 /// [OAuth 2.0
6842 /// scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).
6843 ///
6844 /// Getting app memberships in a space isn't supported when using admin access.
6845 pub use_admin_access: bool,
6846
6847 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6848}
6849
6850impl GetMembershipRequest {
6851 /// Creates a new default instance.
6852 pub fn new() -> Self {
6853 std::default::Default::default()
6854 }
6855
6856 /// Sets the value of [name][crate::model::GetMembershipRequest::name].
6857 ///
6858 /// # Example
6859 /// ```ignore,no_run
6860 /// # use google_chat_v1::model::GetMembershipRequest;
6861 /// # let space_id = "space_id";
6862 /// # let member_id = "member_id";
6863 /// let x = GetMembershipRequest::new().set_name(format!("spaces/{space_id}/members/{member_id}"));
6864 /// ```
6865 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6866 self.name = v.into();
6867 self
6868 }
6869
6870 /// Sets the value of [use_admin_access][crate::model::GetMembershipRequest::use_admin_access].
6871 ///
6872 /// # Example
6873 /// ```ignore,no_run
6874 /// # use google_chat_v1::model::GetMembershipRequest;
6875 /// let x = GetMembershipRequest::new().set_use_admin_access(true);
6876 /// ```
6877 pub fn set_use_admin_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6878 self.use_admin_access = v.into();
6879 self
6880 }
6881}
6882
6883impl wkt::message::Message for GetMembershipRequest {
6884 fn typename() -> &'static str {
6885 "type.googleapis.com/google.chat.v1.GetMembershipRequest"
6886 }
6887}
6888
6889/// Request to delete a membership in a space.
6890#[derive(Clone, Default, PartialEq)]
6891#[non_exhaustive]
6892pub struct DeleteMembershipRequest {
6893 /// Required. Resource name of the membership to delete. Chat apps can delete
6894 /// human users' or their own memberships. Chat apps can't delete other apps'
6895 /// memberships.
6896 ///
6897 /// When deleting a human membership, requires the `chat.memberships` scope
6898 /// with [user
6899 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
6900 /// or the `chat.memberships.app` scope with [app
6901 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
6902 /// and the `spaces/{space}/members/{member}` format.
6903 /// You can use the email as an alias for `{member}`. For example,
6904 /// `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the
6905 /// email of the Google Chat user.
6906 ///
6907 /// When deleting an app membership, requires the `chat.memberships.app` scope
6908 /// and `spaces/{space}/members/app` format.
6909 ///
6910 /// Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`.
6911 pub name: std::string::String,
6912
6913 /// Optional. When `true`, the method runs using the user's Google Workspace
6914 /// administrator privileges.
6915 ///
6916 /// The calling user must be a Google Workspace administrator with the
6917 /// [manage chat and spaces conversations
6918 /// privilege](https://support.google.com/a/answer/13369245).
6919 ///
6920 /// Requires the `chat.admin.memberships` [OAuth 2.0
6921 /// scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).
6922 ///
6923 /// Deleting app memberships in a space isn't supported using admin access.
6924 pub use_admin_access: bool,
6925
6926 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6927}
6928
6929impl DeleteMembershipRequest {
6930 /// Creates a new default instance.
6931 pub fn new() -> Self {
6932 std::default::Default::default()
6933 }
6934
6935 /// Sets the value of [name][crate::model::DeleteMembershipRequest::name].
6936 ///
6937 /// # Example
6938 /// ```ignore,no_run
6939 /// # use google_chat_v1::model::DeleteMembershipRequest;
6940 /// # let space_id = "space_id";
6941 /// # let member_id = "member_id";
6942 /// let x = DeleteMembershipRequest::new().set_name(format!("spaces/{space_id}/members/{member_id}"));
6943 /// ```
6944 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6945 self.name = v.into();
6946 self
6947 }
6948
6949 /// Sets the value of [use_admin_access][crate::model::DeleteMembershipRequest::use_admin_access].
6950 ///
6951 /// # Example
6952 /// ```ignore,no_run
6953 /// # use google_chat_v1::model::DeleteMembershipRequest;
6954 /// let x = DeleteMembershipRequest::new().set_use_admin_access(true);
6955 /// ```
6956 pub fn set_use_admin_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6957 self.use_admin_access = v.into();
6958 self
6959 }
6960}
6961
6962impl wkt::message::Message for DeleteMembershipRequest {
6963 fn typename() -> &'static str {
6964 "type.googleapis.com/google.chat.v1.DeleteMembershipRequest"
6965 }
6966}
6967
6968/// A message in a Google Chat space.
6969#[derive(Clone, Default, PartialEq)]
6970#[non_exhaustive]
6971pub struct Message {
6972 /// Identifier. Resource name of the message.
6973 ///
6974 /// Format: `spaces/{space}/messages/{message}`
6975 ///
6976 /// Where `{space}` is the ID of the space where the message is posted and
6977 /// `{message}` is a system-assigned ID for the message. For example,
6978 /// `spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB`.
6979 ///
6980 /// If you set a custom ID when you create a message, you can use this ID to
6981 /// specify the message in a request by replacing `{message}` with the value
6982 /// from the `clientAssignedMessageId` field. For example,
6983 /// `spaces/AAAAAAAAAAA/messages/client-custom-name`. For details, see [Name
6984 /// a
6985 /// message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message).
6986 pub name: std::string::String,
6987
6988 /// Output only. The user who created the message.
6989 /// If your Chat app [authenticates as a
6990 /// user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
6991 /// the output populates the
6992 /// [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User)
6993 /// `name` and `type`.
6994 pub sender: std::option::Option<crate::model::User>,
6995
6996 /// Optional. Immutable. For spaces created in Chat, the time at which the
6997 /// message was created. This field is output only, except when used in import
6998 /// mode spaces.
6999 ///
7000 /// For import mode spaces, set this field to the historical timestamp at which
7001 /// the message was created in the source in order to preserve the original
7002 /// creation time.
7003 pub create_time: std::option::Option<wkt::Timestamp>,
7004
7005 /// Output only. The time at which the message was last edited by a user. If
7006 /// the message has never been edited, this field is empty.
7007 pub last_update_time: std::option::Option<wkt::Timestamp>,
7008
7009 /// Output only. The time at which the message was deleted in
7010 /// Google Chat. If the message is never deleted, this field is empty.
7011 pub delete_time: std::option::Option<wkt::Timestamp>,
7012
7013 /// Optional. Plain-text body of the message. The first link to an image,
7014 /// video, or web page generates a [preview
7015 /// chip](https://developers.google.com/workspace/chat/preview-links). You can
7016 /// also [@mention a Google Chat
7017 /// user](https://developers.google.com/workspace/chat/format-messages#messages-@mention),
7018 /// or everyone in the space.
7019 ///
7020 /// To learn about creating text messages, see [Send a
7021 /// message](https://developers.google.com/workspace/chat/create-messages).
7022 pub text: std::string::String,
7023
7024 /// Output only. Contains the message `text` with markups added to communicate
7025 /// formatting. This field might not capture all formatting visible in the UI,
7026 /// but includes the following:
7027 ///
7028 /// * [Markup
7029 /// syntax](https://developers.google.com/workspace/chat/format-messages)
7030 /// for bold, italic, strikethrough, monospace, monospace block, bulleted
7031 /// list, and block quote.
7032 ///
7033 /// * [User
7034 /// mentions](https://developers.google.com/workspace/chat/format-messages#messages-@mention)
7035 /// using the format `<users/{user}>`.
7036 ///
7037 /// * Custom hyperlinks using the format `<{url}|{rendered_text}>` where the
7038 /// first string is the URL and the second is the rendered text—for example,
7039 /// `<<http://example.com>|custom text>`.
7040 ///
7041 /// * Custom emoji using the format `:{emoji_name}:`—for example, `:smile:`.
7042 /// This doesn't apply to Unicode emoji, such as `U+1F600` for a grinning
7043 /// face emoji.
7044 ///
7045 /// * Bullet list items using asterisks (`*`)—for example, `* item`.
7046 ///
7047 ///
7048 /// For more information, see [View text formatting sent in a
7049 /// message](https://developers.google.com/workspace/chat/format-messages#view_text_formatting_sent_in_a_message)
7050 pub formatted_text: std::string::String,
7051
7052 /// Deprecated: Use `cards_v2` instead.
7053 ///
7054 /// Rich, formatted, and interactive cards that you can use to display UI
7055 /// elements such as: formatted texts, buttons, and clickable images. Cards are
7056 /// normally displayed below the plain-text body of the message. `cards` and
7057 /// `cards_v2` can have a maximum size of 32 KB.
7058 #[deprecated]
7059 pub cards: std::vec::Vec<crate::model::contextual_add_on_markup::Card>,
7060
7061 /// Optional. An array of
7062 /// [cards](https://developers.google.com/workspace/chat/api/reference/rest/v1/cards).
7063 ///
7064 /// Chat apps can create cards with [app
7065 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).
7066 /// As part of the [Developer Preview
7067 /// Program](https://developers.google.com/workspace/preview), if your Chat app
7068 /// [authenticates as a
7069 /// user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
7070 /// it can create card messages. If your Chat app is not part of Developer
7071 /// Preview Program, it can't create cards with user authentication.
7072 ///
7073 /// To learn how to create a message that contains cards, see [Send a
7074 /// message](https://developers.google.com/workspace/chat/create-messages).
7075 ///
7076 /// [Card builder](https://addons.gsuite.google.com/uikit/builder)
7077 pub cards_v2: std::vec::Vec<crate::model::CardWithId>,
7078
7079 /// Output only. Annotations can be associated with the plain-text body of the
7080 /// message or with chips that link to Google Workspace resources like Google
7081 /// Docs or Sheets with `start_index` and `length` of 0.
7082 pub annotations: std::vec::Vec<crate::model::Annotation>,
7083
7084 /// The thread the message belongs to. For example usage, see
7085 /// [Start or reply to a message
7086 /// thread](https://developers.google.com/workspace/chat/create-messages#create-message-thread).
7087 pub thread: std::option::Option<crate::model::Thread>,
7088
7089 /// Output only. If your Chat app [authenticates as a
7090 /// user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
7091 /// the output only populates the
7092 /// [space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces)
7093 /// `name`.
7094 pub space: std::option::Option<crate::model::Space>,
7095
7096 /// Optional. A plain-text description of the message's cards, used when the
7097 /// actual cards can't be displayed—for example, mobile notifications.
7098 pub fallback_text: std::string::String,
7099
7100 /// Input only. Parameters that a Chat app can use to configure how its
7101 /// response is posted.
7102 pub action_response: std::option::Option<crate::model::ActionResponse>,
7103
7104 /// Output only. Plain-text body of the message with all Chat app mentions
7105 /// stripped out.
7106 pub argument_text: std::string::String,
7107
7108 /// Output only. Slash command information, if applicable.
7109 pub slash_command: std::option::Option<crate::model::SlashCommand>,
7110
7111 /// Optional. User-uploaded attachment.
7112 pub attachment: std::vec::Vec<crate::model::Attachment>,
7113
7114 /// Output only. A URL in the Chat message `text` field that matches a link
7115 /// preview pattern. For more information, see [Preview
7116 /// links](https://developers.google.com/workspace/chat/preview-links).
7117 pub matched_url: std::option::Option<crate::model::MatchedUrl>,
7118
7119 /// Output only. When `true`, the message is a response in a reply thread. When
7120 /// `false`, the message is visible in the space's top-level conversation as
7121 /// either the first message of a thread or a message with no threaded replies.
7122 ///
7123 /// If the space doesn't support reply in threads, this field is always
7124 /// `false`.
7125 pub thread_reply: bool,
7126
7127 /// Output only. Whether this is a silent message. Silent messages are messages
7128 /// where Chat suppresses push notifications for recipients.
7129 pub silent: bool,
7130
7131 /// Optional. A custom ID for the message. You can use field to identify a
7132 /// message, or to get, delete, or update a message. To set a custom ID,
7133 /// specify the
7134 /// [`messageId`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/create#body.QUERY_PARAMETERS.message_id)
7135 /// field when you create the message. For details, see [Name a
7136 /// message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message).
7137 pub client_assigned_message_id: std::string::String,
7138
7139 /// Output only. The list of emoji reaction summaries on the message.
7140 pub emoji_reaction_summaries: std::vec::Vec<crate::model::EmojiReactionSummary>,
7141
7142 /// Optional. Immutable. Input for creating a message, otherwise output only.
7143 /// The user that can view the message. When set, the message is private and
7144 /// only visible to the specified user and the Chat app. To include this field
7145 /// in your request, you must call the Chat API using [app
7146 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
7147 /// and omit the following:
7148 ///
7149 /// * [Attachments](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages.attachments)
7150 ///
7151 /// For details, see [Send a message
7152 /// privately](https://developers.google.com/workspace/chat/create-messages#private).
7153 pub private_message_viewer: std::option::Option<crate::model::User>,
7154
7155 /// Output only. Information about a deleted message. A message is deleted when
7156 /// `delete_time` is set.
7157 pub deletion_metadata: std::option::Option<crate::model::DeletionMetadata>,
7158
7159 /// Optional. Information about a message that another message quotes.
7160 ///
7161 /// When you create a message, you can quote messages within the same
7162 /// thread, or quote a root message to create a new root message.
7163 /// However, you can't quote a message reply from a different thread.
7164 ///
7165 /// When you update a message, you can't add or replace the
7166 /// `quotedMessageMetadata` field, but you can remove it.
7167 ///
7168 /// For example usage, see [Quote another
7169 /// message](https://developers.google.com/workspace/chat/create-messages#quote-a-message).
7170 pub quoted_message_metadata: std::option::Option<crate::model::QuotedMessageMetadata>,
7171
7172 /// Output only. GIF images that are attached to the message.
7173 pub attached_gifs: std::vec::Vec<crate::model::AttachedGif>,
7174
7175 /// Optional. One or more interactive widgets that appear at the bottom of a
7176 /// message. You can add accessory widgets to messages that contain text,
7177 /// cards, or both text and cards. Not supported for messages that contain
7178 /// dialogs. For details, see [Add interactive widgets at the bottom of a
7179 /// message](https://developers.google.com/workspace/chat/create-messages#add-accessory-widgets).
7180 ///
7181 /// Creating a message with accessory widgets requires [app
7182 /// authentication]
7183 /// (<https://developers.google.com/workspace/chat/authenticate-authorize-chat-app>).
7184 pub accessory_widgets: std::vec::Vec<crate::model::AccessoryWidget>,
7185
7186 /// Optional. Specifies how the server interprets the message `text` field
7187 /// content.
7188 pub markup_syntax: crate::model::MarkupSyntax,
7189
7190 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7191}
7192
7193impl Message {
7194 /// Creates a new default instance.
7195 pub fn new() -> Self {
7196 std::default::Default::default()
7197 }
7198
7199 /// Sets the value of [name][crate::model::Message::name].
7200 ///
7201 /// # Example
7202 /// ```ignore,no_run
7203 /// # use google_chat_v1::model::Message;
7204 /// # let space_id = "space_id";
7205 /// # let message_id = "message_id";
7206 /// let x = Message::new().set_name(format!("spaces/{space_id}/messages/{message_id}"));
7207 /// ```
7208 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7209 self.name = v.into();
7210 self
7211 }
7212
7213 /// Sets the value of [sender][crate::model::Message::sender].
7214 ///
7215 /// # Example
7216 /// ```ignore,no_run
7217 /// # use google_chat_v1::model::Message;
7218 /// use google_chat_v1::model::User;
7219 /// let x = Message::new().set_sender(User::default()/* use setters */);
7220 /// ```
7221 pub fn set_sender<T>(mut self, v: T) -> Self
7222 where
7223 T: std::convert::Into<crate::model::User>,
7224 {
7225 self.sender = std::option::Option::Some(v.into());
7226 self
7227 }
7228
7229 /// Sets or clears the value of [sender][crate::model::Message::sender].
7230 ///
7231 /// # Example
7232 /// ```ignore,no_run
7233 /// # use google_chat_v1::model::Message;
7234 /// use google_chat_v1::model::User;
7235 /// let x = Message::new().set_or_clear_sender(Some(User::default()/* use setters */));
7236 /// let x = Message::new().set_or_clear_sender(None::<User>);
7237 /// ```
7238 pub fn set_or_clear_sender<T>(mut self, v: std::option::Option<T>) -> Self
7239 where
7240 T: std::convert::Into<crate::model::User>,
7241 {
7242 self.sender = v.map(|x| x.into());
7243 self
7244 }
7245
7246 /// Sets the value of [create_time][crate::model::Message::create_time].
7247 ///
7248 /// # Example
7249 /// ```ignore,no_run
7250 /// # use google_chat_v1::model::Message;
7251 /// use wkt::Timestamp;
7252 /// let x = Message::new().set_create_time(Timestamp::default()/* use setters */);
7253 /// ```
7254 pub fn set_create_time<T>(mut self, v: T) -> Self
7255 where
7256 T: std::convert::Into<wkt::Timestamp>,
7257 {
7258 self.create_time = std::option::Option::Some(v.into());
7259 self
7260 }
7261
7262 /// Sets or clears the value of [create_time][crate::model::Message::create_time].
7263 ///
7264 /// # Example
7265 /// ```ignore,no_run
7266 /// # use google_chat_v1::model::Message;
7267 /// use wkt::Timestamp;
7268 /// let x = Message::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7269 /// let x = Message::new().set_or_clear_create_time(None::<Timestamp>);
7270 /// ```
7271 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7272 where
7273 T: std::convert::Into<wkt::Timestamp>,
7274 {
7275 self.create_time = v.map(|x| x.into());
7276 self
7277 }
7278
7279 /// Sets the value of [last_update_time][crate::model::Message::last_update_time].
7280 ///
7281 /// # Example
7282 /// ```ignore,no_run
7283 /// # use google_chat_v1::model::Message;
7284 /// use wkt::Timestamp;
7285 /// let x = Message::new().set_last_update_time(Timestamp::default()/* use setters */);
7286 /// ```
7287 pub fn set_last_update_time<T>(mut self, v: T) -> Self
7288 where
7289 T: std::convert::Into<wkt::Timestamp>,
7290 {
7291 self.last_update_time = std::option::Option::Some(v.into());
7292 self
7293 }
7294
7295 /// Sets or clears the value of [last_update_time][crate::model::Message::last_update_time].
7296 ///
7297 /// # Example
7298 /// ```ignore,no_run
7299 /// # use google_chat_v1::model::Message;
7300 /// use wkt::Timestamp;
7301 /// let x = Message::new().set_or_clear_last_update_time(Some(Timestamp::default()/* use setters */));
7302 /// let x = Message::new().set_or_clear_last_update_time(None::<Timestamp>);
7303 /// ```
7304 pub fn set_or_clear_last_update_time<T>(mut self, v: std::option::Option<T>) -> Self
7305 where
7306 T: std::convert::Into<wkt::Timestamp>,
7307 {
7308 self.last_update_time = v.map(|x| x.into());
7309 self
7310 }
7311
7312 /// Sets the value of [delete_time][crate::model::Message::delete_time].
7313 ///
7314 /// # Example
7315 /// ```ignore,no_run
7316 /// # use google_chat_v1::model::Message;
7317 /// use wkt::Timestamp;
7318 /// let x = Message::new().set_delete_time(Timestamp::default()/* use setters */);
7319 /// ```
7320 pub fn set_delete_time<T>(mut self, v: T) -> Self
7321 where
7322 T: std::convert::Into<wkt::Timestamp>,
7323 {
7324 self.delete_time = std::option::Option::Some(v.into());
7325 self
7326 }
7327
7328 /// Sets or clears the value of [delete_time][crate::model::Message::delete_time].
7329 ///
7330 /// # Example
7331 /// ```ignore,no_run
7332 /// # use google_chat_v1::model::Message;
7333 /// use wkt::Timestamp;
7334 /// let x = Message::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
7335 /// let x = Message::new().set_or_clear_delete_time(None::<Timestamp>);
7336 /// ```
7337 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
7338 where
7339 T: std::convert::Into<wkt::Timestamp>,
7340 {
7341 self.delete_time = v.map(|x| x.into());
7342 self
7343 }
7344
7345 /// Sets the value of [text][crate::model::Message::text].
7346 ///
7347 /// # Example
7348 /// ```ignore,no_run
7349 /// # use google_chat_v1::model::Message;
7350 /// let x = Message::new().set_text("example");
7351 /// ```
7352 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7353 self.text = v.into();
7354 self
7355 }
7356
7357 /// Sets the value of [formatted_text][crate::model::Message::formatted_text].
7358 ///
7359 /// # Example
7360 /// ```ignore,no_run
7361 /// # use google_chat_v1::model::Message;
7362 /// let x = Message::new().set_formatted_text("example");
7363 /// ```
7364 pub fn set_formatted_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7365 self.formatted_text = v.into();
7366 self
7367 }
7368
7369 /// Sets the value of [cards][crate::model::Message::cards].
7370 ///
7371 /// # Example
7372 /// ```ignore,no_run
7373 /// # use google_chat_v1::model::Message;
7374 /// use google_chat_v1::model::contextual_add_on_markup::Card;
7375 /// let x = Message::new()
7376 /// .set_cards([
7377 /// Card::default()/* use setters */,
7378 /// Card::default()/* use (different) setters */,
7379 /// ]);
7380 /// ```
7381 #[deprecated]
7382 pub fn set_cards<T, V>(mut self, v: T) -> Self
7383 where
7384 T: std::iter::IntoIterator<Item = V>,
7385 V: std::convert::Into<crate::model::contextual_add_on_markup::Card>,
7386 {
7387 use std::iter::Iterator;
7388 self.cards = v.into_iter().map(|i| i.into()).collect();
7389 self
7390 }
7391
7392 /// Sets the value of [cards_v2][crate::model::Message::cards_v2].
7393 ///
7394 /// # Example
7395 /// ```ignore,no_run
7396 /// # use google_chat_v1::model::Message;
7397 /// use google_chat_v1::model::CardWithId;
7398 /// let x = Message::new()
7399 /// .set_cards_v2([
7400 /// CardWithId::default()/* use setters */,
7401 /// CardWithId::default()/* use (different) setters */,
7402 /// ]);
7403 /// ```
7404 pub fn set_cards_v2<T, V>(mut self, v: T) -> Self
7405 where
7406 T: std::iter::IntoIterator<Item = V>,
7407 V: std::convert::Into<crate::model::CardWithId>,
7408 {
7409 use std::iter::Iterator;
7410 self.cards_v2 = v.into_iter().map(|i| i.into()).collect();
7411 self
7412 }
7413
7414 /// Sets the value of [annotations][crate::model::Message::annotations].
7415 ///
7416 /// # Example
7417 /// ```ignore,no_run
7418 /// # use google_chat_v1::model::Message;
7419 /// use google_chat_v1::model::Annotation;
7420 /// let x = Message::new()
7421 /// .set_annotations([
7422 /// Annotation::default()/* use setters */,
7423 /// Annotation::default()/* use (different) setters */,
7424 /// ]);
7425 /// ```
7426 pub fn set_annotations<T, V>(mut self, v: T) -> Self
7427 where
7428 T: std::iter::IntoIterator<Item = V>,
7429 V: std::convert::Into<crate::model::Annotation>,
7430 {
7431 use std::iter::Iterator;
7432 self.annotations = v.into_iter().map(|i| i.into()).collect();
7433 self
7434 }
7435
7436 /// Sets the value of [thread][crate::model::Message::thread].
7437 ///
7438 /// # Example
7439 /// ```ignore,no_run
7440 /// # use google_chat_v1::model::Message;
7441 /// use google_chat_v1::model::Thread;
7442 /// let x = Message::new().set_thread(Thread::default()/* use setters */);
7443 /// ```
7444 pub fn set_thread<T>(mut self, v: T) -> Self
7445 where
7446 T: std::convert::Into<crate::model::Thread>,
7447 {
7448 self.thread = std::option::Option::Some(v.into());
7449 self
7450 }
7451
7452 /// Sets or clears the value of [thread][crate::model::Message::thread].
7453 ///
7454 /// # Example
7455 /// ```ignore,no_run
7456 /// # use google_chat_v1::model::Message;
7457 /// use google_chat_v1::model::Thread;
7458 /// let x = Message::new().set_or_clear_thread(Some(Thread::default()/* use setters */));
7459 /// let x = Message::new().set_or_clear_thread(None::<Thread>);
7460 /// ```
7461 pub fn set_or_clear_thread<T>(mut self, v: std::option::Option<T>) -> Self
7462 where
7463 T: std::convert::Into<crate::model::Thread>,
7464 {
7465 self.thread = v.map(|x| x.into());
7466 self
7467 }
7468
7469 /// Sets the value of [space][crate::model::Message::space].
7470 ///
7471 /// # Example
7472 /// ```ignore,no_run
7473 /// # use google_chat_v1::model::Message;
7474 /// use google_chat_v1::model::Space;
7475 /// let x = Message::new().set_space(Space::default()/* use setters */);
7476 /// ```
7477 pub fn set_space<T>(mut self, v: T) -> Self
7478 where
7479 T: std::convert::Into<crate::model::Space>,
7480 {
7481 self.space = std::option::Option::Some(v.into());
7482 self
7483 }
7484
7485 /// Sets or clears the value of [space][crate::model::Message::space].
7486 ///
7487 /// # Example
7488 /// ```ignore,no_run
7489 /// # use google_chat_v1::model::Message;
7490 /// use google_chat_v1::model::Space;
7491 /// let x = Message::new().set_or_clear_space(Some(Space::default()/* use setters */));
7492 /// let x = Message::new().set_or_clear_space(None::<Space>);
7493 /// ```
7494 pub fn set_or_clear_space<T>(mut self, v: std::option::Option<T>) -> Self
7495 where
7496 T: std::convert::Into<crate::model::Space>,
7497 {
7498 self.space = v.map(|x| x.into());
7499 self
7500 }
7501
7502 /// Sets the value of [fallback_text][crate::model::Message::fallback_text].
7503 ///
7504 /// # Example
7505 /// ```ignore,no_run
7506 /// # use google_chat_v1::model::Message;
7507 /// let x = Message::new().set_fallback_text("example");
7508 /// ```
7509 pub fn set_fallback_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7510 self.fallback_text = v.into();
7511 self
7512 }
7513
7514 /// Sets the value of [action_response][crate::model::Message::action_response].
7515 ///
7516 /// # Example
7517 /// ```ignore,no_run
7518 /// # use google_chat_v1::model::Message;
7519 /// use google_chat_v1::model::ActionResponse;
7520 /// let x = Message::new().set_action_response(ActionResponse::default()/* use setters */);
7521 /// ```
7522 pub fn set_action_response<T>(mut self, v: T) -> Self
7523 where
7524 T: std::convert::Into<crate::model::ActionResponse>,
7525 {
7526 self.action_response = std::option::Option::Some(v.into());
7527 self
7528 }
7529
7530 /// Sets or clears the value of [action_response][crate::model::Message::action_response].
7531 ///
7532 /// # Example
7533 /// ```ignore,no_run
7534 /// # use google_chat_v1::model::Message;
7535 /// use google_chat_v1::model::ActionResponse;
7536 /// let x = Message::new().set_or_clear_action_response(Some(ActionResponse::default()/* use setters */));
7537 /// let x = Message::new().set_or_clear_action_response(None::<ActionResponse>);
7538 /// ```
7539 pub fn set_or_clear_action_response<T>(mut self, v: std::option::Option<T>) -> Self
7540 where
7541 T: std::convert::Into<crate::model::ActionResponse>,
7542 {
7543 self.action_response = v.map(|x| x.into());
7544 self
7545 }
7546
7547 /// Sets the value of [argument_text][crate::model::Message::argument_text].
7548 ///
7549 /// # Example
7550 /// ```ignore,no_run
7551 /// # use google_chat_v1::model::Message;
7552 /// let x = Message::new().set_argument_text("example");
7553 /// ```
7554 pub fn set_argument_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7555 self.argument_text = v.into();
7556 self
7557 }
7558
7559 /// Sets the value of [slash_command][crate::model::Message::slash_command].
7560 ///
7561 /// # Example
7562 /// ```ignore,no_run
7563 /// # use google_chat_v1::model::Message;
7564 /// use google_chat_v1::model::SlashCommand;
7565 /// let x = Message::new().set_slash_command(SlashCommand::default()/* use setters */);
7566 /// ```
7567 pub fn set_slash_command<T>(mut self, v: T) -> Self
7568 where
7569 T: std::convert::Into<crate::model::SlashCommand>,
7570 {
7571 self.slash_command = std::option::Option::Some(v.into());
7572 self
7573 }
7574
7575 /// Sets or clears the value of [slash_command][crate::model::Message::slash_command].
7576 ///
7577 /// # Example
7578 /// ```ignore,no_run
7579 /// # use google_chat_v1::model::Message;
7580 /// use google_chat_v1::model::SlashCommand;
7581 /// let x = Message::new().set_or_clear_slash_command(Some(SlashCommand::default()/* use setters */));
7582 /// let x = Message::new().set_or_clear_slash_command(None::<SlashCommand>);
7583 /// ```
7584 pub fn set_or_clear_slash_command<T>(mut self, v: std::option::Option<T>) -> Self
7585 where
7586 T: std::convert::Into<crate::model::SlashCommand>,
7587 {
7588 self.slash_command = v.map(|x| x.into());
7589 self
7590 }
7591
7592 /// Sets the value of [attachment][crate::model::Message::attachment].
7593 ///
7594 /// # Example
7595 /// ```ignore,no_run
7596 /// # use google_chat_v1::model::Message;
7597 /// use google_chat_v1::model::Attachment;
7598 /// let x = Message::new()
7599 /// .set_attachment([
7600 /// Attachment::default()/* use setters */,
7601 /// Attachment::default()/* use (different) setters */,
7602 /// ]);
7603 /// ```
7604 pub fn set_attachment<T, V>(mut self, v: T) -> Self
7605 where
7606 T: std::iter::IntoIterator<Item = V>,
7607 V: std::convert::Into<crate::model::Attachment>,
7608 {
7609 use std::iter::Iterator;
7610 self.attachment = v.into_iter().map(|i| i.into()).collect();
7611 self
7612 }
7613
7614 /// Sets the value of [matched_url][crate::model::Message::matched_url].
7615 ///
7616 /// # Example
7617 /// ```ignore,no_run
7618 /// # use google_chat_v1::model::Message;
7619 /// use google_chat_v1::model::MatchedUrl;
7620 /// let x = Message::new().set_matched_url(MatchedUrl::default()/* use setters */);
7621 /// ```
7622 pub fn set_matched_url<T>(mut self, v: T) -> Self
7623 where
7624 T: std::convert::Into<crate::model::MatchedUrl>,
7625 {
7626 self.matched_url = std::option::Option::Some(v.into());
7627 self
7628 }
7629
7630 /// Sets or clears the value of [matched_url][crate::model::Message::matched_url].
7631 ///
7632 /// # Example
7633 /// ```ignore,no_run
7634 /// # use google_chat_v1::model::Message;
7635 /// use google_chat_v1::model::MatchedUrl;
7636 /// let x = Message::new().set_or_clear_matched_url(Some(MatchedUrl::default()/* use setters */));
7637 /// let x = Message::new().set_or_clear_matched_url(None::<MatchedUrl>);
7638 /// ```
7639 pub fn set_or_clear_matched_url<T>(mut self, v: std::option::Option<T>) -> Self
7640 where
7641 T: std::convert::Into<crate::model::MatchedUrl>,
7642 {
7643 self.matched_url = v.map(|x| x.into());
7644 self
7645 }
7646
7647 /// Sets the value of [thread_reply][crate::model::Message::thread_reply].
7648 ///
7649 /// # Example
7650 /// ```ignore,no_run
7651 /// # use google_chat_v1::model::Message;
7652 /// let x = Message::new().set_thread_reply(true);
7653 /// ```
7654 pub fn set_thread_reply<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7655 self.thread_reply = v.into();
7656 self
7657 }
7658
7659 /// Sets the value of [silent][crate::model::Message::silent].
7660 ///
7661 /// # Example
7662 /// ```ignore,no_run
7663 /// # use google_chat_v1::model::Message;
7664 /// let x = Message::new().set_silent(true);
7665 /// ```
7666 pub fn set_silent<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7667 self.silent = v.into();
7668 self
7669 }
7670
7671 /// Sets the value of [client_assigned_message_id][crate::model::Message::client_assigned_message_id].
7672 ///
7673 /// # Example
7674 /// ```ignore,no_run
7675 /// # use google_chat_v1::model::Message;
7676 /// let x = Message::new().set_client_assigned_message_id("example");
7677 /// ```
7678 pub fn set_client_assigned_message_id<T: std::convert::Into<std::string::String>>(
7679 mut self,
7680 v: T,
7681 ) -> Self {
7682 self.client_assigned_message_id = v.into();
7683 self
7684 }
7685
7686 /// Sets the value of [emoji_reaction_summaries][crate::model::Message::emoji_reaction_summaries].
7687 ///
7688 /// # Example
7689 /// ```ignore,no_run
7690 /// # use google_chat_v1::model::Message;
7691 /// use google_chat_v1::model::EmojiReactionSummary;
7692 /// let x = Message::new()
7693 /// .set_emoji_reaction_summaries([
7694 /// EmojiReactionSummary::default()/* use setters */,
7695 /// EmojiReactionSummary::default()/* use (different) setters */,
7696 /// ]);
7697 /// ```
7698 pub fn set_emoji_reaction_summaries<T, V>(mut self, v: T) -> Self
7699 where
7700 T: std::iter::IntoIterator<Item = V>,
7701 V: std::convert::Into<crate::model::EmojiReactionSummary>,
7702 {
7703 use std::iter::Iterator;
7704 self.emoji_reaction_summaries = v.into_iter().map(|i| i.into()).collect();
7705 self
7706 }
7707
7708 /// Sets the value of [private_message_viewer][crate::model::Message::private_message_viewer].
7709 ///
7710 /// # Example
7711 /// ```ignore,no_run
7712 /// # use google_chat_v1::model::Message;
7713 /// use google_chat_v1::model::User;
7714 /// let x = Message::new().set_private_message_viewer(User::default()/* use setters */);
7715 /// ```
7716 pub fn set_private_message_viewer<T>(mut self, v: T) -> Self
7717 where
7718 T: std::convert::Into<crate::model::User>,
7719 {
7720 self.private_message_viewer = std::option::Option::Some(v.into());
7721 self
7722 }
7723
7724 /// Sets or clears the value of [private_message_viewer][crate::model::Message::private_message_viewer].
7725 ///
7726 /// # Example
7727 /// ```ignore,no_run
7728 /// # use google_chat_v1::model::Message;
7729 /// use google_chat_v1::model::User;
7730 /// let x = Message::new().set_or_clear_private_message_viewer(Some(User::default()/* use setters */));
7731 /// let x = Message::new().set_or_clear_private_message_viewer(None::<User>);
7732 /// ```
7733 pub fn set_or_clear_private_message_viewer<T>(mut self, v: std::option::Option<T>) -> Self
7734 where
7735 T: std::convert::Into<crate::model::User>,
7736 {
7737 self.private_message_viewer = v.map(|x| x.into());
7738 self
7739 }
7740
7741 /// Sets the value of [deletion_metadata][crate::model::Message::deletion_metadata].
7742 ///
7743 /// # Example
7744 /// ```ignore,no_run
7745 /// # use google_chat_v1::model::Message;
7746 /// use google_chat_v1::model::DeletionMetadata;
7747 /// let x = Message::new().set_deletion_metadata(DeletionMetadata::default()/* use setters */);
7748 /// ```
7749 pub fn set_deletion_metadata<T>(mut self, v: T) -> Self
7750 where
7751 T: std::convert::Into<crate::model::DeletionMetadata>,
7752 {
7753 self.deletion_metadata = std::option::Option::Some(v.into());
7754 self
7755 }
7756
7757 /// Sets or clears the value of [deletion_metadata][crate::model::Message::deletion_metadata].
7758 ///
7759 /// # Example
7760 /// ```ignore,no_run
7761 /// # use google_chat_v1::model::Message;
7762 /// use google_chat_v1::model::DeletionMetadata;
7763 /// let x = Message::new().set_or_clear_deletion_metadata(Some(DeletionMetadata::default()/* use setters */));
7764 /// let x = Message::new().set_or_clear_deletion_metadata(None::<DeletionMetadata>);
7765 /// ```
7766 pub fn set_or_clear_deletion_metadata<T>(mut self, v: std::option::Option<T>) -> Self
7767 where
7768 T: std::convert::Into<crate::model::DeletionMetadata>,
7769 {
7770 self.deletion_metadata = v.map(|x| x.into());
7771 self
7772 }
7773
7774 /// Sets the value of [quoted_message_metadata][crate::model::Message::quoted_message_metadata].
7775 ///
7776 /// # Example
7777 /// ```ignore,no_run
7778 /// # use google_chat_v1::model::Message;
7779 /// use google_chat_v1::model::QuotedMessageMetadata;
7780 /// let x = Message::new().set_quoted_message_metadata(QuotedMessageMetadata::default()/* use setters */);
7781 /// ```
7782 pub fn set_quoted_message_metadata<T>(mut self, v: T) -> Self
7783 where
7784 T: std::convert::Into<crate::model::QuotedMessageMetadata>,
7785 {
7786 self.quoted_message_metadata = std::option::Option::Some(v.into());
7787 self
7788 }
7789
7790 /// Sets or clears the value of [quoted_message_metadata][crate::model::Message::quoted_message_metadata].
7791 ///
7792 /// # Example
7793 /// ```ignore,no_run
7794 /// # use google_chat_v1::model::Message;
7795 /// use google_chat_v1::model::QuotedMessageMetadata;
7796 /// let x = Message::new().set_or_clear_quoted_message_metadata(Some(QuotedMessageMetadata::default()/* use setters */));
7797 /// let x = Message::new().set_or_clear_quoted_message_metadata(None::<QuotedMessageMetadata>);
7798 /// ```
7799 pub fn set_or_clear_quoted_message_metadata<T>(mut self, v: std::option::Option<T>) -> Self
7800 where
7801 T: std::convert::Into<crate::model::QuotedMessageMetadata>,
7802 {
7803 self.quoted_message_metadata = v.map(|x| x.into());
7804 self
7805 }
7806
7807 /// Sets the value of [attached_gifs][crate::model::Message::attached_gifs].
7808 ///
7809 /// # Example
7810 /// ```ignore,no_run
7811 /// # use google_chat_v1::model::Message;
7812 /// use google_chat_v1::model::AttachedGif;
7813 /// let x = Message::new()
7814 /// .set_attached_gifs([
7815 /// AttachedGif::default()/* use setters */,
7816 /// AttachedGif::default()/* use (different) setters */,
7817 /// ]);
7818 /// ```
7819 pub fn set_attached_gifs<T, V>(mut self, v: T) -> Self
7820 where
7821 T: std::iter::IntoIterator<Item = V>,
7822 V: std::convert::Into<crate::model::AttachedGif>,
7823 {
7824 use std::iter::Iterator;
7825 self.attached_gifs = v.into_iter().map(|i| i.into()).collect();
7826 self
7827 }
7828
7829 /// Sets the value of [accessory_widgets][crate::model::Message::accessory_widgets].
7830 ///
7831 /// # Example
7832 /// ```ignore,no_run
7833 /// # use google_chat_v1::model::Message;
7834 /// use google_chat_v1::model::AccessoryWidget;
7835 /// let x = Message::new()
7836 /// .set_accessory_widgets([
7837 /// AccessoryWidget::default()/* use setters */,
7838 /// AccessoryWidget::default()/* use (different) setters */,
7839 /// ]);
7840 /// ```
7841 pub fn set_accessory_widgets<T, V>(mut self, v: T) -> Self
7842 where
7843 T: std::iter::IntoIterator<Item = V>,
7844 V: std::convert::Into<crate::model::AccessoryWidget>,
7845 {
7846 use std::iter::Iterator;
7847 self.accessory_widgets = v.into_iter().map(|i| i.into()).collect();
7848 self
7849 }
7850
7851 /// Sets the value of [markup_syntax][crate::model::Message::markup_syntax].
7852 ///
7853 /// # Example
7854 /// ```ignore,no_run
7855 /// # use google_chat_v1::model::Message;
7856 /// use google_chat_v1::model::MarkupSyntax;
7857 /// let x0 = Message::new().set_markup_syntax(MarkupSyntax::Chat);
7858 /// let x1 = Message::new().set_markup_syntax(MarkupSyntax::Markdown);
7859 /// ```
7860 pub fn set_markup_syntax<T: std::convert::Into<crate::model::MarkupSyntax>>(
7861 mut self,
7862 v: T,
7863 ) -> Self {
7864 self.markup_syntax = v.into();
7865 self
7866 }
7867}
7868
7869impl wkt::message::Message for Message {
7870 fn typename() -> &'static str {
7871 "type.googleapis.com/google.chat.v1.Message"
7872 }
7873}
7874
7875/// A GIF image that's specified by a URL.
7876#[derive(Clone, Default, PartialEq)]
7877#[non_exhaustive]
7878pub struct AttachedGif {
7879 /// Output only. The URL that hosts the GIF image.
7880 pub uri: std::string::String,
7881
7882 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7883}
7884
7885impl AttachedGif {
7886 /// Creates a new default instance.
7887 pub fn new() -> Self {
7888 std::default::Default::default()
7889 }
7890
7891 /// Sets the value of [uri][crate::model::AttachedGif::uri].
7892 ///
7893 /// # Example
7894 /// ```ignore,no_run
7895 /// # use google_chat_v1::model::AttachedGif;
7896 /// let x = AttachedGif::new().set_uri("example");
7897 /// ```
7898 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7899 self.uri = v.into();
7900 self
7901 }
7902}
7903
7904impl wkt::message::Message for AttachedGif {
7905 fn typename() -> &'static str {
7906 "type.googleapis.com/google.chat.v1.AttachedGif"
7907 }
7908}
7909
7910/// Information about a message that another message quotes.
7911///
7912/// When you update a message, you can't add or replace the
7913/// `quotedMessageMetadata` field, but you can remove it.
7914///
7915/// For example usage, see [Quote another
7916/// message](https://developers.google.com/workspace/chat/create-messages#quote-a-message).
7917#[derive(Clone, Default, PartialEq)]
7918#[non_exhaustive]
7919pub struct QuotedMessageMetadata {
7920 /// Required. Resource name of the message that is quoted.
7921 ///
7922 /// Format: `spaces/{space}/messages/{message}`
7923 pub name: std::string::String,
7924
7925 /// Required. The timestamp when the quoted message was created or when the
7926 /// quoted message was last updated.
7927 ///
7928 /// If the message was edited, use this field, `last_update_time`.
7929 /// If the message was never edited, use `create_time`.
7930 ///
7931 /// If `last_update_time` doesn't match the latest version of the quoted
7932 /// message, the request fails.
7933 pub last_update_time: std::option::Option<wkt::Timestamp>,
7934
7935 /// Optional. Specifies the quote type. If not set, defaults to REPLY in the
7936 /// message read/write path for backward compatibility.
7937 pub quote_type: crate::model::quoted_message_metadata::QuoteType,
7938
7939 /// Output only. A snapshot of the quoted message's content.
7940 pub quoted_message_snapshot: std::option::Option<crate::model::QuotedMessageSnapshot>,
7941
7942 /// Output only. Metadata about the source space of the quoted message.
7943 /// Populated only for FORWARD quote type.
7944 pub forwarded_metadata: std::option::Option<crate::model::ForwardedMetadata>,
7945
7946 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7947}
7948
7949impl QuotedMessageMetadata {
7950 /// Creates a new default instance.
7951 pub fn new() -> Self {
7952 std::default::Default::default()
7953 }
7954
7955 /// Sets the value of [name][crate::model::QuotedMessageMetadata::name].
7956 ///
7957 /// # Example
7958 /// ```ignore,no_run
7959 /// # use google_chat_v1::model::QuotedMessageMetadata;
7960 /// # let space_id = "space_id";
7961 /// # let message_id = "message_id";
7962 /// let x = QuotedMessageMetadata::new().set_name(format!("spaces/{space_id}/messages/{message_id}"));
7963 /// ```
7964 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7965 self.name = v.into();
7966 self
7967 }
7968
7969 /// Sets the value of [last_update_time][crate::model::QuotedMessageMetadata::last_update_time].
7970 ///
7971 /// # Example
7972 /// ```ignore,no_run
7973 /// # use google_chat_v1::model::QuotedMessageMetadata;
7974 /// use wkt::Timestamp;
7975 /// let x = QuotedMessageMetadata::new().set_last_update_time(Timestamp::default()/* use setters */);
7976 /// ```
7977 pub fn set_last_update_time<T>(mut self, v: T) -> Self
7978 where
7979 T: std::convert::Into<wkt::Timestamp>,
7980 {
7981 self.last_update_time = std::option::Option::Some(v.into());
7982 self
7983 }
7984
7985 /// Sets or clears the value of [last_update_time][crate::model::QuotedMessageMetadata::last_update_time].
7986 ///
7987 /// # Example
7988 /// ```ignore,no_run
7989 /// # use google_chat_v1::model::QuotedMessageMetadata;
7990 /// use wkt::Timestamp;
7991 /// let x = QuotedMessageMetadata::new().set_or_clear_last_update_time(Some(Timestamp::default()/* use setters */));
7992 /// let x = QuotedMessageMetadata::new().set_or_clear_last_update_time(None::<Timestamp>);
7993 /// ```
7994 pub fn set_or_clear_last_update_time<T>(mut self, v: std::option::Option<T>) -> Self
7995 where
7996 T: std::convert::Into<wkt::Timestamp>,
7997 {
7998 self.last_update_time = v.map(|x| x.into());
7999 self
8000 }
8001
8002 /// Sets the value of [quote_type][crate::model::QuotedMessageMetadata::quote_type].
8003 ///
8004 /// # Example
8005 /// ```ignore,no_run
8006 /// # use google_chat_v1::model::QuotedMessageMetadata;
8007 /// use google_chat_v1::model::quoted_message_metadata::QuoteType;
8008 /// let x0 = QuotedMessageMetadata::new().set_quote_type(QuoteType::Reply);
8009 /// let x1 = QuotedMessageMetadata::new().set_quote_type(QuoteType::Forward);
8010 /// ```
8011 pub fn set_quote_type<
8012 T: std::convert::Into<crate::model::quoted_message_metadata::QuoteType>,
8013 >(
8014 mut self,
8015 v: T,
8016 ) -> Self {
8017 self.quote_type = v.into();
8018 self
8019 }
8020
8021 /// Sets the value of [quoted_message_snapshot][crate::model::QuotedMessageMetadata::quoted_message_snapshot].
8022 ///
8023 /// # Example
8024 /// ```ignore,no_run
8025 /// # use google_chat_v1::model::QuotedMessageMetadata;
8026 /// use google_chat_v1::model::QuotedMessageSnapshot;
8027 /// let x = QuotedMessageMetadata::new().set_quoted_message_snapshot(QuotedMessageSnapshot::default()/* use setters */);
8028 /// ```
8029 pub fn set_quoted_message_snapshot<T>(mut self, v: T) -> Self
8030 where
8031 T: std::convert::Into<crate::model::QuotedMessageSnapshot>,
8032 {
8033 self.quoted_message_snapshot = std::option::Option::Some(v.into());
8034 self
8035 }
8036
8037 /// Sets or clears the value of [quoted_message_snapshot][crate::model::QuotedMessageMetadata::quoted_message_snapshot].
8038 ///
8039 /// # Example
8040 /// ```ignore,no_run
8041 /// # use google_chat_v1::model::QuotedMessageMetadata;
8042 /// use google_chat_v1::model::QuotedMessageSnapshot;
8043 /// let x = QuotedMessageMetadata::new().set_or_clear_quoted_message_snapshot(Some(QuotedMessageSnapshot::default()/* use setters */));
8044 /// let x = QuotedMessageMetadata::new().set_or_clear_quoted_message_snapshot(None::<QuotedMessageSnapshot>);
8045 /// ```
8046 pub fn set_or_clear_quoted_message_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
8047 where
8048 T: std::convert::Into<crate::model::QuotedMessageSnapshot>,
8049 {
8050 self.quoted_message_snapshot = v.map(|x| x.into());
8051 self
8052 }
8053
8054 /// Sets the value of [forwarded_metadata][crate::model::QuotedMessageMetadata::forwarded_metadata].
8055 ///
8056 /// # Example
8057 /// ```ignore,no_run
8058 /// # use google_chat_v1::model::QuotedMessageMetadata;
8059 /// use google_chat_v1::model::ForwardedMetadata;
8060 /// let x = QuotedMessageMetadata::new().set_forwarded_metadata(ForwardedMetadata::default()/* use setters */);
8061 /// ```
8062 pub fn set_forwarded_metadata<T>(mut self, v: T) -> Self
8063 where
8064 T: std::convert::Into<crate::model::ForwardedMetadata>,
8065 {
8066 self.forwarded_metadata = std::option::Option::Some(v.into());
8067 self
8068 }
8069
8070 /// Sets or clears the value of [forwarded_metadata][crate::model::QuotedMessageMetadata::forwarded_metadata].
8071 ///
8072 /// # Example
8073 /// ```ignore,no_run
8074 /// # use google_chat_v1::model::QuotedMessageMetadata;
8075 /// use google_chat_v1::model::ForwardedMetadata;
8076 /// let x = QuotedMessageMetadata::new().set_or_clear_forwarded_metadata(Some(ForwardedMetadata::default()/* use setters */));
8077 /// let x = QuotedMessageMetadata::new().set_or_clear_forwarded_metadata(None::<ForwardedMetadata>);
8078 /// ```
8079 pub fn set_or_clear_forwarded_metadata<T>(mut self, v: std::option::Option<T>) -> Self
8080 where
8081 T: std::convert::Into<crate::model::ForwardedMetadata>,
8082 {
8083 self.forwarded_metadata = v.map(|x| x.into());
8084 self
8085 }
8086}
8087
8088impl wkt::message::Message for QuotedMessageMetadata {
8089 fn typename() -> &'static str {
8090 "type.googleapis.com/google.chat.v1.QuotedMessageMetadata"
8091 }
8092}
8093
8094/// Defines additional types related to [QuotedMessageMetadata].
8095pub mod quoted_message_metadata {
8096 #[allow(unused_imports)]
8097 use super::*;
8098
8099 /// The quote type of the quoted message.
8100 ///
8101 /// # Working with unknown values
8102 ///
8103 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8104 /// additional enum variants at any time. Adding new variants is not considered
8105 /// a breaking change. Applications should write their code in anticipation of:
8106 ///
8107 /// - New values appearing in future releases of the client library, **and**
8108 /// - New values received dynamically, without application changes.
8109 ///
8110 /// Please consult the [Working with enums] section in the user guide for some
8111 /// guidelines.
8112 ///
8113 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8114 #[derive(Clone, Debug, PartialEq)]
8115 #[non_exhaustive]
8116 pub enum QuoteType {
8117 /// Reserved. This value is unused.
8118 Unspecified,
8119 /// When `quote_type` is `REPLY`, you can do the following:
8120 ///
8121 /// * If you're replying in a thread, you can quote another message in that
8122 /// thread.
8123 ///
8124 /// * If you're creating a root message, you can quote another root message
8125 /// in that space.
8126 ///
8127 Reply,
8128 /// When `quote_type` is `FORWARD`, you can quote a:
8129 ///
8130 /// * Message from a different space.
8131 ///
8132 /// * Message reply from a different thread in the same space.
8133 ///
8134 Forward,
8135 /// If set, the enum was initialized with an unknown value.
8136 ///
8137 /// Applications can examine the value using [QuoteType::value] or
8138 /// [QuoteType::name].
8139 UnknownValue(quote_type::UnknownValue),
8140 }
8141
8142 #[doc(hidden)]
8143 pub mod quote_type {
8144 #[allow(unused_imports)]
8145 use super::*;
8146 #[derive(Clone, Debug, PartialEq)]
8147 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8148 }
8149
8150 impl QuoteType {
8151 /// Gets the enum value.
8152 ///
8153 /// Returns `None` if the enum contains an unknown value deserialized from
8154 /// the string representation of enums.
8155 pub fn value(&self) -> std::option::Option<i32> {
8156 match self {
8157 Self::Unspecified => std::option::Option::Some(0),
8158 Self::Reply => std::option::Option::Some(1),
8159 Self::Forward => std::option::Option::Some(2),
8160 Self::UnknownValue(u) => u.0.value(),
8161 }
8162 }
8163
8164 /// Gets the enum value as a string.
8165 ///
8166 /// Returns `None` if the enum contains an unknown value deserialized from
8167 /// the integer representation of enums.
8168 pub fn name(&self) -> std::option::Option<&str> {
8169 match self {
8170 Self::Unspecified => std::option::Option::Some("QUOTE_TYPE_UNSPECIFIED"),
8171 Self::Reply => std::option::Option::Some("REPLY"),
8172 Self::Forward => std::option::Option::Some("FORWARD"),
8173 Self::UnknownValue(u) => u.0.name(),
8174 }
8175 }
8176 }
8177
8178 impl std::default::Default for QuoteType {
8179 fn default() -> Self {
8180 use std::convert::From;
8181 Self::from(0)
8182 }
8183 }
8184
8185 impl std::fmt::Display for QuoteType {
8186 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8187 wkt::internal::display_enum(f, self.name(), self.value())
8188 }
8189 }
8190
8191 impl std::convert::From<i32> for QuoteType {
8192 fn from(value: i32) -> Self {
8193 match value {
8194 0 => Self::Unspecified,
8195 1 => Self::Reply,
8196 2 => Self::Forward,
8197 _ => Self::UnknownValue(quote_type::UnknownValue(
8198 wkt::internal::UnknownEnumValue::Integer(value),
8199 )),
8200 }
8201 }
8202 }
8203
8204 impl std::convert::From<&str> for QuoteType {
8205 fn from(value: &str) -> Self {
8206 use std::string::ToString;
8207 match value {
8208 "QUOTE_TYPE_UNSPECIFIED" => Self::Unspecified,
8209 "REPLY" => Self::Reply,
8210 "FORWARD" => Self::Forward,
8211 _ => Self::UnknownValue(quote_type::UnknownValue(
8212 wkt::internal::UnknownEnumValue::String(value.to_string()),
8213 )),
8214 }
8215 }
8216 }
8217
8218 impl serde::ser::Serialize for QuoteType {
8219 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8220 where
8221 S: serde::Serializer,
8222 {
8223 match self {
8224 Self::Unspecified => serializer.serialize_i32(0),
8225 Self::Reply => serializer.serialize_i32(1),
8226 Self::Forward => serializer.serialize_i32(2),
8227 Self::UnknownValue(u) => u.0.serialize(serializer),
8228 }
8229 }
8230 }
8231
8232 impl<'de> serde::de::Deserialize<'de> for QuoteType {
8233 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8234 where
8235 D: serde::Deserializer<'de>,
8236 {
8237 deserializer.deserialize_any(wkt::internal::EnumVisitor::<QuoteType>::new(
8238 ".google.chat.v1.QuotedMessageMetadata.QuoteType",
8239 ))
8240 }
8241 }
8242}
8243
8244/// Provides a snapshot of the content of the quoted message at the time of
8245/// quoting or forwarding
8246#[derive(Clone, Default, PartialEq)]
8247#[non_exhaustive]
8248pub struct QuotedMessageSnapshot {
8249 /// Output only. The quoted message's author name.
8250 /// Populated for both REPLY & FORWARD quote types.
8251 pub sender: std::string::String,
8252
8253 /// Output only. Snapshot of the quoted message's text content.
8254 pub text: std::string::String,
8255
8256 /// Output only. Contains the quoted message `text` with markups added to
8257 /// support rich formatting like hyperlinks,custom emojis, markup, etc.
8258 /// Populated only for FORWARD quote type.
8259 pub formatted_text: std::string::String,
8260
8261 /// Output only. Annotations parsed from the text body of the quoted message.
8262 /// Populated only for FORWARD quote type.
8263 pub annotations: std::vec::Vec<crate::model::Annotation>,
8264
8265 /// Output only. Attachments that were part of the quoted message. These are
8266 /// copies of the quoted message's attachment metadata. Populated only for
8267 /// FORWARD quote type.
8268 pub attachments: std::vec::Vec<crate::model::Attachment>,
8269
8270 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8271}
8272
8273impl QuotedMessageSnapshot {
8274 /// Creates a new default instance.
8275 pub fn new() -> Self {
8276 std::default::Default::default()
8277 }
8278
8279 /// Sets the value of [sender][crate::model::QuotedMessageSnapshot::sender].
8280 ///
8281 /// # Example
8282 /// ```ignore,no_run
8283 /// # use google_chat_v1::model::QuotedMessageSnapshot;
8284 /// let x = QuotedMessageSnapshot::new().set_sender("example");
8285 /// ```
8286 pub fn set_sender<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8287 self.sender = v.into();
8288 self
8289 }
8290
8291 /// Sets the value of [text][crate::model::QuotedMessageSnapshot::text].
8292 ///
8293 /// # Example
8294 /// ```ignore,no_run
8295 /// # use google_chat_v1::model::QuotedMessageSnapshot;
8296 /// let x = QuotedMessageSnapshot::new().set_text("example");
8297 /// ```
8298 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8299 self.text = v.into();
8300 self
8301 }
8302
8303 /// Sets the value of [formatted_text][crate::model::QuotedMessageSnapshot::formatted_text].
8304 ///
8305 /// # Example
8306 /// ```ignore,no_run
8307 /// # use google_chat_v1::model::QuotedMessageSnapshot;
8308 /// let x = QuotedMessageSnapshot::new().set_formatted_text("example");
8309 /// ```
8310 pub fn set_formatted_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8311 self.formatted_text = v.into();
8312 self
8313 }
8314
8315 /// Sets the value of [annotations][crate::model::QuotedMessageSnapshot::annotations].
8316 ///
8317 /// # Example
8318 /// ```ignore,no_run
8319 /// # use google_chat_v1::model::QuotedMessageSnapshot;
8320 /// use google_chat_v1::model::Annotation;
8321 /// let x = QuotedMessageSnapshot::new()
8322 /// .set_annotations([
8323 /// Annotation::default()/* use setters */,
8324 /// Annotation::default()/* use (different) setters */,
8325 /// ]);
8326 /// ```
8327 pub fn set_annotations<T, V>(mut self, v: T) -> Self
8328 where
8329 T: std::iter::IntoIterator<Item = V>,
8330 V: std::convert::Into<crate::model::Annotation>,
8331 {
8332 use std::iter::Iterator;
8333 self.annotations = v.into_iter().map(|i| i.into()).collect();
8334 self
8335 }
8336
8337 /// Sets the value of [attachments][crate::model::QuotedMessageSnapshot::attachments].
8338 ///
8339 /// # Example
8340 /// ```ignore,no_run
8341 /// # use google_chat_v1::model::QuotedMessageSnapshot;
8342 /// use google_chat_v1::model::Attachment;
8343 /// let x = QuotedMessageSnapshot::new()
8344 /// .set_attachments([
8345 /// Attachment::default()/* use setters */,
8346 /// Attachment::default()/* use (different) setters */,
8347 /// ]);
8348 /// ```
8349 pub fn set_attachments<T, V>(mut self, v: T) -> Self
8350 where
8351 T: std::iter::IntoIterator<Item = V>,
8352 V: std::convert::Into<crate::model::Attachment>,
8353 {
8354 use std::iter::Iterator;
8355 self.attachments = v.into_iter().map(|i| i.into()).collect();
8356 self
8357 }
8358}
8359
8360impl wkt::message::Message for QuotedMessageSnapshot {
8361 fn typename() -> &'static str {
8362 "type.googleapis.com/google.chat.v1.QuotedMessageSnapshot"
8363 }
8364}
8365
8366/// Metadata about the source space from which a message was forwarded.
8367#[derive(Clone, Default, PartialEq)]
8368#[non_exhaustive]
8369pub struct ForwardedMetadata {
8370 /// Output only. The resource name of the source space.
8371 /// Format: spaces/{space}
8372 pub space: std::string::String,
8373
8374 /// Output only. The display name of the source space or DM at the time of
8375 /// forwarding. For `SPACE`, this is the space name. For `DIRECT_MESSAGE`, this
8376 /// is the other participant's name (e.g., "User A"). For `GROUP_CHAT`, this is
8377 /// a generated name based on members' first names, limited to 5 including the
8378 /// creator (e.g., "User A, User B").
8379 pub space_display_name: std::string::String,
8380
8381 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8382}
8383
8384impl ForwardedMetadata {
8385 /// Creates a new default instance.
8386 pub fn new() -> Self {
8387 std::default::Default::default()
8388 }
8389
8390 /// Sets the value of [space][crate::model::ForwardedMetadata::space].
8391 ///
8392 /// # Example
8393 /// ```ignore,no_run
8394 /// # use google_chat_v1::model::ForwardedMetadata;
8395 /// # let space_id = "space_id";
8396 /// let x = ForwardedMetadata::new().set_space(format!("spaces/{space_id}"));
8397 /// ```
8398 pub fn set_space<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8399 self.space = v.into();
8400 self
8401 }
8402
8403 /// Sets the value of [space_display_name][crate::model::ForwardedMetadata::space_display_name].
8404 ///
8405 /// # Example
8406 /// ```ignore,no_run
8407 /// # use google_chat_v1::model::ForwardedMetadata;
8408 /// let x = ForwardedMetadata::new().set_space_display_name("example");
8409 /// ```
8410 pub fn set_space_display_name<T: std::convert::Into<std::string::String>>(
8411 mut self,
8412 v: T,
8413 ) -> Self {
8414 self.space_display_name = v.into();
8415 self
8416 }
8417}
8418
8419impl wkt::message::Message for ForwardedMetadata {
8420 fn typename() -> &'static str {
8421 "type.googleapis.com/google.chat.v1.ForwardedMetadata"
8422 }
8423}
8424
8425/// A thread in a Google Chat space. For example usage, see
8426/// [Start or reply to a message
8427/// thread](https://developers.google.com/workspace/chat/create-messages#create-message-thread).
8428///
8429/// If you specify a thread when creating a message, you can set the
8430/// [`messageReplyOption`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/create#messagereplyoption)
8431/// field to determine what happens if no matching thread is found.
8432#[derive(Clone, Default, PartialEq)]
8433#[non_exhaustive]
8434pub struct Thread {
8435 /// Identifier. Resource name of the thread.
8436 ///
8437 /// Example: `spaces/{space}/threads/{thread}`
8438 pub name: std::string::String,
8439
8440 /// Optional. Input for creating or updating a thread. Otherwise, output only.
8441 /// ID for the thread. Supports up to 4000 characters.
8442 ///
8443 /// This ID is unique to the Chat app that sets it. For example, if
8444 /// multiple Chat apps create a message using the same thread key,
8445 /// the messages are posted in different threads. To reply in a
8446 /// thread created by a person or another Chat app, specify the thread `name`
8447 /// field instead.
8448 pub thread_key: std::string::String,
8449
8450 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8451}
8452
8453impl Thread {
8454 /// Creates a new default instance.
8455 pub fn new() -> Self {
8456 std::default::Default::default()
8457 }
8458
8459 /// Sets the value of [name][crate::model::Thread::name].
8460 ///
8461 /// # Example
8462 /// ```ignore,no_run
8463 /// # use google_chat_v1::model::Thread;
8464 /// # let space_id = "space_id";
8465 /// # let thread_id = "thread_id";
8466 /// let x = Thread::new().set_name(format!("spaces/{space_id}/threads/{thread_id}"));
8467 /// ```
8468 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8469 self.name = v.into();
8470 self
8471 }
8472
8473 /// Sets the value of [thread_key][crate::model::Thread::thread_key].
8474 ///
8475 /// # Example
8476 /// ```ignore,no_run
8477 /// # use google_chat_v1::model::Thread;
8478 /// let x = Thread::new().set_thread_key("example");
8479 /// ```
8480 pub fn set_thread_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8481 self.thread_key = v.into();
8482 self
8483 }
8484}
8485
8486impl wkt::message::Message for Thread {
8487 fn typename() -> &'static str {
8488 "type.googleapis.com/google.chat.v1.Thread"
8489 }
8490}
8491
8492/// Parameters that a Chat app can use to configure how its response is posted.
8493#[derive(Clone, Default, PartialEq)]
8494#[non_exhaustive]
8495pub struct ActionResponse {
8496 /// Input only. The type of Chat app response.
8497 pub r#type: crate::model::action_response::ResponseType,
8498
8499 /// Input only. URL for users to authenticate or configure. (Only for
8500 /// `REQUEST_CONFIG` response types.)
8501 pub url: std::string::String,
8502
8503 /// Input only. A response to an interaction event related to a
8504 /// [dialog](https://developers.google.com/workspace/chat/dialogs). Must be
8505 /// accompanied by `ResponseType.Dialog`.
8506 pub dialog_action: std::option::Option<crate::model::DialogAction>,
8507
8508 /// Input only. The response of the updated widget.
8509 pub updated_widget: std::option::Option<crate::model::action_response::UpdatedWidget>,
8510
8511 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8512}
8513
8514impl ActionResponse {
8515 /// Creates a new default instance.
8516 pub fn new() -> Self {
8517 std::default::Default::default()
8518 }
8519
8520 /// Sets the value of [r#type][crate::model::ActionResponse::type].
8521 ///
8522 /// # Example
8523 /// ```ignore,no_run
8524 /// # use google_chat_v1::model::ActionResponse;
8525 /// use google_chat_v1::model::action_response::ResponseType;
8526 /// let x0 = ActionResponse::new().set_type(ResponseType::NewMessage);
8527 /// let x1 = ActionResponse::new().set_type(ResponseType::UpdateMessage);
8528 /// let x2 = ActionResponse::new().set_type(ResponseType::UpdateUserMessageCards);
8529 /// ```
8530 pub fn set_type<T: std::convert::Into<crate::model::action_response::ResponseType>>(
8531 mut self,
8532 v: T,
8533 ) -> Self {
8534 self.r#type = v.into();
8535 self
8536 }
8537
8538 /// Sets the value of [url][crate::model::ActionResponse::url].
8539 ///
8540 /// # Example
8541 /// ```ignore,no_run
8542 /// # use google_chat_v1::model::ActionResponse;
8543 /// let x = ActionResponse::new().set_url("example");
8544 /// ```
8545 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8546 self.url = v.into();
8547 self
8548 }
8549
8550 /// Sets the value of [dialog_action][crate::model::ActionResponse::dialog_action].
8551 ///
8552 /// # Example
8553 /// ```ignore,no_run
8554 /// # use google_chat_v1::model::ActionResponse;
8555 /// use google_chat_v1::model::DialogAction;
8556 /// let x = ActionResponse::new().set_dialog_action(DialogAction::default()/* use setters */);
8557 /// ```
8558 pub fn set_dialog_action<T>(mut self, v: T) -> Self
8559 where
8560 T: std::convert::Into<crate::model::DialogAction>,
8561 {
8562 self.dialog_action = std::option::Option::Some(v.into());
8563 self
8564 }
8565
8566 /// Sets or clears the value of [dialog_action][crate::model::ActionResponse::dialog_action].
8567 ///
8568 /// # Example
8569 /// ```ignore,no_run
8570 /// # use google_chat_v1::model::ActionResponse;
8571 /// use google_chat_v1::model::DialogAction;
8572 /// let x = ActionResponse::new().set_or_clear_dialog_action(Some(DialogAction::default()/* use setters */));
8573 /// let x = ActionResponse::new().set_or_clear_dialog_action(None::<DialogAction>);
8574 /// ```
8575 pub fn set_or_clear_dialog_action<T>(mut self, v: std::option::Option<T>) -> Self
8576 where
8577 T: std::convert::Into<crate::model::DialogAction>,
8578 {
8579 self.dialog_action = v.map(|x| x.into());
8580 self
8581 }
8582
8583 /// Sets the value of [updated_widget][crate::model::ActionResponse::updated_widget].
8584 ///
8585 /// # Example
8586 /// ```ignore,no_run
8587 /// # use google_chat_v1::model::ActionResponse;
8588 /// use google_chat_v1::model::action_response::UpdatedWidget;
8589 /// let x = ActionResponse::new().set_updated_widget(UpdatedWidget::default()/* use setters */);
8590 /// ```
8591 pub fn set_updated_widget<T>(mut self, v: T) -> Self
8592 where
8593 T: std::convert::Into<crate::model::action_response::UpdatedWidget>,
8594 {
8595 self.updated_widget = std::option::Option::Some(v.into());
8596 self
8597 }
8598
8599 /// Sets or clears the value of [updated_widget][crate::model::ActionResponse::updated_widget].
8600 ///
8601 /// # Example
8602 /// ```ignore,no_run
8603 /// # use google_chat_v1::model::ActionResponse;
8604 /// use google_chat_v1::model::action_response::UpdatedWidget;
8605 /// let x = ActionResponse::new().set_or_clear_updated_widget(Some(UpdatedWidget::default()/* use setters */));
8606 /// let x = ActionResponse::new().set_or_clear_updated_widget(None::<UpdatedWidget>);
8607 /// ```
8608 pub fn set_or_clear_updated_widget<T>(mut self, v: std::option::Option<T>) -> Self
8609 where
8610 T: std::convert::Into<crate::model::action_response::UpdatedWidget>,
8611 {
8612 self.updated_widget = v.map(|x| x.into());
8613 self
8614 }
8615}
8616
8617impl wkt::message::Message for ActionResponse {
8618 fn typename() -> &'static str {
8619 "type.googleapis.com/google.chat.v1.ActionResponse"
8620 }
8621}
8622
8623/// Defines additional types related to [ActionResponse].
8624pub mod action_response {
8625 #[allow(unused_imports)]
8626 use super::*;
8627
8628 /// List of widget autocomplete results.
8629 #[derive(Clone, Default, PartialEq)]
8630 #[non_exhaustive]
8631 pub struct SelectionItems {
8632 /// An array of the SelectionItem objects.
8633 pub items: std::vec::Vec<google_apps_card_v1::model::selection_input::SelectionItem>,
8634
8635 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8636 }
8637
8638 impl SelectionItems {
8639 /// Creates a new default instance.
8640 pub fn new() -> Self {
8641 std::default::Default::default()
8642 }
8643
8644 /// Sets the value of [items][crate::model::action_response::SelectionItems::items].
8645 ///
8646 /// # Example
8647 /// ```ignore,no_run
8648 /// # use google_chat_v1::model::action_response::SelectionItems;
8649 /// use google_apps_card_v1::model::selection_input::SelectionItem;
8650 /// let x = SelectionItems::new()
8651 /// .set_items([
8652 /// SelectionItem::default()/* use setters */,
8653 /// SelectionItem::default()/* use (different) setters */,
8654 /// ]);
8655 /// ```
8656 pub fn set_items<T, V>(mut self, v: T) -> Self
8657 where
8658 T: std::iter::IntoIterator<Item = V>,
8659 V: std::convert::Into<google_apps_card_v1::model::selection_input::SelectionItem>,
8660 {
8661 use std::iter::Iterator;
8662 self.items = v.into_iter().map(|i| i.into()).collect();
8663 self
8664 }
8665 }
8666
8667 impl wkt::message::Message for SelectionItems {
8668 fn typename() -> &'static str {
8669 "type.googleapis.com/google.chat.v1.ActionResponse.SelectionItems"
8670 }
8671 }
8672
8673 /// For `selectionInput` widgets, returns autocomplete suggestions for a
8674 /// multiselect menu.
8675 #[derive(Clone, Default, PartialEq)]
8676 #[non_exhaustive]
8677 pub struct UpdatedWidget {
8678 /// The ID of the updated widget. The ID must match the one for the
8679 /// widget that triggered the update request.
8680 pub widget: std::string::String,
8681
8682 /// The widget updated in response to a user action.
8683 pub updated_widget:
8684 std::option::Option<crate::model::action_response::updated_widget::UpdatedWidget>,
8685
8686 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8687 }
8688
8689 impl UpdatedWidget {
8690 /// Creates a new default instance.
8691 pub fn new() -> Self {
8692 std::default::Default::default()
8693 }
8694
8695 /// Sets the value of [widget][crate::model::action_response::UpdatedWidget::widget].
8696 ///
8697 /// # Example
8698 /// ```ignore,no_run
8699 /// # use google_chat_v1::model::action_response::UpdatedWidget;
8700 /// let x = UpdatedWidget::new().set_widget("example");
8701 /// ```
8702 pub fn set_widget<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8703 self.widget = v.into();
8704 self
8705 }
8706
8707 /// Sets the value of [updated_widget][crate::model::action_response::UpdatedWidget::updated_widget].
8708 ///
8709 /// Note that all the setters affecting `updated_widget` are mutually
8710 /// exclusive.
8711 ///
8712 /// # Example
8713 /// ```ignore,no_run
8714 /// # use google_chat_v1::model::action_response::UpdatedWidget;
8715 /// use google_chat_v1::model::action_response::SelectionItems;
8716 /// let x = UpdatedWidget::new().set_updated_widget(Some(
8717 /// google_chat_v1::model::action_response::updated_widget::UpdatedWidget::Suggestions(SelectionItems::default().into())));
8718 /// ```
8719 pub fn set_updated_widget<
8720 T: std::convert::Into<
8721 std::option::Option<
8722 crate::model::action_response::updated_widget::UpdatedWidget,
8723 >,
8724 >,
8725 >(
8726 mut self,
8727 v: T,
8728 ) -> Self {
8729 self.updated_widget = v.into();
8730 self
8731 }
8732
8733 /// The value of [updated_widget][crate::model::action_response::UpdatedWidget::updated_widget]
8734 /// if it holds a `Suggestions`, `None` if the field is not set or
8735 /// holds a different branch.
8736 pub fn suggestions(
8737 &self,
8738 ) -> std::option::Option<&std::boxed::Box<crate::model::action_response::SelectionItems>>
8739 {
8740 #[allow(unreachable_patterns)]
8741 self.updated_widget.as_ref().and_then(|v| match v {
8742 crate::model::action_response::updated_widget::UpdatedWidget::Suggestions(v) => {
8743 std::option::Option::Some(v)
8744 }
8745 _ => std::option::Option::None,
8746 })
8747 }
8748
8749 /// Sets the value of [updated_widget][crate::model::action_response::UpdatedWidget::updated_widget]
8750 /// to hold a `Suggestions`.
8751 ///
8752 /// Note that all the setters affecting `updated_widget` are
8753 /// mutually exclusive.
8754 ///
8755 /// # Example
8756 /// ```ignore,no_run
8757 /// # use google_chat_v1::model::action_response::UpdatedWidget;
8758 /// use google_chat_v1::model::action_response::SelectionItems;
8759 /// let x = UpdatedWidget::new().set_suggestions(SelectionItems::default()/* use setters */);
8760 /// assert!(x.suggestions().is_some());
8761 /// ```
8762 pub fn set_suggestions<
8763 T: std::convert::Into<std::boxed::Box<crate::model::action_response::SelectionItems>>,
8764 >(
8765 mut self,
8766 v: T,
8767 ) -> Self {
8768 self.updated_widget = std::option::Option::Some(
8769 crate::model::action_response::updated_widget::UpdatedWidget::Suggestions(v.into()),
8770 );
8771 self
8772 }
8773 }
8774
8775 impl wkt::message::Message for UpdatedWidget {
8776 fn typename() -> &'static str {
8777 "type.googleapis.com/google.chat.v1.ActionResponse.UpdatedWidget"
8778 }
8779 }
8780
8781 /// Defines additional types related to [UpdatedWidget].
8782 pub mod updated_widget {
8783 #[allow(unused_imports)]
8784 use super::*;
8785
8786 /// The widget updated in response to a user action.
8787 #[derive(Clone, Debug, PartialEq)]
8788 #[non_exhaustive]
8789 pub enum UpdatedWidget {
8790 /// List of widget autocomplete results
8791 Suggestions(std::boxed::Box<crate::model::action_response::SelectionItems>),
8792 }
8793 }
8794
8795 /// The type of Chat app response.
8796 ///
8797 /// # Working with unknown values
8798 ///
8799 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8800 /// additional enum variants at any time. Adding new variants is not considered
8801 /// a breaking change. Applications should write their code in anticipation of:
8802 ///
8803 /// - New values appearing in future releases of the client library, **and**
8804 /// - New values received dynamically, without application changes.
8805 ///
8806 /// Please consult the [Working with enums] section in the user guide for some
8807 /// guidelines.
8808 ///
8809 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8810 #[derive(Clone, Debug, PartialEq)]
8811 #[non_exhaustive]
8812 pub enum ResponseType {
8813 /// Default type that's handled as `NEW_MESSAGE`.
8814 TypeUnspecified,
8815 /// Post as a new message in the topic.
8816 NewMessage,
8817 /// Update the Chat app's message. This is only permitted on a `CARD_CLICKED`
8818 /// event where the message sender type is `BOT`.
8819 UpdateMessage,
8820 /// Update the cards on a user's message. This is only permitted as a
8821 /// response to a `MESSAGE` event with a matched url, or a `CARD_CLICKED`
8822 /// event where the message sender type is `HUMAN`. Text is ignored.
8823 UpdateUserMessageCards,
8824 /// Privately ask the user for additional authentication or configuration.
8825 RequestConfig,
8826 /// Presents a
8827 /// [dialog](https://developers.google.com/workspace/chat/dialogs).
8828 Dialog,
8829 /// Widget text autocomplete options query.
8830 UpdateWidget,
8831 /// If set, the enum was initialized with an unknown value.
8832 ///
8833 /// Applications can examine the value using [ResponseType::value] or
8834 /// [ResponseType::name].
8835 UnknownValue(response_type::UnknownValue),
8836 }
8837
8838 #[doc(hidden)]
8839 pub mod response_type {
8840 #[allow(unused_imports)]
8841 use super::*;
8842 #[derive(Clone, Debug, PartialEq)]
8843 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8844 }
8845
8846 impl ResponseType {
8847 /// Gets the enum value.
8848 ///
8849 /// Returns `None` if the enum contains an unknown value deserialized from
8850 /// the string representation of enums.
8851 pub fn value(&self) -> std::option::Option<i32> {
8852 match self {
8853 Self::TypeUnspecified => std::option::Option::Some(0),
8854 Self::NewMessage => std::option::Option::Some(1),
8855 Self::UpdateMessage => std::option::Option::Some(2),
8856 Self::UpdateUserMessageCards => std::option::Option::Some(6),
8857 Self::RequestConfig => std::option::Option::Some(3),
8858 Self::Dialog => std::option::Option::Some(4),
8859 Self::UpdateWidget => std::option::Option::Some(7),
8860 Self::UnknownValue(u) => u.0.value(),
8861 }
8862 }
8863
8864 /// Gets the enum value as a string.
8865 ///
8866 /// Returns `None` if the enum contains an unknown value deserialized from
8867 /// the integer representation of enums.
8868 pub fn name(&self) -> std::option::Option<&str> {
8869 match self {
8870 Self::TypeUnspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
8871 Self::NewMessage => std::option::Option::Some("NEW_MESSAGE"),
8872 Self::UpdateMessage => std::option::Option::Some("UPDATE_MESSAGE"),
8873 Self::UpdateUserMessageCards => {
8874 std::option::Option::Some("UPDATE_USER_MESSAGE_CARDS")
8875 }
8876 Self::RequestConfig => std::option::Option::Some("REQUEST_CONFIG"),
8877 Self::Dialog => std::option::Option::Some("DIALOG"),
8878 Self::UpdateWidget => std::option::Option::Some("UPDATE_WIDGET"),
8879 Self::UnknownValue(u) => u.0.name(),
8880 }
8881 }
8882 }
8883
8884 impl std::default::Default for ResponseType {
8885 fn default() -> Self {
8886 use std::convert::From;
8887 Self::from(0)
8888 }
8889 }
8890
8891 impl std::fmt::Display for ResponseType {
8892 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8893 wkt::internal::display_enum(f, self.name(), self.value())
8894 }
8895 }
8896
8897 impl std::convert::From<i32> for ResponseType {
8898 fn from(value: i32) -> Self {
8899 match value {
8900 0 => Self::TypeUnspecified,
8901 1 => Self::NewMessage,
8902 2 => Self::UpdateMessage,
8903 3 => Self::RequestConfig,
8904 4 => Self::Dialog,
8905 6 => Self::UpdateUserMessageCards,
8906 7 => Self::UpdateWidget,
8907 _ => Self::UnknownValue(response_type::UnknownValue(
8908 wkt::internal::UnknownEnumValue::Integer(value),
8909 )),
8910 }
8911 }
8912 }
8913
8914 impl std::convert::From<&str> for ResponseType {
8915 fn from(value: &str) -> Self {
8916 use std::string::ToString;
8917 match value {
8918 "TYPE_UNSPECIFIED" => Self::TypeUnspecified,
8919 "NEW_MESSAGE" => Self::NewMessage,
8920 "UPDATE_MESSAGE" => Self::UpdateMessage,
8921 "UPDATE_USER_MESSAGE_CARDS" => Self::UpdateUserMessageCards,
8922 "REQUEST_CONFIG" => Self::RequestConfig,
8923 "DIALOG" => Self::Dialog,
8924 "UPDATE_WIDGET" => Self::UpdateWidget,
8925 _ => Self::UnknownValue(response_type::UnknownValue(
8926 wkt::internal::UnknownEnumValue::String(value.to_string()),
8927 )),
8928 }
8929 }
8930 }
8931
8932 impl serde::ser::Serialize for ResponseType {
8933 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8934 where
8935 S: serde::Serializer,
8936 {
8937 match self {
8938 Self::TypeUnspecified => serializer.serialize_i32(0),
8939 Self::NewMessage => serializer.serialize_i32(1),
8940 Self::UpdateMessage => serializer.serialize_i32(2),
8941 Self::UpdateUserMessageCards => serializer.serialize_i32(6),
8942 Self::RequestConfig => serializer.serialize_i32(3),
8943 Self::Dialog => serializer.serialize_i32(4),
8944 Self::UpdateWidget => serializer.serialize_i32(7),
8945 Self::UnknownValue(u) => u.0.serialize(serializer),
8946 }
8947 }
8948 }
8949
8950 impl<'de> serde::de::Deserialize<'de> for ResponseType {
8951 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8952 where
8953 D: serde::Deserializer<'de>,
8954 {
8955 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ResponseType>::new(
8956 ".google.chat.v1.ActionResponse.ResponseType",
8957 ))
8958 }
8959 }
8960}
8961
8962/// One or more interactive widgets that appear at the bottom of a message. For
8963/// details, see [Add interactive widgets at the bottom of a
8964/// message](https://developers.google.com/workspace/chat/create-messages#add-accessory-widgets).
8965#[derive(Clone, Default, PartialEq)]
8966#[non_exhaustive]
8967pub struct AccessoryWidget {
8968 /// The type of action.
8969 pub action: std::option::Option<crate::model::accessory_widget::Action>,
8970
8971 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8972}
8973
8974impl AccessoryWidget {
8975 /// Creates a new default instance.
8976 pub fn new() -> Self {
8977 std::default::Default::default()
8978 }
8979
8980 /// Sets the value of [action][crate::model::AccessoryWidget::action].
8981 ///
8982 /// Note that all the setters affecting `action` are mutually
8983 /// exclusive.
8984 ///
8985 /// # Example
8986 /// ```ignore,no_run
8987 /// # use google_chat_v1::model::AccessoryWidget;
8988 /// use google_apps_card_v1::model::ButtonList;
8989 /// let x = AccessoryWidget::new().set_action(Some(
8990 /// google_chat_v1::model::accessory_widget::Action::ButtonList(ButtonList::default().into())));
8991 /// ```
8992 pub fn set_action<
8993 T: std::convert::Into<std::option::Option<crate::model::accessory_widget::Action>>,
8994 >(
8995 mut self,
8996 v: T,
8997 ) -> Self {
8998 self.action = v.into();
8999 self
9000 }
9001
9002 /// The value of [action][crate::model::AccessoryWidget::action]
9003 /// if it holds a `ButtonList`, `None` if the field is not set or
9004 /// holds a different branch.
9005 pub fn button_list(
9006 &self,
9007 ) -> std::option::Option<&std::boxed::Box<google_apps_card_v1::model::ButtonList>> {
9008 #[allow(unreachable_patterns)]
9009 self.action.as_ref().and_then(|v| match v {
9010 crate::model::accessory_widget::Action::ButtonList(v) => std::option::Option::Some(v),
9011 _ => std::option::Option::None,
9012 })
9013 }
9014
9015 /// Sets the value of [action][crate::model::AccessoryWidget::action]
9016 /// to hold a `ButtonList`.
9017 ///
9018 /// Note that all the setters affecting `action` are
9019 /// mutually exclusive.
9020 ///
9021 /// # Example
9022 /// ```ignore,no_run
9023 /// # use google_chat_v1::model::AccessoryWidget;
9024 /// use google_apps_card_v1::model::ButtonList;
9025 /// let x = AccessoryWidget::new().set_button_list(ButtonList::default()/* use setters */);
9026 /// assert!(x.button_list().is_some());
9027 /// ```
9028 pub fn set_button_list<
9029 T: std::convert::Into<std::boxed::Box<google_apps_card_v1::model::ButtonList>>,
9030 >(
9031 mut self,
9032 v: T,
9033 ) -> Self {
9034 self.action =
9035 std::option::Option::Some(crate::model::accessory_widget::Action::ButtonList(v.into()));
9036 self
9037 }
9038}
9039
9040impl wkt::message::Message for AccessoryWidget {
9041 fn typename() -> &'static str {
9042 "type.googleapis.com/google.chat.v1.AccessoryWidget"
9043 }
9044}
9045
9046/// Defines additional types related to [AccessoryWidget].
9047pub mod accessory_widget {
9048 #[allow(unused_imports)]
9049 use super::*;
9050
9051 /// The type of action.
9052 #[derive(Clone, Debug, PartialEq)]
9053 #[non_exhaustive]
9054 pub enum Action {
9055 /// A list of buttons.
9056 ButtonList(std::boxed::Box<google_apps_card_v1::model::ButtonList>),
9057 }
9058}
9059
9060/// Request to get a message.
9061#[derive(Clone, Default, PartialEq)]
9062#[non_exhaustive]
9063pub struct GetMessageRequest {
9064 /// Required. Resource name of the message.
9065 ///
9066 /// Format: `spaces/{space}/messages/{message}`
9067 ///
9068 /// If you've set a custom ID for your message, you can use the value from the
9069 /// `clientAssignedMessageId` field for `{message}`. For details, see [Name a
9070 /// message]
9071 /// (<https://developers.google.com/workspace/chat/create-messages#name_a_created_message>).
9072 pub name: std::string::String,
9073
9074 /// Optional. Specifies the desired output syntax for the Chat message
9075 /// `formatted_text` field.
9076 pub markup_syntax: crate::model::MarkupSyntax,
9077
9078 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9079}
9080
9081impl GetMessageRequest {
9082 /// Creates a new default instance.
9083 pub fn new() -> Self {
9084 std::default::Default::default()
9085 }
9086
9087 /// Sets the value of [name][crate::model::GetMessageRequest::name].
9088 ///
9089 /// # Example
9090 /// ```ignore,no_run
9091 /// # use google_chat_v1::model::GetMessageRequest;
9092 /// # let space_id = "space_id";
9093 /// # let message_id = "message_id";
9094 /// let x = GetMessageRequest::new().set_name(format!("spaces/{space_id}/messages/{message_id}"));
9095 /// ```
9096 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9097 self.name = v.into();
9098 self
9099 }
9100
9101 /// Sets the value of [markup_syntax][crate::model::GetMessageRequest::markup_syntax].
9102 ///
9103 /// # Example
9104 /// ```ignore,no_run
9105 /// # use google_chat_v1::model::GetMessageRequest;
9106 /// use google_chat_v1::model::MarkupSyntax;
9107 /// let x0 = GetMessageRequest::new().set_markup_syntax(MarkupSyntax::Chat);
9108 /// let x1 = GetMessageRequest::new().set_markup_syntax(MarkupSyntax::Markdown);
9109 /// ```
9110 pub fn set_markup_syntax<T: std::convert::Into<crate::model::MarkupSyntax>>(
9111 mut self,
9112 v: T,
9113 ) -> Self {
9114 self.markup_syntax = v.into();
9115 self
9116 }
9117}
9118
9119impl wkt::message::Message for GetMessageRequest {
9120 fn typename() -> &'static str {
9121 "type.googleapis.com/google.chat.v1.GetMessageRequest"
9122 }
9123}
9124
9125/// Request to delete a message.
9126#[derive(Clone, Default, PartialEq)]
9127#[non_exhaustive]
9128pub struct DeleteMessageRequest {
9129 /// Required. Resource name of the message.
9130 ///
9131 /// Format: `spaces/{space}/messages/{message}`
9132 ///
9133 /// If you've set a custom ID for your message, you can use the value from the
9134 /// `clientAssignedMessageId` field for `{message}`. For details, see [Name a
9135 /// message]
9136 /// (<https://developers.google.com/workspace/chat/create-messages#name_a_created_message>).
9137 pub name: std::string::String,
9138
9139 /// Optional. When `true`, deleting a message also deletes its threaded
9140 /// replies. When `false`, if a message has threaded replies, deletion fails.
9141 ///
9142 /// Only applies when [authenticating as a
9143 /// user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
9144 /// Has no effect when [authenticating as a Chat app]
9145 /// (<https://developers.google.com/workspace/chat/authenticate-authorize-chat-app>).
9146 pub force: bool,
9147
9148 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9149}
9150
9151impl DeleteMessageRequest {
9152 /// Creates a new default instance.
9153 pub fn new() -> Self {
9154 std::default::Default::default()
9155 }
9156
9157 /// Sets the value of [name][crate::model::DeleteMessageRequest::name].
9158 ///
9159 /// # Example
9160 /// ```ignore,no_run
9161 /// # use google_chat_v1::model::DeleteMessageRequest;
9162 /// # let space_id = "space_id";
9163 /// # let message_id = "message_id";
9164 /// let x = DeleteMessageRequest::new().set_name(format!("spaces/{space_id}/messages/{message_id}"));
9165 /// ```
9166 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9167 self.name = v.into();
9168 self
9169 }
9170
9171 /// Sets the value of [force][crate::model::DeleteMessageRequest::force].
9172 ///
9173 /// # Example
9174 /// ```ignore,no_run
9175 /// # use google_chat_v1::model::DeleteMessageRequest;
9176 /// let x = DeleteMessageRequest::new().set_force(true);
9177 /// ```
9178 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9179 self.force = v.into();
9180 self
9181 }
9182}
9183
9184impl wkt::message::Message for DeleteMessageRequest {
9185 fn typename() -> &'static str {
9186 "type.googleapis.com/google.chat.v1.DeleteMessageRequest"
9187 }
9188}
9189
9190/// Request to update a message.
9191#[derive(Clone, Default, PartialEq)]
9192#[non_exhaustive]
9193pub struct UpdateMessageRequest {
9194 /// Required. Message with fields updated.
9195 pub message: std::option::Option<crate::model::Message>,
9196
9197 /// Required. The field paths to update. Separate multiple values with commas
9198 /// or use `*` to update all field paths.
9199 ///
9200 /// Currently supported field paths:
9201 ///
9202 /// - `text`
9203 ///
9204 /// - `attachment`
9205 ///
9206 /// - `cards` (Requires [app
9207 /// authentication](/chat/api/guides/auth/service-accounts).)
9208 ///
9209 /// - `cards_v2` (Requires [app
9210 /// authentication](/chat/api/guides/auth/service-accounts).)
9211 ///
9212 /// - `accessory_widgets` (Requires [app
9213 /// authentication](/chat/api/guides/auth/service-accounts).)
9214 ///
9215 /// - `quoted_message_metadata` (Only allows removal of the quoted message.)
9216 ///
9217 pub update_mask: std::option::Option<wkt::FieldMask>,
9218
9219 /// Optional. If `true` and the message isn't found, a new message is created
9220 /// and `updateMask` is ignored. The specified message ID must be
9221 /// [client-assigned](https://developers.google.com/workspace/chat/create-messages#name_a_created_message)
9222 /// or the request fails.
9223 pub allow_missing: bool,
9224
9225 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9226}
9227
9228impl UpdateMessageRequest {
9229 /// Creates a new default instance.
9230 pub fn new() -> Self {
9231 std::default::Default::default()
9232 }
9233
9234 /// Sets the value of [message][crate::model::UpdateMessageRequest::message].
9235 ///
9236 /// # Example
9237 /// ```ignore,no_run
9238 /// # use google_chat_v1::model::UpdateMessageRequest;
9239 /// use google_chat_v1::model::Message;
9240 /// let x = UpdateMessageRequest::new().set_message(Message::default()/* use setters */);
9241 /// ```
9242 pub fn set_message<T>(mut self, v: T) -> Self
9243 where
9244 T: std::convert::Into<crate::model::Message>,
9245 {
9246 self.message = std::option::Option::Some(v.into());
9247 self
9248 }
9249
9250 /// Sets or clears the value of [message][crate::model::UpdateMessageRequest::message].
9251 ///
9252 /// # Example
9253 /// ```ignore,no_run
9254 /// # use google_chat_v1::model::UpdateMessageRequest;
9255 /// use google_chat_v1::model::Message;
9256 /// let x = UpdateMessageRequest::new().set_or_clear_message(Some(Message::default()/* use setters */));
9257 /// let x = UpdateMessageRequest::new().set_or_clear_message(None::<Message>);
9258 /// ```
9259 pub fn set_or_clear_message<T>(mut self, v: std::option::Option<T>) -> Self
9260 where
9261 T: std::convert::Into<crate::model::Message>,
9262 {
9263 self.message = v.map(|x| x.into());
9264 self
9265 }
9266
9267 /// Sets the value of [update_mask][crate::model::UpdateMessageRequest::update_mask].
9268 ///
9269 /// # Example
9270 /// ```ignore,no_run
9271 /// # use google_chat_v1::model::UpdateMessageRequest;
9272 /// use wkt::FieldMask;
9273 /// let x = UpdateMessageRequest::new().set_update_mask(FieldMask::default()/* use setters */);
9274 /// ```
9275 pub fn set_update_mask<T>(mut self, v: T) -> Self
9276 where
9277 T: std::convert::Into<wkt::FieldMask>,
9278 {
9279 self.update_mask = std::option::Option::Some(v.into());
9280 self
9281 }
9282
9283 /// Sets or clears the value of [update_mask][crate::model::UpdateMessageRequest::update_mask].
9284 ///
9285 /// # Example
9286 /// ```ignore,no_run
9287 /// # use google_chat_v1::model::UpdateMessageRequest;
9288 /// use wkt::FieldMask;
9289 /// let x = UpdateMessageRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
9290 /// let x = UpdateMessageRequest::new().set_or_clear_update_mask(None::<FieldMask>);
9291 /// ```
9292 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9293 where
9294 T: std::convert::Into<wkt::FieldMask>,
9295 {
9296 self.update_mask = v.map(|x| x.into());
9297 self
9298 }
9299
9300 /// Sets the value of [allow_missing][crate::model::UpdateMessageRequest::allow_missing].
9301 ///
9302 /// # Example
9303 /// ```ignore,no_run
9304 /// # use google_chat_v1::model::UpdateMessageRequest;
9305 /// let x = UpdateMessageRequest::new().set_allow_missing(true);
9306 /// ```
9307 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9308 self.allow_missing = v.into();
9309 self
9310 }
9311}
9312
9313impl wkt::message::Message for UpdateMessageRequest {
9314 fn typename() -> &'static str {
9315 "type.googleapis.com/google.chat.v1.UpdateMessageRequest"
9316 }
9317}
9318
9319/// Creates a message.
9320#[derive(Clone, Default, PartialEq)]
9321#[non_exhaustive]
9322pub struct CreateMessageRequest {
9323 /// Required. The resource name of the space in which to create a message.
9324 ///
9325 /// Format: `spaces/{space}`
9326 pub parent: std::string::String,
9327
9328 /// Required. Message body.
9329 pub message: std::option::Option<crate::model::Message>,
9330
9331 /// Optional. Deprecated: Use
9332 /// [thread.thread_key][google.chat.v1.Thread.thread_key] instead. ID for the
9333 /// thread. Supports up to 4000 characters. To start or add to a thread, create
9334 /// a message and specify a `threadKey` or the
9335 /// [thread.name][google.chat.v1.Thread.name]. For example usage, see [Start or
9336 /// reply to a message
9337 /// thread](https://developers.google.com/workspace/chat/create-messages#create-message-thread).
9338 ///
9339 /// [google.chat.v1.Thread.name]: crate::model::Thread::name
9340 /// [google.chat.v1.Thread.thread_key]: crate::model::Thread::thread_key
9341 #[deprecated]
9342 pub thread_key: std::string::String,
9343
9344 /// Optional. A unique request ID for this message. Specifying an existing
9345 /// request ID returns the message created with that ID instead of creating a
9346 /// new message.
9347 pub request_id: std::string::String,
9348
9349 /// Optional. Specifies whether a message starts a thread or replies to one.
9350 /// Only supported in named spaces.
9351 ///
9352 /// When [responding to user
9353 /// interactions](https://developers.google.com/workspace/chat/receive-respond-interactions),
9354 /// this field is ignored. For interactions within a thread, the reply is
9355 /// created in the same thread. Otherwise, the reply is created as a new
9356 /// thread.
9357 pub message_reply_option: crate::model::create_message_request::MessageReplyOption,
9358
9359 /// Optional. A custom ID for a message. Lets Chat apps get, update, or delete
9360 /// a message without needing to store the system-assigned ID in the message's
9361 /// resource name (represented in the message `name` field).
9362 ///
9363 /// The value for this field must meet the following requirements:
9364 ///
9365 /// * Begins with `client-`. For example, `client-custom-name` is a valid
9366 /// custom ID, but `custom-name` is not.
9367 /// * Contains up to 63 characters and only lowercase letters, numbers, and
9368 /// hyphens.
9369 /// * Is unique within a space. A Chat app can't use the same custom ID for
9370 /// different messages.
9371 ///
9372 /// For details, see [Name a
9373 /// message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message).
9374 pub message_id: std::string::String,
9375
9376 /// Optional. Controls the notification behavior when the message is posted.
9377 /// To learn more, see [Force notifications or send silent
9378 /// messages](https://developer.google.com/workspace/chat/create-messages#force-notify-silent).
9379 pub create_message_notification_options:
9380 std::option::Option<crate::model::CreateMessageNotificationOptions>,
9381
9382 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9383}
9384
9385impl CreateMessageRequest {
9386 /// Creates a new default instance.
9387 pub fn new() -> Self {
9388 std::default::Default::default()
9389 }
9390
9391 /// Sets the value of [parent][crate::model::CreateMessageRequest::parent].
9392 ///
9393 /// # Example
9394 /// ```ignore,no_run
9395 /// # use google_chat_v1::model::CreateMessageRequest;
9396 /// # let space_id = "space_id";
9397 /// let x = CreateMessageRequest::new().set_parent(format!("spaces/{space_id}"));
9398 /// ```
9399 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9400 self.parent = v.into();
9401 self
9402 }
9403
9404 /// Sets the value of [message][crate::model::CreateMessageRequest::message].
9405 ///
9406 /// # Example
9407 /// ```ignore,no_run
9408 /// # use google_chat_v1::model::CreateMessageRequest;
9409 /// use google_chat_v1::model::Message;
9410 /// let x = CreateMessageRequest::new().set_message(Message::default()/* use setters */);
9411 /// ```
9412 pub fn set_message<T>(mut self, v: T) -> Self
9413 where
9414 T: std::convert::Into<crate::model::Message>,
9415 {
9416 self.message = std::option::Option::Some(v.into());
9417 self
9418 }
9419
9420 /// Sets or clears the value of [message][crate::model::CreateMessageRequest::message].
9421 ///
9422 /// # Example
9423 /// ```ignore,no_run
9424 /// # use google_chat_v1::model::CreateMessageRequest;
9425 /// use google_chat_v1::model::Message;
9426 /// let x = CreateMessageRequest::new().set_or_clear_message(Some(Message::default()/* use setters */));
9427 /// let x = CreateMessageRequest::new().set_or_clear_message(None::<Message>);
9428 /// ```
9429 pub fn set_or_clear_message<T>(mut self, v: std::option::Option<T>) -> Self
9430 where
9431 T: std::convert::Into<crate::model::Message>,
9432 {
9433 self.message = v.map(|x| x.into());
9434 self
9435 }
9436
9437 /// Sets the value of [thread_key][crate::model::CreateMessageRequest::thread_key].
9438 ///
9439 /// # Example
9440 /// ```ignore,no_run
9441 /// # use google_chat_v1::model::CreateMessageRequest;
9442 /// let x = CreateMessageRequest::new().set_thread_key("example");
9443 /// ```
9444 #[deprecated]
9445 pub fn set_thread_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9446 self.thread_key = v.into();
9447 self
9448 }
9449
9450 /// Sets the value of [request_id][crate::model::CreateMessageRequest::request_id].
9451 ///
9452 /// # Example
9453 /// ```ignore,no_run
9454 /// # use google_chat_v1::model::CreateMessageRequest;
9455 /// let x = CreateMessageRequest::new().set_request_id("example");
9456 /// ```
9457 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9458 self.request_id = v.into();
9459 self
9460 }
9461
9462 /// Sets the value of [message_reply_option][crate::model::CreateMessageRequest::message_reply_option].
9463 ///
9464 /// # Example
9465 /// ```ignore,no_run
9466 /// # use google_chat_v1::model::CreateMessageRequest;
9467 /// use google_chat_v1::model::create_message_request::MessageReplyOption;
9468 /// let x0 = CreateMessageRequest::new().set_message_reply_option(MessageReplyOption::ReplyMessageFallbackToNewThread);
9469 /// let x1 = CreateMessageRequest::new().set_message_reply_option(MessageReplyOption::ReplyMessageOrFail);
9470 /// ```
9471 pub fn set_message_reply_option<
9472 T: std::convert::Into<crate::model::create_message_request::MessageReplyOption>,
9473 >(
9474 mut self,
9475 v: T,
9476 ) -> Self {
9477 self.message_reply_option = v.into();
9478 self
9479 }
9480
9481 /// Sets the value of [message_id][crate::model::CreateMessageRequest::message_id].
9482 ///
9483 /// # Example
9484 /// ```ignore,no_run
9485 /// # use google_chat_v1::model::CreateMessageRequest;
9486 /// let x = CreateMessageRequest::new().set_message_id("example");
9487 /// ```
9488 pub fn set_message_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9489 self.message_id = v.into();
9490 self
9491 }
9492
9493 /// Sets the value of [create_message_notification_options][crate::model::CreateMessageRequest::create_message_notification_options].
9494 ///
9495 /// # Example
9496 /// ```ignore,no_run
9497 /// # use google_chat_v1::model::CreateMessageRequest;
9498 /// use google_chat_v1::model::CreateMessageNotificationOptions;
9499 /// let x = CreateMessageRequest::new().set_create_message_notification_options(CreateMessageNotificationOptions::default()/* use setters */);
9500 /// ```
9501 pub fn set_create_message_notification_options<T>(mut self, v: T) -> Self
9502 where
9503 T: std::convert::Into<crate::model::CreateMessageNotificationOptions>,
9504 {
9505 self.create_message_notification_options = std::option::Option::Some(v.into());
9506 self
9507 }
9508
9509 /// Sets or clears the value of [create_message_notification_options][crate::model::CreateMessageRequest::create_message_notification_options].
9510 ///
9511 /// # Example
9512 /// ```ignore,no_run
9513 /// # use google_chat_v1::model::CreateMessageRequest;
9514 /// use google_chat_v1::model::CreateMessageNotificationOptions;
9515 /// let x = CreateMessageRequest::new().set_or_clear_create_message_notification_options(Some(CreateMessageNotificationOptions::default()/* use setters */));
9516 /// let x = CreateMessageRequest::new().set_or_clear_create_message_notification_options(None::<CreateMessageNotificationOptions>);
9517 /// ```
9518 pub fn set_or_clear_create_message_notification_options<T>(
9519 mut self,
9520 v: std::option::Option<T>,
9521 ) -> Self
9522 where
9523 T: std::convert::Into<crate::model::CreateMessageNotificationOptions>,
9524 {
9525 self.create_message_notification_options = v.map(|x| x.into());
9526 self
9527 }
9528}
9529
9530impl wkt::message::Message for CreateMessageRequest {
9531 fn typename() -> &'static str {
9532 "type.googleapis.com/google.chat.v1.CreateMessageRequest"
9533 }
9534}
9535
9536/// Defines additional types related to [CreateMessageRequest].
9537pub mod create_message_request {
9538 #[allow(unused_imports)]
9539 use super::*;
9540
9541 /// Specifies how to reply to a message.
9542 /// More states might be added in the future.
9543 ///
9544 /// # Working with unknown values
9545 ///
9546 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9547 /// additional enum variants at any time. Adding new variants is not considered
9548 /// a breaking change. Applications should write their code in anticipation of:
9549 ///
9550 /// - New values appearing in future releases of the client library, **and**
9551 /// - New values received dynamically, without application changes.
9552 ///
9553 /// Please consult the [Working with enums] section in the user guide for some
9554 /// guidelines.
9555 ///
9556 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9557 #[derive(Clone, Debug, PartialEq)]
9558 #[non_exhaustive]
9559 pub enum MessageReplyOption {
9560 /// Default. Starts a new thread. Using this option ignores any [thread
9561 /// ID][google.chat.v1.Thread.name] or
9562 /// [`thread_key`][google.chat.v1.Thread.thread_key] that's included.
9563 ///
9564 /// [google.chat.v1.Thread.name]: crate::model::Thread::name
9565 /// [google.chat.v1.Thread.thread_key]: crate::model::Thread::thread_key
9566 Unspecified,
9567 /// Creates the message as a reply to the thread specified by [thread
9568 /// ID][google.chat.v1.Thread.name] or
9569 /// [`thread_key`][google.chat.v1.Thread.thread_key]. If it fails, the
9570 /// message starts a new thread instead.
9571 ///
9572 /// [google.chat.v1.Thread.name]: crate::model::Thread::name
9573 /// [google.chat.v1.Thread.thread_key]: crate::model::Thread::thread_key
9574 ReplyMessageFallbackToNewThread,
9575 /// Creates the message as a reply to the thread specified by [thread
9576 /// ID][google.chat.v1.Thread.name] or
9577 /// [`thread_key`][google.chat.v1.Thread.thread_key]. If a new `thread_key`
9578 /// is used, a new thread is created. If the message creation fails, a
9579 /// `NOT_FOUND` error is returned instead.
9580 ///
9581 /// [google.chat.v1.Thread.name]: crate::model::Thread::name
9582 /// [google.chat.v1.Thread.thread_key]: crate::model::Thread::thread_key
9583 ReplyMessageOrFail,
9584 /// If set, the enum was initialized with an unknown value.
9585 ///
9586 /// Applications can examine the value using [MessageReplyOption::value] or
9587 /// [MessageReplyOption::name].
9588 UnknownValue(message_reply_option::UnknownValue),
9589 }
9590
9591 #[doc(hidden)]
9592 pub mod message_reply_option {
9593 #[allow(unused_imports)]
9594 use super::*;
9595 #[derive(Clone, Debug, PartialEq)]
9596 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9597 }
9598
9599 impl MessageReplyOption {
9600 /// Gets the enum value.
9601 ///
9602 /// Returns `None` if the enum contains an unknown value deserialized from
9603 /// the string representation of enums.
9604 pub fn value(&self) -> std::option::Option<i32> {
9605 match self {
9606 Self::Unspecified => std::option::Option::Some(0),
9607 Self::ReplyMessageFallbackToNewThread => std::option::Option::Some(1),
9608 Self::ReplyMessageOrFail => std::option::Option::Some(2),
9609 Self::UnknownValue(u) => u.0.value(),
9610 }
9611 }
9612
9613 /// Gets the enum value as a string.
9614 ///
9615 /// Returns `None` if the enum contains an unknown value deserialized from
9616 /// the integer representation of enums.
9617 pub fn name(&self) -> std::option::Option<&str> {
9618 match self {
9619 Self::Unspecified => std::option::Option::Some("MESSAGE_REPLY_OPTION_UNSPECIFIED"),
9620 Self::ReplyMessageFallbackToNewThread => {
9621 std::option::Option::Some("REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD")
9622 }
9623 Self::ReplyMessageOrFail => std::option::Option::Some("REPLY_MESSAGE_OR_FAIL"),
9624 Self::UnknownValue(u) => u.0.name(),
9625 }
9626 }
9627 }
9628
9629 impl std::default::Default for MessageReplyOption {
9630 fn default() -> Self {
9631 use std::convert::From;
9632 Self::from(0)
9633 }
9634 }
9635
9636 impl std::fmt::Display for MessageReplyOption {
9637 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9638 wkt::internal::display_enum(f, self.name(), self.value())
9639 }
9640 }
9641
9642 impl std::convert::From<i32> for MessageReplyOption {
9643 fn from(value: i32) -> Self {
9644 match value {
9645 0 => Self::Unspecified,
9646 1 => Self::ReplyMessageFallbackToNewThread,
9647 2 => Self::ReplyMessageOrFail,
9648 _ => Self::UnknownValue(message_reply_option::UnknownValue(
9649 wkt::internal::UnknownEnumValue::Integer(value),
9650 )),
9651 }
9652 }
9653 }
9654
9655 impl std::convert::From<&str> for MessageReplyOption {
9656 fn from(value: &str) -> Self {
9657 use std::string::ToString;
9658 match value {
9659 "MESSAGE_REPLY_OPTION_UNSPECIFIED" => Self::Unspecified,
9660 "REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD" => Self::ReplyMessageFallbackToNewThread,
9661 "REPLY_MESSAGE_OR_FAIL" => Self::ReplyMessageOrFail,
9662 _ => Self::UnknownValue(message_reply_option::UnknownValue(
9663 wkt::internal::UnknownEnumValue::String(value.to_string()),
9664 )),
9665 }
9666 }
9667 }
9668
9669 impl serde::ser::Serialize for MessageReplyOption {
9670 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9671 where
9672 S: serde::Serializer,
9673 {
9674 match self {
9675 Self::Unspecified => serializer.serialize_i32(0),
9676 Self::ReplyMessageFallbackToNewThread => serializer.serialize_i32(1),
9677 Self::ReplyMessageOrFail => serializer.serialize_i32(2),
9678 Self::UnknownValue(u) => u.0.serialize(serializer),
9679 }
9680 }
9681 }
9682
9683 impl<'de> serde::de::Deserialize<'de> for MessageReplyOption {
9684 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9685 where
9686 D: serde::Deserializer<'de>,
9687 {
9688 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MessageReplyOption>::new(
9689 ".google.chat.v1.CreateMessageRequest.MessageReplyOption",
9690 ))
9691 }
9692 }
9693}
9694
9695/// Options for the notification behavior when the message is posted.
9696#[derive(Clone, Default, PartialEq)]
9697#[non_exhaustive]
9698pub struct CreateMessageNotificationOptions {
9699 /// The notification type for the message.
9700 pub notification_type: crate::model::create_message_notification_options::NotificationType,
9701
9702 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9703}
9704
9705impl CreateMessageNotificationOptions {
9706 /// Creates a new default instance.
9707 pub fn new() -> Self {
9708 std::default::Default::default()
9709 }
9710
9711 /// Sets the value of [notification_type][crate::model::CreateMessageNotificationOptions::notification_type].
9712 ///
9713 /// # Example
9714 /// ```ignore,no_run
9715 /// # use google_chat_v1::model::CreateMessageNotificationOptions;
9716 /// use google_chat_v1::model::create_message_notification_options::NotificationType;
9717 /// let x0 = CreateMessageNotificationOptions::new().set_notification_type(NotificationType::ForceNotify);
9718 /// let x1 = CreateMessageNotificationOptions::new().set_notification_type(NotificationType::Silent);
9719 /// ```
9720 pub fn set_notification_type<
9721 T: std::convert::Into<crate::model::create_message_notification_options::NotificationType>,
9722 >(
9723 mut self,
9724 v: T,
9725 ) -> Self {
9726 self.notification_type = v.into();
9727 self
9728 }
9729}
9730
9731impl wkt::message::Message for CreateMessageNotificationOptions {
9732 fn typename() -> &'static str {
9733 "type.googleapis.com/google.chat.v1.CreateMessageNotificationOptions"
9734 }
9735}
9736
9737/// Defines additional types related to [CreateMessageNotificationOptions].
9738pub mod create_message_notification_options {
9739 #[allow(unused_imports)]
9740 use super::*;
9741
9742 /// The notification types options for the message.
9743 ///
9744 /// # Working with unknown values
9745 ///
9746 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9747 /// additional enum variants at any time. Adding new variants is not considered
9748 /// a breaking change. Applications should write their code in anticipation of:
9749 ///
9750 /// - New values appearing in future releases of the client library, **and**
9751 /// - New values received dynamically, without application changes.
9752 ///
9753 /// Please consult the [Working with enums] section in the user guide for some
9754 /// guidelines.
9755 ///
9756 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9757 #[derive(Clone, Debug, PartialEq)]
9758 #[non_exhaustive]
9759 pub enum NotificationType {
9760 /// Default behavior. Notification behavior is similar to when the human user
9761 /// sends the message using the Chat UI: no notification is sent to the
9762 /// human sender.
9763 None,
9764 /// Force notify recipients. This bypasses users' space notification settings
9765 /// and [Chat Do Not Disturb
9766 /// settings](https://support.google.com/chat/answer/9093489). This option
9767 /// does not bypass device-level Do Not Disturb settings.
9768 ///
9769 /// Requires [app authentication]
9770 /// (<https://developers.google.com/workspace/chat/authenticate-authorize-chat-app>).
9771 ForceNotify,
9772 /// Do not notify recipients, and do not mark the message as unread.
9773 /// This behaves similarly to the user muting the conversation or enabling
9774 /// [Chat Do Not Disturb](https://support.google.com/chat/answer/9093489).
9775 ///
9776 /// Requires [app authentication]
9777 /// (<https://developers.google.com/workspace/chat/authenticate-authorize-chat-app>).
9778 Silent,
9779 /// If set, the enum was initialized with an unknown value.
9780 ///
9781 /// Applications can examine the value using [NotificationType::value] or
9782 /// [NotificationType::name].
9783 UnknownValue(notification_type::UnknownValue),
9784 }
9785
9786 #[doc(hidden)]
9787 pub mod notification_type {
9788 #[allow(unused_imports)]
9789 use super::*;
9790 #[derive(Clone, Debug, PartialEq)]
9791 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9792 }
9793
9794 impl NotificationType {
9795 /// Gets the enum value.
9796 ///
9797 /// Returns `None` if the enum contains an unknown value deserialized from
9798 /// the string representation of enums.
9799 pub fn value(&self) -> std::option::Option<i32> {
9800 match self {
9801 Self::None => std::option::Option::Some(0),
9802 Self::ForceNotify => std::option::Option::Some(2),
9803 Self::Silent => std::option::Option::Some(3),
9804 Self::UnknownValue(u) => u.0.value(),
9805 }
9806 }
9807
9808 /// Gets the enum value as a string.
9809 ///
9810 /// Returns `None` if the enum contains an unknown value deserialized from
9811 /// the integer representation of enums.
9812 pub fn name(&self) -> std::option::Option<&str> {
9813 match self {
9814 Self::None => std::option::Option::Some("NOTIFICATION_TYPE_NONE"),
9815 Self::ForceNotify => std::option::Option::Some("NOTIFICATION_TYPE_FORCE_NOTIFY"),
9816 Self::Silent => std::option::Option::Some("NOTIFICATION_TYPE_SILENT"),
9817 Self::UnknownValue(u) => u.0.name(),
9818 }
9819 }
9820 }
9821
9822 impl std::default::Default for NotificationType {
9823 fn default() -> Self {
9824 use std::convert::From;
9825 Self::from(0)
9826 }
9827 }
9828
9829 impl std::fmt::Display for NotificationType {
9830 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9831 wkt::internal::display_enum(f, self.name(), self.value())
9832 }
9833 }
9834
9835 impl std::convert::From<i32> for NotificationType {
9836 fn from(value: i32) -> Self {
9837 match value {
9838 0 => Self::None,
9839 2 => Self::ForceNotify,
9840 3 => Self::Silent,
9841 _ => Self::UnknownValue(notification_type::UnknownValue(
9842 wkt::internal::UnknownEnumValue::Integer(value),
9843 )),
9844 }
9845 }
9846 }
9847
9848 impl std::convert::From<&str> for NotificationType {
9849 fn from(value: &str) -> Self {
9850 use std::string::ToString;
9851 match value {
9852 "NOTIFICATION_TYPE_NONE" => Self::None,
9853 "NOTIFICATION_TYPE_FORCE_NOTIFY" => Self::ForceNotify,
9854 "NOTIFICATION_TYPE_SILENT" => Self::Silent,
9855 _ => Self::UnknownValue(notification_type::UnknownValue(
9856 wkt::internal::UnknownEnumValue::String(value.to_string()),
9857 )),
9858 }
9859 }
9860 }
9861
9862 impl serde::ser::Serialize for NotificationType {
9863 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9864 where
9865 S: serde::Serializer,
9866 {
9867 match self {
9868 Self::None => serializer.serialize_i32(0),
9869 Self::ForceNotify => serializer.serialize_i32(2),
9870 Self::Silent => serializer.serialize_i32(3),
9871 Self::UnknownValue(u) => u.0.serialize(serializer),
9872 }
9873 }
9874 }
9875
9876 impl<'de> serde::de::Deserialize<'de> for NotificationType {
9877 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9878 where
9879 D: serde::Deserializer<'de>,
9880 {
9881 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NotificationType>::new(
9882 ".google.chat.v1.CreateMessageNotificationOptions.NotificationType",
9883 ))
9884 }
9885 }
9886}
9887
9888/// Lists messages in the specified space, that the user is a member of.
9889#[derive(Clone, Default, PartialEq)]
9890#[non_exhaustive]
9891pub struct ListMessagesRequest {
9892 /// Required. The resource name of the space to list messages from.
9893 ///
9894 /// Format: `spaces/{space}`
9895 pub parent: std::string::String,
9896
9897 /// Optional. The maximum number of messages returned. The service might return
9898 /// fewer messages than this value.
9899 ///
9900 /// If unspecified, at most 25 are returned.
9901 ///
9902 /// The maximum value is 1000. If you use a value more than 1000, it's
9903 /// automatically changed to 1000.
9904 ///
9905 /// Negative values return an `INVALID_ARGUMENT` error.
9906 pub page_size: i32,
9907
9908 /// Optional. A page token received from a previous list messages call. Provide
9909 /// this parameter to retrieve the subsequent page.
9910 ///
9911 /// When paginating, all other parameters provided should match the call that
9912 /// provided the page token. Passing different values to the other parameters
9913 /// might lead to unexpected results.
9914 pub page_token: std::string::String,
9915
9916 /// Optional. A query filter.
9917 ///
9918 /// You can filter messages by date (`create_time`) and thread (`thread.name`).
9919 ///
9920 /// To filter messages by the date they were created, specify the `create_time`
9921 /// with a timestamp in [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339)
9922 /// format and double quotation marks. For example,
9923 /// `"2023-04-21T11:30:00-04:00"`. You can use the greater than operator `>` to
9924 /// list messages that were created after a timestamp, or the less than
9925 /// operator `<` to list messages that were created before a timestamp. To
9926 /// filter messages within a time interval, use the `AND` operator between two
9927 /// timestamps.
9928 ///
9929 /// To filter by thread, specify the `thread.name`, formatted as
9930 /// `spaces/{space}/threads/{thread}`. You can only specify one
9931 /// `thread.name` per query.
9932 ///
9933 /// To filter by both thread and date, use the `AND` operator in your query.
9934 ///
9935 /// For example, the following queries are valid:
9936 ///
9937 /// ```norust
9938 /// create_time > "2012-04-21T11:30:00-04:00"
9939 ///
9940 /// create_time > "2012-04-21T11:30:00-04:00" AND
9941 /// thread.name = spaces/AAAAAAAAAAA/threads/123
9942 ///
9943 /// create_time > "2012-04-21T11:30:00+00:00" AND
9944 ///
9945 /// create_time < "2013-01-01T00:00:00+00:00" AND
9946 /// thread.name = spaces/AAAAAAAAAAA/threads/123
9947 ///
9948 /// thread.name = spaces/AAAAAAAAAAA/threads/123
9949 /// ```
9950 ///
9951 /// Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
9952 /// error.
9953 pub filter: std::string::String,
9954
9955 /// Optional. How the list of messages is ordered. Specify a value to order by
9956 /// an ordering operation. Valid ordering operation values are as follows:
9957 ///
9958 /// - `ASC` for ascending.
9959 ///
9960 /// - `DESC` for descending.
9961 ///
9962 ///
9963 /// The default ordering is `create_time ASC`.
9964 pub order_by: std::string::String,
9965
9966 /// Optional. Whether to include deleted messages. Deleted messages include
9967 /// deleted time and metadata about their deletion, but message content is
9968 /// unavailable.
9969 pub show_deleted: bool,
9970
9971 /// Optional. Specifies the desired output syntax for the Chat message
9972 /// `formatted_text` field.
9973 pub markup_syntax: crate::model::MarkupSyntax,
9974
9975 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9976}
9977
9978impl ListMessagesRequest {
9979 /// Creates a new default instance.
9980 pub fn new() -> Self {
9981 std::default::Default::default()
9982 }
9983
9984 /// Sets the value of [parent][crate::model::ListMessagesRequest::parent].
9985 ///
9986 /// # Example
9987 /// ```ignore,no_run
9988 /// # use google_chat_v1::model::ListMessagesRequest;
9989 /// # let space_id = "space_id";
9990 /// let x = ListMessagesRequest::new().set_parent(format!("spaces/{space_id}"));
9991 /// ```
9992 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9993 self.parent = v.into();
9994 self
9995 }
9996
9997 /// Sets the value of [page_size][crate::model::ListMessagesRequest::page_size].
9998 ///
9999 /// # Example
10000 /// ```ignore,no_run
10001 /// # use google_chat_v1::model::ListMessagesRequest;
10002 /// let x = ListMessagesRequest::new().set_page_size(42);
10003 /// ```
10004 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10005 self.page_size = v.into();
10006 self
10007 }
10008
10009 /// Sets the value of [page_token][crate::model::ListMessagesRequest::page_token].
10010 ///
10011 /// # Example
10012 /// ```ignore,no_run
10013 /// # use google_chat_v1::model::ListMessagesRequest;
10014 /// let x = ListMessagesRequest::new().set_page_token("example");
10015 /// ```
10016 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10017 self.page_token = v.into();
10018 self
10019 }
10020
10021 /// Sets the value of [filter][crate::model::ListMessagesRequest::filter].
10022 ///
10023 /// # Example
10024 /// ```ignore,no_run
10025 /// # use google_chat_v1::model::ListMessagesRequest;
10026 /// let x = ListMessagesRequest::new().set_filter("example");
10027 /// ```
10028 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10029 self.filter = v.into();
10030 self
10031 }
10032
10033 /// Sets the value of [order_by][crate::model::ListMessagesRequest::order_by].
10034 ///
10035 /// # Example
10036 /// ```ignore,no_run
10037 /// # use google_chat_v1::model::ListMessagesRequest;
10038 /// let x = ListMessagesRequest::new().set_order_by("example");
10039 /// ```
10040 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10041 self.order_by = v.into();
10042 self
10043 }
10044
10045 /// Sets the value of [show_deleted][crate::model::ListMessagesRequest::show_deleted].
10046 ///
10047 /// # Example
10048 /// ```ignore,no_run
10049 /// # use google_chat_v1::model::ListMessagesRequest;
10050 /// let x = ListMessagesRequest::new().set_show_deleted(true);
10051 /// ```
10052 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10053 self.show_deleted = v.into();
10054 self
10055 }
10056
10057 /// Sets the value of [markup_syntax][crate::model::ListMessagesRequest::markup_syntax].
10058 ///
10059 /// # Example
10060 /// ```ignore,no_run
10061 /// # use google_chat_v1::model::ListMessagesRequest;
10062 /// use google_chat_v1::model::MarkupSyntax;
10063 /// let x0 = ListMessagesRequest::new().set_markup_syntax(MarkupSyntax::Chat);
10064 /// let x1 = ListMessagesRequest::new().set_markup_syntax(MarkupSyntax::Markdown);
10065 /// ```
10066 pub fn set_markup_syntax<T: std::convert::Into<crate::model::MarkupSyntax>>(
10067 mut self,
10068 v: T,
10069 ) -> Self {
10070 self.markup_syntax = v.into();
10071 self
10072 }
10073}
10074
10075impl wkt::message::Message for ListMessagesRequest {
10076 fn typename() -> &'static str {
10077 "type.googleapis.com/google.chat.v1.ListMessagesRequest"
10078 }
10079}
10080
10081/// Response message for listing messages.
10082#[derive(Clone, Default, PartialEq)]
10083#[non_exhaustive]
10084pub struct ListMessagesResponse {
10085 /// List of messages.
10086 pub messages: std::vec::Vec<crate::model::Message>,
10087
10088 /// You can send a token as `pageToken` to retrieve the next page of
10089 /// results. If empty, there are no subsequent pages.
10090 pub next_page_token: std::string::String,
10091
10092 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10093}
10094
10095impl ListMessagesResponse {
10096 /// Creates a new default instance.
10097 pub fn new() -> Self {
10098 std::default::Default::default()
10099 }
10100
10101 /// Sets the value of [messages][crate::model::ListMessagesResponse::messages].
10102 ///
10103 /// # Example
10104 /// ```ignore,no_run
10105 /// # use google_chat_v1::model::ListMessagesResponse;
10106 /// use google_chat_v1::model::Message;
10107 /// let x = ListMessagesResponse::new()
10108 /// .set_messages([
10109 /// Message::default()/* use setters */,
10110 /// Message::default()/* use (different) setters */,
10111 /// ]);
10112 /// ```
10113 pub fn set_messages<T, V>(mut self, v: T) -> Self
10114 where
10115 T: std::iter::IntoIterator<Item = V>,
10116 V: std::convert::Into<crate::model::Message>,
10117 {
10118 use std::iter::Iterator;
10119 self.messages = v.into_iter().map(|i| i.into()).collect();
10120 self
10121 }
10122
10123 /// Sets the value of [next_page_token][crate::model::ListMessagesResponse::next_page_token].
10124 ///
10125 /// # Example
10126 /// ```ignore,no_run
10127 /// # use google_chat_v1::model::ListMessagesResponse;
10128 /// let x = ListMessagesResponse::new().set_next_page_token("example");
10129 /// ```
10130 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10131 self.next_page_token = v.into();
10132 self
10133 }
10134}
10135
10136impl wkt::message::Message for ListMessagesResponse {
10137 fn typename() -> &'static str {
10138 "type.googleapis.com/google.chat.v1.ListMessagesResponse"
10139 }
10140}
10141
10142#[doc(hidden)]
10143impl google_cloud_gax::paginator::internal::PageableResponse for ListMessagesResponse {
10144 type PageItem = crate::model::Message;
10145
10146 fn items(self) -> std::vec::Vec<Self::PageItem> {
10147 self.messages
10148 }
10149
10150 fn next_page_token(&self) -> std::string::String {
10151 use std::clone::Clone;
10152 self.next_page_token.clone()
10153 }
10154}
10155
10156/// Contains a
10157/// [dialog](https://developers.google.com/workspace/chat/dialogs) and request
10158/// status code.
10159#[derive(Clone, Default, PartialEq)]
10160#[non_exhaustive]
10161pub struct DialogAction {
10162 /// Input only. Status for a request to either invoke or submit a
10163 /// [dialog](https://developers.google.com/workspace/chat/dialogs). Displays
10164 /// a status and message to users, if necessary.
10165 /// For example, in case of an error or success.
10166 pub action_status: std::option::Option<crate::model::ActionStatus>,
10167
10168 /// Action to perform.
10169 pub action: std::option::Option<crate::model::dialog_action::Action>,
10170
10171 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10172}
10173
10174impl DialogAction {
10175 /// Creates a new default instance.
10176 pub fn new() -> Self {
10177 std::default::Default::default()
10178 }
10179
10180 /// Sets the value of [action_status][crate::model::DialogAction::action_status].
10181 ///
10182 /// # Example
10183 /// ```ignore,no_run
10184 /// # use google_chat_v1::model::DialogAction;
10185 /// use google_chat_v1::model::ActionStatus;
10186 /// let x = DialogAction::new().set_action_status(ActionStatus::default()/* use setters */);
10187 /// ```
10188 pub fn set_action_status<T>(mut self, v: T) -> Self
10189 where
10190 T: std::convert::Into<crate::model::ActionStatus>,
10191 {
10192 self.action_status = std::option::Option::Some(v.into());
10193 self
10194 }
10195
10196 /// Sets or clears the value of [action_status][crate::model::DialogAction::action_status].
10197 ///
10198 /// # Example
10199 /// ```ignore,no_run
10200 /// # use google_chat_v1::model::DialogAction;
10201 /// use google_chat_v1::model::ActionStatus;
10202 /// let x = DialogAction::new().set_or_clear_action_status(Some(ActionStatus::default()/* use setters */));
10203 /// let x = DialogAction::new().set_or_clear_action_status(None::<ActionStatus>);
10204 /// ```
10205 pub fn set_or_clear_action_status<T>(mut self, v: std::option::Option<T>) -> Self
10206 where
10207 T: std::convert::Into<crate::model::ActionStatus>,
10208 {
10209 self.action_status = v.map(|x| x.into());
10210 self
10211 }
10212
10213 /// Sets the value of [action][crate::model::DialogAction::action].
10214 ///
10215 /// Note that all the setters affecting `action` are mutually
10216 /// exclusive.
10217 ///
10218 /// # Example
10219 /// ```ignore,no_run
10220 /// # use google_chat_v1::model::DialogAction;
10221 /// use google_chat_v1::model::Dialog;
10222 /// let x = DialogAction::new().set_action(Some(
10223 /// google_chat_v1::model::dialog_action::Action::Dialog(Dialog::default().into())));
10224 /// ```
10225 pub fn set_action<
10226 T: std::convert::Into<std::option::Option<crate::model::dialog_action::Action>>,
10227 >(
10228 mut self,
10229 v: T,
10230 ) -> Self {
10231 self.action = v.into();
10232 self
10233 }
10234
10235 /// The value of [action][crate::model::DialogAction::action]
10236 /// if it holds a `Dialog`, `None` if the field is not set or
10237 /// holds a different branch.
10238 pub fn dialog(&self) -> std::option::Option<&std::boxed::Box<crate::model::Dialog>> {
10239 #[allow(unreachable_patterns)]
10240 self.action.as_ref().and_then(|v| match v {
10241 crate::model::dialog_action::Action::Dialog(v) => std::option::Option::Some(v),
10242 _ => std::option::Option::None,
10243 })
10244 }
10245
10246 /// Sets the value of [action][crate::model::DialogAction::action]
10247 /// to hold a `Dialog`.
10248 ///
10249 /// Note that all the setters affecting `action` are
10250 /// mutually exclusive.
10251 ///
10252 /// # Example
10253 /// ```ignore,no_run
10254 /// # use google_chat_v1::model::DialogAction;
10255 /// use google_chat_v1::model::Dialog;
10256 /// let x = DialogAction::new().set_dialog(Dialog::default()/* use setters */);
10257 /// assert!(x.dialog().is_some());
10258 /// ```
10259 pub fn set_dialog<T: std::convert::Into<std::boxed::Box<crate::model::Dialog>>>(
10260 mut self,
10261 v: T,
10262 ) -> Self {
10263 self.action =
10264 std::option::Option::Some(crate::model::dialog_action::Action::Dialog(v.into()));
10265 self
10266 }
10267}
10268
10269impl wkt::message::Message for DialogAction {
10270 fn typename() -> &'static str {
10271 "type.googleapis.com/google.chat.v1.DialogAction"
10272 }
10273}
10274
10275/// Defines additional types related to [DialogAction].
10276pub mod dialog_action {
10277 #[allow(unused_imports)]
10278 use super::*;
10279
10280 /// Action to perform.
10281 #[derive(Clone, Debug, PartialEq)]
10282 #[non_exhaustive]
10283 pub enum Action {
10284 /// Input only.
10285 /// [Dialog](https://developers.google.com/workspace/chat/dialogs) for the
10286 /// request.
10287 Dialog(std::boxed::Box<crate::model::Dialog>),
10288 }
10289}
10290
10291/// Wrapper around the card body of the dialog.
10292#[derive(Clone, Default, PartialEq)]
10293#[non_exhaustive]
10294pub struct Dialog {
10295 /// Input only. Body of the dialog, which is rendered in a modal.
10296 /// Google Chat apps don't support the following card entities:
10297 /// `DateTimePicker`, `OnChangeAction`.
10298 pub body: std::option::Option<google_apps_card_v1::model::Card>,
10299
10300 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10301}
10302
10303impl Dialog {
10304 /// Creates a new default instance.
10305 pub fn new() -> Self {
10306 std::default::Default::default()
10307 }
10308
10309 /// Sets the value of [body][crate::model::Dialog::body].
10310 ///
10311 /// # Example
10312 /// ```ignore,no_run
10313 /// # use google_chat_v1::model::Dialog;
10314 /// use google_apps_card_v1::model::Card;
10315 /// let x = Dialog::new().set_body(Card::default()/* use setters */);
10316 /// ```
10317 pub fn set_body<T>(mut self, v: T) -> Self
10318 where
10319 T: std::convert::Into<google_apps_card_v1::model::Card>,
10320 {
10321 self.body = std::option::Option::Some(v.into());
10322 self
10323 }
10324
10325 /// Sets or clears the value of [body][crate::model::Dialog::body].
10326 ///
10327 /// # Example
10328 /// ```ignore,no_run
10329 /// # use google_chat_v1::model::Dialog;
10330 /// use google_apps_card_v1::model::Card;
10331 /// let x = Dialog::new().set_or_clear_body(Some(Card::default()/* use setters */));
10332 /// let x = Dialog::new().set_or_clear_body(None::<Card>);
10333 /// ```
10334 pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
10335 where
10336 T: std::convert::Into<google_apps_card_v1::model::Card>,
10337 {
10338 self.body = v.map(|x| x.into());
10339 self
10340 }
10341}
10342
10343impl wkt::message::Message for Dialog {
10344 fn typename() -> &'static str {
10345 "type.googleapis.com/google.chat.v1.Dialog"
10346 }
10347}
10348
10349/// A
10350/// [card](https://developers.google.com/workspace/chat/api/reference/rest/v1/cards)
10351/// in a Google Chat message.
10352///
10353/// Chat apps can create cards with [app
10354/// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).
10355/// As part of the [Developer Preview
10356/// Program](https://developers.google.com/workspace/preview), if your Chat app
10357/// [authenticates as a
10358/// user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
10359/// it can create card messages. If your Chat app is not part of Developer
10360/// Preview Program, it can't create cards with user authentication.
10361///
10362/// To learn how to create a message that contains cards, see [Send a
10363/// message](https://developers.google.com/workspace/chat/create-messages).
10364///
10365/// [Card builder](https://addons.gsuite.google.com/uikit/builder)
10366#[derive(Clone, Default, PartialEq)]
10367#[non_exhaustive]
10368pub struct CardWithId {
10369 /// Required if the message contains multiple cards. A unique identifier for
10370 /// a card in a message.
10371 pub card_id: std::string::String,
10372
10373 /// A card. Maximum size is 32 KB.
10374 pub card: std::option::Option<google_apps_card_v1::model::Card>,
10375
10376 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10377}
10378
10379impl CardWithId {
10380 /// Creates a new default instance.
10381 pub fn new() -> Self {
10382 std::default::Default::default()
10383 }
10384
10385 /// Sets the value of [card_id][crate::model::CardWithId::card_id].
10386 ///
10387 /// # Example
10388 /// ```ignore,no_run
10389 /// # use google_chat_v1::model::CardWithId;
10390 /// let x = CardWithId::new().set_card_id("example");
10391 /// ```
10392 pub fn set_card_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10393 self.card_id = v.into();
10394 self
10395 }
10396
10397 /// Sets the value of [card][crate::model::CardWithId::card].
10398 ///
10399 /// # Example
10400 /// ```ignore,no_run
10401 /// # use google_chat_v1::model::CardWithId;
10402 /// use google_apps_card_v1::model::Card;
10403 /// let x = CardWithId::new().set_card(Card::default()/* use setters */);
10404 /// ```
10405 pub fn set_card<T>(mut self, v: T) -> Self
10406 where
10407 T: std::convert::Into<google_apps_card_v1::model::Card>,
10408 {
10409 self.card = std::option::Option::Some(v.into());
10410 self
10411 }
10412
10413 /// Sets or clears the value of [card][crate::model::CardWithId::card].
10414 ///
10415 /// # Example
10416 /// ```ignore,no_run
10417 /// # use google_chat_v1::model::CardWithId;
10418 /// use google_apps_card_v1::model::Card;
10419 /// let x = CardWithId::new().set_or_clear_card(Some(Card::default()/* use setters */));
10420 /// let x = CardWithId::new().set_or_clear_card(None::<Card>);
10421 /// ```
10422 pub fn set_or_clear_card<T>(mut self, v: std::option::Option<T>) -> Self
10423 where
10424 T: std::convert::Into<google_apps_card_v1::model::Card>,
10425 {
10426 self.card = v.map(|x| x.into());
10427 self
10428 }
10429}
10430
10431impl wkt::message::Message for CardWithId {
10432 fn typename() -> &'static str {
10433 "type.googleapis.com/google.chat.v1.CardWithId"
10434 }
10435}
10436
10437/// Request message for searching messages.
10438#[derive(Clone, Default, PartialEq)]
10439#[non_exhaustive]
10440pub struct SearchMessagesRequest {
10441 /// Required. The resource name of the space to search within.
10442 ///
10443 /// To search across all spaces the user has access to, set this field to
10444 /// `spaces/-`. Using any other value for `parent` results in an
10445 /// `INVALID_ARGUMENT` error.
10446 ///
10447 /// To limit the search to one or more spaces, use `space.name` or
10448 /// `space.display_name` in the `filter`.
10449 pub parent: std::string::String,
10450
10451 /// Required. A search query.
10452 ///
10453 /// The query can specify one or more search keywords, which are used to filter
10454 /// the results,
10455 ///
10456 /// You can also filter the results using the following message fields:
10457 ///
10458 /// - `create_time`: Accepts a timestamp in
10459 /// [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) format and the
10460 /// supported comparison operators are: `<` and `>=`.
10461 /// - `sender.name`: The resource name of the sender (`users/{user}`). Only
10462 /// supports `=`. You can use the e-mail as an alias for `{user}`. For
10463 /// example, `users/example@gmail.com`, where `example@gmail.com` is the
10464 /// e-mail of the Google Chat user.
10465 /// - `space.name`: The resource name of the space where the message is posted.
10466 /// (`spaces/{space}`). Only supports `=`. If this filter is not set, the
10467 /// search is performed across all direct messages and spaces the user has
10468 /// access to as a space member.
10469 /// - `space.display_name`: Supports the operator `:` (has) and filters spaces
10470 /// based on a partial match of their display name. Results are limited to
10471 /// the top five space matches. For example, `space.display_name:Project`
10472 /// searches for messages in the top five spaces that contain the word
10473 /// "Project" in their display names.
10474 /// - `attachment`: Supports the operator `:*` (has any) to check for the
10475 /// presence of attachments. If `attachment:*` is specified, only messages
10476 /// that have at least one attachment are returned.
10477 /// - `annotations.user_mentions.user.name`: The resource name of the mentioned
10478 /// user (`users/{user}`). Only supports `:` (has). For example:
10479 /// `annotations.user_mentions.user.name:"users/1234567890"` returns only
10480 /// messages that contain a mention to the specified user. Alternatively, the
10481 /// alias `me` can be used to filter for messages that mention the caller
10482 /// user, for example: `annotations.user_mentions.user.name:users/me`. You
10483 /// can also use the e-mail as an alias for `{user}`, for example,
10484 /// `users/example@gmail.com`.
10485 ///
10486 /// For advanced filtering, the following functions are also available:
10487 ///
10488 /// - `has_link()`: Returns only messages that have at least one hyperlink in
10489 /// the message text.
10490 /// - `is_unread()`: Filters out messages that have been read by the calling
10491 /// user.
10492 ///
10493 /// Using the `space.display_name` filter requires that the calling credentials
10494 /// include one of the following [authorization
10495 /// scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
10496 ///
10497 /// - `<https://www.googleapis.com/auth/chat.spaces.readonly>`
10498 /// - `<https://www.googleapis.com/auth/chat.spaces>`
10499 ///
10500 /// Using the `is_unread()` filter requires that the calling credentials
10501 /// include one of the following [authorization
10502 /// scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
10503 ///
10504 /// - `<https://www.googleapis.com/auth/chat.users.readstate.readonly>`
10505 /// - `<https://www.googleapis.com/auth/chat.users.readstate>`
10506 ///
10507 /// Across different fields, only `AND` operators are supported. A valid
10508 /// example is `sender.name = "users/1234567890" AND is_unread()`. The word
10509 /// `AND` is optional and is implied if omitted. For example, `sender.name =
10510 /// "users/1234567890" is_unread()` is valid and is equivalent to the previous
10511 /// example. An invalid example is `sender.name = "users/1234567890" OR
10512 /// is_unread()` because `OR` is not supported between different fields.
10513 ///
10514 /// Among the same field:
10515 ///
10516 /// - `create_time` supports only `AND`, and can only be used to represent
10517 /// an interval, such as `create_time >= "2022-01-01T00:00:00+00:00" AND
10518 /// create_time < "2023-01-01T00:00:00+00:00"`.
10519 /// - `sender.name` supports only the `OR` operator, for example:
10520 /// `sender.name = "users/1234567890" OR sender.name = "users/0987654321"`.
10521 /// - `space.name` supports only the `OR` operator, for example:
10522 /// `space.name = "spaces/ABCDEFGH" OR space.name = "spaces/QWERTYUI"`.
10523 /// - `space.display_name` supports the operators `AND` and `OR`, but not a
10524 /// mix of both. For example:
10525 /// `space.display_name:Project AND space.display_name:Tasks` returns
10526 /// messages that are in spaces with display names containing both `Project`
10527 /// and `Tasks`, whereas
10528 /// `space.display_name:Project OR space.display_name:Tasks` returns messages
10529 /// that are in spaces with display names containing either `Project` or
10530 /// `Tasks` or both.
10531 /// - `annotations.user_mentions.user.name` supports the operators `AND` and
10532 /// `OR`, but not a mix of both. For example:
10533 /// `annotations.user_mentions.user.name:"users/1234567890" AND
10534 /// annotations.user_mentions.user.name:"users/0987654321"` returns only
10535 /// messages that mentions both users, whereas
10536 /// `annotations.user_mentions.user.name:"users/1234567890" OR
10537 /// annotations.user_mentions.user.name:"users/0987654321"` returns messages
10538 /// that mention either user or both.
10539 ///
10540 /// Parentheses are required to disambiguate operator precedence when combining
10541 /// `AND` and `OR` operators in the same query. For example:
10542 /// `(sender.name="users/me" OR sender.name="users/123456") AND is_unread()`.
10543 /// Otherwise, parentheses are optional.
10544 ///
10545 /// The following example queries are valid:
10546 ///
10547 /// ```norust
10548 /// "Pending reports" AND create_time >= "2023-01-01T00:00:00Z"
10549 ///
10550 /// sender.name = "users/example@gmail.com"
10551 ///
10552 /// annotations.user_mentions.user.name:"users/0987654321"
10553 ///
10554 /// attachment:* AND space.name = "spaces/ABCDEFGH"
10555 ///
10556 /// tasks AND is_unread() AND sender.name = "users/1234567890"
10557 ///
10558 /// "things to do" "urgent"
10559 ///
10560 /// (sender.name = "users/1234567890")
10561 /// AND (create_time < "2023-05-01T00:00:00Z")
10562 ///
10563 /// tasks AND space.name = "spaces/ABCDEFGH" AND has_link()
10564 ///
10565 /// "project one" is_unread()
10566 ///
10567 /// space.display_name:Project tasks
10568 /// ```
10569 ///
10570 /// The maximum query length is 1,000 characters.
10571 ///
10572 /// Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
10573 /// error.
10574 pub filter: std::string::String,
10575
10576 /// Optional. The maximum number of results to return. The service may return
10577 /// fewer than this value.
10578 ///
10579 /// If unspecified, at most 25 are returned.
10580 ///
10581 /// The maximum value is 100. If you use a value more than 100, it's
10582 /// automatically changed to 100.
10583 pub page_size: i32,
10584
10585 /// Optional. A token, received from the previous search messages call. Provide
10586 /// this parameter to retrieve the subsequent page.
10587 ///
10588 /// When paginating, all other parameters provided should match the call that
10589 /// provided the page token. Passing different values to the other parameters
10590 /// might lead to unexpected results.
10591 pub page_token: std::string::String,
10592
10593 /// Optional. How the results list is ordered.
10594 ///
10595 /// Supported attributes to order by are:
10596 ///
10597 /// - `create_time`: Sorts the results by the time of the message creation.
10598 /// Default value.
10599 /// - `relevance`: Sorts the results by relevance.
10600 /// [Developer Preview](https://developers.google.com/workspace/preview).
10601 ///
10602 /// The default ordering is `create_time desc`. Only a single order per query
10603 /// (`create_time` or `relevance`) is supported. Only descending order (`desc`)
10604 /// is supported, and it must be specified after the order attribute.
10605 pub order_by: std::string::String,
10606
10607 /// Optional. Specifies the desired output syntax for the Chat message
10608 /// `formatted_text` field.
10609 pub markup_syntax: crate::model::MarkupSyntax,
10610
10611 /// Optional. Specifies what kind of search results view to return. The default
10612 /// is `SEARCH_MESSAGES_VIEW_BASIC`.
10613 pub view: crate::model::search_messages_request::SearchMessagesView,
10614
10615 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10616}
10617
10618impl SearchMessagesRequest {
10619 /// Creates a new default instance.
10620 pub fn new() -> Self {
10621 std::default::Default::default()
10622 }
10623
10624 /// Sets the value of [parent][crate::model::SearchMessagesRequest::parent].
10625 ///
10626 /// # Example
10627 /// ```ignore,no_run
10628 /// # use google_chat_v1::model::SearchMessagesRequest;
10629 /// # let space_id = "space_id";
10630 /// let x = SearchMessagesRequest::new().set_parent(format!("spaces/{space_id}"));
10631 /// ```
10632 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10633 self.parent = v.into();
10634 self
10635 }
10636
10637 /// Sets the value of [filter][crate::model::SearchMessagesRequest::filter].
10638 ///
10639 /// # Example
10640 /// ```ignore,no_run
10641 /// # use google_chat_v1::model::SearchMessagesRequest;
10642 /// let x = SearchMessagesRequest::new().set_filter("example");
10643 /// ```
10644 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10645 self.filter = v.into();
10646 self
10647 }
10648
10649 /// Sets the value of [page_size][crate::model::SearchMessagesRequest::page_size].
10650 ///
10651 /// # Example
10652 /// ```ignore,no_run
10653 /// # use google_chat_v1::model::SearchMessagesRequest;
10654 /// let x = SearchMessagesRequest::new().set_page_size(42);
10655 /// ```
10656 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10657 self.page_size = v.into();
10658 self
10659 }
10660
10661 /// Sets the value of [page_token][crate::model::SearchMessagesRequest::page_token].
10662 ///
10663 /// # Example
10664 /// ```ignore,no_run
10665 /// # use google_chat_v1::model::SearchMessagesRequest;
10666 /// let x = SearchMessagesRequest::new().set_page_token("example");
10667 /// ```
10668 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10669 self.page_token = v.into();
10670 self
10671 }
10672
10673 /// Sets the value of [order_by][crate::model::SearchMessagesRequest::order_by].
10674 ///
10675 /// # Example
10676 /// ```ignore,no_run
10677 /// # use google_chat_v1::model::SearchMessagesRequest;
10678 /// let x = SearchMessagesRequest::new().set_order_by("example");
10679 /// ```
10680 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10681 self.order_by = v.into();
10682 self
10683 }
10684
10685 /// Sets the value of [markup_syntax][crate::model::SearchMessagesRequest::markup_syntax].
10686 ///
10687 /// # Example
10688 /// ```ignore,no_run
10689 /// # use google_chat_v1::model::SearchMessagesRequest;
10690 /// use google_chat_v1::model::MarkupSyntax;
10691 /// let x0 = SearchMessagesRequest::new().set_markup_syntax(MarkupSyntax::Chat);
10692 /// let x1 = SearchMessagesRequest::new().set_markup_syntax(MarkupSyntax::Markdown);
10693 /// ```
10694 pub fn set_markup_syntax<T: std::convert::Into<crate::model::MarkupSyntax>>(
10695 mut self,
10696 v: T,
10697 ) -> Self {
10698 self.markup_syntax = v.into();
10699 self
10700 }
10701
10702 /// Sets the value of [view][crate::model::SearchMessagesRequest::view].
10703 ///
10704 /// # Example
10705 /// ```ignore,no_run
10706 /// # use google_chat_v1::model::SearchMessagesRequest;
10707 /// use google_chat_v1::model::search_messages_request::SearchMessagesView;
10708 /// let x0 = SearchMessagesRequest::new().set_view(SearchMessagesView::Basic);
10709 /// let x1 = SearchMessagesRequest::new().set_view(SearchMessagesView::Full);
10710 /// ```
10711 pub fn set_view<
10712 T: std::convert::Into<crate::model::search_messages_request::SearchMessagesView>,
10713 >(
10714 mut self,
10715 v: T,
10716 ) -> Self {
10717 self.view = v.into();
10718 self
10719 }
10720}
10721
10722impl wkt::message::Message for SearchMessagesRequest {
10723 fn typename() -> &'static str {
10724 "type.googleapis.com/google.chat.v1.SearchMessagesRequest"
10725 }
10726}
10727
10728/// Defines additional types related to [SearchMessagesRequest].
10729pub mod search_messages_request {
10730 #[allow(unused_imports)]
10731 use super::*;
10732
10733 /// The kinds of view that are supported for partial search results.
10734 ///
10735 /// # Working with unknown values
10736 ///
10737 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10738 /// additional enum variants at any time. Adding new variants is not considered
10739 /// a breaking change. Applications should write their code in anticipation of:
10740 ///
10741 /// - New values appearing in future releases of the client library, **and**
10742 /// - New values received dynamically, without application changes.
10743 ///
10744 /// Please consult the [Working with enums] section in the user guide for some
10745 /// guidelines.
10746 ///
10747 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10748 #[derive(Clone, Debug, PartialEq)]
10749 #[non_exhaustive]
10750 pub enum SearchMessagesView {
10751 /// The default / unset value.
10752 /// The API will default to the BASIC view.
10753 Unspecified,
10754 /// Includes only the matched messages in the results, but no additional
10755 /// metadata. This is the default value.
10756 Basic,
10757 /// Includes everything in the results: the matched messages and additional
10758 /// metadata.
10759 Full,
10760 /// If set, the enum was initialized with an unknown value.
10761 ///
10762 /// Applications can examine the value using [SearchMessagesView::value] or
10763 /// [SearchMessagesView::name].
10764 UnknownValue(search_messages_view::UnknownValue),
10765 }
10766
10767 #[doc(hidden)]
10768 pub mod search_messages_view {
10769 #[allow(unused_imports)]
10770 use super::*;
10771 #[derive(Clone, Debug, PartialEq)]
10772 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10773 }
10774
10775 impl SearchMessagesView {
10776 /// Gets the enum value.
10777 ///
10778 /// Returns `None` if the enum contains an unknown value deserialized from
10779 /// the string representation of enums.
10780 pub fn value(&self) -> std::option::Option<i32> {
10781 match self {
10782 Self::Unspecified => std::option::Option::Some(0),
10783 Self::Basic => std::option::Option::Some(1),
10784 Self::Full => std::option::Option::Some(2),
10785 Self::UnknownValue(u) => u.0.value(),
10786 }
10787 }
10788
10789 /// Gets the enum value as a string.
10790 ///
10791 /// Returns `None` if the enum contains an unknown value deserialized from
10792 /// the integer representation of enums.
10793 pub fn name(&self) -> std::option::Option<&str> {
10794 match self {
10795 Self::Unspecified => std::option::Option::Some("SEARCH_MESSAGES_VIEW_UNSPECIFIED"),
10796 Self::Basic => std::option::Option::Some("SEARCH_MESSAGES_VIEW_BASIC"),
10797 Self::Full => std::option::Option::Some("SEARCH_MESSAGES_VIEW_FULL"),
10798 Self::UnknownValue(u) => u.0.name(),
10799 }
10800 }
10801 }
10802
10803 impl std::default::Default for SearchMessagesView {
10804 fn default() -> Self {
10805 use std::convert::From;
10806 Self::from(0)
10807 }
10808 }
10809
10810 impl std::fmt::Display for SearchMessagesView {
10811 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10812 wkt::internal::display_enum(f, self.name(), self.value())
10813 }
10814 }
10815
10816 impl std::convert::From<i32> for SearchMessagesView {
10817 fn from(value: i32) -> Self {
10818 match value {
10819 0 => Self::Unspecified,
10820 1 => Self::Basic,
10821 2 => Self::Full,
10822 _ => Self::UnknownValue(search_messages_view::UnknownValue(
10823 wkt::internal::UnknownEnumValue::Integer(value),
10824 )),
10825 }
10826 }
10827 }
10828
10829 impl std::convert::From<&str> for SearchMessagesView {
10830 fn from(value: &str) -> Self {
10831 use std::string::ToString;
10832 match value {
10833 "SEARCH_MESSAGES_VIEW_UNSPECIFIED" => Self::Unspecified,
10834 "SEARCH_MESSAGES_VIEW_BASIC" => Self::Basic,
10835 "SEARCH_MESSAGES_VIEW_FULL" => Self::Full,
10836 _ => Self::UnknownValue(search_messages_view::UnknownValue(
10837 wkt::internal::UnknownEnumValue::String(value.to_string()),
10838 )),
10839 }
10840 }
10841 }
10842
10843 impl serde::ser::Serialize for SearchMessagesView {
10844 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10845 where
10846 S: serde::Serializer,
10847 {
10848 match self {
10849 Self::Unspecified => serializer.serialize_i32(0),
10850 Self::Basic => serializer.serialize_i32(1),
10851 Self::Full => serializer.serialize_i32(2),
10852 Self::UnknownValue(u) => u.0.serialize(serializer),
10853 }
10854 }
10855 }
10856
10857 impl<'de> serde::de::Deserialize<'de> for SearchMessagesView {
10858 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10859 where
10860 D: serde::Deserializer<'de>,
10861 {
10862 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchMessagesView>::new(
10863 ".google.chat.v1.SearchMessagesRequest.SearchMessagesView",
10864 ))
10865 }
10866 }
10867}
10868
10869/// Response message for searching messages.
10870#[derive(Clone, Default, PartialEq)]
10871#[non_exhaustive]
10872pub struct SearchMessagesResponse {
10873 /// The list of search results that matched the query.
10874 pub results: std::vec::Vec<crate::model::SearchMessageResult>,
10875
10876 /// A token that can be used to retrieve the next page. If this field is empty,
10877 /// there are no subsequent pages.
10878 pub next_page_token: std::string::String,
10879
10880 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10881}
10882
10883impl SearchMessagesResponse {
10884 /// Creates a new default instance.
10885 pub fn new() -> Self {
10886 std::default::Default::default()
10887 }
10888
10889 /// Sets the value of [results][crate::model::SearchMessagesResponse::results].
10890 ///
10891 /// # Example
10892 /// ```ignore,no_run
10893 /// # use google_chat_v1::model::SearchMessagesResponse;
10894 /// use google_chat_v1::model::SearchMessageResult;
10895 /// let x = SearchMessagesResponse::new()
10896 /// .set_results([
10897 /// SearchMessageResult::default()/* use setters */,
10898 /// SearchMessageResult::default()/* use (different) setters */,
10899 /// ]);
10900 /// ```
10901 pub fn set_results<T, V>(mut self, v: T) -> Self
10902 where
10903 T: std::iter::IntoIterator<Item = V>,
10904 V: std::convert::Into<crate::model::SearchMessageResult>,
10905 {
10906 use std::iter::Iterator;
10907 self.results = v.into_iter().map(|i| i.into()).collect();
10908 self
10909 }
10910
10911 /// Sets the value of [next_page_token][crate::model::SearchMessagesResponse::next_page_token].
10912 ///
10913 /// # Example
10914 /// ```ignore,no_run
10915 /// # use google_chat_v1::model::SearchMessagesResponse;
10916 /// let x = SearchMessagesResponse::new().set_next_page_token("example");
10917 /// ```
10918 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10919 self.next_page_token = v.into();
10920 self
10921 }
10922}
10923
10924impl wkt::message::Message for SearchMessagesResponse {
10925 fn typename() -> &'static str {
10926 "type.googleapis.com/google.chat.v1.SearchMessagesResponse"
10927 }
10928}
10929
10930#[doc(hidden)]
10931impl google_cloud_gax::paginator::internal::PageableResponse for SearchMessagesResponse {
10932 type PageItem = crate::model::SearchMessageResult;
10933
10934 fn items(self) -> std::vec::Vec<Self::PageItem> {
10935 self.results
10936 }
10937
10938 fn next_page_token(&self) -> std::string::String {
10939 use std::clone::Clone;
10940 self.next_page_token.clone()
10941 }
10942}
10943
10944/// A single result item from a message search.
10945#[derive(Clone, Default, PartialEq)]
10946#[non_exhaustive]
10947pub struct SearchMessageResult {
10948 /// The matched message.
10949 pub message: std::option::Option<crate::model::Message>,
10950
10951 /// Indicates if the matched message is read by the calling user.
10952 ///
10953 /// Only returned if the request view is `SEARCH_MESSAGES_VIEW_FULL` and the
10954 /// calling credentials include one of the following [authorization
10955 /// scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
10956 ///
10957 /// - `<https://www.googleapis.com/auth/chat.users.readstate.readonly>`
10958 /// - `<https://www.googleapis.com/auth/chat.users.readstate>`
10959 pub read: std::option::Option<bool>,
10960
10961 /// The mute setting of the calling user for the space where the message is
10962 /// posted. The caller app can use this information to decide how to process
10963 /// the message depending on whether the space is muted for the user or not.
10964 ///
10965 /// Only returned if the request view is `SEARCH_MESSAGES_VIEW_FULL` and the
10966 /// calling credentials include the following [authorization
10967 /// scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
10968 ///
10969 /// - `<https://www.googleapis.com/auth/chat.users.spacesettings>`
10970 pub space_mute_setting: crate::model::space_notification_setting::MuteSetting,
10971
10972 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10973}
10974
10975impl SearchMessageResult {
10976 /// Creates a new default instance.
10977 pub fn new() -> Self {
10978 std::default::Default::default()
10979 }
10980
10981 /// Sets the value of [message][crate::model::SearchMessageResult::message].
10982 ///
10983 /// # Example
10984 /// ```ignore,no_run
10985 /// # use google_chat_v1::model::SearchMessageResult;
10986 /// use google_chat_v1::model::Message;
10987 /// let x = SearchMessageResult::new().set_message(Message::default()/* use setters */);
10988 /// ```
10989 pub fn set_message<T>(mut self, v: T) -> Self
10990 where
10991 T: std::convert::Into<crate::model::Message>,
10992 {
10993 self.message = std::option::Option::Some(v.into());
10994 self
10995 }
10996
10997 /// Sets or clears the value of [message][crate::model::SearchMessageResult::message].
10998 ///
10999 /// # Example
11000 /// ```ignore,no_run
11001 /// # use google_chat_v1::model::SearchMessageResult;
11002 /// use google_chat_v1::model::Message;
11003 /// let x = SearchMessageResult::new().set_or_clear_message(Some(Message::default()/* use setters */));
11004 /// let x = SearchMessageResult::new().set_or_clear_message(None::<Message>);
11005 /// ```
11006 pub fn set_or_clear_message<T>(mut self, v: std::option::Option<T>) -> Self
11007 where
11008 T: std::convert::Into<crate::model::Message>,
11009 {
11010 self.message = v.map(|x| x.into());
11011 self
11012 }
11013
11014 /// Sets the value of [read][crate::model::SearchMessageResult::read].
11015 ///
11016 /// # Example
11017 /// ```ignore,no_run
11018 /// # use google_chat_v1::model::SearchMessageResult;
11019 /// let x = SearchMessageResult::new().set_read(true);
11020 /// ```
11021 pub fn set_read<T>(mut self, v: T) -> Self
11022 where
11023 T: std::convert::Into<bool>,
11024 {
11025 self.read = std::option::Option::Some(v.into());
11026 self
11027 }
11028
11029 /// Sets or clears the value of [read][crate::model::SearchMessageResult::read].
11030 ///
11031 /// # Example
11032 /// ```ignore,no_run
11033 /// # use google_chat_v1::model::SearchMessageResult;
11034 /// let x = SearchMessageResult::new().set_or_clear_read(Some(false));
11035 /// let x = SearchMessageResult::new().set_or_clear_read(None::<bool>);
11036 /// ```
11037 pub fn set_or_clear_read<T>(mut self, v: std::option::Option<T>) -> Self
11038 where
11039 T: std::convert::Into<bool>,
11040 {
11041 self.read = v.map(|x| x.into());
11042 self
11043 }
11044
11045 /// Sets the value of [space_mute_setting][crate::model::SearchMessageResult::space_mute_setting].
11046 ///
11047 /// # Example
11048 /// ```ignore,no_run
11049 /// # use google_chat_v1::model::SearchMessageResult;
11050 /// use google_chat_v1::model::space_notification_setting::MuteSetting;
11051 /// let x0 = SearchMessageResult::new().set_space_mute_setting(MuteSetting::Unmuted);
11052 /// let x1 = SearchMessageResult::new().set_space_mute_setting(MuteSetting::Muted);
11053 /// ```
11054 pub fn set_space_mute_setting<
11055 T: std::convert::Into<crate::model::space_notification_setting::MuteSetting>,
11056 >(
11057 mut self,
11058 v: T,
11059 ) -> Self {
11060 self.space_mute_setting = v.into();
11061 self
11062 }
11063}
11064
11065impl wkt::message::Message for SearchMessageResult {
11066 fn typename() -> &'static str {
11067 "type.googleapis.com/google.chat.v1.SearchMessageResult"
11068 }
11069}
11070
11071/// A reaction to a message.
11072#[derive(Clone, Default, PartialEq)]
11073#[non_exhaustive]
11074pub struct Reaction {
11075 /// Identifier. The resource name of the reaction.
11076 ///
11077 /// Format: `spaces/{space}/messages/{message}/reactions/{reaction}`
11078 pub name: std::string::String,
11079
11080 /// Output only. The user who created the reaction.
11081 pub user: std::option::Option<crate::model::User>,
11082
11083 /// Required. The emoji used in the reaction.
11084 pub emoji: std::option::Option<crate::model::Emoji>,
11085
11086 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11087}
11088
11089impl Reaction {
11090 /// Creates a new default instance.
11091 pub fn new() -> Self {
11092 std::default::Default::default()
11093 }
11094
11095 /// Sets the value of [name][crate::model::Reaction::name].
11096 ///
11097 /// # Example
11098 /// ```ignore,no_run
11099 /// # use google_chat_v1::model::Reaction;
11100 /// # let space_id = "space_id";
11101 /// # let message_id = "message_id";
11102 /// # let reaction_id = "reaction_id";
11103 /// let x = Reaction::new().set_name(format!("spaces/{space_id}/messages/{message_id}/reactions/{reaction_id}"));
11104 /// ```
11105 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11106 self.name = v.into();
11107 self
11108 }
11109
11110 /// Sets the value of [user][crate::model::Reaction::user].
11111 ///
11112 /// # Example
11113 /// ```ignore,no_run
11114 /// # use google_chat_v1::model::Reaction;
11115 /// use google_chat_v1::model::User;
11116 /// let x = Reaction::new().set_user(User::default()/* use setters */);
11117 /// ```
11118 pub fn set_user<T>(mut self, v: T) -> Self
11119 where
11120 T: std::convert::Into<crate::model::User>,
11121 {
11122 self.user = std::option::Option::Some(v.into());
11123 self
11124 }
11125
11126 /// Sets or clears the value of [user][crate::model::Reaction::user].
11127 ///
11128 /// # Example
11129 /// ```ignore,no_run
11130 /// # use google_chat_v1::model::Reaction;
11131 /// use google_chat_v1::model::User;
11132 /// let x = Reaction::new().set_or_clear_user(Some(User::default()/* use setters */));
11133 /// let x = Reaction::new().set_or_clear_user(None::<User>);
11134 /// ```
11135 pub fn set_or_clear_user<T>(mut self, v: std::option::Option<T>) -> Self
11136 where
11137 T: std::convert::Into<crate::model::User>,
11138 {
11139 self.user = v.map(|x| x.into());
11140 self
11141 }
11142
11143 /// Sets the value of [emoji][crate::model::Reaction::emoji].
11144 ///
11145 /// # Example
11146 /// ```ignore,no_run
11147 /// # use google_chat_v1::model::Reaction;
11148 /// use google_chat_v1::model::Emoji;
11149 /// let x = Reaction::new().set_emoji(Emoji::default()/* use setters */);
11150 /// ```
11151 pub fn set_emoji<T>(mut self, v: T) -> Self
11152 where
11153 T: std::convert::Into<crate::model::Emoji>,
11154 {
11155 self.emoji = std::option::Option::Some(v.into());
11156 self
11157 }
11158
11159 /// Sets or clears the value of [emoji][crate::model::Reaction::emoji].
11160 ///
11161 /// # Example
11162 /// ```ignore,no_run
11163 /// # use google_chat_v1::model::Reaction;
11164 /// use google_chat_v1::model::Emoji;
11165 /// let x = Reaction::new().set_or_clear_emoji(Some(Emoji::default()/* use setters */));
11166 /// let x = Reaction::new().set_or_clear_emoji(None::<Emoji>);
11167 /// ```
11168 pub fn set_or_clear_emoji<T>(mut self, v: std::option::Option<T>) -> Self
11169 where
11170 T: std::convert::Into<crate::model::Emoji>,
11171 {
11172 self.emoji = v.map(|x| x.into());
11173 self
11174 }
11175}
11176
11177impl wkt::message::Message for Reaction {
11178 fn typename() -> &'static str {
11179 "type.googleapis.com/google.chat.v1.Reaction"
11180 }
11181}
11182
11183/// An emoji that is used as a reaction to a message.
11184#[derive(Clone, Default, PartialEq)]
11185#[non_exhaustive]
11186pub struct Emoji {
11187 /// Required. The content of the emoji.
11188 pub content: std::option::Option<crate::model::emoji::Content>,
11189
11190 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11191}
11192
11193impl Emoji {
11194 /// Creates a new default instance.
11195 pub fn new() -> Self {
11196 std::default::Default::default()
11197 }
11198
11199 /// Sets the value of [content][crate::model::Emoji::content].
11200 ///
11201 /// Note that all the setters affecting `content` are mutually
11202 /// exclusive.
11203 ///
11204 /// # Example
11205 /// ```ignore,no_run
11206 /// # use google_chat_v1::model::Emoji;
11207 /// use google_chat_v1::model::emoji::Content;
11208 /// let x = Emoji::new().set_content(Some(Content::Unicode("example".to_string())));
11209 /// ```
11210 pub fn set_content<T: std::convert::Into<std::option::Option<crate::model::emoji::Content>>>(
11211 mut self,
11212 v: T,
11213 ) -> Self {
11214 self.content = v.into();
11215 self
11216 }
11217
11218 /// The value of [content][crate::model::Emoji::content]
11219 /// if it holds a `Unicode`, `None` if the field is not set or
11220 /// holds a different branch.
11221 pub fn unicode(&self) -> std::option::Option<&std::string::String> {
11222 #[allow(unreachable_patterns)]
11223 self.content.as_ref().and_then(|v| match v {
11224 crate::model::emoji::Content::Unicode(v) => std::option::Option::Some(v),
11225 _ => std::option::Option::None,
11226 })
11227 }
11228
11229 /// Sets the value of [content][crate::model::Emoji::content]
11230 /// to hold a `Unicode`.
11231 ///
11232 /// Note that all the setters affecting `content` are
11233 /// mutually exclusive.
11234 ///
11235 /// # Example
11236 /// ```ignore,no_run
11237 /// # use google_chat_v1::model::Emoji;
11238 /// let x = Emoji::new().set_unicode("example");
11239 /// assert!(x.unicode().is_some());
11240 /// assert!(x.custom_emoji().is_none());
11241 /// ```
11242 pub fn set_unicode<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11243 self.content = std::option::Option::Some(crate::model::emoji::Content::Unicode(v.into()));
11244 self
11245 }
11246
11247 /// The value of [content][crate::model::Emoji::content]
11248 /// if it holds a `CustomEmoji`, `None` if the field is not set or
11249 /// holds a different branch.
11250 pub fn custom_emoji(&self) -> std::option::Option<&std::boxed::Box<crate::model::CustomEmoji>> {
11251 #[allow(unreachable_patterns)]
11252 self.content.as_ref().and_then(|v| match v {
11253 crate::model::emoji::Content::CustomEmoji(v) => std::option::Option::Some(v),
11254 _ => std::option::Option::None,
11255 })
11256 }
11257
11258 /// Sets the value of [content][crate::model::Emoji::content]
11259 /// to hold a `CustomEmoji`.
11260 ///
11261 /// Note that all the setters affecting `content` are
11262 /// mutually exclusive.
11263 ///
11264 /// # Example
11265 /// ```ignore,no_run
11266 /// # use google_chat_v1::model::Emoji;
11267 /// use google_chat_v1::model::CustomEmoji;
11268 /// let x = Emoji::new().set_custom_emoji(CustomEmoji::default()/* use setters */);
11269 /// assert!(x.custom_emoji().is_some());
11270 /// assert!(x.unicode().is_none());
11271 /// ```
11272 pub fn set_custom_emoji<T: std::convert::Into<std::boxed::Box<crate::model::CustomEmoji>>>(
11273 mut self,
11274 v: T,
11275 ) -> Self {
11276 self.content =
11277 std::option::Option::Some(crate::model::emoji::Content::CustomEmoji(v.into()));
11278 self
11279 }
11280}
11281
11282impl wkt::message::Message for Emoji {
11283 fn typename() -> &'static str {
11284 "type.googleapis.com/google.chat.v1.Emoji"
11285 }
11286}
11287
11288/// Defines additional types related to [Emoji].
11289pub mod emoji {
11290 #[allow(unused_imports)]
11291 use super::*;
11292
11293 /// Required. The content of the emoji.
11294 #[derive(Clone, Debug, PartialEq)]
11295 #[non_exhaustive]
11296 pub enum Content {
11297 /// Optional. A basic emoji represented by a unicode string.
11298 Unicode(std::string::String),
11299 /// A custom emoji.
11300 CustomEmoji(std::boxed::Box<crate::model::CustomEmoji>),
11301 }
11302}
11303
11304/// Represents a [custom emoji](https://support.google.com/chat/answer/12800149).
11305#[derive(Clone, Default, PartialEq)]
11306#[non_exhaustive]
11307pub struct CustomEmoji {
11308 /// Identifier. The resource name of the custom emoji, assigned by the server.
11309 ///
11310 /// Format: `customEmojis/{customEmoji}`
11311 pub name: std::string::String,
11312
11313 /// Output only. Unique key for the custom emoji resource.
11314 pub uid: std::string::String,
11315
11316 /// Optional. Immutable. User-provided name for the custom emoji, which is
11317 /// unique within the organization.
11318 ///
11319 /// Required when the custom emoji is created, output only otherwise.
11320 ///
11321 /// Emoji names must start and end with colons, must be lowercase and can only
11322 /// contain alphanumeric characters, hyphens, and underscores.
11323 /// Hyphens and underscores should be used to separate words and cannot be used
11324 /// consecutively.
11325 ///
11326 /// Example: `:valid-emoji-name:`
11327 pub emoji_name: std::string::String,
11328
11329 /// Output only. A temporary image URL for the custom emoji, valid for at least
11330 /// 10 minutes. Note that this is not populated in the response when the custom
11331 /// emoji is created.
11332 pub temporary_image_uri: std::string::String,
11333
11334 /// Optional. Input only. Payload data.
11335 /// Required when the custom emoji is created.
11336 pub payload: std::option::Option<crate::model::custom_emoji::CustomEmojiPayload>,
11337
11338 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11339}
11340
11341impl CustomEmoji {
11342 /// Creates a new default instance.
11343 pub fn new() -> Self {
11344 std::default::Default::default()
11345 }
11346
11347 /// Sets the value of [name][crate::model::CustomEmoji::name].
11348 ///
11349 /// # Example
11350 /// ```ignore,no_run
11351 /// # use google_chat_v1::model::CustomEmoji;
11352 /// # let custom_emoji_id = "custom_emoji_id";
11353 /// let x = CustomEmoji::new().set_name(format!("customEmojis/{custom_emoji_id}"));
11354 /// ```
11355 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11356 self.name = v.into();
11357 self
11358 }
11359
11360 /// Sets the value of [uid][crate::model::CustomEmoji::uid].
11361 ///
11362 /// # Example
11363 /// ```ignore,no_run
11364 /// # use google_chat_v1::model::CustomEmoji;
11365 /// let x = CustomEmoji::new().set_uid("example");
11366 /// ```
11367 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11368 self.uid = v.into();
11369 self
11370 }
11371
11372 /// Sets the value of [emoji_name][crate::model::CustomEmoji::emoji_name].
11373 ///
11374 /// # Example
11375 /// ```ignore,no_run
11376 /// # use google_chat_v1::model::CustomEmoji;
11377 /// let x = CustomEmoji::new().set_emoji_name("example");
11378 /// ```
11379 pub fn set_emoji_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11380 self.emoji_name = v.into();
11381 self
11382 }
11383
11384 /// Sets the value of [temporary_image_uri][crate::model::CustomEmoji::temporary_image_uri].
11385 ///
11386 /// # Example
11387 /// ```ignore,no_run
11388 /// # use google_chat_v1::model::CustomEmoji;
11389 /// let x = CustomEmoji::new().set_temporary_image_uri("example");
11390 /// ```
11391 pub fn set_temporary_image_uri<T: std::convert::Into<std::string::String>>(
11392 mut self,
11393 v: T,
11394 ) -> Self {
11395 self.temporary_image_uri = v.into();
11396 self
11397 }
11398
11399 /// Sets the value of [payload][crate::model::CustomEmoji::payload].
11400 ///
11401 /// # Example
11402 /// ```ignore,no_run
11403 /// # use google_chat_v1::model::CustomEmoji;
11404 /// use google_chat_v1::model::custom_emoji::CustomEmojiPayload;
11405 /// let x = CustomEmoji::new().set_payload(CustomEmojiPayload::default()/* use setters */);
11406 /// ```
11407 pub fn set_payload<T>(mut self, v: T) -> Self
11408 where
11409 T: std::convert::Into<crate::model::custom_emoji::CustomEmojiPayload>,
11410 {
11411 self.payload = std::option::Option::Some(v.into());
11412 self
11413 }
11414
11415 /// Sets or clears the value of [payload][crate::model::CustomEmoji::payload].
11416 ///
11417 /// # Example
11418 /// ```ignore,no_run
11419 /// # use google_chat_v1::model::CustomEmoji;
11420 /// use google_chat_v1::model::custom_emoji::CustomEmojiPayload;
11421 /// let x = CustomEmoji::new().set_or_clear_payload(Some(CustomEmojiPayload::default()/* use setters */));
11422 /// let x = CustomEmoji::new().set_or_clear_payload(None::<CustomEmojiPayload>);
11423 /// ```
11424 pub fn set_or_clear_payload<T>(mut self, v: std::option::Option<T>) -> Self
11425 where
11426 T: std::convert::Into<crate::model::custom_emoji::CustomEmojiPayload>,
11427 {
11428 self.payload = v.map(|x| x.into());
11429 self
11430 }
11431}
11432
11433impl wkt::message::Message for CustomEmoji {
11434 fn typename() -> &'static str {
11435 "type.googleapis.com/google.chat.v1.CustomEmoji"
11436 }
11437}
11438
11439/// Defines additional types related to [CustomEmoji].
11440pub mod custom_emoji {
11441 #[allow(unused_imports)]
11442 use super::*;
11443
11444 /// Payload data for the custom emoji.
11445 #[derive(Clone, Default, PartialEq)]
11446 #[non_exhaustive]
11447 pub struct CustomEmojiPayload {
11448 /// Required. Input only. The image used for the custom emoji.
11449 ///
11450 /// The payload must be under 256 KB and the dimension of
11451 /// the image must be square and between 64 and 500 pixels. The
11452 /// restrictions are subject to change.
11453 pub file_content: ::bytes::Bytes,
11454
11455 /// Required. Input only. The image file name.
11456 ///
11457 /// Supported file extensions: `.png`, `.jpg`, `.gif`.
11458 pub filename: std::string::String,
11459
11460 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11461 }
11462
11463 impl CustomEmojiPayload {
11464 /// Creates a new default instance.
11465 pub fn new() -> Self {
11466 std::default::Default::default()
11467 }
11468
11469 /// Sets the value of [file_content][crate::model::custom_emoji::CustomEmojiPayload::file_content].
11470 ///
11471 /// # Example
11472 /// ```ignore,no_run
11473 /// # use google_chat_v1::model::custom_emoji::CustomEmojiPayload;
11474 /// let x = CustomEmojiPayload::new().set_file_content(bytes::Bytes::from_static(b"example"));
11475 /// ```
11476 pub fn set_file_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
11477 self.file_content = v.into();
11478 self
11479 }
11480
11481 /// Sets the value of [filename][crate::model::custom_emoji::CustomEmojiPayload::filename].
11482 ///
11483 /// # Example
11484 /// ```ignore,no_run
11485 /// # use google_chat_v1::model::custom_emoji::CustomEmojiPayload;
11486 /// let x = CustomEmojiPayload::new().set_filename("example");
11487 /// ```
11488 pub fn set_filename<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11489 self.filename = v.into();
11490 self
11491 }
11492 }
11493
11494 impl wkt::message::Message for CustomEmojiPayload {
11495 fn typename() -> &'static str {
11496 "type.googleapis.com/google.chat.v1.CustomEmoji.CustomEmojiPayload"
11497 }
11498 }
11499}
11500
11501/// The number of people who reacted to a message with a specific emoji.
11502#[derive(Clone, Default, PartialEq)]
11503#[non_exhaustive]
11504pub struct EmojiReactionSummary {
11505 /// Output only. Emoji associated with the reactions.
11506 pub emoji: std::option::Option<crate::model::Emoji>,
11507
11508 /// Output only. The total number of reactions using the associated emoji.
11509 pub reaction_count: std::option::Option<i32>,
11510
11511 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11512}
11513
11514impl EmojiReactionSummary {
11515 /// Creates a new default instance.
11516 pub fn new() -> Self {
11517 std::default::Default::default()
11518 }
11519
11520 /// Sets the value of [emoji][crate::model::EmojiReactionSummary::emoji].
11521 ///
11522 /// # Example
11523 /// ```ignore,no_run
11524 /// # use google_chat_v1::model::EmojiReactionSummary;
11525 /// use google_chat_v1::model::Emoji;
11526 /// let x = EmojiReactionSummary::new().set_emoji(Emoji::default()/* use setters */);
11527 /// ```
11528 pub fn set_emoji<T>(mut self, v: T) -> Self
11529 where
11530 T: std::convert::Into<crate::model::Emoji>,
11531 {
11532 self.emoji = std::option::Option::Some(v.into());
11533 self
11534 }
11535
11536 /// Sets or clears the value of [emoji][crate::model::EmojiReactionSummary::emoji].
11537 ///
11538 /// # Example
11539 /// ```ignore,no_run
11540 /// # use google_chat_v1::model::EmojiReactionSummary;
11541 /// use google_chat_v1::model::Emoji;
11542 /// let x = EmojiReactionSummary::new().set_or_clear_emoji(Some(Emoji::default()/* use setters */));
11543 /// let x = EmojiReactionSummary::new().set_or_clear_emoji(None::<Emoji>);
11544 /// ```
11545 pub fn set_or_clear_emoji<T>(mut self, v: std::option::Option<T>) -> Self
11546 where
11547 T: std::convert::Into<crate::model::Emoji>,
11548 {
11549 self.emoji = v.map(|x| x.into());
11550 self
11551 }
11552
11553 /// Sets the value of [reaction_count][crate::model::EmojiReactionSummary::reaction_count].
11554 ///
11555 /// # Example
11556 /// ```ignore,no_run
11557 /// # use google_chat_v1::model::EmojiReactionSummary;
11558 /// let x = EmojiReactionSummary::new().set_reaction_count(42);
11559 /// ```
11560 pub fn set_reaction_count<T>(mut self, v: T) -> Self
11561 where
11562 T: std::convert::Into<i32>,
11563 {
11564 self.reaction_count = std::option::Option::Some(v.into());
11565 self
11566 }
11567
11568 /// Sets or clears the value of [reaction_count][crate::model::EmojiReactionSummary::reaction_count].
11569 ///
11570 /// # Example
11571 /// ```ignore,no_run
11572 /// # use google_chat_v1::model::EmojiReactionSummary;
11573 /// let x = EmojiReactionSummary::new().set_or_clear_reaction_count(Some(42));
11574 /// let x = EmojiReactionSummary::new().set_or_clear_reaction_count(None::<i32>);
11575 /// ```
11576 pub fn set_or_clear_reaction_count<T>(mut self, v: std::option::Option<T>) -> Self
11577 where
11578 T: std::convert::Into<i32>,
11579 {
11580 self.reaction_count = v.map(|x| x.into());
11581 self
11582 }
11583}
11584
11585impl wkt::message::Message for EmojiReactionSummary {
11586 fn typename() -> &'static str {
11587 "type.googleapis.com/google.chat.v1.EmojiReactionSummary"
11588 }
11589}
11590
11591/// Creates a reaction to a message.
11592#[derive(Clone, Default, PartialEq)]
11593#[non_exhaustive]
11594pub struct CreateReactionRequest {
11595 /// Required. The message where the reaction is created.
11596 ///
11597 /// Format: `spaces/{space}/messages/{message}`
11598 pub parent: std::string::String,
11599
11600 /// Required. The reaction to create.
11601 pub reaction: std::option::Option<crate::model::Reaction>,
11602
11603 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11604}
11605
11606impl CreateReactionRequest {
11607 /// Creates a new default instance.
11608 pub fn new() -> Self {
11609 std::default::Default::default()
11610 }
11611
11612 /// Sets the value of [parent][crate::model::CreateReactionRequest::parent].
11613 ///
11614 /// # Example
11615 /// ```ignore,no_run
11616 /// # use google_chat_v1::model::CreateReactionRequest;
11617 /// # let space_id = "space_id";
11618 /// # let message_id = "message_id";
11619 /// let x = CreateReactionRequest::new().set_parent(format!("spaces/{space_id}/messages/{message_id}"));
11620 /// ```
11621 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11622 self.parent = v.into();
11623 self
11624 }
11625
11626 /// Sets the value of [reaction][crate::model::CreateReactionRequest::reaction].
11627 ///
11628 /// # Example
11629 /// ```ignore,no_run
11630 /// # use google_chat_v1::model::CreateReactionRequest;
11631 /// use google_chat_v1::model::Reaction;
11632 /// let x = CreateReactionRequest::new().set_reaction(Reaction::default()/* use setters */);
11633 /// ```
11634 pub fn set_reaction<T>(mut self, v: T) -> Self
11635 where
11636 T: std::convert::Into<crate::model::Reaction>,
11637 {
11638 self.reaction = std::option::Option::Some(v.into());
11639 self
11640 }
11641
11642 /// Sets or clears the value of [reaction][crate::model::CreateReactionRequest::reaction].
11643 ///
11644 /// # Example
11645 /// ```ignore,no_run
11646 /// # use google_chat_v1::model::CreateReactionRequest;
11647 /// use google_chat_v1::model::Reaction;
11648 /// let x = CreateReactionRequest::new().set_or_clear_reaction(Some(Reaction::default()/* use setters */));
11649 /// let x = CreateReactionRequest::new().set_or_clear_reaction(None::<Reaction>);
11650 /// ```
11651 pub fn set_or_clear_reaction<T>(mut self, v: std::option::Option<T>) -> Self
11652 where
11653 T: std::convert::Into<crate::model::Reaction>,
11654 {
11655 self.reaction = v.map(|x| x.into());
11656 self
11657 }
11658}
11659
11660impl wkt::message::Message for CreateReactionRequest {
11661 fn typename() -> &'static str {
11662 "type.googleapis.com/google.chat.v1.CreateReactionRequest"
11663 }
11664}
11665
11666/// Lists reactions to a message.
11667#[derive(Clone, Default, PartialEq)]
11668#[non_exhaustive]
11669pub struct ListReactionsRequest {
11670 /// Required. The message users reacted to.
11671 ///
11672 /// Format: `spaces/{space}/messages/{message}`
11673 pub parent: std::string::String,
11674
11675 /// Optional. The maximum number of reactions returned. The service can return
11676 /// fewer reactions than this value. If unspecified, the default value is 25.
11677 /// The maximum value is 200; values above 200 are changed to 200.
11678 pub page_size: i32,
11679
11680 /// Optional. (If resuming from a previous query.)
11681 ///
11682 /// A page token received from a previous list reactions call. Provide this
11683 /// to retrieve the subsequent page.
11684 ///
11685 /// When paginating, the filter value should match the call that provided the
11686 /// page token. Passing a different value might lead to unexpected results.
11687 pub page_token: std::string::String,
11688
11689 /// Optional. A query filter.
11690 ///
11691 /// You can filter reactions by
11692 /// [emoji](https://developers.google.com/workspace/chat/api/reference/rest/v1/Emoji)
11693 /// (either `emoji.unicode` or `emoji.custom_emoji.uid`) and
11694 /// [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User)
11695 /// (`user.name`).
11696 ///
11697 /// To filter reactions for multiple emojis or users, join similar fields
11698 /// with the `OR` operator, such as `emoji.unicode = "🙂" OR emoji.unicode =
11699 /// "👍"` and `user.name = "users/AAAAAA" OR user.name = "users/BBBBBB"`.
11700 ///
11701 /// To filter reactions by emoji and user, use the `AND` operator, such as
11702 /// `emoji.unicode = "🙂" AND user.name = "users/AAAAAA"`.
11703 ///
11704 /// If your query uses both `AND` and `OR`, group them with parentheses.
11705 ///
11706 /// For example, the following queries are valid:
11707 ///
11708 /// ```norust
11709 /// user.name = "users/{user}"
11710 /// emoji.unicode = "🙂"
11711 /// emoji.custom_emoji.uid = "{uid}"
11712 /// emoji.unicode = "🙂" OR emoji.unicode = "👍"
11713 /// emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}"
11714 /// emoji.unicode = "🙂" AND user.name = "users/{user}"
11715 /// (emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}")
11716 /// AND user.name = "users/{user}"
11717 /// ```
11718 ///
11719 /// The following queries are invalid:
11720 ///
11721 /// ```norust
11722 /// emoji.unicode = "🙂" AND emoji.unicode = "👍"
11723 /// emoji.unicode = "🙂" AND emoji.custom_emoji.uid = "{uid}"
11724 /// emoji.unicode = "🙂" OR user.name = "users/{user}"
11725 /// emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" OR
11726 /// user.name = "users/{user}"
11727 /// emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}"
11728 /// AND user.name = "users/{user}"
11729 /// ```
11730 ///
11731 /// Invalid queries are rejected with an `INVALID_ARGUMENT` error.
11732 pub filter: std::string::String,
11733
11734 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11735}
11736
11737impl ListReactionsRequest {
11738 /// Creates a new default instance.
11739 pub fn new() -> Self {
11740 std::default::Default::default()
11741 }
11742
11743 /// Sets the value of [parent][crate::model::ListReactionsRequest::parent].
11744 ///
11745 /// # Example
11746 /// ```ignore,no_run
11747 /// # use google_chat_v1::model::ListReactionsRequest;
11748 /// # let space_id = "space_id";
11749 /// # let message_id = "message_id";
11750 /// let x = ListReactionsRequest::new().set_parent(format!("spaces/{space_id}/messages/{message_id}"));
11751 /// ```
11752 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11753 self.parent = v.into();
11754 self
11755 }
11756
11757 /// Sets the value of [page_size][crate::model::ListReactionsRequest::page_size].
11758 ///
11759 /// # Example
11760 /// ```ignore,no_run
11761 /// # use google_chat_v1::model::ListReactionsRequest;
11762 /// let x = ListReactionsRequest::new().set_page_size(42);
11763 /// ```
11764 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11765 self.page_size = v.into();
11766 self
11767 }
11768
11769 /// Sets the value of [page_token][crate::model::ListReactionsRequest::page_token].
11770 ///
11771 /// # Example
11772 /// ```ignore,no_run
11773 /// # use google_chat_v1::model::ListReactionsRequest;
11774 /// let x = ListReactionsRequest::new().set_page_token("example");
11775 /// ```
11776 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11777 self.page_token = v.into();
11778 self
11779 }
11780
11781 /// Sets the value of [filter][crate::model::ListReactionsRequest::filter].
11782 ///
11783 /// # Example
11784 /// ```ignore,no_run
11785 /// # use google_chat_v1::model::ListReactionsRequest;
11786 /// let x = ListReactionsRequest::new().set_filter("example");
11787 /// ```
11788 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11789 self.filter = v.into();
11790 self
11791 }
11792}
11793
11794impl wkt::message::Message for ListReactionsRequest {
11795 fn typename() -> &'static str {
11796 "type.googleapis.com/google.chat.v1.ListReactionsRequest"
11797 }
11798}
11799
11800/// Response to a list reactions request.
11801#[derive(Clone, Default, PartialEq)]
11802#[non_exhaustive]
11803pub struct ListReactionsResponse {
11804 /// List of reactions in the requested (or first) page.
11805 pub reactions: std::vec::Vec<crate::model::Reaction>,
11806
11807 /// Continuation token to retrieve the next page of results. It's empty
11808 /// for the last page of results.
11809 pub next_page_token: std::string::String,
11810
11811 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11812}
11813
11814impl ListReactionsResponse {
11815 /// Creates a new default instance.
11816 pub fn new() -> Self {
11817 std::default::Default::default()
11818 }
11819
11820 /// Sets the value of [reactions][crate::model::ListReactionsResponse::reactions].
11821 ///
11822 /// # Example
11823 /// ```ignore,no_run
11824 /// # use google_chat_v1::model::ListReactionsResponse;
11825 /// use google_chat_v1::model::Reaction;
11826 /// let x = ListReactionsResponse::new()
11827 /// .set_reactions([
11828 /// Reaction::default()/* use setters */,
11829 /// Reaction::default()/* use (different) setters */,
11830 /// ]);
11831 /// ```
11832 pub fn set_reactions<T, V>(mut self, v: T) -> Self
11833 where
11834 T: std::iter::IntoIterator<Item = V>,
11835 V: std::convert::Into<crate::model::Reaction>,
11836 {
11837 use std::iter::Iterator;
11838 self.reactions = v.into_iter().map(|i| i.into()).collect();
11839 self
11840 }
11841
11842 /// Sets the value of [next_page_token][crate::model::ListReactionsResponse::next_page_token].
11843 ///
11844 /// # Example
11845 /// ```ignore,no_run
11846 /// # use google_chat_v1::model::ListReactionsResponse;
11847 /// let x = ListReactionsResponse::new().set_next_page_token("example");
11848 /// ```
11849 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11850 self.next_page_token = v.into();
11851 self
11852 }
11853}
11854
11855impl wkt::message::Message for ListReactionsResponse {
11856 fn typename() -> &'static str {
11857 "type.googleapis.com/google.chat.v1.ListReactionsResponse"
11858 }
11859}
11860
11861#[doc(hidden)]
11862impl google_cloud_gax::paginator::internal::PageableResponse for ListReactionsResponse {
11863 type PageItem = crate::model::Reaction;
11864
11865 fn items(self) -> std::vec::Vec<Self::PageItem> {
11866 self.reactions
11867 }
11868
11869 fn next_page_token(&self) -> std::string::String {
11870 use std::clone::Clone;
11871 self.next_page_token.clone()
11872 }
11873}
11874
11875/// Deletes a reaction to a message.
11876#[derive(Clone, Default, PartialEq)]
11877#[non_exhaustive]
11878pub struct DeleteReactionRequest {
11879 /// Required. Name of the reaction to delete.
11880 ///
11881 /// Format: `spaces/{space}/messages/{message}/reactions/{reaction}`
11882 pub name: std::string::String,
11883
11884 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11885}
11886
11887impl DeleteReactionRequest {
11888 /// Creates a new default instance.
11889 pub fn new() -> Self {
11890 std::default::Default::default()
11891 }
11892
11893 /// Sets the value of [name][crate::model::DeleteReactionRequest::name].
11894 ///
11895 /// # Example
11896 /// ```ignore,no_run
11897 /// # use google_chat_v1::model::DeleteReactionRequest;
11898 /// # let space_id = "space_id";
11899 /// # let message_id = "message_id";
11900 /// # let reaction_id = "reaction_id";
11901 /// let x = DeleteReactionRequest::new().set_name(format!("spaces/{space_id}/messages/{message_id}/reactions/{reaction_id}"));
11902 /// ```
11903 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11904 self.name = v.into();
11905 self
11906 }
11907}
11908
11909impl wkt::message::Message for DeleteReactionRequest {
11910 fn typename() -> &'static str {
11911 "type.googleapis.com/google.chat.v1.DeleteReactionRequest"
11912 }
11913}
11914
11915/// A request to create a custom emoji.
11916#[derive(Clone, Default, PartialEq)]
11917#[non_exhaustive]
11918pub struct CreateCustomEmojiRequest {
11919 /// Required. The custom emoji to create.
11920 pub custom_emoji: std::option::Option<crate::model::CustomEmoji>,
11921
11922 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11923}
11924
11925impl CreateCustomEmojiRequest {
11926 /// Creates a new default instance.
11927 pub fn new() -> Self {
11928 std::default::Default::default()
11929 }
11930
11931 /// Sets the value of [custom_emoji][crate::model::CreateCustomEmojiRequest::custom_emoji].
11932 ///
11933 /// # Example
11934 /// ```ignore,no_run
11935 /// # use google_chat_v1::model::CreateCustomEmojiRequest;
11936 /// use google_chat_v1::model::CustomEmoji;
11937 /// let x = CreateCustomEmojiRequest::new().set_custom_emoji(CustomEmoji::default()/* use setters */);
11938 /// ```
11939 pub fn set_custom_emoji<T>(mut self, v: T) -> Self
11940 where
11941 T: std::convert::Into<crate::model::CustomEmoji>,
11942 {
11943 self.custom_emoji = std::option::Option::Some(v.into());
11944 self
11945 }
11946
11947 /// Sets or clears the value of [custom_emoji][crate::model::CreateCustomEmojiRequest::custom_emoji].
11948 ///
11949 /// # Example
11950 /// ```ignore,no_run
11951 /// # use google_chat_v1::model::CreateCustomEmojiRequest;
11952 /// use google_chat_v1::model::CustomEmoji;
11953 /// let x = CreateCustomEmojiRequest::new().set_or_clear_custom_emoji(Some(CustomEmoji::default()/* use setters */));
11954 /// let x = CreateCustomEmojiRequest::new().set_or_clear_custom_emoji(None::<CustomEmoji>);
11955 /// ```
11956 pub fn set_or_clear_custom_emoji<T>(mut self, v: std::option::Option<T>) -> Self
11957 where
11958 T: std::convert::Into<crate::model::CustomEmoji>,
11959 {
11960 self.custom_emoji = v.map(|x| x.into());
11961 self
11962 }
11963}
11964
11965impl wkt::message::Message for CreateCustomEmojiRequest {
11966 fn typename() -> &'static str {
11967 "type.googleapis.com/google.chat.v1.CreateCustomEmojiRequest"
11968 }
11969}
11970
11971/// A request to return a single custom emoji.
11972#[derive(Clone, Default, PartialEq)]
11973#[non_exhaustive]
11974pub struct GetCustomEmojiRequest {
11975 /// Required. Resource name of the custom emoji.
11976 ///
11977 /// Format: `customEmojis/{customEmoji}`
11978 ///
11979 /// You can use the emoji name as an alias for `{customEmoji}`. For example,
11980 /// `customEmojis/:example-emoji:` where `:example-emoji:` is the emoji name
11981 /// for a custom emoji.
11982 pub name: std::string::String,
11983
11984 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11985}
11986
11987impl GetCustomEmojiRequest {
11988 /// Creates a new default instance.
11989 pub fn new() -> Self {
11990 std::default::Default::default()
11991 }
11992
11993 /// Sets the value of [name][crate::model::GetCustomEmojiRequest::name].
11994 ///
11995 /// # Example
11996 /// ```ignore,no_run
11997 /// # use google_chat_v1::model::GetCustomEmojiRequest;
11998 /// # let custom_emoji_id = "custom_emoji_id";
11999 /// let x = GetCustomEmojiRequest::new().set_name(format!("customEmojis/{custom_emoji_id}"));
12000 /// ```
12001 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12002 self.name = v.into();
12003 self
12004 }
12005}
12006
12007impl wkt::message::Message for GetCustomEmojiRequest {
12008 fn typename() -> &'static str {
12009 "type.googleapis.com/google.chat.v1.GetCustomEmojiRequest"
12010 }
12011}
12012
12013/// A request to return a list of custom emojis.
12014#[derive(Clone, Default, PartialEq)]
12015#[non_exhaustive]
12016pub struct ListCustomEmojisRequest {
12017 /// Optional. The maximum number of custom emojis returned. The service can
12018 /// return fewer custom emojis than this value. If unspecified, the default
12019 /// value is 25. The maximum value is 200; values above 200 are changed to 200.
12020 pub page_size: i32,
12021
12022 /// Optional. (If resuming from a previous query.)
12023 ///
12024 /// A page token received from a previous list custom emoji call. Provide this
12025 /// to retrieve the subsequent page.
12026 ///
12027 /// When paginating, the filter value should match the call that provided the
12028 /// page token. Passing a different value might lead to unexpected results.
12029 pub page_token: std::string::String,
12030
12031 /// Optional. A query filter.
12032 ///
12033 /// Supports filtering by creator.
12034 ///
12035 /// To filter by creator, you must specify a valid value. Currently only
12036 /// `creator("users/me")` and `NOT creator("users/me")` are accepted to filter
12037 /// custom emojis by whether they were created by the calling user or not.
12038 ///
12039 /// For example, the following query returns custom emojis created by the
12040 /// caller:
12041 ///
12042 /// ```norust
12043 /// creator("users/me")
12044 /// ```
12045 ///
12046 /// Invalid queries are rejected with an `INVALID_ARGUMENT` error.
12047 pub filter: std::string::String,
12048
12049 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12050}
12051
12052impl ListCustomEmojisRequest {
12053 /// Creates a new default instance.
12054 pub fn new() -> Self {
12055 std::default::Default::default()
12056 }
12057
12058 /// Sets the value of [page_size][crate::model::ListCustomEmojisRequest::page_size].
12059 ///
12060 /// # Example
12061 /// ```ignore,no_run
12062 /// # use google_chat_v1::model::ListCustomEmojisRequest;
12063 /// let x = ListCustomEmojisRequest::new().set_page_size(42);
12064 /// ```
12065 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12066 self.page_size = v.into();
12067 self
12068 }
12069
12070 /// Sets the value of [page_token][crate::model::ListCustomEmojisRequest::page_token].
12071 ///
12072 /// # Example
12073 /// ```ignore,no_run
12074 /// # use google_chat_v1::model::ListCustomEmojisRequest;
12075 /// let x = ListCustomEmojisRequest::new().set_page_token("example");
12076 /// ```
12077 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12078 self.page_token = v.into();
12079 self
12080 }
12081
12082 /// Sets the value of [filter][crate::model::ListCustomEmojisRequest::filter].
12083 ///
12084 /// # Example
12085 /// ```ignore,no_run
12086 /// # use google_chat_v1::model::ListCustomEmojisRequest;
12087 /// let x = ListCustomEmojisRequest::new().set_filter("example");
12088 /// ```
12089 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12090 self.filter = v.into();
12091 self
12092 }
12093}
12094
12095impl wkt::message::Message for ListCustomEmojisRequest {
12096 fn typename() -> &'static str {
12097 "type.googleapis.com/google.chat.v1.ListCustomEmojisRequest"
12098 }
12099}
12100
12101/// A response to list custom emojis.
12102#[derive(Clone, Default, PartialEq)]
12103#[non_exhaustive]
12104pub struct ListCustomEmojisResponse {
12105 /// Unordered list. List of custom emojis.
12106 pub custom_emojis: std::vec::Vec<crate::model::CustomEmoji>,
12107
12108 /// A token that you can send as `pageToken` to retrieve the next page of
12109 /// results. If empty, there are no subsequent pages.
12110 pub next_page_token: std::string::String,
12111
12112 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12113}
12114
12115impl ListCustomEmojisResponse {
12116 /// Creates a new default instance.
12117 pub fn new() -> Self {
12118 std::default::Default::default()
12119 }
12120
12121 /// Sets the value of [custom_emojis][crate::model::ListCustomEmojisResponse::custom_emojis].
12122 ///
12123 /// # Example
12124 /// ```ignore,no_run
12125 /// # use google_chat_v1::model::ListCustomEmojisResponse;
12126 /// use google_chat_v1::model::CustomEmoji;
12127 /// let x = ListCustomEmojisResponse::new()
12128 /// .set_custom_emojis([
12129 /// CustomEmoji::default()/* use setters */,
12130 /// CustomEmoji::default()/* use (different) setters */,
12131 /// ]);
12132 /// ```
12133 pub fn set_custom_emojis<T, V>(mut self, v: T) -> Self
12134 where
12135 T: std::iter::IntoIterator<Item = V>,
12136 V: std::convert::Into<crate::model::CustomEmoji>,
12137 {
12138 use std::iter::Iterator;
12139 self.custom_emojis = v.into_iter().map(|i| i.into()).collect();
12140 self
12141 }
12142
12143 /// Sets the value of [next_page_token][crate::model::ListCustomEmojisResponse::next_page_token].
12144 ///
12145 /// # Example
12146 /// ```ignore,no_run
12147 /// # use google_chat_v1::model::ListCustomEmojisResponse;
12148 /// let x = ListCustomEmojisResponse::new().set_next_page_token("example");
12149 /// ```
12150 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12151 self.next_page_token = v.into();
12152 self
12153 }
12154}
12155
12156impl wkt::message::Message for ListCustomEmojisResponse {
12157 fn typename() -> &'static str {
12158 "type.googleapis.com/google.chat.v1.ListCustomEmojisResponse"
12159 }
12160}
12161
12162#[doc(hidden)]
12163impl google_cloud_gax::paginator::internal::PageableResponse for ListCustomEmojisResponse {
12164 type PageItem = crate::model::CustomEmoji;
12165
12166 fn items(self) -> std::vec::Vec<Self::PageItem> {
12167 self.custom_emojis
12168 }
12169
12170 fn next_page_token(&self) -> std::string::String {
12171 use std::clone::Clone;
12172 self.next_page_token.clone()
12173 }
12174}
12175
12176/// Request for deleting a custom emoji.
12177#[derive(Clone, Default, PartialEq)]
12178#[non_exhaustive]
12179pub struct DeleteCustomEmojiRequest {
12180 /// Required. Resource name of the custom emoji to delete.
12181 ///
12182 /// Format: `customEmojis/{customEmoji}`
12183 ///
12184 /// You can use the emoji name as an alias for `{customEmoji}`. For example,
12185 /// `customEmojis/:example-emoji:` where `:example-emoji:` is the emoji name
12186 /// for a custom emoji.
12187 pub name: std::string::String,
12188
12189 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12190}
12191
12192impl DeleteCustomEmojiRequest {
12193 /// Creates a new default instance.
12194 pub fn new() -> Self {
12195 std::default::Default::default()
12196 }
12197
12198 /// Sets the value of [name][crate::model::DeleteCustomEmojiRequest::name].
12199 ///
12200 /// # Example
12201 /// ```ignore,no_run
12202 /// # use google_chat_v1::model::DeleteCustomEmojiRequest;
12203 /// # let custom_emoji_id = "custom_emoji_id";
12204 /// let x = DeleteCustomEmojiRequest::new().set_name(format!("customEmojis/{custom_emoji_id}"));
12205 /// ```
12206 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12207 self.name = v.into();
12208 self
12209 }
12210}
12211
12212impl wkt::message::Message for DeleteCustomEmojiRequest {
12213 fn typename() -> &'static str {
12214 "type.googleapis.com/google.chat.v1.DeleteCustomEmojiRequest"
12215 }
12216}
12217
12218/// Represents a [section](https://support.google.com/chat/answer/16059854) in
12219/// Google Chat. Sections help users organize their spaces. There are two types
12220/// of sections:
12221///
12222/// 1. **System Sections:** These are predefined sections managed by Google
12223/// Chat.
12224/// Their resource names are fixed, and they cannot be created, deleted, or
12225/// have their `display_name` modified. Examples include:
12226///
12227/// * `users/{user}/sections/default-direct-messages`
12228/// * `users/{user}/sections/default-spaces`
12229/// * `users/{user}/sections/default-apps`
12230/// 1. **Custom Sections:** These are sections created and managed by the user.
12231/// Creating a custom section using `CreateSection` **requires** a
12232/// `display_name`. Custom sections can be updated using `UpdateSection` and
12233/// deleted using `DeleteSection`.
12234///
12235#[derive(Clone, Default, PartialEq)]
12236#[non_exhaustive]
12237pub struct Section {
12238 /// Identifier. Resource name of the section.
12239 ///
12240 /// For system sections, the section ID is a constant string:
12241 ///
12242 /// - DEFAULT_DIRECT_MESSAGES: `users/{user}/sections/default-direct-messages`
12243 /// - DEFAULT_SPACES: `users/{user}/sections/default-spaces`
12244 /// - DEFAULT_APPS: `users/{user}/sections/default-apps`
12245 ///
12246 /// Format: `users/{user}/sections/{section}`
12247 pub name: std::string::String,
12248
12249 /// Optional. The section's display name. Only populated for sections of type
12250 /// `CUSTOM_SECTION`. Supports up to 80 characters. Required when creating a
12251 /// `CUSTOM_SECTION`.
12252 pub display_name: std::string::String,
12253
12254 /// Output only. The order of the section in relation to other sections.
12255 /// Sections with a lower `sort_order` value appear before sections with a
12256 /// higher value.
12257 pub sort_order: i32,
12258
12259 /// Required. The type of the section.
12260 pub r#type: crate::model::section::SectionType,
12261
12262 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12263}
12264
12265impl Section {
12266 /// Creates a new default instance.
12267 pub fn new() -> Self {
12268 std::default::Default::default()
12269 }
12270
12271 /// Sets the value of [name][crate::model::Section::name].
12272 ///
12273 /// # Example
12274 /// ```ignore,no_run
12275 /// # use google_chat_v1::model::Section;
12276 /// # let user_id = "user_id";
12277 /// # let section_id = "section_id";
12278 /// let x = Section::new().set_name(format!("users/{user_id}/sections/{section_id}"));
12279 /// ```
12280 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12281 self.name = v.into();
12282 self
12283 }
12284
12285 /// Sets the value of [display_name][crate::model::Section::display_name].
12286 ///
12287 /// # Example
12288 /// ```ignore,no_run
12289 /// # use google_chat_v1::model::Section;
12290 /// let x = Section::new().set_display_name("example");
12291 /// ```
12292 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12293 self.display_name = v.into();
12294 self
12295 }
12296
12297 /// Sets the value of [sort_order][crate::model::Section::sort_order].
12298 ///
12299 /// # Example
12300 /// ```ignore,no_run
12301 /// # use google_chat_v1::model::Section;
12302 /// let x = Section::new().set_sort_order(42);
12303 /// ```
12304 pub fn set_sort_order<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12305 self.sort_order = v.into();
12306 self
12307 }
12308
12309 /// Sets the value of [r#type][crate::model::Section::type].
12310 ///
12311 /// # Example
12312 /// ```ignore,no_run
12313 /// # use google_chat_v1::model::Section;
12314 /// use google_chat_v1::model::section::SectionType;
12315 /// let x0 = Section::new().set_type(SectionType::CustomSection);
12316 /// let x1 = Section::new().set_type(SectionType::DefaultDirectMessages);
12317 /// let x2 = Section::new().set_type(SectionType::DefaultSpaces);
12318 /// ```
12319 pub fn set_type<T: std::convert::Into<crate::model::section::SectionType>>(
12320 mut self,
12321 v: T,
12322 ) -> Self {
12323 self.r#type = v.into();
12324 self
12325 }
12326}
12327
12328impl wkt::message::Message for Section {
12329 fn typename() -> &'static str {
12330 "type.googleapis.com/google.chat.v1.Section"
12331 }
12332}
12333
12334/// Defines additional types related to [Section].
12335pub mod section {
12336 #[allow(unused_imports)]
12337 use super::*;
12338
12339 /// Section types.
12340 ///
12341 /// # Working with unknown values
12342 ///
12343 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12344 /// additional enum variants at any time. Adding new variants is not considered
12345 /// a breaking change. Applications should write their code in anticipation of:
12346 ///
12347 /// - New values appearing in future releases of the client library, **and**
12348 /// - New values received dynamically, without application changes.
12349 ///
12350 /// Please consult the [Working with enums] section in the user guide for some
12351 /// guidelines.
12352 ///
12353 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12354 #[derive(Clone, Debug, PartialEq)]
12355 #[non_exhaustive]
12356 pub enum SectionType {
12357 /// Unspecified section type.
12358 Unspecified,
12359 /// Custom section.
12360 CustomSection,
12361 /// Default section containing
12362 /// [DIRECT_MESSAGE](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype)
12363 /// between two human users or
12364 /// [GROUP_CHAT](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype)
12365 /// spaces that don't belong to any custom section.
12366 DefaultDirectMessages,
12367 /// Default spaces that don't belong to any custom section.
12368 DefaultSpaces,
12369 /// Default section containing a user's installed apps.
12370 DefaultApps,
12371 /// If set, the enum was initialized with an unknown value.
12372 ///
12373 /// Applications can examine the value using [SectionType::value] or
12374 /// [SectionType::name].
12375 UnknownValue(section_type::UnknownValue),
12376 }
12377
12378 #[doc(hidden)]
12379 pub mod section_type {
12380 #[allow(unused_imports)]
12381 use super::*;
12382 #[derive(Clone, Debug, PartialEq)]
12383 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12384 }
12385
12386 impl SectionType {
12387 /// Gets the enum value.
12388 ///
12389 /// Returns `None` if the enum contains an unknown value deserialized from
12390 /// the string representation of enums.
12391 pub fn value(&self) -> std::option::Option<i32> {
12392 match self {
12393 Self::Unspecified => std::option::Option::Some(0),
12394 Self::CustomSection => std::option::Option::Some(1),
12395 Self::DefaultDirectMessages => std::option::Option::Some(2),
12396 Self::DefaultSpaces => std::option::Option::Some(3),
12397 Self::DefaultApps => std::option::Option::Some(6),
12398 Self::UnknownValue(u) => u.0.value(),
12399 }
12400 }
12401
12402 /// Gets the enum value as a string.
12403 ///
12404 /// Returns `None` if the enum contains an unknown value deserialized from
12405 /// the integer representation of enums.
12406 pub fn name(&self) -> std::option::Option<&str> {
12407 match self {
12408 Self::Unspecified => std::option::Option::Some("SECTION_TYPE_UNSPECIFIED"),
12409 Self::CustomSection => std::option::Option::Some("CUSTOM_SECTION"),
12410 Self::DefaultDirectMessages => std::option::Option::Some("DEFAULT_DIRECT_MESSAGES"),
12411 Self::DefaultSpaces => std::option::Option::Some("DEFAULT_SPACES"),
12412 Self::DefaultApps => std::option::Option::Some("DEFAULT_APPS"),
12413 Self::UnknownValue(u) => u.0.name(),
12414 }
12415 }
12416 }
12417
12418 impl std::default::Default for SectionType {
12419 fn default() -> Self {
12420 use std::convert::From;
12421 Self::from(0)
12422 }
12423 }
12424
12425 impl std::fmt::Display for SectionType {
12426 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12427 wkt::internal::display_enum(f, self.name(), self.value())
12428 }
12429 }
12430
12431 impl std::convert::From<i32> for SectionType {
12432 fn from(value: i32) -> Self {
12433 match value {
12434 0 => Self::Unspecified,
12435 1 => Self::CustomSection,
12436 2 => Self::DefaultDirectMessages,
12437 3 => Self::DefaultSpaces,
12438 6 => Self::DefaultApps,
12439 _ => Self::UnknownValue(section_type::UnknownValue(
12440 wkt::internal::UnknownEnumValue::Integer(value),
12441 )),
12442 }
12443 }
12444 }
12445
12446 impl std::convert::From<&str> for SectionType {
12447 fn from(value: &str) -> Self {
12448 use std::string::ToString;
12449 match value {
12450 "SECTION_TYPE_UNSPECIFIED" => Self::Unspecified,
12451 "CUSTOM_SECTION" => Self::CustomSection,
12452 "DEFAULT_DIRECT_MESSAGES" => Self::DefaultDirectMessages,
12453 "DEFAULT_SPACES" => Self::DefaultSpaces,
12454 "DEFAULT_APPS" => Self::DefaultApps,
12455 _ => Self::UnknownValue(section_type::UnknownValue(
12456 wkt::internal::UnknownEnumValue::String(value.to_string()),
12457 )),
12458 }
12459 }
12460 }
12461
12462 impl serde::ser::Serialize for SectionType {
12463 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12464 where
12465 S: serde::Serializer,
12466 {
12467 match self {
12468 Self::Unspecified => serializer.serialize_i32(0),
12469 Self::CustomSection => serializer.serialize_i32(1),
12470 Self::DefaultDirectMessages => serializer.serialize_i32(2),
12471 Self::DefaultSpaces => serializer.serialize_i32(3),
12472 Self::DefaultApps => serializer.serialize_i32(6),
12473 Self::UnknownValue(u) => u.0.serialize(serializer),
12474 }
12475 }
12476 }
12477
12478 impl<'de> serde::de::Deserialize<'de> for SectionType {
12479 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12480 where
12481 D: serde::Deserializer<'de>,
12482 {
12483 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SectionType>::new(
12484 ".google.chat.v1.Section.SectionType",
12485 ))
12486 }
12487 }
12488}
12489
12490/// A user's defined section item. This is used to represent section items, such
12491/// as spaces, grouped under a section.
12492#[derive(Clone, Default, PartialEq)]
12493#[non_exhaustive]
12494pub struct SectionItem {
12495 /// Identifier. The resource name of the section item.
12496 ///
12497 /// Format: `users/{user}/sections/{section}/items/{item}`
12498 pub name: std::string::String,
12499
12500 /// Required. The section item.
12501 pub item: std::option::Option<crate::model::section_item::Item>,
12502
12503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12504}
12505
12506impl SectionItem {
12507 /// Creates a new default instance.
12508 pub fn new() -> Self {
12509 std::default::Default::default()
12510 }
12511
12512 /// Sets the value of [name][crate::model::SectionItem::name].
12513 ///
12514 /// # Example
12515 /// ```ignore,no_run
12516 /// # use google_chat_v1::model::SectionItem;
12517 /// # let user_id = "user_id";
12518 /// # let section_id = "section_id";
12519 /// # let item_id = "item_id";
12520 /// let x = SectionItem::new().set_name(format!("users/{user_id}/sections/{section_id}/items/{item_id}"));
12521 /// ```
12522 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12523 self.name = v.into();
12524 self
12525 }
12526
12527 /// Sets the value of [item][crate::model::SectionItem::item].
12528 ///
12529 /// Note that all the setters affecting `item` are mutually
12530 /// exclusive.
12531 ///
12532 /// # Example
12533 /// ```ignore,no_run
12534 /// # use google_chat_v1::model::SectionItem;
12535 /// use google_chat_v1::model::section_item::Item;
12536 /// let x = SectionItem::new().set_item(Some(Item::Space("example".to_string())));
12537 /// ```
12538 pub fn set_item<
12539 T: std::convert::Into<std::option::Option<crate::model::section_item::Item>>,
12540 >(
12541 mut self,
12542 v: T,
12543 ) -> Self {
12544 self.item = v.into();
12545 self
12546 }
12547
12548 /// The value of [item][crate::model::SectionItem::item]
12549 /// if it holds a `Space`, `None` if the field is not set or
12550 /// holds a different branch.
12551 pub fn space(&self) -> std::option::Option<&std::string::String> {
12552 #[allow(unreachable_patterns)]
12553 self.item.as_ref().and_then(|v| match v {
12554 crate::model::section_item::Item::Space(v) => std::option::Option::Some(v),
12555 _ => std::option::Option::None,
12556 })
12557 }
12558
12559 /// Sets the value of [item][crate::model::SectionItem::item]
12560 /// to hold a `Space`.
12561 ///
12562 /// Note that all the setters affecting `item` are
12563 /// mutually exclusive.
12564 ///
12565 /// # Example
12566 /// ```ignore,no_run
12567 /// # use google_chat_v1::model::SectionItem;
12568 /// # let space_id = "space_id";
12569 /// let x = SectionItem::new().set_space(format!("spaces/{space_id}"));
12570 /// assert!(x.space().is_some());
12571 /// ```
12572 pub fn set_space<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12573 self.item = std::option::Option::Some(crate::model::section_item::Item::Space(v.into()));
12574 self
12575 }
12576}
12577
12578impl wkt::message::Message for SectionItem {
12579 fn typename() -> &'static str {
12580 "type.googleapis.com/google.chat.v1.SectionItem"
12581 }
12582}
12583
12584/// Defines additional types related to [SectionItem].
12585pub mod section_item {
12586 #[allow(unused_imports)]
12587 use super::*;
12588
12589 /// Required. The section item.
12590 #[derive(Clone, Debug, PartialEq)]
12591 #[non_exhaustive]
12592 pub enum Item {
12593 /// Optional. The space resource name.
12594 ///
12595 /// Format: `spaces/{space}`
12596 Space(std::string::String),
12597 }
12598}
12599
12600/// Request message for creating a section.
12601#[derive(Clone, Default, PartialEq)]
12602#[non_exhaustive]
12603pub struct CreateSectionRequest {
12604 /// Required. The parent resource name where the section is created.
12605 ///
12606 /// Format: `users/{user}`
12607 pub parent: std::string::String,
12608
12609 /// Required. The section to create.
12610 pub section: std::option::Option<crate::model::Section>,
12611
12612 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12613}
12614
12615impl CreateSectionRequest {
12616 /// Creates a new default instance.
12617 pub fn new() -> Self {
12618 std::default::Default::default()
12619 }
12620
12621 /// Sets the value of [parent][crate::model::CreateSectionRequest::parent].
12622 ///
12623 /// # Example
12624 /// ```ignore,no_run
12625 /// # use google_chat_v1::model::CreateSectionRequest;
12626 /// let x = CreateSectionRequest::new().set_parent("example");
12627 /// ```
12628 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12629 self.parent = v.into();
12630 self
12631 }
12632
12633 /// Sets the value of [section][crate::model::CreateSectionRequest::section].
12634 ///
12635 /// # Example
12636 /// ```ignore,no_run
12637 /// # use google_chat_v1::model::CreateSectionRequest;
12638 /// use google_chat_v1::model::Section;
12639 /// let x = CreateSectionRequest::new().set_section(Section::default()/* use setters */);
12640 /// ```
12641 pub fn set_section<T>(mut self, v: T) -> Self
12642 where
12643 T: std::convert::Into<crate::model::Section>,
12644 {
12645 self.section = std::option::Option::Some(v.into());
12646 self
12647 }
12648
12649 /// Sets or clears the value of [section][crate::model::CreateSectionRequest::section].
12650 ///
12651 /// # Example
12652 /// ```ignore,no_run
12653 /// # use google_chat_v1::model::CreateSectionRequest;
12654 /// use google_chat_v1::model::Section;
12655 /// let x = CreateSectionRequest::new().set_or_clear_section(Some(Section::default()/* use setters */));
12656 /// let x = CreateSectionRequest::new().set_or_clear_section(None::<Section>);
12657 /// ```
12658 pub fn set_or_clear_section<T>(mut self, v: std::option::Option<T>) -> Self
12659 where
12660 T: std::convert::Into<crate::model::Section>,
12661 {
12662 self.section = v.map(|x| x.into());
12663 self
12664 }
12665}
12666
12667impl wkt::message::Message for CreateSectionRequest {
12668 fn typename() -> &'static str {
12669 "type.googleapis.com/google.chat.v1.CreateSectionRequest"
12670 }
12671}
12672
12673/// Request message for deleting a section.
12674/// [Developer Preview](https://developers.google.com/workspace/preview).
12675#[derive(Clone, Default, PartialEq)]
12676#[non_exhaustive]
12677pub struct DeleteSectionRequest {
12678 /// Required. The name of the section to delete.
12679 ///
12680 /// Format: `users/{user}/sections/{section}`
12681 pub name: std::string::String,
12682
12683 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12684}
12685
12686impl DeleteSectionRequest {
12687 /// Creates a new default instance.
12688 pub fn new() -> Self {
12689 std::default::Default::default()
12690 }
12691
12692 /// Sets the value of [name][crate::model::DeleteSectionRequest::name].
12693 ///
12694 /// # Example
12695 /// ```ignore,no_run
12696 /// # use google_chat_v1::model::DeleteSectionRequest;
12697 /// # let user_id = "user_id";
12698 /// # let section_id = "section_id";
12699 /// let x = DeleteSectionRequest::new().set_name(format!("users/{user_id}/sections/{section_id}"));
12700 /// ```
12701 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12702 self.name = v.into();
12703 self
12704 }
12705}
12706
12707impl wkt::message::Message for DeleteSectionRequest {
12708 fn typename() -> &'static str {
12709 "type.googleapis.com/google.chat.v1.DeleteSectionRequest"
12710 }
12711}
12712
12713/// Request message for updating a section.
12714#[derive(Clone, Default, PartialEq)]
12715#[non_exhaustive]
12716pub struct UpdateSectionRequest {
12717 /// Required. The section to update.
12718 pub section: std::option::Option<crate::model::Section>,
12719
12720 /// Required. The mask to specify which fields to update.
12721 ///
12722 /// Currently supported field paths:
12723 ///
12724 /// - `display_name`
12725 pub update_mask: std::option::Option<wkt::FieldMask>,
12726
12727 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12728}
12729
12730impl UpdateSectionRequest {
12731 /// Creates a new default instance.
12732 pub fn new() -> Self {
12733 std::default::Default::default()
12734 }
12735
12736 /// Sets the value of [section][crate::model::UpdateSectionRequest::section].
12737 ///
12738 /// # Example
12739 /// ```ignore,no_run
12740 /// # use google_chat_v1::model::UpdateSectionRequest;
12741 /// use google_chat_v1::model::Section;
12742 /// let x = UpdateSectionRequest::new().set_section(Section::default()/* use setters */);
12743 /// ```
12744 pub fn set_section<T>(mut self, v: T) -> Self
12745 where
12746 T: std::convert::Into<crate::model::Section>,
12747 {
12748 self.section = std::option::Option::Some(v.into());
12749 self
12750 }
12751
12752 /// Sets or clears the value of [section][crate::model::UpdateSectionRequest::section].
12753 ///
12754 /// # Example
12755 /// ```ignore,no_run
12756 /// # use google_chat_v1::model::UpdateSectionRequest;
12757 /// use google_chat_v1::model::Section;
12758 /// let x = UpdateSectionRequest::new().set_or_clear_section(Some(Section::default()/* use setters */));
12759 /// let x = UpdateSectionRequest::new().set_or_clear_section(None::<Section>);
12760 /// ```
12761 pub fn set_or_clear_section<T>(mut self, v: std::option::Option<T>) -> Self
12762 where
12763 T: std::convert::Into<crate::model::Section>,
12764 {
12765 self.section = v.map(|x| x.into());
12766 self
12767 }
12768
12769 /// Sets the value of [update_mask][crate::model::UpdateSectionRequest::update_mask].
12770 ///
12771 /// # Example
12772 /// ```ignore,no_run
12773 /// # use google_chat_v1::model::UpdateSectionRequest;
12774 /// use wkt::FieldMask;
12775 /// let x = UpdateSectionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
12776 /// ```
12777 pub fn set_update_mask<T>(mut self, v: T) -> Self
12778 where
12779 T: std::convert::Into<wkt::FieldMask>,
12780 {
12781 self.update_mask = std::option::Option::Some(v.into());
12782 self
12783 }
12784
12785 /// Sets or clears the value of [update_mask][crate::model::UpdateSectionRequest::update_mask].
12786 ///
12787 /// # Example
12788 /// ```ignore,no_run
12789 /// # use google_chat_v1::model::UpdateSectionRequest;
12790 /// use wkt::FieldMask;
12791 /// let x = UpdateSectionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
12792 /// let x = UpdateSectionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
12793 /// ```
12794 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12795 where
12796 T: std::convert::Into<wkt::FieldMask>,
12797 {
12798 self.update_mask = v.map(|x| x.into());
12799 self
12800 }
12801}
12802
12803impl wkt::message::Message for UpdateSectionRequest {
12804 fn typename() -> &'static str {
12805 "type.googleapis.com/google.chat.v1.UpdateSectionRequest"
12806 }
12807}
12808
12809/// Request message for listing sections.
12810#[derive(Clone, Default, PartialEq)]
12811#[non_exhaustive]
12812pub struct ListSectionsRequest {
12813 /// Required. The parent, which is the user resource name that owns this
12814 /// collection of sections. Only supports listing sections for the calling
12815 /// user. To refer to the calling user, set one of the following:
12816 ///
12817 /// - The `me` alias. For example, `users/me`.
12818 ///
12819 /// - Their Workspace email address. For example, `users/user@example.com`.
12820 ///
12821 /// - Their user id. For example, `users/123456789`.
12822 ///
12823 ///
12824 /// Format: `users/{user}`
12825 pub parent: std::string::String,
12826
12827 /// Optional. The maximum number of sections to return. The service may return
12828 /// fewer than this value.
12829 ///
12830 /// If unspecified, at most 10 sections will be returned.
12831 ///
12832 /// The maximum value is 100. If you use a value more than 100, it's
12833 /// automatically changed to 100.
12834 ///
12835 /// Negative values return an `INVALID_ARGUMENT` error.
12836 pub page_size: i32,
12837
12838 /// Optional. A page token, received from a previous list sections call.
12839 /// Provide this to retrieve the subsequent page.
12840 ///
12841 /// When paginating, all other parameters provided should match the call that
12842 /// provided the page token. Passing different values to the other parameters
12843 /// might lead to unexpected results.
12844 pub page_token: std::string::String,
12845
12846 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12847}
12848
12849impl ListSectionsRequest {
12850 /// Creates a new default instance.
12851 pub fn new() -> Self {
12852 std::default::Default::default()
12853 }
12854
12855 /// Sets the value of [parent][crate::model::ListSectionsRequest::parent].
12856 ///
12857 /// # Example
12858 /// ```ignore,no_run
12859 /// # use google_chat_v1::model::ListSectionsRequest;
12860 /// let x = ListSectionsRequest::new().set_parent("example");
12861 /// ```
12862 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12863 self.parent = v.into();
12864 self
12865 }
12866
12867 /// Sets the value of [page_size][crate::model::ListSectionsRequest::page_size].
12868 ///
12869 /// # Example
12870 /// ```ignore,no_run
12871 /// # use google_chat_v1::model::ListSectionsRequest;
12872 /// let x = ListSectionsRequest::new().set_page_size(42);
12873 /// ```
12874 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12875 self.page_size = v.into();
12876 self
12877 }
12878
12879 /// Sets the value of [page_token][crate::model::ListSectionsRequest::page_token].
12880 ///
12881 /// # Example
12882 /// ```ignore,no_run
12883 /// # use google_chat_v1::model::ListSectionsRequest;
12884 /// let x = ListSectionsRequest::new().set_page_token("example");
12885 /// ```
12886 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12887 self.page_token = v.into();
12888 self
12889 }
12890}
12891
12892impl wkt::message::Message for ListSectionsRequest {
12893 fn typename() -> &'static str {
12894 "type.googleapis.com/google.chat.v1.ListSectionsRequest"
12895 }
12896}
12897
12898/// Response message for listing sections.
12899#[derive(Clone, Default, PartialEq)]
12900#[non_exhaustive]
12901pub struct ListSectionsResponse {
12902 /// The sections from the specified user.
12903 pub sections: std::vec::Vec<crate::model::Section>,
12904
12905 /// A token, which can be sent as `page_token` to retrieve the next page.
12906 /// If this field is omitted, there are no subsequent pages.
12907 pub next_page_token: std::string::String,
12908
12909 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12910}
12911
12912impl ListSectionsResponse {
12913 /// Creates a new default instance.
12914 pub fn new() -> Self {
12915 std::default::Default::default()
12916 }
12917
12918 /// Sets the value of [sections][crate::model::ListSectionsResponse::sections].
12919 ///
12920 /// # Example
12921 /// ```ignore,no_run
12922 /// # use google_chat_v1::model::ListSectionsResponse;
12923 /// use google_chat_v1::model::Section;
12924 /// let x = ListSectionsResponse::new()
12925 /// .set_sections([
12926 /// Section::default()/* use setters */,
12927 /// Section::default()/* use (different) setters */,
12928 /// ]);
12929 /// ```
12930 pub fn set_sections<T, V>(mut self, v: T) -> Self
12931 where
12932 T: std::iter::IntoIterator<Item = V>,
12933 V: std::convert::Into<crate::model::Section>,
12934 {
12935 use std::iter::Iterator;
12936 self.sections = v.into_iter().map(|i| i.into()).collect();
12937 self
12938 }
12939
12940 /// Sets the value of [next_page_token][crate::model::ListSectionsResponse::next_page_token].
12941 ///
12942 /// # Example
12943 /// ```ignore,no_run
12944 /// # use google_chat_v1::model::ListSectionsResponse;
12945 /// let x = ListSectionsResponse::new().set_next_page_token("example");
12946 /// ```
12947 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12948 self.next_page_token = v.into();
12949 self
12950 }
12951}
12952
12953impl wkt::message::Message for ListSectionsResponse {
12954 fn typename() -> &'static str {
12955 "type.googleapis.com/google.chat.v1.ListSectionsResponse"
12956 }
12957}
12958
12959#[doc(hidden)]
12960impl google_cloud_gax::paginator::internal::PageableResponse for ListSectionsResponse {
12961 type PageItem = crate::model::Section;
12962
12963 fn items(self) -> std::vec::Vec<Self::PageItem> {
12964 self.sections
12965 }
12966
12967 fn next_page_token(&self) -> std::string::String {
12968 use std::clone::Clone;
12969 self.next_page_token.clone()
12970 }
12971}
12972
12973/// Request message for positioning a section.
12974#[derive(Clone, Default, PartialEq)]
12975#[non_exhaustive]
12976pub struct PositionSectionRequest {
12977 /// Required. The resource name of the section to position.
12978 ///
12979 /// Format: `users/{user}/sections/{section}`
12980 pub name: std::string::String,
12981
12982 /// Required. The new position of the section.
12983 pub position: std::option::Option<crate::model::position_section_request::PositionOneof>,
12984
12985 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12986}
12987
12988impl PositionSectionRequest {
12989 /// Creates a new default instance.
12990 pub fn new() -> Self {
12991 std::default::Default::default()
12992 }
12993
12994 /// Sets the value of [name][crate::model::PositionSectionRequest::name].
12995 ///
12996 /// # Example
12997 /// ```ignore,no_run
12998 /// # use google_chat_v1::model::PositionSectionRequest;
12999 /// # let user_id = "user_id";
13000 /// # let section_id = "section_id";
13001 /// let x = PositionSectionRequest::new().set_name(format!("users/{user_id}/sections/{section_id}"));
13002 /// ```
13003 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13004 self.name = v.into();
13005 self
13006 }
13007
13008 /// Sets the value of [position][crate::model::PositionSectionRequest::position].
13009 ///
13010 /// Note that all the setters affecting `position` are mutually
13011 /// exclusive.
13012 ///
13013 /// # Example
13014 /// ```ignore,no_run
13015 /// # use google_chat_v1::model::PositionSectionRequest;
13016 /// use google_chat_v1::model::position_section_request::PositionOneof;
13017 /// let x = PositionSectionRequest::new().set_position(Some(PositionOneof::SortOrder(42)));
13018 /// ```
13019 pub fn set_position<
13020 T: std::convert::Into<
13021 std::option::Option<crate::model::position_section_request::PositionOneof>,
13022 >,
13023 >(
13024 mut self,
13025 v: T,
13026 ) -> Self {
13027 self.position = v.into();
13028 self
13029 }
13030
13031 /// The value of [position][crate::model::PositionSectionRequest::position]
13032 /// if it holds a `SortOrder`, `None` if the field is not set or
13033 /// holds a different branch.
13034 pub fn sort_order(&self) -> std::option::Option<&i32> {
13035 #[allow(unreachable_patterns)]
13036 self.position.as_ref().and_then(|v| match v {
13037 crate::model::position_section_request::PositionOneof::SortOrder(v) => {
13038 std::option::Option::Some(v)
13039 }
13040 _ => std::option::Option::None,
13041 })
13042 }
13043
13044 /// Sets the value of [position][crate::model::PositionSectionRequest::position]
13045 /// to hold a `SortOrder`.
13046 ///
13047 /// Note that all the setters affecting `position` are
13048 /// mutually exclusive.
13049 ///
13050 /// # Example
13051 /// ```ignore,no_run
13052 /// # use google_chat_v1::model::PositionSectionRequest;
13053 /// let x = PositionSectionRequest::new().set_sort_order(42);
13054 /// assert!(x.sort_order().is_some());
13055 /// assert!(x.relative_position().is_none());
13056 /// ```
13057 pub fn set_sort_order<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13058 self.position = std::option::Option::Some(
13059 crate::model::position_section_request::PositionOneof::SortOrder(v.into()),
13060 );
13061 self
13062 }
13063
13064 /// The value of [position][crate::model::PositionSectionRequest::position]
13065 /// if it holds a `RelativePosition`, `None` if the field is not set or
13066 /// holds a different branch.
13067 pub fn relative_position(
13068 &self,
13069 ) -> std::option::Option<&crate::model::position_section_request::Position> {
13070 #[allow(unreachable_patterns)]
13071 self.position.as_ref().and_then(|v| match v {
13072 crate::model::position_section_request::PositionOneof::RelativePosition(v) => {
13073 std::option::Option::Some(v)
13074 }
13075 _ => std::option::Option::None,
13076 })
13077 }
13078
13079 /// Sets the value of [position][crate::model::PositionSectionRequest::position]
13080 /// to hold a `RelativePosition`.
13081 ///
13082 /// Note that all the setters affecting `position` are
13083 /// mutually exclusive.
13084 ///
13085 /// # Example
13086 /// ```ignore,no_run
13087 /// # use google_chat_v1::model::PositionSectionRequest;
13088 /// use google_chat_v1::model::position_section_request::Position;
13089 /// let x0 = PositionSectionRequest::new().set_relative_position(Position::Start);
13090 /// let x1 = PositionSectionRequest::new().set_relative_position(Position::End);
13091 /// assert!(x0.relative_position().is_some());
13092 /// assert!(x0.sort_order().is_none());
13093 /// assert!(x1.relative_position().is_some());
13094 /// assert!(x1.sort_order().is_none());
13095 /// ```
13096 pub fn set_relative_position<
13097 T: std::convert::Into<crate::model::position_section_request::Position>,
13098 >(
13099 mut self,
13100 v: T,
13101 ) -> Self {
13102 self.position = std::option::Option::Some(
13103 crate::model::position_section_request::PositionOneof::RelativePosition(v.into()),
13104 );
13105 self
13106 }
13107}
13108
13109impl wkt::message::Message for PositionSectionRequest {
13110 fn typename() -> &'static str {
13111 "type.googleapis.com/google.chat.v1.PositionSectionRequest"
13112 }
13113}
13114
13115/// Defines additional types related to [PositionSectionRequest].
13116pub mod position_section_request {
13117 #[allow(unused_imports)]
13118 use super::*;
13119
13120 /// The position of the section.
13121 ///
13122 /// # Working with unknown values
13123 ///
13124 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13125 /// additional enum variants at any time. Adding new variants is not considered
13126 /// a breaking change. Applications should write their code in anticipation of:
13127 ///
13128 /// - New values appearing in future releases of the client library, **and**
13129 /// - New values received dynamically, without application changes.
13130 ///
13131 /// Please consult the [Working with enums] section in the user guide for some
13132 /// guidelines.
13133 ///
13134 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13135 #[derive(Clone, Debug, PartialEq)]
13136 #[non_exhaustive]
13137 pub enum Position {
13138 /// Unspecified position.
13139 Unspecified,
13140 /// Start of the list of sections.
13141 Start,
13142 /// End of the list of sections.
13143 End,
13144 /// If set, the enum was initialized with an unknown value.
13145 ///
13146 /// Applications can examine the value using [Position::value] or
13147 /// [Position::name].
13148 UnknownValue(position::UnknownValue),
13149 }
13150
13151 #[doc(hidden)]
13152 pub mod position {
13153 #[allow(unused_imports)]
13154 use super::*;
13155 #[derive(Clone, Debug, PartialEq)]
13156 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13157 }
13158
13159 impl Position {
13160 /// Gets the enum value.
13161 ///
13162 /// Returns `None` if the enum contains an unknown value deserialized from
13163 /// the string representation of enums.
13164 pub fn value(&self) -> std::option::Option<i32> {
13165 match self {
13166 Self::Unspecified => std::option::Option::Some(0),
13167 Self::Start => std::option::Option::Some(1),
13168 Self::End => std::option::Option::Some(2),
13169 Self::UnknownValue(u) => u.0.value(),
13170 }
13171 }
13172
13173 /// Gets the enum value as a string.
13174 ///
13175 /// Returns `None` if the enum contains an unknown value deserialized from
13176 /// the integer representation of enums.
13177 pub fn name(&self) -> std::option::Option<&str> {
13178 match self {
13179 Self::Unspecified => std::option::Option::Some("POSITION_UNSPECIFIED"),
13180 Self::Start => std::option::Option::Some("START"),
13181 Self::End => std::option::Option::Some("END"),
13182 Self::UnknownValue(u) => u.0.name(),
13183 }
13184 }
13185 }
13186
13187 impl std::default::Default for Position {
13188 fn default() -> Self {
13189 use std::convert::From;
13190 Self::from(0)
13191 }
13192 }
13193
13194 impl std::fmt::Display for Position {
13195 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13196 wkt::internal::display_enum(f, self.name(), self.value())
13197 }
13198 }
13199
13200 impl std::convert::From<i32> for Position {
13201 fn from(value: i32) -> Self {
13202 match value {
13203 0 => Self::Unspecified,
13204 1 => Self::Start,
13205 2 => Self::End,
13206 _ => Self::UnknownValue(position::UnknownValue(
13207 wkt::internal::UnknownEnumValue::Integer(value),
13208 )),
13209 }
13210 }
13211 }
13212
13213 impl std::convert::From<&str> for Position {
13214 fn from(value: &str) -> Self {
13215 use std::string::ToString;
13216 match value {
13217 "POSITION_UNSPECIFIED" => Self::Unspecified,
13218 "START" => Self::Start,
13219 "END" => Self::End,
13220 _ => Self::UnknownValue(position::UnknownValue(
13221 wkt::internal::UnknownEnumValue::String(value.to_string()),
13222 )),
13223 }
13224 }
13225 }
13226
13227 impl serde::ser::Serialize for Position {
13228 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13229 where
13230 S: serde::Serializer,
13231 {
13232 match self {
13233 Self::Unspecified => serializer.serialize_i32(0),
13234 Self::Start => serializer.serialize_i32(1),
13235 Self::End => serializer.serialize_i32(2),
13236 Self::UnknownValue(u) => u.0.serialize(serializer),
13237 }
13238 }
13239 }
13240
13241 impl<'de> serde::de::Deserialize<'de> for Position {
13242 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13243 where
13244 D: serde::Deserializer<'de>,
13245 {
13246 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Position>::new(
13247 ".google.chat.v1.PositionSectionRequest.Position",
13248 ))
13249 }
13250 }
13251
13252 /// Required. The new position of the section.
13253 #[derive(Clone, Debug, PartialEq)]
13254 #[non_exhaustive]
13255 pub enum PositionOneof {
13256 /// Optional. The absolute position of the section in the list of sections.
13257 /// The position must be greater than 0. If the position is greater than the
13258 /// number of sections, the section will be appended to the end of the list.
13259 /// This operation inserts the section at the given position and shifts the
13260 /// original section at that position, and those below it, to the next
13261 /// position.
13262 SortOrder(i32),
13263 /// Optional. The relative position of the section in the list of sections.
13264 RelativePosition(crate::model::position_section_request::Position),
13265 }
13266}
13267
13268/// Response message for positioning a section.
13269#[derive(Clone, Default, PartialEq)]
13270#[non_exhaustive]
13271pub struct PositionSectionResponse {
13272 /// The updated section.
13273 pub section: std::option::Option<crate::model::Section>,
13274
13275 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13276}
13277
13278impl PositionSectionResponse {
13279 /// Creates a new default instance.
13280 pub fn new() -> Self {
13281 std::default::Default::default()
13282 }
13283
13284 /// Sets the value of [section][crate::model::PositionSectionResponse::section].
13285 ///
13286 /// # Example
13287 /// ```ignore,no_run
13288 /// # use google_chat_v1::model::PositionSectionResponse;
13289 /// use google_chat_v1::model::Section;
13290 /// let x = PositionSectionResponse::new().set_section(Section::default()/* use setters */);
13291 /// ```
13292 pub fn set_section<T>(mut self, v: T) -> Self
13293 where
13294 T: std::convert::Into<crate::model::Section>,
13295 {
13296 self.section = std::option::Option::Some(v.into());
13297 self
13298 }
13299
13300 /// Sets or clears the value of [section][crate::model::PositionSectionResponse::section].
13301 ///
13302 /// # Example
13303 /// ```ignore,no_run
13304 /// # use google_chat_v1::model::PositionSectionResponse;
13305 /// use google_chat_v1::model::Section;
13306 /// let x = PositionSectionResponse::new().set_or_clear_section(Some(Section::default()/* use setters */));
13307 /// let x = PositionSectionResponse::new().set_or_clear_section(None::<Section>);
13308 /// ```
13309 pub fn set_or_clear_section<T>(mut self, v: std::option::Option<T>) -> Self
13310 where
13311 T: std::convert::Into<crate::model::Section>,
13312 {
13313 self.section = v.map(|x| x.into());
13314 self
13315 }
13316}
13317
13318impl wkt::message::Message for PositionSectionResponse {
13319 fn typename() -> &'static str {
13320 "type.googleapis.com/google.chat.v1.PositionSectionResponse"
13321 }
13322}
13323
13324/// Request message for listing section items.
13325#[derive(Clone, Default, PartialEq)]
13326#[non_exhaustive]
13327pub struct ListSectionItemsRequest {
13328 /// Required. The parent, which is the section resource name that owns this
13329 /// collection of section items. Only supports listing section items for the
13330 /// calling user.
13331 ///
13332 /// When you're filtering by space, use the wildcard `-` to search across all
13333 /// sections. For example, `users/{user}/sections/-`.
13334 ///
13335 /// Format: `users/{user}/sections/{section}`
13336 pub parent: std::string::String,
13337
13338 /// Optional. The maximum number of section items to return. The service may
13339 /// return fewer than this value.
13340 ///
13341 /// If unspecified, at most 10 section items will be returned.
13342 ///
13343 /// The maximum value is 100. If you use a value more than 100, it's
13344 /// automatically changed to 100.
13345 ///
13346 /// Negative values return an `INVALID_ARGUMENT` error.
13347 pub page_size: i32,
13348
13349 /// Optional. A page token, received from a previous list section items call.
13350 /// Provide this to retrieve the subsequent page.
13351 ///
13352 /// When paginating, all other parameters provided should match the call that
13353 /// provided the page token. Passing different values to the other parameters
13354 /// might lead to unexpected results.
13355 pub page_token: std::string::String,
13356
13357 /// Optional. A query filter.
13358 ///
13359 /// Currently only supports filtering by space.
13360 ///
13361 /// For example, `space = spaces/{space}`.
13362 ///
13363 /// Invalid queries are rejected with an `INVALID_ARGUMENT` error.
13364 pub filter: std::string::String,
13365
13366 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13367}
13368
13369impl ListSectionItemsRequest {
13370 /// Creates a new default instance.
13371 pub fn new() -> Self {
13372 std::default::Default::default()
13373 }
13374
13375 /// Sets the value of [parent][crate::model::ListSectionItemsRequest::parent].
13376 ///
13377 /// # Example
13378 /// ```ignore,no_run
13379 /// # use google_chat_v1::model::ListSectionItemsRequest;
13380 /// # let user_id = "user_id";
13381 /// # let section_id = "section_id";
13382 /// let x = ListSectionItemsRequest::new().set_parent(format!("users/{user_id}/sections/{section_id}"));
13383 /// ```
13384 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13385 self.parent = v.into();
13386 self
13387 }
13388
13389 /// Sets the value of [page_size][crate::model::ListSectionItemsRequest::page_size].
13390 ///
13391 /// # Example
13392 /// ```ignore,no_run
13393 /// # use google_chat_v1::model::ListSectionItemsRequest;
13394 /// let x = ListSectionItemsRequest::new().set_page_size(42);
13395 /// ```
13396 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13397 self.page_size = v.into();
13398 self
13399 }
13400
13401 /// Sets the value of [page_token][crate::model::ListSectionItemsRequest::page_token].
13402 ///
13403 /// # Example
13404 /// ```ignore,no_run
13405 /// # use google_chat_v1::model::ListSectionItemsRequest;
13406 /// let x = ListSectionItemsRequest::new().set_page_token("example");
13407 /// ```
13408 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13409 self.page_token = v.into();
13410 self
13411 }
13412
13413 /// Sets the value of [filter][crate::model::ListSectionItemsRequest::filter].
13414 ///
13415 /// # Example
13416 /// ```ignore,no_run
13417 /// # use google_chat_v1::model::ListSectionItemsRequest;
13418 /// let x = ListSectionItemsRequest::new().set_filter("example");
13419 /// ```
13420 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13421 self.filter = v.into();
13422 self
13423 }
13424}
13425
13426impl wkt::message::Message for ListSectionItemsRequest {
13427 fn typename() -> &'static str {
13428 "type.googleapis.com/google.chat.v1.ListSectionItemsRequest"
13429 }
13430}
13431
13432/// Response message for listing section items.
13433#[derive(Clone, Default, PartialEq)]
13434#[non_exhaustive]
13435pub struct ListSectionItemsResponse {
13436 /// The section items from the specified section.
13437 pub section_items: std::vec::Vec<crate::model::SectionItem>,
13438
13439 /// A token, which can be sent as `page_token` to retrieve the next page. If
13440 /// this field is omitted, there are no subsequent pages.
13441 pub next_page_token: std::string::String,
13442
13443 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13444}
13445
13446impl ListSectionItemsResponse {
13447 /// Creates a new default instance.
13448 pub fn new() -> Self {
13449 std::default::Default::default()
13450 }
13451
13452 /// Sets the value of [section_items][crate::model::ListSectionItemsResponse::section_items].
13453 ///
13454 /// # Example
13455 /// ```ignore,no_run
13456 /// # use google_chat_v1::model::ListSectionItemsResponse;
13457 /// use google_chat_v1::model::SectionItem;
13458 /// let x = ListSectionItemsResponse::new()
13459 /// .set_section_items([
13460 /// SectionItem::default()/* use setters */,
13461 /// SectionItem::default()/* use (different) setters */,
13462 /// ]);
13463 /// ```
13464 pub fn set_section_items<T, V>(mut self, v: T) -> Self
13465 where
13466 T: std::iter::IntoIterator<Item = V>,
13467 V: std::convert::Into<crate::model::SectionItem>,
13468 {
13469 use std::iter::Iterator;
13470 self.section_items = v.into_iter().map(|i| i.into()).collect();
13471 self
13472 }
13473
13474 /// Sets the value of [next_page_token][crate::model::ListSectionItemsResponse::next_page_token].
13475 ///
13476 /// # Example
13477 /// ```ignore,no_run
13478 /// # use google_chat_v1::model::ListSectionItemsResponse;
13479 /// let x = ListSectionItemsResponse::new().set_next_page_token("example");
13480 /// ```
13481 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13482 self.next_page_token = v.into();
13483 self
13484 }
13485}
13486
13487impl wkt::message::Message for ListSectionItemsResponse {
13488 fn typename() -> &'static str {
13489 "type.googleapis.com/google.chat.v1.ListSectionItemsResponse"
13490 }
13491}
13492
13493#[doc(hidden)]
13494impl google_cloud_gax::paginator::internal::PageableResponse for ListSectionItemsResponse {
13495 type PageItem = crate::model::SectionItem;
13496
13497 fn items(self) -> std::vec::Vec<Self::PageItem> {
13498 self.section_items
13499 }
13500
13501 fn next_page_token(&self) -> std::string::String {
13502 use std::clone::Clone;
13503 self.next_page_token.clone()
13504 }
13505}
13506
13507/// Request message for moving a section item across sections.
13508#[derive(Clone, Default, PartialEq)]
13509#[non_exhaustive]
13510pub struct MoveSectionItemRequest {
13511 /// Required. The resource name of the section item to move.
13512 ///
13513 /// Format: `users/{user}/sections/{section}/items/{item}`
13514 pub name: std::string::String,
13515
13516 /// Required. The resource name of the section to move the section item to.
13517 ///
13518 /// Format: `users/{user}/sections/{section}`
13519 pub target_section: std::string::String,
13520
13521 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13522}
13523
13524impl MoveSectionItemRequest {
13525 /// Creates a new default instance.
13526 pub fn new() -> Self {
13527 std::default::Default::default()
13528 }
13529
13530 /// Sets the value of [name][crate::model::MoveSectionItemRequest::name].
13531 ///
13532 /// # Example
13533 /// ```ignore,no_run
13534 /// # use google_chat_v1::model::MoveSectionItemRequest;
13535 /// # let user_id = "user_id";
13536 /// # let section_id = "section_id";
13537 /// # let item_id = "item_id";
13538 /// let x = MoveSectionItemRequest::new().set_name(format!("users/{user_id}/sections/{section_id}/items/{item_id}"));
13539 /// ```
13540 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13541 self.name = v.into();
13542 self
13543 }
13544
13545 /// Sets the value of [target_section][crate::model::MoveSectionItemRequest::target_section].
13546 ///
13547 /// # Example
13548 /// ```ignore,no_run
13549 /// # use google_chat_v1::model::MoveSectionItemRequest;
13550 /// # let user_id = "user_id";
13551 /// # let section_id = "section_id";
13552 /// let x = MoveSectionItemRequest::new().set_target_section(format!("users/{user_id}/sections/{section_id}"));
13553 /// ```
13554 pub fn set_target_section<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13555 self.target_section = v.into();
13556 self
13557 }
13558}
13559
13560impl wkt::message::Message for MoveSectionItemRequest {
13561 fn typename() -> &'static str {
13562 "type.googleapis.com/google.chat.v1.MoveSectionItemRequest"
13563 }
13564}
13565
13566/// Response message for moving a section item.
13567#[derive(Clone, Default, PartialEq)]
13568#[non_exhaustive]
13569pub struct MoveSectionItemResponse {
13570 /// The updated section item.
13571 pub section_item: std::option::Option<crate::model::SectionItem>,
13572
13573 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13574}
13575
13576impl MoveSectionItemResponse {
13577 /// Creates a new default instance.
13578 pub fn new() -> Self {
13579 std::default::Default::default()
13580 }
13581
13582 /// Sets the value of [section_item][crate::model::MoveSectionItemResponse::section_item].
13583 ///
13584 /// # Example
13585 /// ```ignore,no_run
13586 /// # use google_chat_v1::model::MoveSectionItemResponse;
13587 /// use google_chat_v1::model::SectionItem;
13588 /// let x = MoveSectionItemResponse::new().set_section_item(SectionItem::default()/* use setters */);
13589 /// ```
13590 pub fn set_section_item<T>(mut self, v: T) -> Self
13591 where
13592 T: std::convert::Into<crate::model::SectionItem>,
13593 {
13594 self.section_item = std::option::Option::Some(v.into());
13595 self
13596 }
13597
13598 /// Sets or clears the value of [section_item][crate::model::MoveSectionItemResponse::section_item].
13599 ///
13600 /// # Example
13601 /// ```ignore,no_run
13602 /// # use google_chat_v1::model::MoveSectionItemResponse;
13603 /// use google_chat_v1::model::SectionItem;
13604 /// let x = MoveSectionItemResponse::new().set_or_clear_section_item(Some(SectionItem::default()/* use setters */));
13605 /// let x = MoveSectionItemResponse::new().set_or_clear_section_item(None::<SectionItem>);
13606 /// ```
13607 pub fn set_or_clear_section_item<T>(mut self, v: std::option::Option<T>) -> Self
13608 where
13609 T: std::convert::Into<crate::model::SectionItem>,
13610 {
13611 self.section_item = v.map(|x| x.into());
13612 self
13613 }
13614}
13615
13616impl wkt::message::Message for MoveSectionItemResponse {
13617 fn typename() -> &'static str {
13618 "type.googleapis.com/google.chat.v1.MoveSectionItemResponse"
13619 }
13620}
13621
13622/// Metadata about a [slash
13623/// command](https://developers.google.com/workspace/chat/commands) in
13624/// Google Chat.
13625#[derive(Clone, Default, PartialEq)]
13626#[non_exhaustive]
13627pub struct SlashCommand {
13628 /// The ID of the slash command.
13629 pub command_id: i64,
13630
13631 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13632}
13633
13634impl SlashCommand {
13635 /// Creates a new default instance.
13636 pub fn new() -> Self {
13637 std::default::Default::default()
13638 }
13639
13640 /// Sets the value of [command_id][crate::model::SlashCommand::command_id].
13641 ///
13642 /// # Example
13643 /// ```ignore,no_run
13644 /// # use google_chat_v1::model::SlashCommand;
13645 /// let x = SlashCommand::new().set_command_id(42);
13646 /// ```
13647 pub fn set_command_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13648 self.command_id = v.into();
13649 self
13650 }
13651}
13652
13653impl wkt::message::Message for SlashCommand {
13654 fn typename() -> &'static str {
13655 "type.googleapis.com/google.chat.v1.SlashCommand"
13656 }
13657}
13658
13659/// A space in Google Chat. Spaces are conversations between two or more users
13660/// or 1:1 messages between a user and a Chat app.
13661#[derive(Clone, Default, PartialEq)]
13662#[non_exhaustive]
13663pub struct Space {
13664 /// Identifier. Resource name of the space.
13665 ///
13666 /// Format: `spaces/{space}`
13667 ///
13668 /// Where `{space}` represents the system-assigned ID for the space. You can
13669 /// obtain the space ID by calling the
13670 /// [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list)
13671 /// method or from the space URL. For example, if the space URL
13672 /// is `<https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA>`, the space ID
13673 /// is `AAAAAAAAA`.
13674 pub name: std::string::String,
13675
13676 /// Output only. Deprecated: Use `space_type` instead.
13677 /// The type of a space.
13678 #[deprecated]
13679 pub r#type: crate::model::space::Type,
13680
13681 /// Optional. The type of space. Required when creating a space or updating the
13682 /// space type of a space. Output only for other usage.
13683 pub space_type: crate::model::space::SpaceType,
13684
13685 /// Optional. Whether the space is a DM between a Chat app and a single
13686 /// human.
13687 pub single_user_bot_dm: bool,
13688
13689 /// Output only. Deprecated: Use `spaceThreadingState` instead.
13690 /// Whether messages are threaded in this space.
13691 #[deprecated]
13692 pub threaded: bool,
13693
13694 /// Optional. The space's display name. Required when [creating a
13695 /// space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create)
13696 /// with a `spaceType` of `SPACE`. If you receive the error message
13697 /// `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a
13698 /// different `displayName`. An existing space within the Google Workspace
13699 /// organization might already use this display name.
13700 ///
13701 /// For direct messages, this field might be empty.
13702 ///
13703 /// Supports up to 128 characters.
13704 pub display_name: std::string::String,
13705
13706 /// Optional. Immutable. Whether this space permits any Google Chat user as a
13707 /// member. Input when creating a space in a Google Workspace organization.
13708 /// Omit this field when creating spaces in the following conditions:
13709 ///
13710 /// * The authenticated user uses a consumer account (unmanaged user
13711 /// account). By default, a space created by a consumer account permits any
13712 /// Google Chat user.
13713 ///
13714 /// For existing spaces, this field is output only.
13715 pub external_user_allowed: bool,
13716
13717 /// Output only. The threading state in the Chat space.
13718 pub space_threading_state: crate::model::space::SpaceThreadingState,
13719
13720 /// Optional. Details about the space including description and rules.
13721 pub space_details: std::option::Option<crate::model::space::SpaceDetails>,
13722
13723 /// Optional. The message history state for messages and threads in this space.
13724 pub space_history_state: crate::model::HistoryState,
13725
13726 /// Optional. Whether this space is created in `Import Mode` as part of a data
13727 /// migration into Google Workspace. While spaces are being imported, they
13728 /// aren't visible to users until the import is complete.
13729 ///
13730 /// Creating a space in `Import Mode`requires [user
13731 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
13732 pub import_mode: bool,
13733
13734 /// Optional. Immutable. For spaces created in Chat, the time the space was
13735 /// created. This field is output only, except when used in import mode spaces.
13736 ///
13737 /// For import mode spaces, set this field to the historical timestamp at which
13738 /// the space was created in the source in order to preserve the original
13739 /// creation time.
13740 ///
13741 /// Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
13742 pub create_time: std::option::Option<wkt::Timestamp>,
13743
13744 /// Output only. Timestamp of the last message in the space.
13745 pub last_active_time: std::option::Option<wkt::Timestamp>,
13746
13747 /// Output only. For direct message (DM) spaces with a Chat app, whether the
13748 /// space was created by a Google Workspace administrator. Administrators can
13749 /// install and set up a direct message with a Chat app on behalf of users in
13750 /// their organization.
13751 ///
13752 /// To support admin install, your Chat app must feature direct messaging.
13753 pub admin_installed: bool,
13754
13755 /// Output only. The count of joined memberships grouped by member type.
13756 /// Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or
13757 /// `GROUP_CHAT`.
13758 pub membership_count: std::option::Option<crate::model::space::MembershipCount>,
13759
13760 /// Optional. Specifies the [access
13761 /// setting](https://support.google.com/chat/answer/11971020) of the space.
13762 /// Only populated when the `space_type` is `SPACE`.
13763 pub access_settings: std::option::Option<crate::model::space::AccessSettings>,
13764
13765 /// Optional. Immutable. The customer id of the domain of the space.
13766 /// Required only when creating a space with [app
13767 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
13768 /// and `SpaceType` is `SPACE`, otherwise should not be set.
13769 ///
13770 /// In the format `customers/{customer}`, where `customer` is the `id` from the
13771 /// [Admin SDK customer
13772 /// resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers).
13773 /// Private apps can also use the `customers/my_customer` alias to create
13774 /// the space in the same Google Workspace organization as the app.
13775 ///
13776 /// This field isn't populated for direct messages (DMs) or when the space is
13777 /// created by non-Google Workspace users.
13778 pub customer: std::option::Option<std::string::String>,
13779
13780 /// Output only. The URI for a user to access the space.
13781 pub space_uri: std::string::String,
13782
13783 /// Output only. The time when the space will be automatically deleted by the
13784 /// system if it remains in import mode.
13785 ///
13786 /// Each space created in import mode must exit this mode before this expire
13787 /// time using `spaces.completeImport`.
13788 ///
13789 /// This field is only populated for spaces that were created with import mode.
13790 pub import_mode_expire_time: std::option::Option<wkt::Timestamp>,
13791
13792 /// Represents the [permission settings]
13793 /// (<https://support.google.com/chat/answer/13340792>) of a space. Only
13794 /// populated when the `space_type` is `SPACE`.
13795 pub space_permission_settings:
13796 std::option::Option<crate::model::space::SpacePermissionSettings>,
13797
13798 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13799}
13800
13801impl Space {
13802 /// Creates a new default instance.
13803 pub fn new() -> Self {
13804 std::default::Default::default()
13805 }
13806
13807 /// Sets the value of [name][crate::model::Space::name].
13808 ///
13809 /// # Example
13810 /// ```ignore,no_run
13811 /// # use google_chat_v1::model::Space;
13812 /// # let space_id = "space_id";
13813 /// let x = Space::new().set_name(format!("spaces/{space_id}"));
13814 /// ```
13815 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13816 self.name = v.into();
13817 self
13818 }
13819
13820 /// Sets the value of [r#type][crate::model::Space::type].
13821 ///
13822 /// # Example
13823 /// ```ignore,no_run
13824 /// # use google_chat_v1::model::Space;
13825 /// use google_chat_v1::model::space::Type;
13826 /// let x0 = Space::new().set_type(Type::Room);
13827 /// let x1 = Space::new().set_type(Type::Dm);
13828 /// ```
13829 #[deprecated]
13830 pub fn set_type<T: std::convert::Into<crate::model::space::Type>>(mut self, v: T) -> Self {
13831 self.r#type = v.into();
13832 self
13833 }
13834
13835 /// Sets the value of [space_type][crate::model::Space::space_type].
13836 ///
13837 /// # Example
13838 /// ```ignore,no_run
13839 /// # use google_chat_v1::model::Space;
13840 /// use google_chat_v1::model::space::SpaceType;
13841 /// let x0 = Space::new().set_space_type(SpaceType::Space);
13842 /// let x1 = Space::new().set_space_type(SpaceType::GroupChat);
13843 /// let x2 = Space::new().set_space_type(SpaceType::DirectMessage);
13844 /// ```
13845 pub fn set_space_type<T: std::convert::Into<crate::model::space::SpaceType>>(
13846 mut self,
13847 v: T,
13848 ) -> Self {
13849 self.space_type = v.into();
13850 self
13851 }
13852
13853 /// Sets the value of [single_user_bot_dm][crate::model::Space::single_user_bot_dm].
13854 ///
13855 /// # Example
13856 /// ```ignore,no_run
13857 /// # use google_chat_v1::model::Space;
13858 /// let x = Space::new().set_single_user_bot_dm(true);
13859 /// ```
13860 pub fn set_single_user_bot_dm<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13861 self.single_user_bot_dm = v.into();
13862 self
13863 }
13864
13865 /// Sets the value of [threaded][crate::model::Space::threaded].
13866 ///
13867 /// # Example
13868 /// ```ignore,no_run
13869 /// # use google_chat_v1::model::Space;
13870 /// let x = Space::new().set_threaded(true);
13871 /// ```
13872 #[deprecated]
13873 pub fn set_threaded<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13874 self.threaded = v.into();
13875 self
13876 }
13877
13878 /// Sets the value of [display_name][crate::model::Space::display_name].
13879 ///
13880 /// # Example
13881 /// ```ignore,no_run
13882 /// # use google_chat_v1::model::Space;
13883 /// let x = Space::new().set_display_name("example");
13884 /// ```
13885 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13886 self.display_name = v.into();
13887 self
13888 }
13889
13890 /// Sets the value of [external_user_allowed][crate::model::Space::external_user_allowed].
13891 ///
13892 /// # Example
13893 /// ```ignore,no_run
13894 /// # use google_chat_v1::model::Space;
13895 /// let x = Space::new().set_external_user_allowed(true);
13896 /// ```
13897 pub fn set_external_user_allowed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13898 self.external_user_allowed = v.into();
13899 self
13900 }
13901
13902 /// Sets the value of [space_threading_state][crate::model::Space::space_threading_state].
13903 ///
13904 /// # Example
13905 /// ```ignore,no_run
13906 /// # use google_chat_v1::model::Space;
13907 /// use google_chat_v1::model::space::SpaceThreadingState;
13908 /// let x0 = Space::new().set_space_threading_state(SpaceThreadingState::ThreadedMessages);
13909 /// let x1 = Space::new().set_space_threading_state(SpaceThreadingState::GroupedMessages);
13910 /// let x2 = Space::new().set_space_threading_state(SpaceThreadingState::UnthreadedMessages);
13911 /// ```
13912 pub fn set_space_threading_state<
13913 T: std::convert::Into<crate::model::space::SpaceThreadingState>,
13914 >(
13915 mut self,
13916 v: T,
13917 ) -> Self {
13918 self.space_threading_state = v.into();
13919 self
13920 }
13921
13922 /// Sets the value of [space_details][crate::model::Space::space_details].
13923 ///
13924 /// # Example
13925 /// ```ignore,no_run
13926 /// # use google_chat_v1::model::Space;
13927 /// use google_chat_v1::model::space::SpaceDetails;
13928 /// let x = Space::new().set_space_details(SpaceDetails::default()/* use setters */);
13929 /// ```
13930 pub fn set_space_details<T>(mut self, v: T) -> Self
13931 where
13932 T: std::convert::Into<crate::model::space::SpaceDetails>,
13933 {
13934 self.space_details = std::option::Option::Some(v.into());
13935 self
13936 }
13937
13938 /// Sets or clears the value of [space_details][crate::model::Space::space_details].
13939 ///
13940 /// # Example
13941 /// ```ignore,no_run
13942 /// # use google_chat_v1::model::Space;
13943 /// use google_chat_v1::model::space::SpaceDetails;
13944 /// let x = Space::new().set_or_clear_space_details(Some(SpaceDetails::default()/* use setters */));
13945 /// let x = Space::new().set_or_clear_space_details(None::<SpaceDetails>);
13946 /// ```
13947 pub fn set_or_clear_space_details<T>(mut self, v: std::option::Option<T>) -> Self
13948 where
13949 T: std::convert::Into<crate::model::space::SpaceDetails>,
13950 {
13951 self.space_details = v.map(|x| x.into());
13952 self
13953 }
13954
13955 /// Sets the value of [space_history_state][crate::model::Space::space_history_state].
13956 ///
13957 /// # Example
13958 /// ```ignore,no_run
13959 /// # use google_chat_v1::model::Space;
13960 /// use google_chat_v1::model::HistoryState;
13961 /// let x0 = Space::new().set_space_history_state(HistoryState::HistoryOff);
13962 /// let x1 = Space::new().set_space_history_state(HistoryState::HistoryOn);
13963 /// ```
13964 pub fn set_space_history_state<T: std::convert::Into<crate::model::HistoryState>>(
13965 mut self,
13966 v: T,
13967 ) -> Self {
13968 self.space_history_state = v.into();
13969 self
13970 }
13971
13972 /// Sets the value of [import_mode][crate::model::Space::import_mode].
13973 ///
13974 /// # Example
13975 /// ```ignore,no_run
13976 /// # use google_chat_v1::model::Space;
13977 /// let x = Space::new().set_import_mode(true);
13978 /// ```
13979 pub fn set_import_mode<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13980 self.import_mode = v.into();
13981 self
13982 }
13983
13984 /// Sets the value of [create_time][crate::model::Space::create_time].
13985 ///
13986 /// # Example
13987 /// ```ignore,no_run
13988 /// # use google_chat_v1::model::Space;
13989 /// use wkt::Timestamp;
13990 /// let x = Space::new().set_create_time(Timestamp::default()/* use setters */);
13991 /// ```
13992 pub fn set_create_time<T>(mut self, v: T) -> Self
13993 where
13994 T: std::convert::Into<wkt::Timestamp>,
13995 {
13996 self.create_time = std::option::Option::Some(v.into());
13997 self
13998 }
13999
14000 /// Sets or clears the value of [create_time][crate::model::Space::create_time].
14001 ///
14002 /// # Example
14003 /// ```ignore,no_run
14004 /// # use google_chat_v1::model::Space;
14005 /// use wkt::Timestamp;
14006 /// let x = Space::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
14007 /// let x = Space::new().set_or_clear_create_time(None::<Timestamp>);
14008 /// ```
14009 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
14010 where
14011 T: std::convert::Into<wkt::Timestamp>,
14012 {
14013 self.create_time = v.map(|x| x.into());
14014 self
14015 }
14016
14017 /// Sets the value of [last_active_time][crate::model::Space::last_active_time].
14018 ///
14019 /// # Example
14020 /// ```ignore,no_run
14021 /// # use google_chat_v1::model::Space;
14022 /// use wkt::Timestamp;
14023 /// let x = Space::new().set_last_active_time(Timestamp::default()/* use setters */);
14024 /// ```
14025 pub fn set_last_active_time<T>(mut self, v: T) -> Self
14026 where
14027 T: std::convert::Into<wkt::Timestamp>,
14028 {
14029 self.last_active_time = std::option::Option::Some(v.into());
14030 self
14031 }
14032
14033 /// Sets or clears the value of [last_active_time][crate::model::Space::last_active_time].
14034 ///
14035 /// # Example
14036 /// ```ignore,no_run
14037 /// # use google_chat_v1::model::Space;
14038 /// use wkt::Timestamp;
14039 /// let x = Space::new().set_or_clear_last_active_time(Some(Timestamp::default()/* use setters */));
14040 /// let x = Space::new().set_or_clear_last_active_time(None::<Timestamp>);
14041 /// ```
14042 pub fn set_or_clear_last_active_time<T>(mut self, v: std::option::Option<T>) -> Self
14043 where
14044 T: std::convert::Into<wkt::Timestamp>,
14045 {
14046 self.last_active_time = v.map(|x| x.into());
14047 self
14048 }
14049
14050 /// Sets the value of [admin_installed][crate::model::Space::admin_installed].
14051 ///
14052 /// # Example
14053 /// ```ignore,no_run
14054 /// # use google_chat_v1::model::Space;
14055 /// let x = Space::new().set_admin_installed(true);
14056 /// ```
14057 pub fn set_admin_installed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14058 self.admin_installed = v.into();
14059 self
14060 }
14061
14062 /// Sets the value of [membership_count][crate::model::Space::membership_count].
14063 ///
14064 /// # Example
14065 /// ```ignore,no_run
14066 /// # use google_chat_v1::model::Space;
14067 /// use google_chat_v1::model::space::MembershipCount;
14068 /// let x = Space::new().set_membership_count(MembershipCount::default()/* use setters */);
14069 /// ```
14070 pub fn set_membership_count<T>(mut self, v: T) -> Self
14071 where
14072 T: std::convert::Into<crate::model::space::MembershipCount>,
14073 {
14074 self.membership_count = std::option::Option::Some(v.into());
14075 self
14076 }
14077
14078 /// Sets or clears the value of [membership_count][crate::model::Space::membership_count].
14079 ///
14080 /// # Example
14081 /// ```ignore,no_run
14082 /// # use google_chat_v1::model::Space;
14083 /// use google_chat_v1::model::space::MembershipCount;
14084 /// let x = Space::new().set_or_clear_membership_count(Some(MembershipCount::default()/* use setters */));
14085 /// let x = Space::new().set_or_clear_membership_count(None::<MembershipCount>);
14086 /// ```
14087 pub fn set_or_clear_membership_count<T>(mut self, v: std::option::Option<T>) -> Self
14088 where
14089 T: std::convert::Into<crate::model::space::MembershipCount>,
14090 {
14091 self.membership_count = v.map(|x| x.into());
14092 self
14093 }
14094
14095 /// Sets the value of [access_settings][crate::model::Space::access_settings].
14096 ///
14097 /// # Example
14098 /// ```ignore,no_run
14099 /// # use google_chat_v1::model::Space;
14100 /// use google_chat_v1::model::space::AccessSettings;
14101 /// let x = Space::new().set_access_settings(AccessSettings::default()/* use setters */);
14102 /// ```
14103 pub fn set_access_settings<T>(mut self, v: T) -> Self
14104 where
14105 T: std::convert::Into<crate::model::space::AccessSettings>,
14106 {
14107 self.access_settings = std::option::Option::Some(v.into());
14108 self
14109 }
14110
14111 /// Sets or clears the value of [access_settings][crate::model::Space::access_settings].
14112 ///
14113 /// # Example
14114 /// ```ignore,no_run
14115 /// # use google_chat_v1::model::Space;
14116 /// use google_chat_v1::model::space::AccessSettings;
14117 /// let x = Space::new().set_or_clear_access_settings(Some(AccessSettings::default()/* use setters */));
14118 /// let x = Space::new().set_or_clear_access_settings(None::<AccessSettings>);
14119 /// ```
14120 pub fn set_or_clear_access_settings<T>(mut self, v: std::option::Option<T>) -> Self
14121 where
14122 T: std::convert::Into<crate::model::space::AccessSettings>,
14123 {
14124 self.access_settings = v.map(|x| x.into());
14125 self
14126 }
14127
14128 /// Sets the value of [customer][crate::model::Space::customer].
14129 ///
14130 /// # Example
14131 /// ```ignore,no_run
14132 /// # use google_chat_v1::model::Space;
14133 /// let x = Space::new().set_customer("example");
14134 /// ```
14135 pub fn set_customer<T>(mut self, v: T) -> Self
14136 where
14137 T: std::convert::Into<std::string::String>,
14138 {
14139 self.customer = std::option::Option::Some(v.into());
14140 self
14141 }
14142
14143 /// Sets or clears the value of [customer][crate::model::Space::customer].
14144 ///
14145 /// # Example
14146 /// ```ignore,no_run
14147 /// # use google_chat_v1::model::Space;
14148 /// let x = Space::new().set_or_clear_customer(Some("example"));
14149 /// let x = Space::new().set_or_clear_customer(None::<String>);
14150 /// ```
14151 pub fn set_or_clear_customer<T>(mut self, v: std::option::Option<T>) -> Self
14152 where
14153 T: std::convert::Into<std::string::String>,
14154 {
14155 self.customer = v.map(|x| x.into());
14156 self
14157 }
14158
14159 /// Sets the value of [space_uri][crate::model::Space::space_uri].
14160 ///
14161 /// # Example
14162 /// ```ignore,no_run
14163 /// # use google_chat_v1::model::Space;
14164 /// let x = Space::new().set_space_uri("example");
14165 /// ```
14166 pub fn set_space_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14167 self.space_uri = v.into();
14168 self
14169 }
14170
14171 /// Sets the value of [import_mode_expire_time][crate::model::Space::import_mode_expire_time].
14172 ///
14173 /// # Example
14174 /// ```ignore,no_run
14175 /// # use google_chat_v1::model::Space;
14176 /// use wkt::Timestamp;
14177 /// let x = Space::new().set_import_mode_expire_time(Timestamp::default()/* use setters */);
14178 /// ```
14179 pub fn set_import_mode_expire_time<T>(mut self, v: T) -> Self
14180 where
14181 T: std::convert::Into<wkt::Timestamp>,
14182 {
14183 self.import_mode_expire_time = std::option::Option::Some(v.into());
14184 self
14185 }
14186
14187 /// Sets or clears the value of [import_mode_expire_time][crate::model::Space::import_mode_expire_time].
14188 ///
14189 /// # Example
14190 /// ```ignore,no_run
14191 /// # use google_chat_v1::model::Space;
14192 /// use wkt::Timestamp;
14193 /// let x = Space::new().set_or_clear_import_mode_expire_time(Some(Timestamp::default()/* use setters */));
14194 /// let x = Space::new().set_or_clear_import_mode_expire_time(None::<Timestamp>);
14195 /// ```
14196 pub fn set_or_clear_import_mode_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
14197 where
14198 T: std::convert::Into<wkt::Timestamp>,
14199 {
14200 self.import_mode_expire_time = v.map(|x| x.into());
14201 self
14202 }
14203
14204 /// Sets the value of [space_permission_settings][crate::model::Space::space_permission_settings].
14205 ///
14206 /// Note that all the setters affecting `space_permission_settings` are mutually
14207 /// exclusive.
14208 ///
14209 /// # Example
14210 /// ```ignore,no_run
14211 /// # use google_chat_v1::model::Space;
14212 /// use google_chat_v1::model::space::PredefinedPermissionSettings;
14213 /// let x0 = Space::new().set_space_permission_settings(Some(
14214 /// google_chat_v1::model::space::SpacePermissionSettings::PredefinedPermissionSettings(PredefinedPermissionSettings::CollaborationSpace)));
14215 /// let x1 = Space::new().set_space_permission_settings(Some(
14216 /// google_chat_v1::model::space::SpacePermissionSettings::PredefinedPermissionSettings(PredefinedPermissionSettings::AnnouncementSpace)));
14217 /// ```
14218 pub fn set_space_permission_settings<
14219 T: std::convert::Into<std::option::Option<crate::model::space::SpacePermissionSettings>>,
14220 >(
14221 mut self,
14222 v: T,
14223 ) -> Self {
14224 self.space_permission_settings = v.into();
14225 self
14226 }
14227
14228 /// The value of [space_permission_settings][crate::model::Space::space_permission_settings]
14229 /// if it holds a `PredefinedPermissionSettings`, `None` if the field is not set or
14230 /// holds a different branch.
14231 pub fn predefined_permission_settings(
14232 &self,
14233 ) -> std::option::Option<&crate::model::space::PredefinedPermissionSettings> {
14234 #[allow(unreachable_patterns)]
14235 self.space_permission_settings
14236 .as_ref()
14237 .and_then(|v| match v {
14238 crate::model::space::SpacePermissionSettings::PredefinedPermissionSettings(v) => {
14239 std::option::Option::Some(v)
14240 }
14241 _ => std::option::Option::None,
14242 })
14243 }
14244
14245 /// Sets the value of [space_permission_settings][crate::model::Space::space_permission_settings]
14246 /// to hold a `PredefinedPermissionSettings`.
14247 ///
14248 /// Note that all the setters affecting `space_permission_settings` are
14249 /// mutually exclusive.
14250 ///
14251 /// # Example
14252 /// ```ignore,no_run
14253 /// # use google_chat_v1::model::Space;
14254 /// use google_chat_v1::model::space::PredefinedPermissionSettings;
14255 /// let x0 = Space::new().set_predefined_permission_settings(PredefinedPermissionSettings::CollaborationSpace);
14256 /// let x1 = Space::new().set_predefined_permission_settings(PredefinedPermissionSettings::AnnouncementSpace);
14257 /// assert!(x0.predefined_permission_settings().is_some());
14258 /// assert!(x0.permission_settings().is_none());
14259 /// assert!(x1.predefined_permission_settings().is_some());
14260 /// assert!(x1.permission_settings().is_none());
14261 /// ```
14262 pub fn set_predefined_permission_settings<
14263 T: std::convert::Into<crate::model::space::PredefinedPermissionSettings>,
14264 >(
14265 mut self,
14266 v: T,
14267 ) -> Self {
14268 self.space_permission_settings = std::option::Option::Some(
14269 crate::model::space::SpacePermissionSettings::PredefinedPermissionSettings(v.into()),
14270 );
14271 self
14272 }
14273
14274 /// The value of [space_permission_settings][crate::model::Space::space_permission_settings]
14275 /// if it holds a `PermissionSettings`, `None` if the field is not set or
14276 /// holds a different branch.
14277 pub fn permission_settings(
14278 &self,
14279 ) -> std::option::Option<&std::boxed::Box<crate::model::space::PermissionSettings>> {
14280 #[allow(unreachable_patterns)]
14281 self.space_permission_settings
14282 .as_ref()
14283 .and_then(|v| match v {
14284 crate::model::space::SpacePermissionSettings::PermissionSettings(v) => {
14285 std::option::Option::Some(v)
14286 }
14287 _ => std::option::Option::None,
14288 })
14289 }
14290
14291 /// Sets the value of [space_permission_settings][crate::model::Space::space_permission_settings]
14292 /// to hold a `PermissionSettings`.
14293 ///
14294 /// Note that all the setters affecting `space_permission_settings` are
14295 /// mutually exclusive.
14296 ///
14297 /// # Example
14298 /// ```ignore,no_run
14299 /// # use google_chat_v1::model::Space;
14300 /// use google_chat_v1::model::space::PermissionSettings;
14301 /// let x = Space::new().set_permission_settings(PermissionSettings::default()/* use setters */);
14302 /// assert!(x.permission_settings().is_some());
14303 /// assert!(x.predefined_permission_settings().is_none());
14304 /// ```
14305 pub fn set_permission_settings<
14306 T: std::convert::Into<std::boxed::Box<crate::model::space::PermissionSettings>>,
14307 >(
14308 mut self,
14309 v: T,
14310 ) -> Self {
14311 self.space_permission_settings = std::option::Option::Some(
14312 crate::model::space::SpacePermissionSettings::PermissionSettings(v.into()),
14313 );
14314 self
14315 }
14316}
14317
14318impl wkt::message::Message for Space {
14319 fn typename() -> &'static str {
14320 "type.googleapis.com/google.chat.v1.Space"
14321 }
14322}
14323
14324/// Defines additional types related to [Space].
14325pub mod space {
14326 #[allow(unused_imports)]
14327 use super::*;
14328
14329 /// Details about the space including description and rules.
14330 #[derive(Clone, Default, PartialEq)]
14331 #[non_exhaustive]
14332 pub struct SpaceDetails {
14333 /// Optional. A description of the space. For example, describe the space's
14334 /// discussion topic, functional purpose, or participants.
14335 ///
14336 /// Supports up to 150 characters.
14337 pub description: std::string::String,
14338
14339 /// Optional. The space's rules, expectations, and etiquette.
14340 ///
14341 /// Supports up to 5,000 characters.
14342 pub guidelines: std::string::String,
14343
14344 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14345 }
14346
14347 impl SpaceDetails {
14348 /// Creates a new default instance.
14349 pub fn new() -> Self {
14350 std::default::Default::default()
14351 }
14352
14353 /// Sets the value of [description][crate::model::space::SpaceDetails::description].
14354 ///
14355 /// # Example
14356 /// ```ignore,no_run
14357 /// # use google_chat_v1::model::space::SpaceDetails;
14358 /// let x = SpaceDetails::new().set_description("example");
14359 /// ```
14360 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14361 self.description = v.into();
14362 self
14363 }
14364
14365 /// Sets the value of [guidelines][crate::model::space::SpaceDetails::guidelines].
14366 ///
14367 /// # Example
14368 /// ```ignore,no_run
14369 /// # use google_chat_v1::model::space::SpaceDetails;
14370 /// let x = SpaceDetails::new().set_guidelines("example");
14371 /// ```
14372 pub fn set_guidelines<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14373 self.guidelines = v.into();
14374 self
14375 }
14376 }
14377
14378 impl wkt::message::Message for SpaceDetails {
14379 fn typename() -> &'static str {
14380 "type.googleapis.com/google.chat.v1.Space.SpaceDetails"
14381 }
14382 }
14383
14384 /// Represents the count of memberships of a space, grouped into categories.
14385 #[derive(Clone, Default, PartialEq)]
14386 #[non_exhaustive]
14387 pub struct MembershipCount {
14388 /// Output only. Count of human users that have directly joined the space,
14389 /// not counting users joined by having membership in a joined group.
14390 pub joined_direct_human_user_count: i32,
14391
14392 /// Output only. Count of all groups that have directly joined the space.
14393 pub joined_group_count: i32,
14394
14395 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14396 }
14397
14398 impl MembershipCount {
14399 /// Creates a new default instance.
14400 pub fn new() -> Self {
14401 std::default::Default::default()
14402 }
14403
14404 /// Sets the value of [joined_direct_human_user_count][crate::model::space::MembershipCount::joined_direct_human_user_count].
14405 ///
14406 /// # Example
14407 /// ```ignore,no_run
14408 /// # use google_chat_v1::model::space::MembershipCount;
14409 /// let x = MembershipCount::new().set_joined_direct_human_user_count(42);
14410 /// ```
14411 pub fn set_joined_direct_human_user_count<T: std::convert::Into<i32>>(
14412 mut self,
14413 v: T,
14414 ) -> Self {
14415 self.joined_direct_human_user_count = v.into();
14416 self
14417 }
14418
14419 /// Sets the value of [joined_group_count][crate::model::space::MembershipCount::joined_group_count].
14420 ///
14421 /// # Example
14422 /// ```ignore,no_run
14423 /// # use google_chat_v1::model::space::MembershipCount;
14424 /// let x = MembershipCount::new().set_joined_group_count(42);
14425 /// ```
14426 pub fn set_joined_group_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14427 self.joined_group_count = v.into();
14428 self
14429 }
14430 }
14431
14432 impl wkt::message::Message for MembershipCount {
14433 fn typename() -> &'static str {
14434 "type.googleapis.com/google.chat.v1.Space.MembershipCount"
14435 }
14436 }
14437
14438 /// Represents the [access
14439 /// setting](https://support.google.com/chat/answer/11971020) of the space.
14440 #[derive(Clone, Default, PartialEq)]
14441 #[non_exhaustive]
14442 pub struct AccessSettings {
14443 /// Output only. Indicates the access state of the space.
14444 pub access_state: crate::model::space::access_settings::AccessState,
14445
14446 /// Optional. The resource name of the [target
14447 /// audience](https://support.google.com/a/answer/9934697) who can discover
14448 /// the space, join the space, and preview the messages in the space. If
14449 /// unset, only users or Google Groups who have been individually invited or
14450 /// added to the space can access it. For details, see [Make a space
14451 /// discoverable to a target
14452 /// audience](https://developers.google.com/workspace/chat/space-target-audience).
14453 ///
14454 /// Format: `audiences/{audience}`
14455 ///
14456 /// To use the default target audience for the Google Workspace organization,
14457 /// set to `audiences/default`.
14458 ///
14459 /// Reading the target audience supports:
14460 ///
14461 /// - [User
14462 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
14463 ///
14464 /// - [App
14465 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
14466 /// with [administrator
14467 /// approval](https://support.google.com/a?p=chat-app-auth)
14468 /// with the `chat.app.spaces` scope.
14469 ///
14470 ///
14471 /// This field is not populated when using the `chat.bot` scope with [app
14472 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).
14473 ///
14474 /// Setting the target audience requires [user
14475 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
14476 pub audience: std::string::String,
14477
14478 /// Optional. Access permission settings for the space.
14479 ///
14480 /// To set the target audience when creating a space, specify the
14481 /// `accessSettings.audience` field in your request.
14482 pub access_permission_settings:
14483 std::option::Option<crate::model::space::AccessPermissionSettings>,
14484
14485 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14486 }
14487
14488 impl AccessSettings {
14489 /// Creates a new default instance.
14490 pub fn new() -> Self {
14491 std::default::Default::default()
14492 }
14493
14494 /// Sets the value of [access_state][crate::model::space::AccessSettings::access_state].
14495 ///
14496 /// # Example
14497 /// ```ignore,no_run
14498 /// # use google_chat_v1::model::space::AccessSettings;
14499 /// use google_chat_v1::model::space::access_settings::AccessState;
14500 /// let x0 = AccessSettings::new().set_access_state(AccessState::Private);
14501 /// let x1 = AccessSettings::new().set_access_state(AccessState::Discoverable);
14502 /// ```
14503 pub fn set_access_state<
14504 T: std::convert::Into<crate::model::space::access_settings::AccessState>,
14505 >(
14506 mut self,
14507 v: T,
14508 ) -> Self {
14509 self.access_state = v.into();
14510 self
14511 }
14512
14513 /// Sets the value of [audience][crate::model::space::AccessSettings::audience].
14514 ///
14515 /// # Example
14516 /// ```ignore,no_run
14517 /// # use google_chat_v1::model::space::AccessSettings;
14518 /// let x = AccessSettings::new().set_audience("example");
14519 /// ```
14520 pub fn set_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14521 self.audience = v.into();
14522 self
14523 }
14524
14525 /// Sets the value of [access_permission_settings][crate::model::space::AccessSettings::access_permission_settings].
14526 ///
14527 /// # Example
14528 /// ```ignore,no_run
14529 /// # use google_chat_v1::model::space::AccessSettings;
14530 /// use google_chat_v1::model::space::AccessPermissionSettings;
14531 /// let x = AccessSettings::new().set_access_permission_settings(AccessPermissionSettings::default()/* use setters */);
14532 /// ```
14533 pub fn set_access_permission_settings<T>(mut self, v: T) -> Self
14534 where
14535 T: std::convert::Into<crate::model::space::AccessPermissionSettings>,
14536 {
14537 self.access_permission_settings = std::option::Option::Some(v.into());
14538 self
14539 }
14540
14541 /// Sets or clears the value of [access_permission_settings][crate::model::space::AccessSettings::access_permission_settings].
14542 ///
14543 /// # Example
14544 /// ```ignore,no_run
14545 /// # use google_chat_v1::model::space::AccessSettings;
14546 /// use google_chat_v1::model::space::AccessPermissionSettings;
14547 /// let x = AccessSettings::new().set_or_clear_access_permission_settings(Some(AccessPermissionSettings::default()/* use setters */));
14548 /// let x = AccessSettings::new().set_or_clear_access_permission_settings(None::<AccessPermissionSettings>);
14549 /// ```
14550 pub fn set_or_clear_access_permission_settings<T>(
14551 mut self,
14552 v: std::option::Option<T>,
14553 ) -> Self
14554 where
14555 T: std::convert::Into<crate::model::space::AccessPermissionSettings>,
14556 {
14557 self.access_permission_settings = v.map(|x| x.into());
14558 self
14559 }
14560 }
14561
14562 impl wkt::message::Message for AccessSettings {
14563 fn typename() -> &'static str {
14564 "type.googleapis.com/google.chat.v1.Space.AccessSettings"
14565 }
14566 }
14567
14568 /// Defines additional types related to [AccessSettings].
14569 pub mod access_settings {
14570 #[allow(unused_imports)]
14571 use super::*;
14572
14573 /// Represents the access state of the space.
14574 ///
14575 /// # Working with unknown values
14576 ///
14577 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14578 /// additional enum variants at any time. Adding new variants is not considered
14579 /// a breaking change. Applications should write their code in anticipation of:
14580 ///
14581 /// - New values appearing in future releases of the client library, **and**
14582 /// - New values received dynamically, without application changes.
14583 ///
14584 /// Please consult the [Working with enums] section in the user guide for some
14585 /// guidelines.
14586 ///
14587 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14588 #[derive(Clone, Debug, PartialEq)]
14589 #[non_exhaustive]
14590 pub enum AccessState {
14591 /// Access state is unknown or not supported in this API.
14592 Unspecified,
14593 /// Only users or Google Groups that have been individually added or
14594 /// invited by other users or Google Workspace administrators can discover
14595 /// and access the space.
14596 Private,
14597 /// A space manager has granted a target audience access to
14598 /// the space. Users or Google Groups that have been individually added or
14599 /// invited to the space can also discover and access the space. To learn
14600 /// more, see [Make a space discoverable to specific
14601 /// users](https://developers.google.com/workspace/chat/space-target-audience).
14602 ///
14603 /// Creating discoverable spaces requires [user
14604 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
14605 Discoverable,
14606 /// If set, the enum was initialized with an unknown value.
14607 ///
14608 /// Applications can examine the value using [AccessState::value] or
14609 /// [AccessState::name].
14610 UnknownValue(access_state::UnknownValue),
14611 }
14612
14613 #[doc(hidden)]
14614 pub mod access_state {
14615 #[allow(unused_imports)]
14616 use super::*;
14617 #[derive(Clone, Debug, PartialEq)]
14618 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14619 }
14620
14621 impl AccessState {
14622 /// Gets the enum value.
14623 ///
14624 /// Returns `None` if the enum contains an unknown value deserialized from
14625 /// the string representation of enums.
14626 pub fn value(&self) -> std::option::Option<i32> {
14627 match self {
14628 Self::Unspecified => std::option::Option::Some(0),
14629 Self::Private => std::option::Option::Some(1),
14630 Self::Discoverable => std::option::Option::Some(2),
14631 Self::UnknownValue(u) => u.0.value(),
14632 }
14633 }
14634
14635 /// Gets the enum value as a string.
14636 ///
14637 /// Returns `None` if the enum contains an unknown value deserialized from
14638 /// the integer representation of enums.
14639 pub fn name(&self) -> std::option::Option<&str> {
14640 match self {
14641 Self::Unspecified => std::option::Option::Some("ACCESS_STATE_UNSPECIFIED"),
14642 Self::Private => std::option::Option::Some("PRIVATE"),
14643 Self::Discoverable => std::option::Option::Some("DISCOVERABLE"),
14644 Self::UnknownValue(u) => u.0.name(),
14645 }
14646 }
14647 }
14648
14649 impl std::default::Default for AccessState {
14650 fn default() -> Self {
14651 use std::convert::From;
14652 Self::from(0)
14653 }
14654 }
14655
14656 impl std::fmt::Display for AccessState {
14657 fn fmt(
14658 &self,
14659 f: &mut std::fmt::Formatter<'_>,
14660 ) -> std::result::Result<(), std::fmt::Error> {
14661 wkt::internal::display_enum(f, self.name(), self.value())
14662 }
14663 }
14664
14665 impl std::convert::From<i32> for AccessState {
14666 fn from(value: i32) -> Self {
14667 match value {
14668 0 => Self::Unspecified,
14669 1 => Self::Private,
14670 2 => Self::Discoverable,
14671 _ => Self::UnknownValue(access_state::UnknownValue(
14672 wkt::internal::UnknownEnumValue::Integer(value),
14673 )),
14674 }
14675 }
14676 }
14677
14678 impl std::convert::From<&str> for AccessState {
14679 fn from(value: &str) -> Self {
14680 use std::string::ToString;
14681 match value {
14682 "ACCESS_STATE_UNSPECIFIED" => Self::Unspecified,
14683 "PRIVATE" => Self::Private,
14684 "DISCOVERABLE" => Self::Discoverable,
14685 _ => Self::UnknownValue(access_state::UnknownValue(
14686 wkt::internal::UnknownEnumValue::String(value.to_string()),
14687 )),
14688 }
14689 }
14690 }
14691
14692 impl serde::ser::Serialize for AccessState {
14693 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14694 where
14695 S: serde::Serializer,
14696 {
14697 match self {
14698 Self::Unspecified => serializer.serialize_i32(0),
14699 Self::Private => serializer.serialize_i32(1),
14700 Self::Discoverable => serializer.serialize_i32(2),
14701 Self::UnknownValue(u) => u.0.serialize(serializer),
14702 }
14703 }
14704 }
14705
14706 impl<'de> serde::de::Deserialize<'de> for AccessState {
14707 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14708 where
14709 D: serde::Deserializer<'de>,
14710 {
14711 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AccessState>::new(
14712 ".google.chat.v1.Space.AccessSettings.AccessState",
14713 ))
14714 }
14715 }
14716 }
14717
14718 /// Access permission settings for a space.
14719 #[derive(Clone, Default, PartialEq)]
14720 #[non_exhaustive]
14721 pub struct AccessPermissionSettings {
14722 /// Optional. Access permission setting for discovering the space.
14723 pub discover_space_setting:
14724 std::option::Option<crate::model::space::AccessPermissionSetting>,
14725
14726 /// Optional. Access permission setting for joining the space.
14727 pub join_space_setting: std::option::Option<crate::model::space::AccessPermissionSetting>,
14728
14729 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14730 }
14731
14732 impl AccessPermissionSettings {
14733 /// Creates a new default instance.
14734 pub fn new() -> Self {
14735 std::default::Default::default()
14736 }
14737
14738 /// Sets the value of [discover_space_setting][crate::model::space::AccessPermissionSettings::discover_space_setting].
14739 ///
14740 /// # Example
14741 /// ```ignore,no_run
14742 /// # use google_chat_v1::model::space::AccessPermissionSettings;
14743 /// use google_chat_v1::model::space::AccessPermissionSetting;
14744 /// let x = AccessPermissionSettings::new().set_discover_space_setting(AccessPermissionSetting::default()/* use setters */);
14745 /// ```
14746 pub fn set_discover_space_setting<T>(mut self, v: T) -> Self
14747 where
14748 T: std::convert::Into<crate::model::space::AccessPermissionSetting>,
14749 {
14750 self.discover_space_setting = std::option::Option::Some(v.into());
14751 self
14752 }
14753
14754 /// Sets or clears the value of [discover_space_setting][crate::model::space::AccessPermissionSettings::discover_space_setting].
14755 ///
14756 /// # Example
14757 /// ```ignore,no_run
14758 /// # use google_chat_v1::model::space::AccessPermissionSettings;
14759 /// use google_chat_v1::model::space::AccessPermissionSetting;
14760 /// let x = AccessPermissionSettings::new().set_or_clear_discover_space_setting(Some(AccessPermissionSetting::default()/* use setters */));
14761 /// let x = AccessPermissionSettings::new().set_or_clear_discover_space_setting(None::<AccessPermissionSetting>);
14762 /// ```
14763 pub fn set_or_clear_discover_space_setting<T>(mut self, v: std::option::Option<T>) -> Self
14764 where
14765 T: std::convert::Into<crate::model::space::AccessPermissionSetting>,
14766 {
14767 self.discover_space_setting = v.map(|x| x.into());
14768 self
14769 }
14770
14771 /// Sets the value of [join_space_setting][crate::model::space::AccessPermissionSettings::join_space_setting].
14772 ///
14773 /// # Example
14774 /// ```ignore,no_run
14775 /// # use google_chat_v1::model::space::AccessPermissionSettings;
14776 /// use google_chat_v1::model::space::AccessPermissionSetting;
14777 /// let x = AccessPermissionSettings::new().set_join_space_setting(AccessPermissionSetting::default()/* use setters */);
14778 /// ```
14779 pub fn set_join_space_setting<T>(mut self, v: T) -> Self
14780 where
14781 T: std::convert::Into<crate::model::space::AccessPermissionSetting>,
14782 {
14783 self.join_space_setting = std::option::Option::Some(v.into());
14784 self
14785 }
14786
14787 /// Sets or clears the value of [join_space_setting][crate::model::space::AccessPermissionSettings::join_space_setting].
14788 ///
14789 /// # Example
14790 /// ```ignore,no_run
14791 /// # use google_chat_v1::model::space::AccessPermissionSettings;
14792 /// use google_chat_v1::model::space::AccessPermissionSetting;
14793 /// let x = AccessPermissionSettings::new().set_or_clear_join_space_setting(Some(AccessPermissionSetting::default()/* use setters */));
14794 /// let x = AccessPermissionSettings::new().set_or_clear_join_space_setting(None::<AccessPermissionSetting>);
14795 /// ```
14796 pub fn set_or_clear_join_space_setting<T>(mut self, v: std::option::Option<T>) -> Self
14797 where
14798 T: std::convert::Into<crate::model::space::AccessPermissionSetting>,
14799 {
14800 self.join_space_setting = v.map(|x| x.into());
14801 self
14802 }
14803 }
14804
14805 impl wkt::message::Message for AccessPermissionSettings {
14806 fn typename() -> &'static str {
14807 "type.googleapis.com/google.chat.v1.Space.AccessPermissionSettings"
14808 }
14809 }
14810
14811 /// An access permission setting.
14812 #[derive(Clone, Default, PartialEq)]
14813 #[non_exhaustive]
14814 pub struct AccessPermissionSetting {
14815 /// Optional. Unordered list. Allowed principals for this permission.
14816 pub principals: std::vec::Vec<crate::model::space::Principal>,
14817
14818 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14819 }
14820
14821 impl AccessPermissionSetting {
14822 /// Creates a new default instance.
14823 pub fn new() -> Self {
14824 std::default::Default::default()
14825 }
14826
14827 /// Sets the value of [principals][crate::model::space::AccessPermissionSetting::principals].
14828 ///
14829 /// # Example
14830 /// ```ignore,no_run
14831 /// # use google_chat_v1::model::space::AccessPermissionSetting;
14832 /// use google_chat_v1::model::space::Principal;
14833 /// let x = AccessPermissionSetting::new()
14834 /// .set_principals([
14835 /// Principal::default()/* use setters */,
14836 /// Principal::default()/* use (different) setters */,
14837 /// ]);
14838 /// ```
14839 pub fn set_principals<T, V>(mut self, v: T) -> Self
14840 where
14841 T: std::iter::IntoIterator<Item = V>,
14842 V: std::convert::Into<crate::model::space::Principal>,
14843 {
14844 use std::iter::Iterator;
14845 self.principals = v.into_iter().map(|i| i.into()).collect();
14846 self
14847 }
14848 }
14849
14850 impl wkt::message::Message for AccessPermissionSetting {
14851 fn typename() -> &'static str {
14852 "type.googleapis.com/google.chat.v1.Space.AccessPermissionSetting"
14853 }
14854 }
14855
14856 /// A principal representing an entity granted access.
14857 #[derive(Clone, Default, PartialEq)]
14858 #[non_exhaustive]
14859 pub struct Principal {
14860 /// The type of principal.
14861 pub principal_type: std::option::Option<crate::model::space::principal::PrincipalType>,
14862
14863 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14864 }
14865
14866 impl Principal {
14867 /// Creates a new default instance.
14868 pub fn new() -> Self {
14869 std::default::Default::default()
14870 }
14871
14872 /// Sets the value of [principal_type][crate::model::space::Principal::principal_type].
14873 ///
14874 /// Note that all the setters affecting `principal_type` are mutually
14875 /// exclusive.
14876 ///
14877 /// # Example
14878 /// ```ignore,no_run
14879 /// # use google_chat_v1::model::space::Principal;
14880 /// use google_chat_v1::model::Audience;
14881 /// let x = Principal::new().set_principal_type(Some(
14882 /// google_chat_v1::model::space::principal::PrincipalType::Audience(Audience::default().into())));
14883 /// ```
14884 pub fn set_principal_type<
14885 T: std::convert::Into<std::option::Option<crate::model::space::principal::PrincipalType>>,
14886 >(
14887 mut self,
14888 v: T,
14889 ) -> Self {
14890 self.principal_type = v.into();
14891 self
14892 }
14893
14894 /// The value of [principal_type][crate::model::space::Principal::principal_type]
14895 /// if it holds a `Audience`, `None` if the field is not set or
14896 /// holds a different branch.
14897 pub fn audience(&self) -> std::option::Option<&std::boxed::Box<crate::model::Audience>> {
14898 #[allow(unreachable_patterns)]
14899 self.principal_type.as_ref().and_then(|v| match v {
14900 crate::model::space::principal::PrincipalType::Audience(v) => {
14901 std::option::Option::Some(v)
14902 }
14903 _ => std::option::Option::None,
14904 })
14905 }
14906
14907 /// Sets the value of [principal_type][crate::model::space::Principal::principal_type]
14908 /// to hold a `Audience`.
14909 ///
14910 /// Note that all the setters affecting `principal_type` are
14911 /// mutually exclusive.
14912 ///
14913 /// # Example
14914 /// ```ignore,no_run
14915 /// # use google_chat_v1::model::space::Principal;
14916 /// use google_chat_v1::model::Audience;
14917 /// let x = Principal::new().set_audience(Audience::default()/* use setters */);
14918 /// assert!(x.audience().is_some());
14919 /// ```
14920 pub fn set_audience<T: std::convert::Into<std::boxed::Box<crate::model::Audience>>>(
14921 mut self,
14922 v: T,
14923 ) -> Self {
14924 self.principal_type = std::option::Option::Some(
14925 crate::model::space::principal::PrincipalType::Audience(v.into()),
14926 );
14927 self
14928 }
14929 }
14930
14931 impl wkt::message::Message for Principal {
14932 fn typename() -> &'static str {
14933 "type.googleapis.com/google.chat.v1.Space.Principal"
14934 }
14935 }
14936
14937 /// Defines additional types related to [Principal].
14938 pub mod principal {
14939 #[allow(unused_imports)]
14940 use super::*;
14941
14942 /// The type of principal.
14943 #[derive(Clone, Debug, PartialEq)]
14944 #[non_exhaustive]
14945 pub enum PrincipalType {
14946 /// An audience.
14947 Audience(std::boxed::Box<crate::model::Audience>),
14948 }
14949 }
14950
14951 /// [Permission settings](https://support.google.com/chat/answer/13340792)
14952 /// that you can specify when updating an existing named space.
14953 ///
14954 /// To set permission settings when creating a space, specify the
14955 /// `PredefinedPermissionSettings` field in your request.
14956 #[derive(Clone, Default, PartialEq)]
14957 #[non_exhaustive]
14958 pub struct PermissionSettings {
14959 /// Optional. Setting for managing members and groups in a space.
14960 pub manage_members_and_groups: std::option::Option<crate::model::space::PermissionSetting>,
14961
14962 /// Optional. Setting for updating space name, avatar, description and
14963 /// guidelines.
14964 pub modify_space_details: std::option::Option<crate::model::space::PermissionSetting>,
14965
14966 /// Optional. Setting for toggling space history on and off.
14967 pub toggle_history: std::option::Option<crate::model::space::PermissionSetting>,
14968
14969 /// Optional. Setting for using @all in a space.
14970 pub use_at_mention_all: std::option::Option<crate::model::space::PermissionSetting>,
14971
14972 /// Optional. Setting for managing apps in a space.
14973 pub manage_apps: std::option::Option<crate::model::space::PermissionSetting>,
14974
14975 /// Optional. Setting for managing webhooks in a space.
14976 pub manage_webhooks: std::option::Option<crate::model::space::PermissionSetting>,
14977
14978 /// Output only. Setting for posting messages in a space.
14979 pub post_messages: std::option::Option<crate::model::space::PermissionSetting>,
14980
14981 /// Optional. Setting for replying to messages in a space.
14982 pub reply_messages: std::option::Option<crate::model::space::PermissionSetting>,
14983
14984 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14985 }
14986
14987 impl PermissionSettings {
14988 /// Creates a new default instance.
14989 pub fn new() -> Self {
14990 std::default::Default::default()
14991 }
14992
14993 /// Sets the value of [manage_members_and_groups][crate::model::space::PermissionSettings::manage_members_and_groups].
14994 ///
14995 /// # Example
14996 /// ```ignore,no_run
14997 /// # use google_chat_v1::model::space::PermissionSettings;
14998 /// use google_chat_v1::model::space::PermissionSetting;
14999 /// let x = PermissionSettings::new().set_manage_members_and_groups(PermissionSetting::default()/* use setters */);
15000 /// ```
15001 pub fn set_manage_members_and_groups<T>(mut self, v: T) -> Self
15002 where
15003 T: std::convert::Into<crate::model::space::PermissionSetting>,
15004 {
15005 self.manage_members_and_groups = std::option::Option::Some(v.into());
15006 self
15007 }
15008
15009 /// Sets or clears the value of [manage_members_and_groups][crate::model::space::PermissionSettings::manage_members_and_groups].
15010 ///
15011 /// # Example
15012 /// ```ignore,no_run
15013 /// # use google_chat_v1::model::space::PermissionSettings;
15014 /// use google_chat_v1::model::space::PermissionSetting;
15015 /// let x = PermissionSettings::new().set_or_clear_manage_members_and_groups(Some(PermissionSetting::default()/* use setters */));
15016 /// let x = PermissionSettings::new().set_or_clear_manage_members_and_groups(None::<PermissionSetting>);
15017 /// ```
15018 pub fn set_or_clear_manage_members_and_groups<T>(
15019 mut self,
15020 v: std::option::Option<T>,
15021 ) -> Self
15022 where
15023 T: std::convert::Into<crate::model::space::PermissionSetting>,
15024 {
15025 self.manage_members_and_groups = v.map(|x| x.into());
15026 self
15027 }
15028
15029 /// Sets the value of [modify_space_details][crate::model::space::PermissionSettings::modify_space_details].
15030 ///
15031 /// # Example
15032 /// ```ignore,no_run
15033 /// # use google_chat_v1::model::space::PermissionSettings;
15034 /// use google_chat_v1::model::space::PermissionSetting;
15035 /// let x = PermissionSettings::new().set_modify_space_details(PermissionSetting::default()/* use setters */);
15036 /// ```
15037 pub fn set_modify_space_details<T>(mut self, v: T) -> Self
15038 where
15039 T: std::convert::Into<crate::model::space::PermissionSetting>,
15040 {
15041 self.modify_space_details = std::option::Option::Some(v.into());
15042 self
15043 }
15044
15045 /// Sets or clears the value of [modify_space_details][crate::model::space::PermissionSettings::modify_space_details].
15046 ///
15047 /// # Example
15048 /// ```ignore,no_run
15049 /// # use google_chat_v1::model::space::PermissionSettings;
15050 /// use google_chat_v1::model::space::PermissionSetting;
15051 /// let x = PermissionSettings::new().set_or_clear_modify_space_details(Some(PermissionSetting::default()/* use setters */));
15052 /// let x = PermissionSettings::new().set_or_clear_modify_space_details(None::<PermissionSetting>);
15053 /// ```
15054 pub fn set_or_clear_modify_space_details<T>(mut self, v: std::option::Option<T>) -> Self
15055 where
15056 T: std::convert::Into<crate::model::space::PermissionSetting>,
15057 {
15058 self.modify_space_details = v.map(|x| x.into());
15059 self
15060 }
15061
15062 /// Sets the value of [toggle_history][crate::model::space::PermissionSettings::toggle_history].
15063 ///
15064 /// # Example
15065 /// ```ignore,no_run
15066 /// # use google_chat_v1::model::space::PermissionSettings;
15067 /// use google_chat_v1::model::space::PermissionSetting;
15068 /// let x = PermissionSettings::new().set_toggle_history(PermissionSetting::default()/* use setters */);
15069 /// ```
15070 pub fn set_toggle_history<T>(mut self, v: T) -> Self
15071 where
15072 T: std::convert::Into<crate::model::space::PermissionSetting>,
15073 {
15074 self.toggle_history = std::option::Option::Some(v.into());
15075 self
15076 }
15077
15078 /// Sets or clears the value of [toggle_history][crate::model::space::PermissionSettings::toggle_history].
15079 ///
15080 /// # Example
15081 /// ```ignore,no_run
15082 /// # use google_chat_v1::model::space::PermissionSettings;
15083 /// use google_chat_v1::model::space::PermissionSetting;
15084 /// let x = PermissionSettings::new().set_or_clear_toggle_history(Some(PermissionSetting::default()/* use setters */));
15085 /// let x = PermissionSettings::new().set_or_clear_toggle_history(None::<PermissionSetting>);
15086 /// ```
15087 pub fn set_or_clear_toggle_history<T>(mut self, v: std::option::Option<T>) -> Self
15088 where
15089 T: std::convert::Into<crate::model::space::PermissionSetting>,
15090 {
15091 self.toggle_history = v.map(|x| x.into());
15092 self
15093 }
15094
15095 /// Sets the value of [use_at_mention_all][crate::model::space::PermissionSettings::use_at_mention_all].
15096 ///
15097 /// # Example
15098 /// ```ignore,no_run
15099 /// # use google_chat_v1::model::space::PermissionSettings;
15100 /// use google_chat_v1::model::space::PermissionSetting;
15101 /// let x = PermissionSettings::new().set_use_at_mention_all(PermissionSetting::default()/* use setters */);
15102 /// ```
15103 pub fn set_use_at_mention_all<T>(mut self, v: T) -> Self
15104 where
15105 T: std::convert::Into<crate::model::space::PermissionSetting>,
15106 {
15107 self.use_at_mention_all = std::option::Option::Some(v.into());
15108 self
15109 }
15110
15111 /// Sets or clears the value of [use_at_mention_all][crate::model::space::PermissionSettings::use_at_mention_all].
15112 ///
15113 /// # Example
15114 /// ```ignore,no_run
15115 /// # use google_chat_v1::model::space::PermissionSettings;
15116 /// use google_chat_v1::model::space::PermissionSetting;
15117 /// let x = PermissionSettings::new().set_or_clear_use_at_mention_all(Some(PermissionSetting::default()/* use setters */));
15118 /// let x = PermissionSettings::new().set_or_clear_use_at_mention_all(None::<PermissionSetting>);
15119 /// ```
15120 pub fn set_or_clear_use_at_mention_all<T>(mut self, v: std::option::Option<T>) -> Self
15121 where
15122 T: std::convert::Into<crate::model::space::PermissionSetting>,
15123 {
15124 self.use_at_mention_all = v.map(|x| x.into());
15125 self
15126 }
15127
15128 /// Sets the value of [manage_apps][crate::model::space::PermissionSettings::manage_apps].
15129 ///
15130 /// # Example
15131 /// ```ignore,no_run
15132 /// # use google_chat_v1::model::space::PermissionSettings;
15133 /// use google_chat_v1::model::space::PermissionSetting;
15134 /// let x = PermissionSettings::new().set_manage_apps(PermissionSetting::default()/* use setters */);
15135 /// ```
15136 pub fn set_manage_apps<T>(mut self, v: T) -> Self
15137 where
15138 T: std::convert::Into<crate::model::space::PermissionSetting>,
15139 {
15140 self.manage_apps = std::option::Option::Some(v.into());
15141 self
15142 }
15143
15144 /// Sets or clears the value of [manage_apps][crate::model::space::PermissionSettings::manage_apps].
15145 ///
15146 /// # Example
15147 /// ```ignore,no_run
15148 /// # use google_chat_v1::model::space::PermissionSettings;
15149 /// use google_chat_v1::model::space::PermissionSetting;
15150 /// let x = PermissionSettings::new().set_or_clear_manage_apps(Some(PermissionSetting::default()/* use setters */));
15151 /// let x = PermissionSettings::new().set_or_clear_manage_apps(None::<PermissionSetting>);
15152 /// ```
15153 pub fn set_or_clear_manage_apps<T>(mut self, v: std::option::Option<T>) -> Self
15154 where
15155 T: std::convert::Into<crate::model::space::PermissionSetting>,
15156 {
15157 self.manage_apps = v.map(|x| x.into());
15158 self
15159 }
15160
15161 /// Sets the value of [manage_webhooks][crate::model::space::PermissionSettings::manage_webhooks].
15162 ///
15163 /// # Example
15164 /// ```ignore,no_run
15165 /// # use google_chat_v1::model::space::PermissionSettings;
15166 /// use google_chat_v1::model::space::PermissionSetting;
15167 /// let x = PermissionSettings::new().set_manage_webhooks(PermissionSetting::default()/* use setters */);
15168 /// ```
15169 pub fn set_manage_webhooks<T>(mut self, v: T) -> Self
15170 where
15171 T: std::convert::Into<crate::model::space::PermissionSetting>,
15172 {
15173 self.manage_webhooks = std::option::Option::Some(v.into());
15174 self
15175 }
15176
15177 /// Sets or clears the value of [manage_webhooks][crate::model::space::PermissionSettings::manage_webhooks].
15178 ///
15179 /// # Example
15180 /// ```ignore,no_run
15181 /// # use google_chat_v1::model::space::PermissionSettings;
15182 /// use google_chat_v1::model::space::PermissionSetting;
15183 /// let x = PermissionSettings::new().set_or_clear_manage_webhooks(Some(PermissionSetting::default()/* use setters */));
15184 /// let x = PermissionSettings::new().set_or_clear_manage_webhooks(None::<PermissionSetting>);
15185 /// ```
15186 pub fn set_or_clear_manage_webhooks<T>(mut self, v: std::option::Option<T>) -> Self
15187 where
15188 T: std::convert::Into<crate::model::space::PermissionSetting>,
15189 {
15190 self.manage_webhooks = v.map(|x| x.into());
15191 self
15192 }
15193
15194 /// Sets the value of [post_messages][crate::model::space::PermissionSettings::post_messages].
15195 ///
15196 /// # Example
15197 /// ```ignore,no_run
15198 /// # use google_chat_v1::model::space::PermissionSettings;
15199 /// use google_chat_v1::model::space::PermissionSetting;
15200 /// let x = PermissionSettings::new().set_post_messages(PermissionSetting::default()/* use setters */);
15201 /// ```
15202 pub fn set_post_messages<T>(mut self, v: T) -> Self
15203 where
15204 T: std::convert::Into<crate::model::space::PermissionSetting>,
15205 {
15206 self.post_messages = std::option::Option::Some(v.into());
15207 self
15208 }
15209
15210 /// Sets or clears the value of [post_messages][crate::model::space::PermissionSettings::post_messages].
15211 ///
15212 /// # Example
15213 /// ```ignore,no_run
15214 /// # use google_chat_v1::model::space::PermissionSettings;
15215 /// use google_chat_v1::model::space::PermissionSetting;
15216 /// let x = PermissionSettings::new().set_or_clear_post_messages(Some(PermissionSetting::default()/* use setters */));
15217 /// let x = PermissionSettings::new().set_or_clear_post_messages(None::<PermissionSetting>);
15218 /// ```
15219 pub fn set_or_clear_post_messages<T>(mut self, v: std::option::Option<T>) -> Self
15220 where
15221 T: std::convert::Into<crate::model::space::PermissionSetting>,
15222 {
15223 self.post_messages = v.map(|x| x.into());
15224 self
15225 }
15226
15227 /// Sets the value of [reply_messages][crate::model::space::PermissionSettings::reply_messages].
15228 ///
15229 /// # Example
15230 /// ```ignore,no_run
15231 /// # use google_chat_v1::model::space::PermissionSettings;
15232 /// use google_chat_v1::model::space::PermissionSetting;
15233 /// let x = PermissionSettings::new().set_reply_messages(PermissionSetting::default()/* use setters */);
15234 /// ```
15235 pub fn set_reply_messages<T>(mut self, v: T) -> Self
15236 where
15237 T: std::convert::Into<crate::model::space::PermissionSetting>,
15238 {
15239 self.reply_messages = std::option::Option::Some(v.into());
15240 self
15241 }
15242
15243 /// Sets or clears the value of [reply_messages][crate::model::space::PermissionSettings::reply_messages].
15244 ///
15245 /// # Example
15246 /// ```ignore,no_run
15247 /// # use google_chat_v1::model::space::PermissionSettings;
15248 /// use google_chat_v1::model::space::PermissionSetting;
15249 /// let x = PermissionSettings::new().set_or_clear_reply_messages(Some(PermissionSetting::default()/* use setters */));
15250 /// let x = PermissionSettings::new().set_or_clear_reply_messages(None::<PermissionSetting>);
15251 /// ```
15252 pub fn set_or_clear_reply_messages<T>(mut self, v: std::option::Option<T>) -> Self
15253 where
15254 T: std::convert::Into<crate::model::space::PermissionSetting>,
15255 {
15256 self.reply_messages = v.map(|x| x.into());
15257 self
15258 }
15259 }
15260
15261 impl wkt::message::Message for PermissionSettings {
15262 fn typename() -> &'static str {
15263 "type.googleapis.com/google.chat.v1.Space.PermissionSettings"
15264 }
15265 }
15266
15267 /// Represents a space permission setting.
15268 #[derive(Clone, Default, PartialEq)]
15269 #[non_exhaustive]
15270 pub struct PermissionSetting {
15271 /// Optional. Whether space owners
15272 /// ([`ROLE_MANAGER`][google.chat.v1.Membership.MembershipRole.ROLE_MANAGER])
15273 /// have this permission.
15274 ///
15275 /// [google.chat.v1.Membership.MembershipRole.ROLE_MANAGER]: crate::model::membership::MembershipRole::RoleManager
15276 pub managers_allowed: bool,
15277
15278 /// Optional. Whether space managers
15279 /// [`ROLE_ASSISTANT_MANAGER`][google.chat.v1.Membership.MembershipRole.ROLE_ASSISTANT_MANAGER])
15280 /// have this permission.
15281 ///
15282 /// [google.chat.v1.Membership.MembershipRole.ROLE_ASSISTANT_MANAGER]: crate::model::membership::MembershipRole::RoleAssistantManager
15283 pub assistant_managers_allowed: std::option::Option<bool>,
15284
15285 /// Optional. Whether basic space members
15286 /// ([`ROLE_MEMBER`][google.chat.v1.Membership.MembershipRole.ROLE_MEMBER])
15287 /// have this permission.
15288 ///
15289 /// [google.chat.v1.Membership.MembershipRole.ROLE_MEMBER]: crate::model::membership::MembershipRole::RoleMember
15290 pub members_allowed: bool,
15291
15292 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15293 }
15294
15295 impl PermissionSetting {
15296 /// Creates a new default instance.
15297 pub fn new() -> Self {
15298 std::default::Default::default()
15299 }
15300
15301 /// Sets the value of [managers_allowed][crate::model::space::PermissionSetting::managers_allowed].
15302 ///
15303 /// # Example
15304 /// ```ignore,no_run
15305 /// # use google_chat_v1::model::space::PermissionSetting;
15306 /// let x = PermissionSetting::new().set_managers_allowed(true);
15307 /// ```
15308 pub fn set_managers_allowed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15309 self.managers_allowed = v.into();
15310 self
15311 }
15312
15313 /// Sets the value of [assistant_managers_allowed][crate::model::space::PermissionSetting::assistant_managers_allowed].
15314 ///
15315 /// # Example
15316 /// ```ignore,no_run
15317 /// # use google_chat_v1::model::space::PermissionSetting;
15318 /// let x = PermissionSetting::new().set_assistant_managers_allowed(true);
15319 /// ```
15320 pub fn set_assistant_managers_allowed<T>(mut self, v: T) -> Self
15321 where
15322 T: std::convert::Into<bool>,
15323 {
15324 self.assistant_managers_allowed = std::option::Option::Some(v.into());
15325 self
15326 }
15327
15328 /// Sets or clears the value of [assistant_managers_allowed][crate::model::space::PermissionSetting::assistant_managers_allowed].
15329 ///
15330 /// # Example
15331 /// ```ignore,no_run
15332 /// # use google_chat_v1::model::space::PermissionSetting;
15333 /// let x = PermissionSetting::new().set_or_clear_assistant_managers_allowed(Some(false));
15334 /// let x = PermissionSetting::new().set_or_clear_assistant_managers_allowed(None::<bool>);
15335 /// ```
15336 pub fn set_or_clear_assistant_managers_allowed<T>(
15337 mut self,
15338 v: std::option::Option<T>,
15339 ) -> Self
15340 where
15341 T: std::convert::Into<bool>,
15342 {
15343 self.assistant_managers_allowed = v.map(|x| x.into());
15344 self
15345 }
15346
15347 /// Sets the value of [members_allowed][crate::model::space::PermissionSetting::members_allowed].
15348 ///
15349 /// # Example
15350 /// ```ignore,no_run
15351 /// # use google_chat_v1::model::space::PermissionSetting;
15352 /// let x = PermissionSetting::new().set_members_allowed(true);
15353 /// ```
15354 pub fn set_members_allowed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15355 self.members_allowed = v.into();
15356 self
15357 }
15358 }
15359
15360 impl wkt::message::Message for PermissionSetting {
15361 fn typename() -> &'static str {
15362 "type.googleapis.com/google.chat.v1.Space.PermissionSetting"
15363 }
15364 }
15365
15366 /// Deprecated: Use `SpaceType` instead.
15367 ///
15368 /// # Working with unknown values
15369 ///
15370 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15371 /// additional enum variants at any time. Adding new variants is not considered
15372 /// a breaking change. Applications should write their code in anticipation of:
15373 ///
15374 /// - New values appearing in future releases of the client library, **and**
15375 /// - New values received dynamically, without application changes.
15376 ///
15377 /// Please consult the [Working with enums] section in the user guide for some
15378 /// guidelines.
15379 ///
15380 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
15381 #[derive(Clone, Debug, PartialEq)]
15382 #[non_exhaustive]
15383 pub enum Type {
15384 /// Reserved.
15385 Unspecified,
15386 /// Conversations between two or more humans.
15387 Room,
15388 /// 1:1 Direct Message between a human and a Chat app, where all messages are
15389 /// flat. Note that this doesn't include direct messages between two humans.
15390 Dm,
15391 /// If set, the enum was initialized with an unknown value.
15392 ///
15393 /// Applications can examine the value using [Type::value] or
15394 /// [Type::name].
15395 UnknownValue(r#type::UnknownValue),
15396 }
15397
15398 #[doc(hidden)]
15399 pub mod r#type {
15400 #[allow(unused_imports)]
15401 use super::*;
15402 #[derive(Clone, Debug, PartialEq)]
15403 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15404 }
15405
15406 impl Type {
15407 /// Gets the enum value.
15408 ///
15409 /// Returns `None` if the enum contains an unknown value deserialized from
15410 /// the string representation of enums.
15411 pub fn value(&self) -> std::option::Option<i32> {
15412 match self {
15413 Self::Unspecified => std::option::Option::Some(0),
15414 Self::Room => std::option::Option::Some(1),
15415 Self::Dm => std::option::Option::Some(2),
15416 Self::UnknownValue(u) => u.0.value(),
15417 }
15418 }
15419
15420 /// Gets the enum value as a string.
15421 ///
15422 /// Returns `None` if the enum contains an unknown value deserialized from
15423 /// the integer representation of enums.
15424 pub fn name(&self) -> std::option::Option<&str> {
15425 match self {
15426 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
15427 Self::Room => std::option::Option::Some("ROOM"),
15428 Self::Dm => std::option::Option::Some("DM"),
15429 Self::UnknownValue(u) => u.0.name(),
15430 }
15431 }
15432 }
15433
15434 impl std::default::Default for Type {
15435 fn default() -> Self {
15436 use std::convert::From;
15437 Self::from(0)
15438 }
15439 }
15440
15441 impl std::fmt::Display for Type {
15442 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15443 wkt::internal::display_enum(f, self.name(), self.value())
15444 }
15445 }
15446
15447 impl std::convert::From<i32> for Type {
15448 fn from(value: i32) -> Self {
15449 match value {
15450 0 => Self::Unspecified,
15451 1 => Self::Room,
15452 2 => Self::Dm,
15453 _ => Self::UnknownValue(r#type::UnknownValue(
15454 wkt::internal::UnknownEnumValue::Integer(value),
15455 )),
15456 }
15457 }
15458 }
15459
15460 impl std::convert::From<&str> for Type {
15461 fn from(value: &str) -> Self {
15462 use std::string::ToString;
15463 match value {
15464 "TYPE_UNSPECIFIED" => Self::Unspecified,
15465 "ROOM" => Self::Room,
15466 "DM" => Self::Dm,
15467 _ => Self::UnknownValue(r#type::UnknownValue(
15468 wkt::internal::UnknownEnumValue::String(value.to_string()),
15469 )),
15470 }
15471 }
15472 }
15473
15474 impl serde::ser::Serialize for Type {
15475 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15476 where
15477 S: serde::Serializer,
15478 {
15479 match self {
15480 Self::Unspecified => serializer.serialize_i32(0),
15481 Self::Room => serializer.serialize_i32(1),
15482 Self::Dm => serializer.serialize_i32(2),
15483 Self::UnknownValue(u) => u.0.serialize(serializer),
15484 }
15485 }
15486 }
15487
15488 impl<'de> serde::de::Deserialize<'de> for Type {
15489 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15490 where
15491 D: serde::Deserializer<'de>,
15492 {
15493 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
15494 ".google.chat.v1.Space.Type",
15495 ))
15496 }
15497 }
15498
15499 /// The type of space. Required when creating or updating a space. Output only
15500 /// for other usage.
15501 ///
15502 /// # Working with unknown values
15503 ///
15504 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15505 /// additional enum variants at any time. Adding new variants is not considered
15506 /// a breaking change. Applications should write their code in anticipation of:
15507 ///
15508 /// - New values appearing in future releases of the client library, **and**
15509 /// - New values received dynamically, without application changes.
15510 ///
15511 /// Please consult the [Working with enums] section in the user guide for some
15512 /// guidelines.
15513 ///
15514 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
15515 #[derive(Clone, Debug, PartialEq)]
15516 #[non_exhaustive]
15517 pub enum SpaceType {
15518 /// Reserved.
15519 Unspecified,
15520 /// A place where people send messages, share files, and collaborate.
15521 /// A `SPACE` can include Chat apps.
15522 Space,
15523 /// Group conversations between 3 or more people.
15524 /// A `GROUP_CHAT` can include Chat apps.
15525 GroupChat,
15526 /// 1:1 messages between two humans or a human and a Chat app.
15527 DirectMessage,
15528 /// If set, the enum was initialized with an unknown value.
15529 ///
15530 /// Applications can examine the value using [SpaceType::value] or
15531 /// [SpaceType::name].
15532 UnknownValue(space_type::UnknownValue),
15533 }
15534
15535 #[doc(hidden)]
15536 pub mod space_type {
15537 #[allow(unused_imports)]
15538 use super::*;
15539 #[derive(Clone, Debug, PartialEq)]
15540 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15541 }
15542
15543 impl SpaceType {
15544 /// Gets the enum value.
15545 ///
15546 /// Returns `None` if the enum contains an unknown value deserialized from
15547 /// the string representation of enums.
15548 pub fn value(&self) -> std::option::Option<i32> {
15549 match self {
15550 Self::Unspecified => std::option::Option::Some(0),
15551 Self::Space => std::option::Option::Some(1),
15552 Self::GroupChat => std::option::Option::Some(2),
15553 Self::DirectMessage => std::option::Option::Some(3),
15554 Self::UnknownValue(u) => u.0.value(),
15555 }
15556 }
15557
15558 /// Gets the enum value as a string.
15559 ///
15560 /// Returns `None` if the enum contains an unknown value deserialized from
15561 /// the integer representation of enums.
15562 pub fn name(&self) -> std::option::Option<&str> {
15563 match self {
15564 Self::Unspecified => std::option::Option::Some("SPACE_TYPE_UNSPECIFIED"),
15565 Self::Space => std::option::Option::Some("SPACE"),
15566 Self::GroupChat => std::option::Option::Some("GROUP_CHAT"),
15567 Self::DirectMessage => std::option::Option::Some("DIRECT_MESSAGE"),
15568 Self::UnknownValue(u) => u.0.name(),
15569 }
15570 }
15571 }
15572
15573 impl std::default::Default for SpaceType {
15574 fn default() -> Self {
15575 use std::convert::From;
15576 Self::from(0)
15577 }
15578 }
15579
15580 impl std::fmt::Display for SpaceType {
15581 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15582 wkt::internal::display_enum(f, self.name(), self.value())
15583 }
15584 }
15585
15586 impl std::convert::From<i32> for SpaceType {
15587 fn from(value: i32) -> Self {
15588 match value {
15589 0 => Self::Unspecified,
15590 1 => Self::Space,
15591 2 => Self::GroupChat,
15592 3 => Self::DirectMessage,
15593 _ => Self::UnknownValue(space_type::UnknownValue(
15594 wkt::internal::UnknownEnumValue::Integer(value),
15595 )),
15596 }
15597 }
15598 }
15599
15600 impl std::convert::From<&str> for SpaceType {
15601 fn from(value: &str) -> Self {
15602 use std::string::ToString;
15603 match value {
15604 "SPACE_TYPE_UNSPECIFIED" => Self::Unspecified,
15605 "SPACE" => Self::Space,
15606 "GROUP_CHAT" => Self::GroupChat,
15607 "DIRECT_MESSAGE" => Self::DirectMessage,
15608 _ => Self::UnknownValue(space_type::UnknownValue(
15609 wkt::internal::UnknownEnumValue::String(value.to_string()),
15610 )),
15611 }
15612 }
15613 }
15614
15615 impl serde::ser::Serialize for SpaceType {
15616 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15617 where
15618 S: serde::Serializer,
15619 {
15620 match self {
15621 Self::Unspecified => serializer.serialize_i32(0),
15622 Self::Space => serializer.serialize_i32(1),
15623 Self::GroupChat => serializer.serialize_i32(2),
15624 Self::DirectMessage => serializer.serialize_i32(3),
15625 Self::UnknownValue(u) => u.0.serialize(serializer),
15626 }
15627 }
15628 }
15629
15630 impl<'de> serde::de::Deserialize<'de> for SpaceType {
15631 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15632 where
15633 D: serde::Deserializer<'de>,
15634 {
15635 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SpaceType>::new(
15636 ".google.chat.v1.Space.SpaceType",
15637 ))
15638 }
15639 }
15640
15641 /// Specifies the type of threading state in the Chat space.
15642 ///
15643 /// # Working with unknown values
15644 ///
15645 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15646 /// additional enum variants at any time. Adding new variants is not considered
15647 /// a breaking change. Applications should write their code in anticipation of:
15648 ///
15649 /// - New values appearing in future releases of the client library, **and**
15650 /// - New values received dynamically, without application changes.
15651 ///
15652 /// Please consult the [Working with enums] section in the user guide for some
15653 /// guidelines.
15654 ///
15655 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
15656 #[derive(Clone, Debug, PartialEq)]
15657 #[non_exhaustive]
15658 pub enum SpaceThreadingState {
15659 /// Reserved.
15660 Unspecified,
15661 /// Spaces that support message threads. When users respond to a message,
15662 /// they can reply in-thread, which keeps their response in the context of
15663 /// the original message.
15664 ThreadedMessages,
15665 /// Named spaces where the conversation is organized by topic. Topics and
15666 /// their replies are grouped together.
15667 GroupedMessages,
15668 /// Spaces that don't support message threading. This space threading state
15669 /// is only used for special cases including:
15670 ///
15671 /// * Continuous meeting chat where threading is intentionally turned off.
15672 /// * Legacy group conversations that were created prior to 2022.
15673 UnthreadedMessages,
15674 /// If set, the enum was initialized with an unknown value.
15675 ///
15676 /// Applications can examine the value using [SpaceThreadingState::value] or
15677 /// [SpaceThreadingState::name].
15678 UnknownValue(space_threading_state::UnknownValue),
15679 }
15680
15681 #[doc(hidden)]
15682 pub mod space_threading_state {
15683 #[allow(unused_imports)]
15684 use super::*;
15685 #[derive(Clone, Debug, PartialEq)]
15686 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15687 }
15688
15689 impl SpaceThreadingState {
15690 /// Gets the enum value.
15691 ///
15692 /// Returns `None` if the enum contains an unknown value deserialized from
15693 /// the string representation of enums.
15694 pub fn value(&self) -> std::option::Option<i32> {
15695 match self {
15696 Self::Unspecified => std::option::Option::Some(0),
15697 Self::ThreadedMessages => std::option::Option::Some(2),
15698 Self::GroupedMessages => std::option::Option::Some(3),
15699 Self::UnthreadedMessages => std::option::Option::Some(4),
15700 Self::UnknownValue(u) => u.0.value(),
15701 }
15702 }
15703
15704 /// Gets the enum value as a string.
15705 ///
15706 /// Returns `None` if the enum contains an unknown value deserialized from
15707 /// the integer representation of enums.
15708 pub fn name(&self) -> std::option::Option<&str> {
15709 match self {
15710 Self::Unspecified => std::option::Option::Some("SPACE_THREADING_STATE_UNSPECIFIED"),
15711 Self::ThreadedMessages => std::option::Option::Some("THREADED_MESSAGES"),
15712 Self::GroupedMessages => std::option::Option::Some("GROUPED_MESSAGES"),
15713 Self::UnthreadedMessages => std::option::Option::Some("UNTHREADED_MESSAGES"),
15714 Self::UnknownValue(u) => u.0.name(),
15715 }
15716 }
15717 }
15718
15719 impl std::default::Default for SpaceThreadingState {
15720 fn default() -> Self {
15721 use std::convert::From;
15722 Self::from(0)
15723 }
15724 }
15725
15726 impl std::fmt::Display for SpaceThreadingState {
15727 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15728 wkt::internal::display_enum(f, self.name(), self.value())
15729 }
15730 }
15731
15732 impl std::convert::From<i32> for SpaceThreadingState {
15733 fn from(value: i32) -> Self {
15734 match value {
15735 0 => Self::Unspecified,
15736 2 => Self::ThreadedMessages,
15737 3 => Self::GroupedMessages,
15738 4 => Self::UnthreadedMessages,
15739 _ => Self::UnknownValue(space_threading_state::UnknownValue(
15740 wkt::internal::UnknownEnumValue::Integer(value),
15741 )),
15742 }
15743 }
15744 }
15745
15746 impl std::convert::From<&str> for SpaceThreadingState {
15747 fn from(value: &str) -> Self {
15748 use std::string::ToString;
15749 match value {
15750 "SPACE_THREADING_STATE_UNSPECIFIED" => Self::Unspecified,
15751 "THREADED_MESSAGES" => Self::ThreadedMessages,
15752 "GROUPED_MESSAGES" => Self::GroupedMessages,
15753 "UNTHREADED_MESSAGES" => Self::UnthreadedMessages,
15754 _ => Self::UnknownValue(space_threading_state::UnknownValue(
15755 wkt::internal::UnknownEnumValue::String(value.to_string()),
15756 )),
15757 }
15758 }
15759 }
15760
15761 impl serde::ser::Serialize for SpaceThreadingState {
15762 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15763 where
15764 S: serde::Serializer,
15765 {
15766 match self {
15767 Self::Unspecified => serializer.serialize_i32(0),
15768 Self::ThreadedMessages => serializer.serialize_i32(2),
15769 Self::GroupedMessages => serializer.serialize_i32(3),
15770 Self::UnthreadedMessages => serializer.serialize_i32(4),
15771 Self::UnknownValue(u) => u.0.serialize(serializer),
15772 }
15773 }
15774 }
15775
15776 impl<'de> serde::de::Deserialize<'de> for SpaceThreadingState {
15777 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15778 where
15779 D: serde::Deserializer<'de>,
15780 {
15781 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SpaceThreadingState>::new(
15782 ".google.chat.v1.Space.SpaceThreadingState",
15783 ))
15784 }
15785 }
15786
15787 /// Predefined permission settings that you can only specify when creating a
15788 /// named space. More settings might be added in the future.
15789 /// For details about permission settings for named spaces, see [Learn about
15790 /// spaces](https://support.google.com/chat/answer/7659784).
15791 ///
15792 /// # Working with unknown values
15793 ///
15794 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15795 /// additional enum variants at any time. Adding new variants is not considered
15796 /// a breaking change. Applications should write their code in anticipation of:
15797 ///
15798 /// - New values appearing in future releases of the client library, **and**
15799 /// - New values received dynamically, without application changes.
15800 ///
15801 /// Please consult the [Working with enums] section in the user guide for some
15802 /// guidelines.
15803 ///
15804 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
15805 #[derive(Clone, Debug, PartialEq)]
15806 #[non_exhaustive]
15807 pub enum PredefinedPermissionSettings {
15808 /// Unspecified. Don't use.
15809 Unspecified,
15810 /// Setting to make the space a collaboration space where all members can
15811 /// post messages.
15812 CollaborationSpace,
15813 /// Setting to make the space an announcement space where only space managers
15814 /// can post messages.
15815 AnnouncementSpace,
15816 /// If set, the enum was initialized with an unknown value.
15817 ///
15818 /// Applications can examine the value using [PredefinedPermissionSettings::value] or
15819 /// [PredefinedPermissionSettings::name].
15820 UnknownValue(predefined_permission_settings::UnknownValue),
15821 }
15822
15823 #[doc(hidden)]
15824 pub mod predefined_permission_settings {
15825 #[allow(unused_imports)]
15826 use super::*;
15827 #[derive(Clone, Debug, PartialEq)]
15828 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15829 }
15830
15831 impl PredefinedPermissionSettings {
15832 /// Gets the enum value.
15833 ///
15834 /// Returns `None` if the enum contains an unknown value deserialized from
15835 /// the string representation of enums.
15836 pub fn value(&self) -> std::option::Option<i32> {
15837 match self {
15838 Self::Unspecified => std::option::Option::Some(0),
15839 Self::CollaborationSpace => std::option::Option::Some(1),
15840 Self::AnnouncementSpace => std::option::Option::Some(2),
15841 Self::UnknownValue(u) => u.0.value(),
15842 }
15843 }
15844
15845 /// Gets the enum value as a string.
15846 ///
15847 /// Returns `None` if the enum contains an unknown value deserialized from
15848 /// the integer representation of enums.
15849 pub fn name(&self) -> std::option::Option<&str> {
15850 match self {
15851 Self::Unspecified => {
15852 std::option::Option::Some("PREDEFINED_PERMISSION_SETTINGS_UNSPECIFIED")
15853 }
15854 Self::CollaborationSpace => std::option::Option::Some("COLLABORATION_SPACE"),
15855 Self::AnnouncementSpace => std::option::Option::Some("ANNOUNCEMENT_SPACE"),
15856 Self::UnknownValue(u) => u.0.name(),
15857 }
15858 }
15859 }
15860
15861 impl std::default::Default for PredefinedPermissionSettings {
15862 fn default() -> Self {
15863 use std::convert::From;
15864 Self::from(0)
15865 }
15866 }
15867
15868 impl std::fmt::Display for PredefinedPermissionSettings {
15869 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15870 wkt::internal::display_enum(f, self.name(), self.value())
15871 }
15872 }
15873
15874 impl std::convert::From<i32> for PredefinedPermissionSettings {
15875 fn from(value: i32) -> Self {
15876 match value {
15877 0 => Self::Unspecified,
15878 1 => Self::CollaborationSpace,
15879 2 => Self::AnnouncementSpace,
15880 _ => Self::UnknownValue(predefined_permission_settings::UnknownValue(
15881 wkt::internal::UnknownEnumValue::Integer(value),
15882 )),
15883 }
15884 }
15885 }
15886
15887 impl std::convert::From<&str> for PredefinedPermissionSettings {
15888 fn from(value: &str) -> Self {
15889 use std::string::ToString;
15890 match value {
15891 "PREDEFINED_PERMISSION_SETTINGS_UNSPECIFIED" => Self::Unspecified,
15892 "COLLABORATION_SPACE" => Self::CollaborationSpace,
15893 "ANNOUNCEMENT_SPACE" => Self::AnnouncementSpace,
15894 _ => Self::UnknownValue(predefined_permission_settings::UnknownValue(
15895 wkt::internal::UnknownEnumValue::String(value.to_string()),
15896 )),
15897 }
15898 }
15899 }
15900
15901 impl serde::ser::Serialize for PredefinedPermissionSettings {
15902 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15903 where
15904 S: serde::Serializer,
15905 {
15906 match self {
15907 Self::Unspecified => serializer.serialize_i32(0),
15908 Self::CollaborationSpace => serializer.serialize_i32(1),
15909 Self::AnnouncementSpace => serializer.serialize_i32(2),
15910 Self::UnknownValue(u) => u.0.serialize(serializer),
15911 }
15912 }
15913 }
15914
15915 impl<'de> serde::de::Deserialize<'de> for PredefinedPermissionSettings {
15916 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15917 where
15918 D: serde::Deserializer<'de>,
15919 {
15920 deserializer.deserialize_any(
15921 wkt::internal::EnumVisitor::<PredefinedPermissionSettings>::new(
15922 ".google.chat.v1.Space.PredefinedPermissionSettings",
15923 ),
15924 )
15925 }
15926 }
15927
15928 /// Represents the [permission settings]
15929 /// (<https://support.google.com/chat/answer/13340792>) of a space. Only
15930 /// populated when the `space_type` is `SPACE`.
15931 #[derive(Clone, Debug, PartialEq)]
15932 #[non_exhaustive]
15933 pub enum SpacePermissionSettings {
15934 /// Optional. Input only. Predefined space permission settings, input only
15935 /// when creating a space. If the field is not set, a collaboration space is
15936 /// created. After you create the space, settings are populated in the
15937 /// `PermissionSettings` field.
15938 ///
15939 /// Setting predefined permission settings supports:
15940 ///
15941 /// - [App
15942 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
15943 /// with [administrator
15944 /// approval](https://support.google.com/a?p=chat-app-auth) with the
15945 /// `chat.app.spaces` or `chat.app.spaces.create` scopes.
15946 ///
15947 /// - [User
15948 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
15949 ///
15950 PredefinedPermissionSettings(crate::model::space::PredefinedPermissionSettings),
15951 /// Optional. Space permission settings for existing spaces. Input for
15952 /// updating exact space permission settings, where existing permission
15953 /// settings are replaced. Output lists current permission settings.
15954 ///
15955 /// Reading and updating permission settings supports:
15956 ///
15957 /// - [App
15958 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
15959 /// with [administrator
15960 /// approval](https://support.google.com/a?p=chat-app-auth) with the
15961 /// `chat.app.spaces` scope. Only populated and settable when the Chat app
15962 /// created the space.
15963 ///
15964 /// - [User
15965 /// authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
15966 ///
15967 PermissionSettings(std::boxed::Box<crate::model::space::PermissionSettings>),
15968 }
15969}
15970
15971/// A request to create a named space with no members.
15972#[derive(Clone, Default, PartialEq)]
15973#[non_exhaustive]
15974pub struct CreateSpaceRequest {
15975 /// Required. The `displayName` and `spaceType` fields must be populated. Only
15976 /// `SpaceType.SPACE` and `SpaceType.GROUP_CHAT` are supported.
15977 /// `SpaceType.GROUP_CHAT` can only be used if `importMode` is set to true.
15978 ///
15979 /// If you receive the error message `ALREADY_EXISTS`,
15980 /// try a different `displayName`. An existing space within the Google
15981 /// Workspace organization might already use this display name.
15982 ///
15983 /// The space `name` is assigned on the server so anything specified in this
15984 /// field will be ignored.
15985 pub space: std::option::Option<crate::model::Space>,
15986
15987 /// Optional. A unique identifier for this request.
15988 /// A random UUID is recommended.
15989 /// Specifying an existing request ID returns the space created with that ID
15990 /// instead of creating a new space.
15991 /// Specifying an existing request ID from the same Chat app with a different
15992 /// authenticated user returns an error.
15993 pub request_id: std::string::String,
15994
15995 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15996}
15997
15998impl CreateSpaceRequest {
15999 /// Creates a new default instance.
16000 pub fn new() -> Self {
16001 std::default::Default::default()
16002 }
16003
16004 /// Sets the value of [space][crate::model::CreateSpaceRequest::space].
16005 ///
16006 /// # Example
16007 /// ```ignore,no_run
16008 /// # use google_chat_v1::model::CreateSpaceRequest;
16009 /// use google_chat_v1::model::Space;
16010 /// let x = CreateSpaceRequest::new().set_space(Space::default()/* use setters */);
16011 /// ```
16012 pub fn set_space<T>(mut self, v: T) -> Self
16013 where
16014 T: std::convert::Into<crate::model::Space>,
16015 {
16016 self.space = std::option::Option::Some(v.into());
16017 self
16018 }
16019
16020 /// Sets or clears the value of [space][crate::model::CreateSpaceRequest::space].
16021 ///
16022 /// # Example
16023 /// ```ignore,no_run
16024 /// # use google_chat_v1::model::CreateSpaceRequest;
16025 /// use google_chat_v1::model::Space;
16026 /// let x = CreateSpaceRequest::new().set_or_clear_space(Some(Space::default()/* use setters */));
16027 /// let x = CreateSpaceRequest::new().set_or_clear_space(None::<Space>);
16028 /// ```
16029 pub fn set_or_clear_space<T>(mut self, v: std::option::Option<T>) -> Self
16030 where
16031 T: std::convert::Into<crate::model::Space>,
16032 {
16033 self.space = v.map(|x| x.into());
16034 self
16035 }
16036
16037 /// Sets the value of [request_id][crate::model::CreateSpaceRequest::request_id].
16038 ///
16039 /// # Example
16040 /// ```ignore,no_run
16041 /// # use google_chat_v1::model::CreateSpaceRequest;
16042 /// let x = CreateSpaceRequest::new().set_request_id("example");
16043 /// ```
16044 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16045 self.request_id = v.into();
16046 self
16047 }
16048}
16049
16050impl wkt::message::Message for CreateSpaceRequest {
16051 fn typename() -> &'static str {
16052 "type.googleapis.com/google.chat.v1.CreateSpaceRequest"
16053 }
16054}
16055
16056/// A request to list the spaces the caller is a member of.
16057#[derive(Clone, Default, PartialEq)]
16058#[non_exhaustive]
16059pub struct ListSpacesRequest {
16060 /// Optional. The maximum number of spaces to return. The service might return
16061 /// fewer than this value.
16062 ///
16063 /// If unspecified, at most 100 spaces are returned.
16064 ///
16065 /// The maximum value is 1000. If you use a value more than 1000, it's
16066 /// automatically changed to 1000.
16067 ///
16068 /// Negative values return an `INVALID_ARGUMENT` error.
16069 pub page_size: i32,
16070
16071 /// Optional. A page token, received from a previous list spaces call.
16072 /// Provide this parameter to retrieve the subsequent page.
16073 ///
16074 /// When paginating, the filter value should match the call that provided the
16075 /// page token. Passing a different value may lead to unexpected results.
16076 pub page_token: std::string::String,
16077
16078 /// Optional. A query filter.
16079 ///
16080 /// You can filter spaces by the space type
16081 /// ([`space_type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype)).
16082 ///
16083 /// To filter by space type, you must specify valid enum value, such as
16084 /// `SPACE` or `GROUP_CHAT` (the `space_type` can't be
16085 /// `SPACE_TYPE_UNSPECIFIED`). To query for multiple space types, use the `OR`
16086 /// operator.
16087 ///
16088 /// For example, the following queries are valid:
16089 ///
16090 /// ```norust
16091 /// space_type = "SPACE"
16092 /// spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE"
16093 /// ```
16094 ///
16095 /// Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
16096 /// error.
16097 pub filter: std::string::String,
16098
16099 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16100}
16101
16102impl ListSpacesRequest {
16103 /// Creates a new default instance.
16104 pub fn new() -> Self {
16105 std::default::Default::default()
16106 }
16107
16108 /// Sets the value of [page_size][crate::model::ListSpacesRequest::page_size].
16109 ///
16110 /// # Example
16111 /// ```ignore,no_run
16112 /// # use google_chat_v1::model::ListSpacesRequest;
16113 /// let x = ListSpacesRequest::new().set_page_size(42);
16114 /// ```
16115 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16116 self.page_size = v.into();
16117 self
16118 }
16119
16120 /// Sets the value of [page_token][crate::model::ListSpacesRequest::page_token].
16121 ///
16122 /// # Example
16123 /// ```ignore,no_run
16124 /// # use google_chat_v1::model::ListSpacesRequest;
16125 /// let x = ListSpacesRequest::new().set_page_token("example");
16126 /// ```
16127 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16128 self.page_token = v.into();
16129 self
16130 }
16131
16132 /// Sets the value of [filter][crate::model::ListSpacesRequest::filter].
16133 ///
16134 /// # Example
16135 /// ```ignore,no_run
16136 /// # use google_chat_v1::model::ListSpacesRequest;
16137 /// let x = ListSpacesRequest::new().set_filter("example");
16138 /// ```
16139 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16140 self.filter = v.into();
16141 self
16142 }
16143}
16144
16145impl wkt::message::Message for ListSpacesRequest {
16146 fn typename() -> &'static str {
16147 "type.googleapis.com/google.chat.v1.ListSpacesRequest"
16148 }
16149}
16150
16151/// The response for a list spaces request.
16152#[derive(Clone, Default, PartialEq)]
16153#[non_exhaustive]
16154pub struct ListSpacesResponse {
16155 /// List of spaces in the requested (or first) page.
16156 /// Note: The `permissionSettings` field is not returned in the Space
16157 /// object for list requests.
16158 pub spaces: std::vec::Vec<crate::model::Space>,
16159
16160 /// You can send a token as `pageToken` to retrieve the next page of
16161 /// results. If empty, there are no subsequent pages.
16162 pub next_page_token: std::string::String,
16163
16164 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16165}
16166
16167impl ListSpacesResponse {
16168 /// Creates a new default instance.
16169 pub fn new() -> Self {
16170 std::default::Default::default()
16171 }
16172
16173 /// Sets the value of [spaces][crate::model::ListSpacesResponse::spaces].
16174 ///
16175 /// # Example
16176 /// ```ignore,no_run
16177 /// # use google_chat_v1::model::ListSpacesResponse;
16178 /// use google_chat_v1::model::Space;
16179 /// let x = ListSpacesResponse::new()
16180 /// .set_spaces([
16181 /// Space::default()/* use setters */,
16182 /// Space::default()/* use (different) setters */,
16183 /// ]);
16184 /// ```
16185 pub fn set_spaces<T, V>(mut self, v: T) -> Self
16186 where
16187 T: std::iter::IntoIterator<Item = V>,
16188 V: std::convert::Into<crate::model::Space>,
16189 {
16190 use std::iter::Iterator;
16191 self.spaces = v.into_iter().map(|i| i.into()).collect();
16192 self
16193 }
16194
16195 /// Sets the value of [next_page_token][crate::model::ListSpacesResponse::next_page_token].
16196 ///
16197 /// # Example
16198 /// ```ignore,no_run
16199 /// # use google_chat_v1::model::ListSpacesResponse;
16200 /// let x = ListSpacesResponse::new().set_next_page_token("example");
16201 /// ```
16202 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16203 self.next_page_token = v.into();
16204 self
16205 }
16206}
16207
16208impl wkt::message::Message for ListSpacesResponse {
16209 fn typename() -> &'static str {
16210 "type.googleapis.com/google.chat.v1.ListSpacesResponse"
16211 }
16212}
16213
16214#[doc(hidden)]
16215impl google_cloud_gax::paginator::internal::PageableResponse for ListSpacesResponse {
16216 type PageItem = crate::model::Space;
16217
16218 fn items(self) -> std::vec::Vec<Self::PageItem> {
16219 self.spaces
16220 }
16221
16222 fn next_page_token(&self) -> std::string::String {
16223 use std::clone::Clone;
16224 self.next_page_token.clone()
16225 }
16226}
16227
16228/// A request to return a single space.
16229#[derive(Clone, Default, PartialEq)]
16230#[non_exhaustive]
16231pub struct GetSpaceRequest {
16232 /// Required. Resource name of the space, in the form `spaces/{space}`.
16233 ///
16234 /// Format: `spaces/{space}`
16235 pub name: std::string::String,
16236
16237 /// Optional. When `true`, the method runs using the user's Google Workspace
16238 /// administrator privileges.
16239 ///
16240 /// The calling user must be a Google Workspace administrator with the
16241 /// [manage chat and spaces conversations
16242 /// privilege](https://support.google.com/a/answer/13369245).
16243 ///
16244 /// Requires the `chat.admin.spaces` or `chat.admin.spaces.readonly` [OAuth 2.0
16245 /// scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).
16246 pub use_admin_access: bool,
16247
16248 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16249}
16250
16251impl GetSpaceRequest {
16252 /// Creates a new default instance.
16253 pub fn new() -> Self {
16254 std::default::Default::default()
16255 }
16256
16257 /// Sets the value of [name][crate::model::GetSpaceRequest::name].
16258 ///
16259 /// # Example
16260 /// ```ignore,no_run
16261 /// # use google_chat_v1::model::GetSpaceRequest;
16262 /// # let space_id = "space_id";
16263 /// let x = GetSpaceRequest::new().set_name(format!("spaces/{space_id}"));
16264 /// ```
16265 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16266 self.name = v.into();
16267 self
16268 }
16269
16270 /// Sets the value of [use_admin_access][crate::model::GetSpaceRequest::use_admin_access].
16271 ///
16272 /// # Example
16273 /// ```ignore,no_run
16274 /// # use google_chat_v1::model::GetSpaceRequest;
16275 /// let x = GetSpaceRequest::new().set_use_admin_access(true);
16276 /// ```
16277 pub fn set_use_admin_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16278 self.use_admin_access = v.into();
16279 self
16280 }
16281}
16282
16283impl wkt::message::Message for GetSpaceRequest {
16284 fn typename() -> &'static str {
16285 "type.googleapis.com/google.chat.v1.GetSpaceRequest"
16286 }
16287}
16288
16289/// A request to get direct message space based on the user resource.
16290#[derive(Clone, Default, PartialEq)]
16291#[non_exhaustive]
16292pub struct FindDirectMessageRequest {
16293 /// Required. Resource name of the user to find direct message with.
16294 ///
16295 /// Format: `users/{user}`, where `{user}` is either the `id` for the
16296 /// [person](https://developers.google.com/people/api/rest/v1/people) from the
16297 /// People API, or the `id` for the
16298 /// [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users)
16299 /// in the Directory API. For example, if the People API profile ID is
16300 /// `123456789`, you can find a direct message with that person by using
16301 /// `users/123456789` as the `name`. When [authenticated as a
16302 /// user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
16303 /// you can use the email as an alias for `{user}`. For example,
16304 /// `users/example@gmail.com` where `example@gmail.com` is the email of the
16305 /// Google Chat user.
16306 pub name: std::string::String,
16307
16308 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16309}
16310
16311impl FindDirectMessageRequest {
16312 /// Creates a new default instance.
16313 pub fn new() -> Self {
16314 std::default::Default::default()
16315 }
16316
16317 /// Sets the value of [name][crate::model::FindDirectMessageRequest::name].
16318 ///
16319 /// # Example
16320 /// ```ignore,no_run
16321 /// # use google_chat_v1::model::FindDirectMessageRequest;
16322 /// let x = FindDirectMessageRequest::new().set_name("example");
16323 /// ```
16324 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16325 self.name = v.into();
16326 self
16327 }
16328}
16329
16330impl wkt::message::Message for FindDirectMessageRequest {
16331 fn typename() -> &'static str {
16332 "type.googleapis.com/google.chat.v1.FindDirectMessageRequest"
16333 }
16334}
16335
16336/// A request to get group chat spaces based on user resources.
16337#[derive(Clone, Default, PartialEq)]
16338#[non_exhaustive]
16339pub struct FindGroupChatsRequest {
16340 /// Optional. Resource names of all human users in group chat with the calling
16341 /// user. Chat apps can't be included in the request.
16342 ///
16343 /// The maximum number of users that can be specified in a single request is
16344 /// `49`.
16345 ///
16346 /// Format: `users/{user}`, where `{user}` is either the `id` for the
16347 /// [person](https://developers.google.com/people/api/rest/v1/people) from the
16348 /// People API, or the `id` for the
16349 /// [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users)
16350 /// in the Directory API. For example, to find all group chats with the calling
16351 /// user and two other users, with People API profile IDs `123456789` and
16352 /// `987654321`, you can use `users/123456789` and `users/987654321`.
16353 /// You can also use the email as an alias for `{user}`. For example,
16354 /// `users/example@gmail.com` where `example@gmail.com` is the email of the
16355 /// Google Chat user.
16356 pub users: std::vec::Vec<std::string::String>,
16357
16358 /// Optional. The maximum number of spaces to return. The service might return
16359 /// fewer than this value.
16360 ///
16361 /// If unspecified, at most 10 spaces are returned.
16362 ///
16363 /// The maximum value is 30. If you use a value more than 30, it's
16364 /// automatically changed to 30.
16365 ///
16366 /// Negative values return an `INVALID_ARGUMENT` error.
16367 pub page_size: i32,
16368
16369 /// Optional. A page token, received from a previous call to find group chats.
16370 /// Provide this parameter to retrieve the subsequent page.
16371 ///
16372 /// When paginating, all other parameters provided should match the call that
16373 /// provided the token. Passing different values may lead to unexpected
16374 /// results.
16375 pub page_token: std::string::String,
16376
16377 /// Requested space view type. If unset, defaults to
16378 /// `SPACE_VIEW_RESOURCE_NAME_ONLY`. Requests that specify
16379 /// `SPACE_VIEW_EXPANDED` must include scopes that allow reading space data,
16380 /// for example,
16381 /// <https://www.googleapis.com/auth/chat.spaces> or
16382 /// <https://www.googleapis.com/auth/chat.spaces.readonly>.
16383 pub space_view: crate::model::SpaceView,
16384
16385 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16386}
16387
16388impl FindGroupChatsRequest {
16389 /// Creates a new default instance.
16390 pub fn new() -> Self {
16391 std::default::Default::default()
16392 }
16393
16394 /// Sets the value of [users][crate::model::FindGroupChatsRequest::users].
16395 ///
16396 /// # Example
16397 /// ```ignore,no_run
16398 /// # use google_chat_v1::model::FindGroupChatsRequest;
16399 /// let x = FindGroupChatsRequest::new().set_users(["a", "b", "c"]);
16400 /// ```
16401 pub fn set_users<T, V>(mut self, v: T) -> Self
16402 where
16403 T: std::iter::IntoIterator<Item = V>,
16404 V: std::convert::Into<std::string::String>,
16405 {
16406 use std::iter::Iterator;
16407 self.users = v.into_iter().map(|i| i.into()).collect();
16408 self
16409 }
16410
16411 /// Sets the value of [page_size][crate::model::FindGroupChatsRequest::page_size].
16412 ///
16413 /// # Example
16414 /// ```ignore,no_run
16415 /// # use google_chat_v1::model::FindGroupChatsRequest;
16416 /// let x = FindGroupChatsRequest::new().set_page_size(42);
16417 /// ```
16418 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16419 self.page_size = v.into();
16420 self
16421 }
16422
16423 /// Sets the value of [page_token][crate::model::FindGroupChatsRequest::page_token].
16424 ///
16425 /// # Example
16426 /// ```ignore,no_run
16427 /// # use google_chat_v1::model::FindGroupChatsRequest;
16428 /// let x = FindGroupChatsRequest::new().set_page_token("example");
16429 /// ```
16430 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16431 self.page_token = v.into();
16432 self
16433 }
16434
16435 /// Sets the value of [space_view][crate::model::FindGroupChatsRequest::space_view].
16436 ///
16437 /// # Example
16438 /// ```ignore,no_run
16439 /// # use google_chat_v1::model::FindGroupChatsRequest;
16440 /// use google_chat_v1::model::SpaceView;
16441 /// let x0 = FindGroupChatsRequest::new().set_space_view(SpaceView::ResourceNameOnly);
16442 /// let x1 = FindGroupChatsRequest::new().set_space_view(SpaceView::Expanded);
16443 /// ```
16444 pub fn set_space_view<T: std::convert::Into<crate::model::SpaceView>>(mut self, v: T) -> Self {
16445 self.space_view = v.into();
16446 self
16447 }
16448}
16449
16450impl wkt::message::Message for FindGroupChatsRequest {
16451 fn typename() -> &'static str {
16452 "type.googleapis.com/google.chat.v1.FindGroupChatsRequest"
16453 }
16454}
16455
16456/// A response containing group chat spaces with exactly the calling user and the
16457/// requested users.
16458#[derive(Clone, Default, PartialEq)]
16459#[non_exhaustive]
16460pub struct FindGroupChatsResponse {
16461 /// List of spaces in the requested (or first) page.
16462 pub spaces: std::vec::Vec<crate::model::Space>,
16463
16464 /// A token that you can send as `pageToken` to retrieve the next page of
16465 /// results. If empty, there are no subsequent pages.
16466 pub next_page_token: std::string::String,
16467
16468 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16469}
16470
16471impl FindGroupChatsResponse {
16472 /// Creates a new default instance.
16473 pub fn new() -> Self {
16474 std::default::Default::default()
16475 }
16476
16477 /// Sets the value of [spaces][crate::model::FindGroupChatsResponse::spaces].
16478 ///
16479 /// # Example
16480 /// ```ignore,no_run
16481 /// # use google_chat_v1::model::FindGroupChatsResponse;
16482 /// use google_chat_v1::model::Space;
16483 /// let x = FindGroupChatsResponse::new()
16484 /// .set_spaces([
16485 /// Space::default()/* use setters */,
16486 /// Space::default()/* use (different) setters */,
16487 /// ]);
16488 /// ```
16489 pub fn set_spaces<T, V>(mut self, v: T) -> Self
16490 where
16491 T: std::iter::IntoIterator<Item = V>,
16492 V: std::convert::Into<crate::model::Space>,
16493 {
16494 use std::iter::Iterator;
16495 self.spaces = v.into_iter().map(|i| i.into()).collect();
16496 self
16497 }
16498
16499 /// Sets the value of [next_page_token][crate::model::FindGroupChatsResponse::next_page_token].
16500 ///
16501 /// # Example
16502 /// ```ignore,no_run
16503 /// # use google_chat_v1::model::FindGroupChatsResponse;
16504 /// let x = FindGroupChatsResponse::new().set_next_page_token("example");
16505 /// ```
16506 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16507 self.next_page_token = v.into();
16508 self
16509 }
16510}
16511
16512impl wkt::message::Message for FindGroupChatsResponse {
16513 fn typename() -> &'static str {
16514 "type.googleapis.com/google.chat.v1.FindGroupChatsResponse"
16515 }
16516}
16517
16518#[doc(hidden)]
16519impl google_cloud_gax::paginator::internal::PageableResponse for FindGroupChatsResponse {
16520 type PageItem = crate::model::Space;
16521
16522 fn items(self) -> std::vec::Vec<Self::PageItem> {
16523 self.spaces
16524 }
16525
16526 fn next_page_token(&self) -> std::string::String {
16527 use std::clone::Clone;
16528 self.next_page_token.clone()
16529 }
16530}
16531
16532/// A request to update a single space.
16533#[derive(Clone, Default, PartialEq)]
16534#[non_exhaustive]
16535pub struct UpdateSpaceRequest {
16536 /// Required. Space with fields to be updated. `Space.name` must be
16537 /// populated in the form of `spaces/{space}`. Only fields
16538 /// specified by `update_mask` are updated.
16539 pub space: std::option::Option<crate::model::Space>,
16540
16541 /// Required. The updated field paths, comma separated if there are
16542 /// multiple.
16543 ///
16544 /// You can update the following fields for a space:
16545 ///
16546 /// `space_details`: Updates the space's description and guidelines. You must
16547 /// pass both description and guidelines in the update request as
16548 /// [`SpaceDetails`][google.chat.v1.Space.SpaceDetails]. If you only want to
16549 /// update one of the fields, pass the existing value for the other field.
16550 ///
16551 /// `display_name`: Only supports updating the display name for spaces where
16552 /// `spaceType` field is `SPACE`.
16553 /// If you receive the error message `ALREADY_EXISTS`, try a different
16554 /// value. An existing space within the
16555 /// Google Workspace organization might already use this display name.
16556 ///
16557 /// `space_type`: Only supports changing a `GROUP_CHAT` space type to
16558 /// `SPACE`. Include `display_name` together
16559 /// with `space_type` in the update mask and ensure that the specified space
16560 /// has a non-empty display name and the `SPACE` space type. Including the
16561 /// `space_type` mask and the `SPACE` type in the specified space when updating
16562 /// the display name is optional if the existing space already has the `SPACE`
16563 /// type. Trying to update the space type in other ways results in an invalid
16564 /// argument error.
16565 /// `space_type` is not supported with `useAdminAccess`.
16566 ///
16567 /// `space_history_state`: Updates [space history
16568 /// settings](https://support.google.com/chat/answer/7664687) by turning
16569 /// history on or off for the space. Only supported if history settings are
16570 /// enabled for the Google Workspace organization. To update the
16571 /// space history state, you must omit all other field masks in your request.
16572 /// `space_history_state` is not supported with `useAdminAccess`.
16573 ///
16574 /// `access_settings.audience`: Updates the [access
16575 /// setting](https://support.google.com/chat/answer/11971020) of who can
16576 /// discover the space, join the space, and preview the messages in named space
16577 /// where `spaceType` field is `SPACE`. If the existing space has a
16578 /// target audience, you can remove the audience and restrict space access by
16579 /// omitting a value for this field mask. To update access settings for a
16580 /// space, the authenticating user must be a space manager and omit all other
16581 /// field masks in your request. You can't update this field if the space is in
16582 /// [import
16583 /// mode](https://developers.google.com/workspace/chat/import-data-overview).
16584 /// To learn more, see [Make a space discoverable to specific
16585 /// users](https://developers.google.com/workspace/chat/space-target-audience).
16586 /// `access_settings.audience` is not supported with `useAdminAccess`.
16587 ///
16588 /// `access_settings.access_permission_settings`: Updates the [access
16589 /// permission
16590 /// settings](https://support.google.com/chat/answer/11971020) of who can
16591 /// discover and join the space where `spaceType` field is `SPACE`. Principals
16592 /// allowed to join the space must also be allowed to discover it. To update
16593 /// access permission settings for a space, the authenticating user must be a
16594 /// space manager or assistant manager and omit all other field masks in the
16595 /// request. You can't update this field if the space is in [import
16596 /// mode](https://developers.google.com/workspace/chat/import-data-overview).
16597 /// To learn more, see [Make a space discoverable to specific
16598 /// users](https://developers.google.com/workspace/chat/space-target-audience).
16599 /// `access_settings.access_permission_settings` is not supported with
16600 /// `useAdminAccess`.
16601 /// The supported field masks include:
16602 ///
16603 /// - `access_settings.access_permission_settings.discoverSpaceSetting`
16604 /// - `access_settings.access_permission_settings.joinSpaceSetting`
16605 ///
16606 /// `permission_settings`: Supports changing the
16607 /// [permission settings](https://support.google.com/chat/answer/13340792)
16608 /// of a space.
16609 /// When updating permission settings, you can only specify
16610 /// `permissionSettings` field masks; you cannot update other field masks
16611 /// at the same time.
16612 /// The supported field masks include:
16613 ///
16614 /// - `permission_settings.manageMembersAndGroups`
16615 /// - `permission_settings.modifySpaceDetails`
16616 /// - `permission_settings.toggleHistory`
16617 /// - `permission_settings.useAtMentionAll`
16618 /// - `permission_settings.manageApps`
16619 /// - `permission_settings.manageWebhooks`
16620 /// - `permission_settings.replyMessages`
16621 ///
16622 /// [google.chat.v1.Space.SpaceDetails]: crate::model::space::SpaceDetails
16623 pub update_mask: std::option::Option<wkt::FieldMask>,
16624
16625 /// Optional. When `true`, the method runs using the user's Google Workspace
16626 /// administrator privileges.
16627 ///
16628 /// The calling user must be a Google Workspace administrator with the
16629 /// [manage chat and spaces conversations
16630 /// privilege](https://support.google.com/a/answer/13369245).
16631 ///
16632 /// Requires the `chat.admin.spaces` [OAuth 2.0
16633 /// scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).
16634 ///
16635 /// Some `FieldMask` values are not supported using admin access. For details,
16636 /// see the description of `update_mask`.
16637 pub use_admin_access: bool,
16638
16639 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16640}
16641
16642impl UpdateSpaceRequest {
16643 /// Creates a new default instance.
16644 pub fn new() -> Self {
16645 std::default::Default::default()
16646 }
16647
16648 /// Sets the value of [space][crate::model::UpdateSpaceRequest::space].
16649 ///
16650 /// # Example
16651 /// ```ignore,no_run
16652 /// # use google_chat_v1::model::UpdateSpaceRequest;
16653 /// use google_chat_v1::model::Space;
16654 /// let x = UpdateSpaceRequest::new().set_space(Space::default()/* use setters */);
16655 /// ```
16656 pub fn set_space<T>(mut self, v: T) -> Self
16657 where
16658 T: std::convert::Into<crate::model::Space>,
16659 {
16660 self.space = std::option::Option::Some(v.into());
16661 self
16662 }
16663
16664 /// Sets or clears the value of [space][crate::model::UpdateSpaceRequest::space].
16665 ///
16666 /// # Example
16667 /// ```ignore,no_run
16668 /// # use google_chat_v1::model::UpdateSpaceRequest;
16669 /// use google_chat_v1::model::Space;
16670 /// let x = UpdateSpaceRequest::new().set_or_clear_space(Some(Space::default()/* use setters */));
16671 /// let x = UpdateSpaceRequest::new().set_or_clear_space(None::<Space>);
16672 /// ```
16673 pub fn set_or_clear_space<T>(mut self, v: std::option::Option<T>) -> Self
16674 where
16675 T: std::convert::Into<crate::model::Space>,
16676 {
16677 self.space = v.map(|x| x.into());
16678 self
16679 }
16680
16681 /// Sets the value of [update_mask][crate::model::UpdateSpaceRequest::update_mask].
16682 ///
16683 /// # Example
16684 /// ```ignore,no_run
16685 /// # use google_chat_v1::model::UpdateSpaceRequest;
16686 /// use wkt::FieldMask;
16687 /// let x = UpdateSpaceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
16688 /// ```
16689 pub fn set_update_mask<T>(mut self, v: T) -> Self
16690 where
16691 T: std::convert::Into<wkt::FieldMask>,
16692 {
16693 self.update_mask = std::option::Option::Some(v.into());
16694 self
16695 }
16696
16697 /// Sets or clears the value of [update_mask][crate::model::UpdateSpaceRequest::update_mask].
16698 ///
16699 /// # Example
16700 /// ```ignore,no_run
16701 /// # use google_chat_v1::model::UpdateSpaceRequest;
16702 /// use wkt::FieldMask;
16703 /// let x = UpdateSpaceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
16704 /// let x = UpdateSpaceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
16705 /// ```
16706 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
16707 where
16708 T: std::convert::Into<wkt::FieldMask>,
16709 {
16710 self.update_mask = v.map(|x| x.into());
16711 self
16712 }
16713
16714 /// Sets the value of [use_admin_access][crate::model::UpdateSpaceRequest::use_admin_access].
16715 ///
16716 /// # Example
16717 /// ```ignore,no_run
16718 /// # use google_chat_v1::model::UpdateSpaceRequest;
16719 /// let x = UpdateSpaceRequest::new().set_use_admin_access(true);
16720 /// ```
16721 pub fn set_use_admin_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16722 self.use_admin_access = v.into();
16723 self
16724 }
16725}
16726
16727impl wkt::message::Message for UpdateSpaceRequest {
16728 fn typename() -> &'static str {
16729 "type.googleapis.com/google.chat.v1.UpdateSpaceRequest"
16730 }
16731}
16732
16733/// Request to search for a list of spaces based on a query.
16734#[derive(Clone, Default, PartialEq)]
16735#[non_exhaustive]
16736pub struct SearchSpacesRequest {
16737 /// When `true`, the method runs using the user's Google Workspace
16738 /// administrator privileges.
16739 ///
16740 /// The calling user must be a Google Workspace administrator with the
16741 /// [manage chat and spaces conversations
16742 /// privilege](https://support.google.com/a/answer/13369245).
16743 ///
16744 /// Requires either the `chat.admin.spaces.readonly` or `chat.admin.spaces`
16745 /// [OAuth 2.0
16746 /// scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).
16747 pub use_admin_access: bool,
16748
16749 /// The maximum number of spaces to return. The service may return fewer than
16750 /// this value.
16751 ///
16752 /// If unspecified, at most 100 spaces are returned.
16753 ///
16754 /// The maximum value is 1000. If you use a value more than 1000, it's
16755 /// automatically changed to 1000.
16756 pub page_size: i32,
16757
16758 /// A token, received from the previous search spaces call. Provide this
16759 /// parameter to retrieve the subsequent page.
16760 ///
16761 /// When paginating, all other parameters provided should match the call that
16762 /// provided the page token. Passing different values to the other parameters
16763 /// might lead to unexpected results.
16764 pub page_token: std::string::String,
16765
16766 /// Required. A search query.
16767 ///
16768 /// You can search by using the following parameters when `useAdminAccess`
16769 /// is set to `true`:
16770 ///
16771 /// - `create_time`
16772 /// - `customer`
16773 /// - `display_name`
16774 /// - `external_user_allowed`
16775 /// - `last_active_time`
16776 /// - `space_history_state`
16777 /// - `space_type`
16778 ///
16779 /// When `useAdminAccess` is set to `false`:
16780 ///
16781 /// - `display_name`
16782 /// - `external_user_allowed`
16783 /// - `space_type`
16784 ///
16785 /// `create_time` and `last_active_time` accept a timestamp in
16786 /// [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) format and the supported
16787 /// comparison operators are: `=`, `<`, `>`, `<=`, `>=`.
16788 ///
16789 /// `customer` is required when `useAdminAccess` is set to `true`, and is
16790 /// used to indicate which customer to fetch spaces from.
16791 /// `customers/my_customer` is the only supported value.
16792 ///
16793 /// `display_name` only accepts the `HAS` (`:`) operator. The text to
16794 /// match is first tokenized into tokens and each token is prefix-matched
16795 /// case-insensitively and independently as a substring anywhere in the space's
16796 /// `display_name`. For example, `Fun Eve` matches `Fun event` or `The
16797 /// evening was fun`, but not `notFun event` or `even`. When `useAdminAccess`
16798 /// is set to `false`, `display_name` is required to retrieve meaningful
16799 /// results. Otherwise, the default behavior is to return an empty response.
16800 ///
16801 /// `external_user_allowed` accepts either `true` or `false`.
16802 ///
16803 /// `space_history_state` only accepts values from the [`historyState`]
16804 /// (<https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#Space.HistoryState>)
16805 /// field of a `space` resource.
16806 ///
16807 /// `space_type` is required and the only valid value is `SPACE`.
16808 ///
16809 /// Across different fields, only `AND` operators are supported. A valid
16810 /// example is `space_type = "SPACE" AND display_name:"Hello"` and an invalid
16811 /// example is `space_type = "SPACE" OR display_name:"Hello"`.
16812 ///
16813 /// Among the same field,
16814 /// `space_type` doesn't support `AND` or `OR` operators.
16815 /// `display_name`, 'space_history_state', and 'external_user_allowed' only
16816 /// support `OR` operators.
16817 /// `last_active_time` and `create_time` support both `AND` and `OR` operators.
16818 /// `AND` can only be used to represent an interval, such as `last_active_time
16819 /// < "2022-01-01T00:00:00+00:00" AND last_active_time >
16820 /// "2023-01-01T00:00:00+00:00"`.
16821 ///
16822 /// The following example queries are valid when `useAdminAccess` is set to
16823 /// `true`:
16824 ///
16825 /// ```norust
16826 /// customer = "customers/my_customer" AND space_type = "SPACE"
16827 ///
16828 /// customer = "customers/my_customer" AND space_type = "SPACE" AND
16829 /// display_name:"Hello World"
16830 ///
16831 /// customer = "customers/my_customer" AND space_type = "SPACE" AND
16832 /// (last_active_time < "2020-01-01T00:00:00+00:00" OR last_active_time >
16833 /// "2022-01-01T00:00:00+00:00")
16834 ///
16835 /// customer = "customers/my_customer" AND space_type = "SPACE" AND
16836 /// (display_name:"Hello World" OR display_name:"Fun event") AND
16837 /// (last_active_time > "2020-01-01T00:00:00+00:00" AND last_active_time <
16838 /// "2022-01-01T00:00:00+00:00")
16839 ///
16840 /// customer = "customers/my_customer" AND space_type = "SPACE" AND
16841 /// (create_time > "2019-01-01T00:00:00+00:00" AND create_time <
16842 /// "2020-01-01T00:00:00+00:00") AND (external_user_allowed = "true") AND
16843 /// (space_history_state = "HISTORY_ON" OR space_history_state = "HISTORY_OFF")
16844 /// ```
16845 ///
16846 /// The following example queries are valid when `useAdminAccess` is set to
16847 /// `false`:
16848 ///
16849 /// ```norust
16850 /// display_name:"Hello World" AND space_type = "SPACE"
16851 ///
16852 /// (display_name:"Hello" OR display_name:"Fun") AND space_type = "SPACE"
16853 ///
16854 /// (external_user_allowed = "true" AND space_type = "SPACE") // Returns an
16855 /// empty response.
16856 ///
16857 /// (external_user_allowed = "true" AND display_name:"Hello" AND space_type =
16858 /// "SPACE")
16859 /// ```
16860 pub query: std::string::String,
16861
16862 /// Optional. How the list of spaces is ordered.
16863 ///
16864 /// Supported attributes to order by are:
16865 ///
16866 /// - `membership_count.joined_direct_human_user_count` — Denotes the count of
16867 /// human users that have directly joined a space.
16868 /// - `last_active_time` — Denotes the time when last eligible item is added to
16869 /// any topic of this space.
16870 /// - `create_time` — Denotes the time of the space creation.
16871 ///
16872 /// When `useAdminAccess` is `false`, only `create_time` and `relevance` are
16873 /// supported for ordering. Only `DESC` is supported for these fields in
16874 /// non-admin searches.
16875 ///
16876 /// Valid ordering operation values are:
16877 ///
16878 /// - `ASC` for ascending. Default value.
16879 ///
16880 /// - `DESC` for descending.
16881 ///
16882 ///
16883 /// The supported syntax are when `useAdminAccess` is set to `true`:
16884 ///
16885 /// - `membership_count.joined_direct_human_user_count DESC`
16886 /// - `membership_count.joined_direct_human_user_count ASC`
16887 /// - `last_active_time DESC`
16888 /// - `last_active_time ASC`
16889 /// - `create_time DESC`
16890 /// - `create_time ASC`
16891 ///
16892 /// When `useAdminAccess` is set to `false`:
16893 ///
16894 /// - `create_time DESC`
16895 /// - `relevance DESC`
16896 /// [Developer Preview](https://developers.google.com/workspace/preview).
16897 pub order_by: std::string::String,
16898
16899 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16900}
16901
16902impl SearchSpacesRequest {
16903 /// Creates a new default instance.
16904 pub fn new() -> Self {
16905 std::default::Default::default()
16906 }
16907
16908 /// Sets the value of [use_admin_access][crate::model::SearchSpacesRequest::use_admin_access].
16909 ///
16910 /// # Example
16911 /// ```ignore,no_run
16912 /// # use google_chat_v1::model::SearchSpacesRequest;
16913 /// let x = SearchSpacesRequest::new().set_use_admin_access(true);
16914 /// ```
16915 pub fn set_use_admin_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16916 self.use_admin_access = v.into();
16917 self
16918 }
16919
16920 /// Sets the value of [page_size][crate::model::SearchSpacesRequest::page_size].
16921 ///
16922 /// # Example
16923 /// ```ignore,no_run
16924 /// # use google_chat_v1::model::SearchSpacesRequest;
16925 /// let x = SearchSpacesRequest::new().set_page_size(42);
16926 /// ```
16927 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16928 self.page_size = v.into();
16929 self
16930 }
16931
16932 /// Sets the value of [page_token][crate::model::SearchSpacesRequest::page_token].
16933 ///
16934 /// # Example
16935 /// ```ignore,no_run
16936 /// # use google_chat_v1::model::SearchSpacesRequest;
16937 /// let x = SearchSpacesRequest::new().set_page_token("example");
16938 /// ```
16939 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16940 self.page_token = v.into();
16941 self
16942 }
16943
16944 /// Sets the value of [query][crate::model::SearchSpacesRequest::query].
16945 ///
16946 /// # Example
16947 /// ```ignore,no_run
16948 /// # use google_chat_v1::model::SearchSpacesRequest;
16949 /// let x = SearchSpacesRequest::new().set_query("example");
16950 /// ```
16951 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16952 self.query = v.into();
16953 self
16954 }
16955
16956 /// Sets the value of [order_by][crate::model::SearchSpacesRequest::order_by].
16957 ///
16958 /// # Example
16959 /// ```ignore,no_run
16960 /// # use google_chat_v1::model::SearchSpacesRequest;
16961 /// let x = SearchSpacesRequest::new().set_order_by("example");
16962 /// ```
16963 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16964 self.order_by = v.into();
16965 self
16966 }
16967}
16968
16969impl wkt::message::Message for SearchSpacesRequest {
16970 fn typename() -> &'static str {
16971 "type.googleapis.com/google.chat.v1.SearchSpacesRequest"
16972 }
16973}
16974
16975/// Response with a list of spaces corresponding to the search spaces request.
16976#[derive(Clone, Default, PartialEq)]
16977#[non_exhaustive]
16978pub struct SearchSpacesResponse {
16979 /// Deprecated: Please use the new `results` field instead.
16980 /// A page of the requested spaces. This field will be populated only when
16981 /// `useAdminAccess` is set to `true` and deprecated in favor of the new
16982 /// `results` field.
16983 #[deprecated]
16984 pub spaces: std::vec::Vec<crate::model::Space>,
16985
16986 /// A token that can be used to retrieve the next page. If this field is empty,
16987 /// there are no subsequent pages.
16988 pub next_page_token: std::string::String,
16989
16990 /// The total number of spaces that match the query, across all pages. If the
16991 /// result is over 10,000 spaces, this value is an estimate.
16992 pub total_size: i32,
16993
16994 /// Output only. The list of search results that matched the query.
16995 pub results: std::vec::Vec<crate::model::search_spaces_response::SearchSpaceResult>,
16996
16997 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16998}
16999
17000impl SearchSpacesResponse {
17001 /// Creates a new default instance.
17002 pub fn new() -> Self {
17003 std::default::Default::default()
17004 }
17005
17006 /// Sets the value of [spaces][crate::model::SearchSpacesResponse::spaces].
17007 ///
17008 /// # Example
17009 /// ```ignore,no_run
17010 /// # use google_chat_v1::model::SearchSpacesResponse;
17011 /// use google_chat_v1::model::Space;
17012 /// let x = SearchSpacesResponse::new()
17013 /// .set_spaces([
17014 /// Space::default()/* use setters */,
17015 /// Space::default()/* use (different) setters */,
17016 /// ]);
17017 /// ```
17018 #[deprecated]
17019 pub fn set_spaces<T, V>(mut self, v: T) -> Self
17020 where
17021 T: std::iter::IntoIterator<Item = V>,
17022 V: std::convert::Into<crate::model::Space>,
17023 {
17024 use std::iter::Iterator;
17025 self.spaces = v.into_iter().map(|i| i.into()).collect();
17026 self
17027 }
17028
17029 /// Sets the value of [next_page_token][crate::model::SearchSpacesResponse::next_page_token].
17030 ///
17031 /// # Example
17032 /// ```ignore,no_run
17033 /// # use google_chat_v1::model::SearchSpacesResponse;
17034 /// let x = SearchSpacesResponse::new().set_next_page_token("example");
17035 /// ```
17036 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17037 self.next_page_token = v.into();
17038 self
17039 }
17040
17041 /// Sets the value of [total_size][crate::model::SearchSpacesResponse::total_size].
17042 ///
17043 /// # Example
17044 /// ```ignore,no_run
17045 /// # use google_chat_v1::model::SearchSpacesResponse;
17046 /// let x = SearchSpacesResponse::new().set_total_size(42);
17047 /// ```
17048 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17049 self.total_size = v.into();
17050 self
17051 }
17052
17053 /// Sets the value of [results][crate::model::SearchSpacesResponse::results].
17054 ///
17055 /// # Example
17056 /// ```ignore,no_run
17057 /// # use google_chat_v1::model::SearchSpacesResponse;
17058 /// use google_chat_v1::model::search_spaces_response::SearchSpaceResult;
17059 /// let x = SearchSpacesResponse::new()
17060 /// .set_results([
17061 /// SearchSpaceResult::default()/* use setters */,
17062 /// SearchSpaceResult::default()/* use (different) setters */,
17063 /// ]);
17064 /// ```
17065 pub fn set_results<T, V>(mut self, v: T) -> Self
17066 where
17067 T: std::iter::IntoIterator<Item = V>,
17068 V: std::convert::Into<crate::model::search_spaces_response::SearchSpaceResult>,
17069 {
17070 use std::iter::Iterator;
17071 self.results = v.into_iter().map(|i| i.into()).collect();
17072 self
17073 }
17074}
17075
17076impl wkt::message::Message for SearchSpacesResponse {
17077 fn typename() -> &'static str {
17078 "type.googleapis.com/google.chat.v1.SearchSpacesResponse"
17079 }
17080}
17081
17082#[doc(hidden)]
17083impl google_cloud_gax::paginator::internal::PageableResponse for SearchSpacesResponse {
17084 type PageItem = crate::model::Space;
17085
17086 fn items(self) -> std::vec::Vec<Self::PageItem> {
17087 self.spaces
17088 }
17089
17090 fn next_page_token(&self) -> std::string::String {
17091 use std::clone::Clone;
17092 self.next_page_token.clone()
17093 }
17094}
17095
17096/// Defines additional types related to [SearchSpacesResponse].
17097pub mod search_spaces_response {
17098 #[allow(unused_imports)]
17099 use super::*;
17100
17101 /// A single result item from a space search.
17102 #[derive(Clone, Default, PartialEq)]
17103 #[non_exhaustive]
17104 pub struct SearchSpaceResult {
17105 /// Output only. The matched space.
17106 pub space: std::option::Option<crate::model::Space>,
17107
17108 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17109 }
17110
17111 impl SearchSpaceResult {
17112 /// Creates a new default instance.
17113 pub fn new() -> Self {
17114 std::default::Default::default()
17115 }
17116
17117 /// Sets the value of [space][crate::model::search_spaces_response::SearchSpaceResult::space].
17118 ///
17119 /// # Example
17120 /// ```ignore,no_run
17121 /// # use google_chat_v1::model::search_spaces_response::SearchSpaceResult;
17122 /// use google_chat_v1::model::Space;
17123 /// let x = SearchSpaceResult::new().set_space(Space::default()/* use setters */);
17124 /// ```
17125 pub fn set_space<T>(mut self, v: T) -> Self
17126 where
17127 T: std::convert::Into<crate::model::Space>,
17128 {
17129 self.space = std::option::Option::Some(v.into());
17130 self
17131 }
17132
17133 /// Sets or clears the value of [space][crate::model::search_spaces_response::SearchSpaceResult::space].
17134 ///
17135 /// # Example
17136 /// ```ignore,no_run
17137 /// # use google_chat_v1::model::search_spaces_response::SearchSpaceResult;
17138 /// use google_chat_v1::model::Space;
17139 /// let x = SearchSpaceResult::new().set_or_clear_space(Some(Space::default()/* use setters */));
17140 /// let x = SearchSpaceResult::new().set_or_clear_space(None::<Space>);
17141 /// ```
17142 pub fn set_or_clear_space<T>(mut self, v: std::option::Option<T>) -> Self
17143 where
17144 T: std::convert::Into<crate::model::Space>,
17145 {
17146 self.space = v.map(|x| x.into());
17147 self
17148 }
17149 }
17150
17151 impl wkt::message::Message for SearchSpaceResult {
17152 fn typename() -> &'static str {
17153 "type.googleapis.com/google.chat.v1.SearchSpacesResponse.SearchSpaceResult"
17154 }
17155 }
17156}
17157
17158/// Request for deleting a space.
17159#[derive(Clone, Default, PartialEq)]
17160#[non_exhaustive]
17161pub struct DeleteSpaceRequest {
17162 /// Required. Resource name of the space to delete.
17163 ///
17164 /// Format: `spaces/{space}`
17165 pub name: std::string::String,
17166
17167 /// Optional. When `true`, the method runs using the user's Google Workspace
17168 /// administrator privileges.
17169 ///
17170 /// The calling user must be a Google Workspace administrator with the
17171 /// [manage chat and spaces conversations
17172 /// privilege](https://support.google.com/a/answer/13369245).
17173 ///
17174 /// Requires the `chat.admin.delete` [OAuth 2.0
17175 /// scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).
17176 pub use_admin_access: bool,
17177
17178 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17179}
17180
17181impl DeleteSpaceRequest {
17182 /// Creates a new default instance.
17183 pub fn new() -> Self {
17184 std::default::Default::default()
17185 }
17186
17187 /// Sets the value of [name][crate::model::DeleteSpaceRequest::name].
17188 ///
17189 /// # Example
17190 /// ```ignore,no_run
17191 /// # use google_chat_v1::model::DeleteSpaceRequest;
17192 /// # let space_id = "space_id";
17193 /// let x = DeleteSpaceRequest::new().set_name(format!("spaces/{space_id}"));
17194 /// ```
17195 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17196 self.name = v.into();
17197 self
17198 }
17199
17200 /// Sets the value of [use_admin_access][crate::model::DeleteSpaceRequest::use_admin_access].
17201 ///
17202 /// # Example
17203 /// ```ignore,no_run
17204 /// # use google_chat_v1::model::DeleteSpaceRequest;
17205 /// let x = DeleteSpaceRequest::new().set_use_admin_access(true);
17206 /// ```
17207 pub fn set_use_admin_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17208 self.use_admin_access = v.into();
17209 self
17210 }
17211}
17212
17213impl wkt::message::Message for DeleteSpaceRequest {
17214 fn typename() -> &'static str {
17215 "type.googleapis.com/google.chat.v1.DeleteSpaceRequest"
17216 }
17217}
17218
17219/// Request message for completing the import process for a space.
17220#[derive(Clone, Default, PartialEq)]
17221#[non_exhaustive]
17222pub struct CompleteImportSpaceRequest {
17223 /// Required. Resource name of the import mode space.
17224 ///
17225 /// Format: `spaces/{space}`
17226 pub name: std::string::String,
17227
17228 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17229}
17230
17231impl CompleteImportSpaceRequest {
17232 /// Creates a new default instance.
17233 pub fn new() -> Self {
17234 std::default::Default::default()
17235 }
17236
17237 /// Sets the value of [name][crate::model::CompleteImportSpaceRequest::name].
17238 ///
17239 /// # Example
17240 /// ```ignore,no_run
17241 /// # use google_chat_v1::model::CompleteImportSpaceRequest;
17242 /// # let space_id = "space_id";
17243 /// let x = CompleteImportSpaceRequest::new().set_name(format!("spaces/{space_id}"));
17244 /// ```
17245 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17246 self.name = v.into();
17247 self
17248 }
17249}
17250
17251impl wkt::message::Message for CompleteImportSpaceRequest {
17252 fn typename() -> &'static str {
17253 "type.googleapis.com/google.chat.v1.CompleteImportSpaceRequest"
17254 }
17255}
17256
17257/// Response message for completing the import process for a space.
17258#[derive(Clone, Default, PartialEq)]
17259#[non_exhaustive]
17260pub struct CompleteImportSpaceResponse {
17261 /// The import mode space.
17262 pub space: std::option::Option<crate::model::Space>,
17263
17264 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17265}
17266
17267impl CompleteImportSpaceResponse {
17268 /// Creates a new default instance.
17269 pub fn new() -> Self {
17270 std::default::Default::default()
17271 }
17272
17273 /// Sets the value of [space][crate::model::CompleteImportSpaceResponse::space].
17274 ///
17275 /// # Example
17276 /// ```ignore,no_run
17277 /// # use google_chat_v1::model::CompleteImportSpaceResponse;
17278 /// use google_chat_v1::model::Space;
17279 /// let x = CompleteImportSpaceResponse::new().set_space(Space::default()/* use setters */);
17280 /// ```
17281 pub fn set_space<T>(mut self, v: T) -> Self
17282 where
17283 T: std::convert::Into<crate::model::Space>,
17284 {
17285 self.space = std::option::Option::Some(v.into());
17286 self
17287 }
17288
17289 /// Sets or clears the value of [space][crate::model::CompleteImportSpaceResponse::space].
17290 ///
17291 /// # Example
17292 /// ```ignore,no_run
17293 /// # use google_chat_v1::model::CompleteImportSpaceResponse;
17294 /// use google_chat_v1::model::Space;
17295 /// let x = CompleteImportSpaceResponse::new().set_or_clear_space(Some(Space::default()/* use setters */));
17296 /// let x = CompleteImportSpaceResponse::new().set_or_clear_space(None::<Space>);
17297 /// ```
17298 pub fn set_or_clear_space<T>(mut self, v: std::option::Option<T>) -> Self
17299 where
17300 T: std::convert::Into<crate::model::Space>,
17301 {
17302 self.space = v.map(|x| x.into());
17303 self
17304 }
17305}
17306
17307impl wkt::message::Message for CompleteImportSpaceResponse {
17308 fn typename() -> &'static str {
17309 "type.googleapis.com/google.chat.v1.CompleteImportSpaceResponse"
17310 }
17311}
17312
17313/// An event that represents a change or activity in a Google Chat space. To
17314/// learn more, see [Work with events from Google
17315/// Chat](https://developers.google.com/workspace/chat/events-overview).
17316#[derive(Clone, Default, PartialEq)]
17317#[non_exhaustive]
17318pub struct SpaceEvent {
17319 /// Resource name of the space event.
17320 ///
17321 /// Format: `spaces/{space}/spaceEvents/{spaceEvent}`
17322 pub name: std::string::String,
17323
17324 /// Time when the event occurred.
17325 pub event_time: std::option::Option<wkt::Timestamp>,
17326
17327 /// Type of space event. Each event type has a batch version, which
17328 /// represents multiple instances of the event type that occur in a short
17329 /// period of time. For `spaceEvents.list()` requests, omit batch event types
17330 /// in your query filter. By default, the server returns both event type and
17331 /// its batch version.
17332 ///
17333 /// Supported event types for
17334 /// [messages](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages):
17335 ///
17336 /// * New message: `google.workspace.chat.message.v1.created`
17337 /// * Updated message: `google.workspace.chat.message.v1.updated`
17338 /// * Deleted message: `google.workspace.chat.message.v1.deleted`
17339 /// * Multiple new messages: `google.workspace.chat.message.v1.batchCreated`
17340 /// * Multiple updated messages:
17341 /// `google.workspace.chat.message.v1.batchUpdated`
17342 /// * Multiple deleted messages:
17343 /// `google.workspace.chat.message.v1.batchDeleted`
17344 ///
17345 /// Supported event types for
17346 /// [memberships](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members):
17347 ///
17348 /// * New membership: `google.workspace.chat.membership.v1.created`
17349 /// * Updated membership: `google.workspace.chat.membership.v1.updated`
17350 /// * Deleted membership: `google.workspace.chat.membership.v1.deleted`
17351 /// * Multiple new memberships:
17352 /// `google.workspace.chat.membership.v1.batchCreated`
17353 /// * Multiple updated memberships:
17354 /// `google.workspace.chat.membership.v1.batchUpdated`
17355 /// * Multiple deleted memberships:
17356 /// `google.workspace.chat.membership.v1.batchDeleted`
17357 ///
17358 /// Supported event types for
17359 /// [reactions](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages.reactions):
17360 ///
17361 /// * New reaction: `google.workspace.chat.reaction.v1.created`
17362 /// * Deleted reaction: `google.workspace.chat.reaction.v1.deleted`
17363 /// * Multiple new reactions:
17364 /// `google.workspace.chat.reaction.v1.batchCreated`
17365 /// * Multiple deleted reactions:
17366 /// `google.workspace.chat.reaction.v1.batchDeleted`
17367 ///
17368 /// Supported event types about the
17369 /// [space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces):
17370 ///
17371 /// * Updated space: `google.workspace.chat.space.v1.updated`
17372 /// * Multiple space updates: `google.workspace.chat.space.v1.batchUpdated`
17373 pub event_type: std::string::String,
17374
17375 #[allow(missing_docs)]
17376 pub payload: std::option::Option<crate::model::space_event::Payload>,
17377
17378 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17379}
17380
17381impl SpaceEvent {
17382 /// Creates a new default instance.
17383 pub fn new() -> Self {
17384 std::default::Default::default()
17385 }
17386
17387 /// Sets the value of [name][crate::model::SpaceEvent::name].
17388 ///
17389 /// # Example
17390 /// ```ignore,no_run
17391 /// # use google_chat_v1::model::SpaceEvent;
17392 /// # let space_id = "space_id";
17393 /// # let space_event_id = "space_event_id";
17394 /// let x = SpaceEvent::new().set_name(format!("spaces/{space_id}/spaceEvents/{space_event_id}"));
17395 /// ```
17396 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17397 self.name = v.into();
17398 self
17399 }
17400
17401 /// Sets the value of [event_time][crate::model::SpaceEvent::event_time].
17402 ///
17403 /// # Example
17404 /// ```ignore,no_run
17405 /// # use google_chat_v1::model::SpaceEvent;
17406 /// use wkt::Timestamp;
17407 /// let x = SpaceEvent::new().set_event_time(Timestamp::default()/* use setters */);
17408 /// ```
17409 pub fn set_event_time<T>(mut self, v: T) -> Self
17410 where
17411 T: std::convert::Into<wkt::Timestamp>,
17412 {
17413 self.event_time = std::option::Option::Some(v.into());
17414 self
17415 }
17416
17417 /// Sets or clears the value of [event_time][crate::model::SpaceEvent::event_time].
17418 ///
17419 /// # Example
17420 /// ```ignore,no_run
17421 /// # use google_chat_v1::model::SpaceEvent;
17422 /// use wkt::Timestamp;
17423 /// let x = SpaceEvent::new().set_or_clear_event_time(Some(Timestamp::default()/* use setters */));
17424 /// let x = SpaceEvent::new().set_or_clear_event_time(None::<Timestamp>);
17425 /// ```
17426 pub fn set_or_clear_event_time<T>(mut self, v: std::option::Option<T>) -> Self
17427 where
17428 T: std::convert::Into<wkt::Timestamp>,
17429 {
17430 self.event_time = v.map(|x| x.into());
17431 self
17432 }
17433
17434 /// Sets the value of [event_type][crate::model::SpaceEvent::event_type].
17435 ///
17436 /// # Example
17437 /// ```ignore,no_run
17438 /// # use google_chat_v1::model::SpaceEvent;
17439 /// let x = SpaceEvent::new().set_event_type("example");
17440 /// ```
17441 pub fn set_event_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17442 self.event_type = v.into();
17443 self
17444 }
17445
17446 /// Sets the value of [payload][crate::model::SpaceEvent::payload].
17447 ///
17448 /// Note that all the setters affecting `payload` are mutually
17449 /// exclusive.
17450 ///
17451 /// # Example
17452 /// ```ignore,no_run
17453 /// # use google_chat_v1::model::SpaceEvent;
17454 /// use google_chat_v1::model::MessageCreatedEventData;
17455 /// let x = SpaceEvent::new().set_payload(Some(
17456 /// google_chat_v1::model::space_event::Payload::MessageCreatedEventData(MessageCreatedEventData::default().into())));
17457 /// ```
17458 pub fn set_payload<
17459 T: std::convert::Into<std::option::Option<crate::model::space_event::Payload>>,
17460 >(
17461 mut self,
17462 v: T,
17463 ) -> Self {
17464 self.payload = v.into();
17465 self
17466 }
17467
17468 /// The value of [payload][crate::model::SpaceEvent::payload]
17469 /// if it holds a `MessageCreatedEventData`, `None` if the field is not set or
17470 /// holds a different branch.
17471 pub fn message_created_event_data(
17472 &self,
17473 ) -> std::option::Option<&std::boxed::Box<crate::model::MessageCreatedEventData>> {
17474 #[allow(unreachable_patterns)]
17475 self.payload.as_ref().and_then(|v| match v {
17476 crate::model::space_event::Payload::MessageCreatedEventData(v) => {
17477 std::option::Option::Some(v)
17478 }
17479 _ => std::option::Option::None,
17480 })
17481 }
17482
17483 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
17484 /// to hold a `MessageCreatedEventData`.
17485 ///
17486 /// Note that all the setters affecting `payload` are
17487 /// mutually exclusive.
17488 ///
17489 /// # Example
17490 /// ```ignore,no_run
17491 /// # use google_chat_v1::model::SpaceEvent;
17492 /// use google_chat_v1::model::MessageCreatedEventData;
17493 /// let x = SpaceEvent::new().set_message_created_event_data(MessageCreatedEventData::default()/* use setters */);
17494 /// assert!(x.message_created_event_data().is_some());
17495 /// assert!(x.message_updated_event_data().is_none());
17496 /// assert!(x.message_deleted_event_data().is_none());
17497 /// assert!(x.message_batch_created_event_data().is_none());
17498 /// assert!(x.message_batch_updated_event_data().is_none());
17499 /// assert!(x.message_batch_deleted_event_data().is_none());
17500 /// assert!(x.space_updated_event_data().is_none());
17501 /// assert!(x.space_batch_updated_event_data().is_none());
17502 /// assert!(x.membership_created_event_data().is_none());
17503 /// assert!(x.membership_updated_event_data().is_none());
17504 /// assert!(x.membership_deleted_event_data().is_none());
17505 /// assert!(x.membership_batch_created_event_data().is_none());
17506 /// assert!(x.membership_batch_updated_event_data().is_none());
17507 /// assert!(x.membership_batch_deleted_event_data().is_none());
17508 /// assert!(x.reaction_created_event_data().is_none());
17509 /// assert!(x.reaction_deleted_event_data().is_none());
17510 /// assert!(x.reaction_batch_created_event_data().is_none());
17511 /// assert!(x.reaction_batch_deleted_event_data().is_none());
17512 /// ```
17513 pub fn set_message_created_event_data<
17514 T: std::convert::Into<std::boxed::Box<crate::model::MessageCreatedEventData>>,
17515 >(
17516 mut self,
17517 v: T,
17518 ) -> Self {
17519 self.payload = std::option::Option::Some(
17520 crate::model::space_event::Payload::MessageCreatedEventData(v.into()),
17521 );
17522 self
17523 }
17524
17525 /// The value of [payload][crate::model::SpaceEvent::payload]
17526 /// if it holds a `MessageUpdatedEventData`, `None` if the field is not set or
17527 /// holds a different branch.
17528 pub fn message_updated_event_data(
17529 &self,
17530 ) -> std::option::Option<&std::boxed::Box<crate::model::MessageUpdatedEventData>> {
17531 #[allow(unreachable_patterns)]
17532 self.payload.as_ref().and_then(|v| match v {
17533 crate::model::space_event::Payload::MessageUpdatedEventData(v) => {
17534 std::option::Option::Some(v)
17535 }
17536 _ => std::option::Option::None,
17537 })
17538 }
17539
17540 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
17541 /// to hold a `MessageUpdatedEventData`.
17542 ///
17543 /// Note that all the setters affecting `payload` are
17544 /// mutually exclusive.
17545 ///
17546 /// # Example
17547 /// ```ignore,no_run
17548 /// # use google_chat_v1::model::SpaceEvent;
17549 /// use google_chat_v1::model::MessageUpdatedEventData;
17550 /// let x = SpaceEvent::new().set_message_updated_event_data(MessageUpdatedEventData::default()/* use setters */);
17551 /// assert!(x.message_updated_event_data().is_some());
17552 /// assert!(x.message_created_event_data().is_none());
17553 /// assert!(x.message_deleted_event_data().is_none());
17554 /// assert!(x.message_batch_created_event_data().is_none());
17555 /// assert!(x.message_batch_updated_event_data().is_none());
17556 /// assert!(x.message_batch_deleted_event_data().is_none());
17557 /// assert!(x.space_updated_event_data().is_none());
17558 /// assert!(x.space_batch_updated_event_data().is_none());
17559 /// assert!(x.membership_created_event_data().is_none());
17560 /// assert!(x.membership_updated_event_data().is_none());
17561 /// assert!(x.membership_deleted_event_data().is_none());
17562 /// assert!(x.membership_batch_created_event_data().is_none());
17563 /// assert!(x.membership_batch_updated_event_data().is_none());
17564 /// assert!(x.membership_batch_deleted_event_data().is_none());
17565 /// assert!(x.reaction_created_event_data().is_none());
17566 /// assert!(x.reaction_deleted_event_data().is_none());
17567 /// assert!(x.reaction_batch_created_event_data().is_none());
17568 /// assert!(x.reaction_batch_deleted_event_data().is_none());
17569 /// ```
17570 pub fn set_message_updated_event_data<
17571 T: std::convert::Into<std::boxed::Box<crate::model::MessageUpdatedEventData>>,
17572 >(
17573 mut self,
17574 v: T,
17575 ) -> Self {
17576 self.payload = std::option::Option::Some(
17577 crate::model::space_event::Payload::MessageUpdatedEventData(v.into()),
17578 );
17579 self
17580 }
17581
17582 /// The value of [payload][crate::model::SpaceEvent::payload]
17583 /// if it holds a `MessageDeletedEventData`, `None` if the field is not set or
17584 /// holds a different branch.
17585 pub fn message_deleted_event_data(
17586 &self,
17587 ) -> std::option::Option<&std::boxed::Box<crate::model::MessageDeletedEventData>> {
17588 #[allow(unreachable_patterns)]
17589 self.payload.as_ref().and_then(|v| match v {
17590 crate::model::space_event::Payload::MessageDeletedEventData(v) => {
17591 std::option::Option::Some(v)
17592 }
17593 _ => std::option::Option::None,
17594 })
17595 }
17596
17597 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
17598 /// to hold a `MessageDeletedEventData`.
17599 ///
17600 /// Note that all the setters affecting `payload` are
17601 /// mutually exclusive.
17602 ///
17603 /// # Example
17604 /// ```ignore,no_run
17605 /// # use google_chat_v1::model::SpaceEvent;
17606 /// use google_chat_v1::model::MessageDeletedEventData;
17607 /// let x = SpaceEvent::new().set_message_deleted_event_data(MessageDeletedEventData::default()/* use setters */);
17608 /// assert!(x.message_deleted_event_data().is_some());
17609 /// assert!(x.message_created_event_data().is_none());
17610 /// assert!(x.message_updated_event_data().is_none());
17611 /// assert!(x.message_batch_created_event_data().is_none());
17612 /// assert!(x.message_batch_updated_event_data().is_none());
17613 /// assert!(x.message_batch_deleted_event_data().is_none());
17614 /// assert!(x.space_updated_event_data().is_none());
17615 /// assert!(x.space_batch_updated_event_data().is_none());
17616 /// assert!(x.membership_created_event_data().is_none());
17617 /// assert!(x.membership_updated_event_data().is_none());
17618 /// assert!(x.membership_deleted_event_data().is_none());
17619 /// assert!(x.membership_batch_created_event_data().is_none());
17620 /// assert!(x.membership_batch_updated_event_data().is_none());
17621 /// assert!(x.membership_batch_deleted_event_data().is_none());
17622 /// assert!(x.reaction_created_event_data().is_none());
17623 /// assert!(x.reaction_deleted_event_data().is_none());
17624 /// assert!(x.reaction_batch_created_event_data().is_none());
17625 /// assert!(x.reaction_batch_deleted_event_data().is_none());
17626 /// ```
17627 pub fn set_message_deleted_event_data<
17628 T: std::convert::Into<std::boxed::Box<crate::model::MessageDeletedEventData>>,
17629 >(
17630 mut self,
17631 v: T,
17632 ) -> Self {
17633 self.payload = std::option::Option::Some(
17634 crate::model::space_event::Payload::MessageDeletedEventData(v.into()),
17635 );
17636 self
17637 }
17638
17639 /// The value of [payload][crate::model::SpaceEvent::payload]
17640 /// if it holds a `MessageBatchCreatedEventData`, `None` if the field is not set or
17641 /// holds a different branch.
17642 pub fn message_batch_created_event_data(
17643 &self,
17644 ) -> std::option::Option<&std::boxed::Box<crate::model::MessageBatchCreatedEventData>> {
17645 #[allow(unreachable_patterns)]
17646 self.payload.as_ref().and_then(|v| match v {
17647 crate::model::space_event::Payload::MessageBatchCreatedEventData(v) => {
17648 std::option::Option::Some(v)
17649 }
17650 _ => std::option::Option::None,
17651 })
17652 }
17653
17654 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
17655 /// to hold a `MessageBatchCreatedEventData`.
17656 ///
17657 /// Note that all the setters affecting `payload` are
17658 /// mutually exclusive.
17659 ///
17660 /// # Example
17661 /// ```ignore,no_run
17662 /// # use google_chat_v1::model::SpaceEvent;
17663 /// use google_chat_v1::model::MessageBatchCreatedEventData;
17664 /// let x = SpaceEvent::new().set_message_batch_created_event_data(MessageBatchCreatedEventData::default()/* use setters */);
17665 /// assert!(x.message_batch_created_event_data().is_some());
17666 /// assert!(x.message_created_event_data().is_none());
17667 /// assert!(x.message_updated_event_data().is_none());
17668 /// assert!(x.message_deleted_event_data().is_none());
17669 /// assert!(x.message_batch_updated_event_data().is_none());
17670 /// assert!(x.message_batch_deleted_event_data().is_none());
17671 /// assert!(x.space_updated_event_data().is_none());
17672 /// assert!(x.space_batch_updated_event_data().is_none());
17673 /// assert!(x.membership_created_event_data().is_none());
17674 /// assert!(x.membership_updated_event_data().is_none());
17675 /// assert!(x.membership_deleted_event_data().is_none());
17676 /// assert!(x.membership_batch_created_event_data().is_none());
17677 /// assert!(x.membership_batch_updated_event_data().is_none());
17678 /// assert!(x.membership_batch_deleted_event_data().is_none());
17679 /// assert!(x.reaction_created_event_data().is_none());
17680 /// assert!(x.reaction_deleted_event_data().is_none());
17681 /// assert!(x.reaction_batch_created_event_data().is_none());
17682 /// assert!(x.reaction_batch_deleted_event_data().is_none());
17683 /// ```
17684 pub fn set_message_batch_created_event_data<
17685 T: std::convert::Into<std::boxed::Box<crate::model::MessageBatchCreatedEventData>>,
17686 >(
17687 mut self,
17688 v: T,
17689 ) -> Self {
17690 self.payload = std::option::Option::Some(
17691 crate::model::space_event::Payload::MessageBatchCreatedEventData(v.into()),
17692 );
17693 self
17694 }
17695
17696 /// The value of [payload][crate::model::SpaceEvent::payload]
17697 /// if it holds a `MessageBatchUpdatedEventData`, `None` if the field is not set or
17698 /// holds a different branch.
17699 pub fn message_batch_updated_event_data(
17700 &self,
17701 ) -> std::option::Option<&std::boxed::Box<crate::model::MessageBatchUpdatedEventData>> {
17702 #[allow(unreachable_patterns)]
17703 self.payload.as_ref().and_then(|v| match v {
17704 crate::model::space_event::Payload::MessageBatchUpdatedEventData(v) => {
17705 std::option::Option::Some(v)
17706 }
17707 _ => std::option::Option::None,
17708 })
17709 }
17710
17711 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
17712 /// to hold a `MessageBatchUpdatedEventData`.
17713 ///
17714 /// Note that all the setters affecting `payload` are
17715 /// mutually exclusive.
17716 ///
17717 /// # Example
17718 /// ```ignore,no_run
17719 /// # use google_chat_v1::model::SpaceEvent;
17720 /// use google_chat_v1::model::MessageBatchUpdatedEventData;
17721 /// let x = SpaceEvent::new().set_message_batch_updated_event_data(MessageBatchUpdatedEventData::default()/* use setters */);
17722 /// assert!(x.message_batch_updated_event_data().is_some());
17723 /// assert!(x.message_created_event_data().is_none());
17724 /// assert!(x.message_updated_event_data().is_none());
17725 /// assert!(x.message_deleted_event_data().is_none());
17726 /// assert!(x.message_batch_created_event_data().is_none());
17727 /// assert!(x.message_batch_deleted_event_data().is_none());
17728 /// assert!(x.space_updated_event_data().is_none());
17729 /// assert!(x.space_batch_updated_event_data().is_none());
17730 /// assert!(x.membership_created_event_data().is_none());
17731 /// assert!(x.membership_updated_event_data().is_none());
17732 /// assert!(x.membership_deleted_event_data().is_none());
17733 /// assert!(x.membership_batch_created_event_data().is_none());
17734 /// assert!(x.membership_batch_updated_event_data().is_none());
17735 /// assert!(x.membership_batch_deleted_event_data().is_none());
17736 /// assert!(x.reaction_created_event_data().is_none());
17737 /// assert!(x.reaction_deleted_event_data().is_none());
17738 /// assert!(x.reaction_batch_created_event_data().is_none());
17739 /// assert!(x.reaction_batch_deleted_event_data().is_none());
17740 /// ```
17741 pub fn set_message_batch_updated_event_data<
17742 T: std::convert::Into<std::boxed::Box<crate::model::MessageBatchUpdatedEventData>>,
17743 >(
17744 mut self,
17745 v: T,
17746 ) -> Self {
17747 self.payload = std::option::Option::Some(
17748 crate::model::space_event::Payload::MessageBatchUpdatedEventData(v.into()),
17749 );
17750 self
17751 }
17752
17753 /// The value of [payload][crate::model::SpaceEvent::payload]
17754 /// if it holds a `MessageBatchDeletedEventData`, `None` if the field is not set or
17755 /// holds a different branch.
17756 pub fn message_batch_deleted_event_data(
17757 &self,
17758 ) -> std::option::Option<&std::boxed::Box<crate::model::MessageBatchDeletedEventData>> {
17759 #[allow(unreachable_patterns)]
17760 self.payload.as_ref().and_then(|v| match v {
17761 crate::model::space_event::Payload::MessageBatchDeletedEventData(v) => {
17762 std::option::Option::Some(v)
17763 }
17764 _ => std::option::Option::None,
17765 })
17766 }
17767
17768 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
17769 /// to hold a `MessageBatchDeletedEventData`.
17770 ///
17771 /// Note that all the setters affecting `payload` are
17772 /// mutually exclusive.
17773 ///
17774 /// # Example
17775 /// ```ignore,no_run
17776 /// # use google_chat_v1::model::SpaceEvent;
17777 /// use google_chat_v1::model::MessageBatchDeletedEventData;
17778 /// let x = SpaceEvent::new().set_message_batch_deleted_event_data(MessageBatchDeletedEventData::default()/* use setters */);
17779 /// assert!(x.message_batch_deleted_event_data().is_some());
17780 /// assert!(x.message_created_event_data().is_none());
17781 /// assert!(x.message_updated_event_data().is_none());
17782 /// assert!(x.message_deleted_event_data().is_none());
17783 /// assert!(x.message_batch_created_event_data().is_none());
17784 /// assert!(x.message_batch_updated_event_data().is_none());
17785 /// assert!(x.space_updated_event_data().is_none());
17786 /// assert!(x.space_batch_updated_event_data().is_none());
17787 /// assert!(x.membership_created_event_data().is_none());
17788 /// assert!(x.membership_updated_event_data().is_none());
17789 /// assert!(x.membership_deleted_event_data().is_none());
17790 /// assert!(x.membership_batch_created_event_data().is_none());
17791 /// assert!(x.membership_batch_updated_event_data().is_none());
17792 /// assert!(x.membership_batch_deleted_event_data().is_none());
17793 /// assert!(x.reaction_created_event_data().is_none());
17794 /// assert!(x.reaction_deleted_event_data().is_none());
17795 /// assert!(x.reaction_batch_created_event_data().is_none());
17796 /// assert!(x.reaction_batch_deleted_event_data().is_none());
17797 /// ```
17798 pub fn set_message_batch_deleted_event_data<
17799 T: std::convert::Into<std::boxed::Box<crate::model::MessageBatchDeletedEventData>>,
17800 >(
17801 mut self,
17802 v: T,
17803 ) -> Self {
17804 self.payload = std::option::Option::Some(
17805 crate::model::space_event::Payload::MessageBatchDeletedEventData(v.into()),
17806 );
17807 self
17808 }
17809
17810 /// The value of [payload][crate::model::SpaceEvent::payload]
17811 /// if it holds a `SpaceUpdatedEventData`, `None` if the field is not set or
17812 /// holds a different branch.
17813 pub fn space_updated_event_data(
17814 &self,
17815 ) -> std::option::Option<&std::boxed::Box<crate::model::SpaceUpdatedEventData>> {
17816 #[allow(unreachable_patterns)]
17817 self.payload.as_ref().and_then(|v| match v {
17818 crate::model::space_event::Payload::SpaceUpdatedEventData(v) => {
17819 std::option::Option::Some(v)
17820 }
17821 _ => std::option::Option::None,
17822 })
17823 }
17824
17825 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
17826 /// to hold a `SpaceUpdatedEventData`.
17827 ///
17828 /// Note that all the setters affecting `payload` are
17829 /// mutually exclusive.
17830 ///
17831 /// # Example
17832 /// ```ignore,no_run
17833 /// # use google_chat_v1::model::SpaceEvent;
17834 /// use google_chat_v1::model::SpaceUpdatedEventData;
17835 /// let x = SpaceEvent::new().set_space_updated_event_data(SpaceUpdatedEventData::default()/* use setters */);
17836 /// assert!(x.space_updated_event_data().is_some());
17837 /// assert!(x.message_created_event_data().is_none());
17838 /// assert!(x.message_updated_event_data().is_none());
17839 /// assert!(x.message_deleted_event_data().is_none());
17840 /// assert!(x.message_batch_created_event_data().is_none());
17841 /// assert!(x.message_batch_updated_event_data().is_none());
17842 /// assert!(x.message_batch_deleted_event_data().is_none());
17843 /// assert!(x.space_batch_updated_event_data().is_none());
17844 /// assert!(x.membership_created_event_data().is_none());
17845 /// assert!(x.membership_updated_event_data().is_none());
17846 /// assert!(x.membership_deleted_event_data().is_none());
17847 /// assert!(x.membership_batch_created_event_data().is_none());
17848 /// assert!(x.membership_batch_updated_event_data().is_none());
17849 /// assert!(x.membership_batch_deleted_event_data().is_none());
17850 /// assert!(x.reaction_created_event_data().is_none());
17851 /// assert!(x.reaction_deleted_event_data().is_none());
17852 /// assert!(x.reaction_batch_created_event_data().is_none());
17853 /// assert!(x.reaction_batch_deleted_event_data().is_none());
17854 /// ```
17855 pub fn set_space_updated_event_data<
17856 T: std::convert::Into<std::boxed::Box<crate::model::SpaceUpdatedEventData>>,
17857 >(
17858 mut self,
17859 v: T,
17860 ) -> Self {
17861 self.payload = std::option::Option::Some(
17862 crate::model::space_event::Payload::SpaceUpdatedEventData(v.into()),
17863 );
17864 self
17865 }
17866
17867 /// The value of [payload][crate::model::SpaceEvent::payload]
17868 /// if it holds a `SpaceBatchUpdatedEventData`, `None` if the field is not set or
17869 /// holds a different branch.
17870 pub fn space_batch_updated_event_data(
17871 &self,
17872 ) -> std::option::Option<&std::boxed::Box<crate::model::SpaceBatchUpdatedEventData>> {
17873 #[allow(unreachable_patterns)]
17874 self.payload.as_ref().and_then(|v| match v {
17875 crate::model::space_event::Payload::SpaceBatchUpdatedEventData(v) => {
17876 std::option::Option::Some(v)
17877 }
17878 _ => std::option::Option::None,
17879 })
17880 }
17881
17882 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
17883 /// to hold a `SpaceBatchUpdatedEventData`.
17884 ///
17885 /// Note that all the setters affecting `payload` are
17886 /// mutually exclusive.
17887 ///
17888 /// # Example
17889 /// ```ignore,no_run
17890 /// # use google_chat_v1::model::SpaceEvent;
17891 /// use google_chat_v1::model::SpaceBatchUpdatedEventData;
17892 /// let x = SpaceEvent::new().set_space_batch_updated_event_data(SpaceBatchUpdatedEventData::default()/* use setters */);
17893 /// assert!(x.space_batch_updated_event_data().is_some());
17894 /// assert!(x.message_created_event_data().is_none());
17895 /// assert!(x.message_updated_event_data().is_none());
17896 /// assert!(x.message_deleted_event_data().is_none());
17897 /// assert!(x.message_batch_created_event_data().is_none());
17898 /// assert!(x.message_batch_updated_event_data().is_none());
17899 /// assert!(x.message_batch_deleted_event_data().is_none());
17900 /// assert!(x.space_updated_event_data().is_none());
17901 /// assert!(x.membership_created_event_data().is_none());
17902 /// assert!(x.membership_updated_event_data().is_none());
17903 /// assert!(x.membership_deleted_event_data().is_none());
17904 /// assert!(x.membership_batch_created_event_data().is_none());
17905 /// assert!(x.membership_batch_updated_event_data().is_none());
17906 /// assert!(x.membership_batch_deleted_event_data().is_none());
17907 /// assert!(x.reaction_created_event_data().is_none());
17908 /// assert!(x.reaction_deleted_event_data().is_none());
17909 /// assert!(x.reaction_batch_created_event_data().is_none());
17910 /// assert!(x.reaction_batch_deleted_event_data().is_none());
17911 /// ```
17912 pub fn set_space_batch_updated_event_data<
17913 T: std::convert::Into<std::boxed::Box<crate::model::SpaceBatchUpdatedEventData>>,
17914 >(
17915 mut self,
17916 v: T,
17917 ) -> Self {
17918 self.payload = std::option::Option::Some(
17919 crate::model::space_event::Payload::SpaceBatchUpdatedEventData(v.into()),
17920 );
17921 self
17922 }
17923
17924 /// The value of [payload][crate::model::SpaceEvent::payload]
17925 /// if it holds a `MembershipCreatedEventData`, `None` if the field is not set or
17926 /// holds a different branch.
17927 pub fn membership_created_event_data(
17928 &self,
17929 ) -> std::option::Option<&std::boxed::Box<crate::model::MembershipCreatedEventData>> {
17930 #[allow(unreachable_patterns)]
17931 self.payload.as_ref().and_then(|v| match v {
17932 crate::model::space_event::Payload::MembershipCreatedEventData(v) => {
17933 std::option::Option::Some(v)
17934 }
17935 _ => std::option::Option::None,
17936 })
17937 }
17938
17939 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
17940 /// to hold a `MembershipCreatedEventData`.
17941 ///
17942 /// Note that all the setters affecting `payload` are
17943 /// mutually exclusive.
17944 ///
17945 /// # Example
17946 /// ```ignore,no_run
17947 /// # use google_chat_v1::model::SpaceEvent;
17948 /// use google_chat_v1::model::MembershipCreatedEventData;
17949 /// let x = SpaceEvent::new().set_membership_created_event_data(MembershipCreatedEventData::default()/* use setters */);
17950 /// assert!(x.membership_created_event_data().is_some());
17951 /// assert!(x.message_created_event_data().is_none());
17952 /// assert!(x.message_updated_event_data().is_none());
17953 /// assert!(x.message_deleted_event_data().is_none());
17954 /// assert!(x.message_batch_created_event_data().is_none());
17955 /// assert!(x.message_batch_updated_event_data().is_none());
17956 /// assert!(x.message_batch_deleted_event_data().is_none());
17957 /// assert!(x.space_updated_event_data().is_none());
17958 /// assert!(x.space_batch_updated_event_data().is_none());
17959 /// assert!(x.membership_updated_event_data().is_none());
17960 /// assert!(x.membership_deleted_event_data().is_none());
17961 /// assert!(x.membership_batch_created_event_data().is_none());
17962 /// assert!(x.membership_batch_updated_event_data().is_none());
17963 /// assert!(x.membership_batch_deleted_event_data().is_none());
17964 /// assert!(x.reaction_created_event_data().is_none());
17965 /// assert!(x.reaction_deleted_event_data().is_none());
17966 /// assert!(x.reaction_batch_created_event_data().is_none());
17967 /// assert!(x.reaction_batch_deleted_event_data().is_none());
17968 /// ```
17969 pub fn set_membership_created_event_data<
17970 T: std::convert::Into<std::boxed::Box<crate::model::MembershipCreatedEventData>>,
17971 >(
17972 mut self,
17973 v: T,
17974 ) -> Self {
17975 self.payload = std::option::Option::Some(
17976 crate::model::space_event::Payload::MembershipCreatedEventData(v.into()),
17977 );
17978 self
17979 }
17980
17981 /// The value of [payload][crate::model::SpaceEvent::payload]
17982 /// if it holds a `MembershipUpdatedEventData`, `None` if the field is not set or
17983 /// holds a different branch.
17984 pub fn membership_updated_event_data(
17985 &self,
17986 ) -> std::option::Option<&std::boxed::Box<crate::model::MembershipUpdatedEventData>> {
17987 #[allow(unreachable_patterns)]
17988 self.payload.as_ref().and_then(|v| match v {
17989 crate::model::space_event::Payload::MembershipUpdatedEventData(v) => {
17990 std::option::Option::Some(v)
17991 }
17992 _ => std::option::Option::None,
17993 })
17994 }
17995
17996 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
17997 /// to hold a `MembershipUpdatedEventData`.
17998 ///
17999 /// Note that all the setters affecting `payload` are
18000 /// mutually exclusive.
18001 ///
18002 /// # Example
18003 /// ```ignore,no_run
18004 /// # use google_chat_v1::model::SpaceEvent;
18005 /// use google_chat_v1::model::MembershipUpdatedEventData;
18006 /// let x = SpaceEvent::new().set_membership_updated_event_data(MembershipUpdatedEventData::default()/* use setters */);
18007 /// assert!(x.membership_updated_event_data().is_some());
18008 /// assert!(x.message_created_event_data().is_none());
18009 /// assert!(x.message_updated_event_data().is_none());
18010 /// assert!(x.message_deleted_event_data().is_none());
18011 /// assert!(x.message_batch_created_event_data().is_none());
18012 /// assert!(x.message_batch_updated_event_data().is_none());
18013 /// assert!(x.message_batch_deleted_event_data().is_none());
18014 /// assert!(x.space_updated_event_data().is_none());
18015 /// assert!(x.space_batch_updated_event_data().is_none());
18016 /// assert!(x.membership_created_event_data().is_none());
18017 /// assert!(x.membership_deleted_event_data().is_none());
18018 /// assert!(x.membership_batch_created_event_data().is_none());
18019 /// assert!(x.membership_batch_updated_event_data().is_none());
18020 /// assert!(x.membership_batch_deleted_event_data().is_none());
18021 /// assert!(x.reaction_created_event_data().is_none());
18022 /// assert!(x.reaction_deleted_event_data().is_none());
18023 /// assert!(x.reaction_batch_created_event_data().is_none());
18024 /// assert!(x.reaction_batch_deleted_event_data().is_none());
18025 /// ```
18026 pub fn set_membership_updated_event_data<
18027 T: std::convert::Into<std::boxed::Box<crate::model::MembershipUpdatedEventData>>,
18028 >(
18029 mut self,
18030 v: T,
18031 ) -> Self {
18032 self.payload = std::option::Option::Some(
18033 crate::model::space_event::Payload::MembershipUpdatedEventData(v.into()),
18034 );
18035 self
18036 }
18037
18038 /// The value of [payload][crate::model::SpaceEvent::payload]
18039 /// if it holds a `MembershipDeletedEventData`, `None` if the field is not set or
18040 /// holds a different branch.
18041 pub fn membership_deleted_event_data(
18042 &self,
18043 ) -> std::option::Option<&std::boxed::Box<crate::model::MembershipDeletedEventData>> {
18044 #[allow(unreachable_patterns)]
18045 self.payload.as_ref().and_then(|v| match v {
18046 crate::model::space_event::Payload::MembershipDeletedEventData(v) => {
18047 std::option::Option::Some(v)
18048 }
18049 _ => std::option::Option::None,
18050 })
18051 }
18052
18053 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
18054 /// to hold a `MembershipDeletedEventData`.
18055 ///
18056 /// Note that all the setters affecting `payload` are
18057 /// mutually exclusive.
18058 ///
18059 /// # Example
18060 /// ```ignore,no_run
18061 /// # use google_chat_v1::model::SpaceEvent;
18062 /// use google_chat_v1::model::MembershipDeletedEventData;
18063 /// let x = SpaceEvent::new().set_membership_deleted_event_data(MembershipDeletedEventData::default()/* use setters */);
18064 /// assert!(x.membership_deleted_event_data().is_some());
18065 /// assert!(x.message_created_event_data().is_none());
18066 /// assert!(x.message_updated_event_data().is_none());
18067 /// assert!(x.message_deleted_event_data().is_none());
18068 /// assert!(x.message_batch_created_event_data().is_none());
18069 /// assert!(x.message_batch_updated_event_data().is_none());
18070 /// assert!(x.message_batch_deleted_event_data().is_none());
18071 /// assert!(x.space_updated_event_data().is_none());
18072 /// assert!(x.space_batch_updated_event_data().is_none());
18073 /// assert!(x.membership_created_event_data().is_none());
18074 /// assert!(x.membership_updated_event_data().is_none());
18075 /// assert!(x.membership_batch_created_event_data().is_none());
18076 /// assert!(x.membership_batch_updated_event_data().is_none());
18077 /// assert!(x.membership_batch_deleted_event_data().is_none());
18078 /// assert!(x.reaction_created_event_data().is_none());
18079 /// assert!(x.reaction_deleted_event_data().is_none());
18080 /// assert!(x.reaction_batch_created_event_data().is_none());
18081 /// assert!(x.reaction_batch_deleted_event_data().is_none());
18082 /// ```
18083 pub fn set_membership_deleted_event_data<
18084 T: std::convert::Into<std::boxed::Box<crate::model::MembershipDeletedEventData>>,
18085 >(
18086 mut self,
18087 v: T,
18088 ) -> Self {
18089 self.payload = std::option::Option::Some(
18090 crate::model::space_event::Payload::MembershipDeletedEventData(v.into()),
18091 );
18092 self
18093 }
18094
18095 /// The value of [payload][crate::model::SpaceEvent::payload]
18096 /// if it holds a `MembershipBatchCreatedEventData`, `None` if the field is not set or
18097 /// holds a different branch.
18098 pub fn membership_batch_created_event_data(
18099 &self,
18100 ) -> std::option::Option<&std::boxed::Box<crate::model::MembershipBatchCreatedEventData>> {
18101 #[allow(unreachable_patterns)]
18102 self.payload.as_ref().and_then(|v| match v {
18103 crate::model::space_event::Payload::MembershipBatchCreatedEventData(v) => {
18104 std::option::Option::Some(v)
18105 }
18106 _ => std::option::Option::None,
18107 })
18108 }
18109
18110 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
18111 /// to hold a `MembershipBatchCreatedEventData`.
18112 ///
18113 /// Note that all the setters affecting `payload` are
18114 /// mutually exclusive.
18115 ///
18116 /// # Example
18117 /// ```ignore,no_run
18118 /// # use google_chat_v1::model::SpaceEvent;
18119 /// use google_chat_v1::model::MembershipBatchCreatedEventData;
18120 /// let x = SpaceEvent::new().set_membership_batch_created_event_data(MembershipBatchCreatedEventData::default()/* use setters */);
18121 /// assert!(x.membership_batch_created_event_data().is_some());
18122 /// assert!(x.message_created_event_data().is_none());
18123 /// assert!(x.message_updated_event_data().is_none());
18124 /// assert!(x.message_deleted_event_data().is_none());
18125 /// assert!(x.message_batch_created_event_data().is_none());
18126 /// assert!(x.message_batch_updated_event_data().is_none());
18127 /// assert!(x.message_batch_deleted_event_data().is_none());
18128 /// assert!(x.space_updated_event_data().is_none());
18129 /// assert!(x.space_batch_updated_event_data().is_none());
18130 /// assert!(x.membership_created_event_data().is_none());
18131 /// assert!(x.membership_updated_event_data().is_none());
18132 /// assert!(x.membership_deleted_event_data().is_none());
18133 /// assert!(x.membership_batch_updated_event_data().is_none());
18134 /// assert!(x.membership_batch_deleted_event_data().is_none());
18135 /// assert!(x.reaction_created_event_data().is_none());
18136 /// assert!(x.reaction_deleted_event_data().is_none());
18137 /// assert!(x.reaction_batch_created_event_data().is_none());
18138 /// assert!(x.reaction_batch_deleted_event_data().is_none());
18139 /// ```
18140 pub fn set_membership_batch_created_event_data<
18141 T: std::convert::Into<std::boxed::Box<crate::model::MembershipBatchCreatedEventData>>,
18142 >(
18143 mut self,
18144 v: T,
18145 ) -> Self {
18146 self.payload = std::option::Option::Some(
18147 crate::model::space_event::Payload::MembershipBatchCreatedEventData(v.into()),
18148 );
18149 self
18150 }
18151
18152 /// The value of [payload][crate::model::SpaceEvent::payload]
18153 /// if it holds a `MembershipBatchUpdatedEventData`, `None` if the field is not set or
18154 /// holds a different branch.
18155 pub fn membership_batch_updated_event_data(
18156 &self,
18157 ) -> std::option::Option<&std::boxed::Box<crate::model::MembershipBatchUpdatedEventData>> {
18158 #[allow(unreachable_patterns)]
18159 self.payload.as_ref().and_then(|v| match v {
18160 crate::model::space_event::Payload::MembershipBatchUpdatedEventData(v) => {
18161 std::option::Option::Some(v)
18162 }
18163 _ => std::option::Option::None,
18164 })
18165 }
18166
18167 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
18168 /// to hold a `MembershipBatchUpdatedEventData`.
18169 ///
18170 /// Note that all the setters affecting `payload` are
18171 /// mutually exclusive.
18172 ///
18173 /// # Example
18174 /// ```ignore,no_run
18175 /// # use google_chat_v1::model::SpaceEvent;
18176 /// use google_chat_v1::model::MembershipBatchUpdatedEventData;
18177 /// let x = SpaceEvent::new().set_membership_batch_updated_event_data(MembershipBatchUpdatedEventData::default()/* use setters */);
18178 /// assert!(x.membership_batch_updated_event_data().is_some());
18179 /// assert!(x.message_created_event_data().is_none());
18180 /// assert!(x.message_updated_event_data().is_none());
18181 /// assert!(x.message_deleted_event_data().is_none());
18182 /// assert!(x.message_batch_created_event_data().is_none());
18183 /// assert!(x.message_batch_updated_event_data().is_none());
18184 /// assert!(x.message_batch_deleted_event_data().is_none());
18185 /// assert!(x.space_updated_event_data().is_none());
18186 /// assert!(x.space_batch_updated_event_data().is_none());
18187 /// assert!(x.membership_created_event_data().is_none());
18188 /// assert!(x.membership_updated_event_data().is_none());
18189 /// assert!(x.membership_deleted_event_data().is_none());
18190 /// assert!(x.membership_batch_created_event_data().is_none());
18191 /// assert!(x.membership_batch_deleted_event_data().is_none());
18192 /// assert!(x.reaction_created_event_data().is_none());
18193 /// assert!(x.reaction_deleted_event_data().is_none());
18194 /// assert!(x.reaction_batch_created_event_data().is_none());
18195 /// assert!(x.reaction_batch_deleted_event_data().is_none());
18196 /// ```
18197 pub fn set_membership_batch_updated_event_data<
18198 T: std::convert::Into<std::boxed::Box<crate::model::MembershipBatchUpdatedEventData>>,
18199 >(
18200 mut self,
18201 v: T,
18202 ) -> Self {
18203 self.payload = std::option::Option::Some(
18204 crate::model::space_event::Payload::MembershipBatchUpdatedEventData(v.into()),
18205 );
18206 self
18207 }
18208
18209 /// The value of [payload][crate::model::SpaceEvent::payload]
18210 /// if it holds a `MembershipBatchDeletedEventData`, `None` if the field is not set or
18211 /// holds a different branch.
18212 pub fn membership_batch_deleted_event_data(
18213 &self,
18214 ) -> std::option::Option<&std::boxed::Box<crate::model::MembershipBatchDeletedEventData>> {
18215 #[allow(unreachable_patterns)]
18216 self.payload.as_ref().and_then(|v| match v {
18217 crate::model::space_event::Payload::MembershipBatchDeletedEventData(v) => {
18218 std::option::Option::Some(v)
18219 }
18220 _ => std::option::Option::None,
18221 })
18222 }
18223
18224 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
18225 /// to hold a `MembershipBatchDeletedEventData`.
18226 ///
18227 /// Note that all the setters affecting `payload` are
18228 /// mutually exclusive.
18229 ///
18230 /// # Example
18231 /// ```ignore,no_run
18232 /// # use google_chat_v1::model::SpaceEvent;
18233 /// use google_chat_v1::model::MembershipBatchDeletedEventData;
18234 /// let x = SpaceEvent::new().set_membership_batch_deleted_event_data(MembershipBatchDeletedEventData::default()/* use setters */);
18235 /// assert!(x.membership_batch_deleted_event_data().is_some());
18236 /// assert!(x.message_created_event_data().is_none());
18237 /// assert!(x.message_updated_event_data().is_none());
18238 /// assert!(x.message_deleted_event_data().is_none());
18239 /// assert!(x.message_batch_created_event_data().is_none());
18240 /// assert!(x.message_batch_updated_event_data().is_none());
18241 /// assert!(x.message_batch_deleted_event_data().is_none());
18242 /// assert!(x.space_updated_event_data().is_none());
18243 /// assert!(x.space_batch_updated_event_data().is_none());
18244 /// assert!(x.membership_created_event_data().is_none());
18245 /// assert!(x.membership_updated_event_data().is_none());
18246 /// assert!(x.membership_deleted_event_data().is_none());
18247 /// assert!(x.membership_batch_created_event_data().is_none());
18248 /// assert!(x.membership_batch_updated_event_data().is_none());
18249 /// assert!(x.reaction_created_event_data().is_none());
18250 /// assert!(x.reaction_deleted_event_data().is_none());
18251 /// assert!(x.reaction_batch_created_event_data().is_none());
18252 /// assert!(x.reaction_batch_deleted_event_data().is_none());
18253 /// ```
18254 pub fn set_membership_batch_deleted_event_data<
18255 T: std::convert::Into<std::boxed::Box<crate::model::MembershipBatchDeletedEventData>>,
18256 >(
18257 mut self,
18258 v: T,
18259 ) -> Self {
18260 self.payload = std::option::Option::Some(
18261 crate::model::space_event::Payload::MembershipBatchDeletedEventData(v.into()),
18262 );
18263 self
18264 }
18265
18266 /// The value of [payload][crate::model::SpaceEvent::payload]
18267 /// if it holds a `ReactionCreatedEventData`, `None` if the field is not set or
18268 /// holds a different branch.
18269 pub fn reaction_created_event_data(
18270 &self,
18271 ) -> std::option::Option<&std::boxed::Box<crate::model::ReactionCreatedEventData>> {
18272 #[allow(unreachable_patterns)]
18273 self.payload.as_ref().and_then(|v| match v {
18274 crate::model::space_event::Payload::ReactionCreatedEventData(v) => {
18275 std::option::Option::Some(v)
18276 }
18277 _ => std::option::Option::None,
18278 })
18279 }
18280
18281 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
18282 /// to hold a `ReactionCreatedEventData`.
18283 ///
18284 /// Note that all the setters affecting `payload` are
18285 /// mutually exclusive.
18286 ///
18287 /// # Example
18288 /// ```ignore,no_run
18289 /// # use google_chat_v1::model::SpaceEvent;
18290 /// use google_chat_v1::model::ReactionCreatedEventData;
18291 /// let x = SpaceEvent::new().set_reaction_created_event_data(ReactionCreatedEventData::default()/* use setters */);
18292 /// assert!(x.reaction_created_event_data().is_some());
18293 /// assert!(x.message_created_event_data().is_none());
18294 /// assert!(x.message_updated_event_data().is_none());
18295 /// assert!(x.message_deleted_event_data().is_none());
18296 /// assert!(x.message_batch_created_event_data().is_none());
18297 /// assert!(x.message_batch_updated_event_data().is_none());
18298 /// assert!(x.message_batch_deleted_event_data().is_none());
18299 /// assert!(x.space_updated_event_data().is_none());
18300 /// assert!(x.space_batch_updated_event_data().is_none());
18301 /// assert!(x.membership_created_event_data().is_none());
18302 /// assert!(x.membership_updated_event_data().is_none());
18303 /// assert!(x.membership_deleted_event_data().is_none());
18304 /// assert!(x.membership_batch_created_event_data().is_none());
18305 /// assert!(x.membership_batch_updated_event_data().is_none());
18306 /// assert!(x.membership_batch_deleted_event_data().is_none());
18307 /// assert!(x.reaction_deleted_event_data().is_none());
18308 /// assert!(x.reaction_batch_created_event_data().is_none());
18309 /// assert!(x.reaction_batch_deleted_event_data().is_none());
18310 /// ```
18311 pub fn set_reaction_created_event_data<
18312 T: std::convert::Into<std::boxed::Box<crate::model::ReactionCreatedEventData>>,
18313 >(
18314 mut self,
18315 v: T,
18316 ) -> Self {
18317 self.payload = std::option::Option::Some(
18318 crate::model::space_event::Payload::ReactionCreatedEventData(v.into()),
18319 );
18320 self
18321 }
18322
18323 /// The value of [payload][crate::model::SpaceEvent::payload]
18324 /// if it holds a `ReactionDeletedEventData`, `None` if the field is not set or
18325 /// holds a different branch.
18326 pub fn reaction_deleted_event_data(
18327 &self,
18328 ) -> std::option::Option<&std::boxed::Box<crate::model::ReactionDeletedEventData>> {
18329 #[allow(unreachable_patterns)]
18330 self.payload.as_ref().and_then(|v| match v {
18331 crate::model::space_event::Payload::ReactionDeletedEventData(v) => {
18332 std::option::Option::Some(v)
18333 }
18334 _ => std::option::Option::None,
18335 })
18336 }
18337
18338 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
18339 /// to hold a `ReactionDeletedEventData`.
18340 ///
18341 /// Note that all the setters affecting `payload` are
18342 /// mutually exclusive.
18343 ///
18344 /// # Example
18345 /// ```ignore,no_run
18346 /// # use google_chat_v1::model::SpaceEvent;
18347 /// use google_chat_v1::model::ReactionDeletedEventData;
18348 /// let x = SpaceEvent::new().set_reaction_deleted_event_data(ReactionDeletedEventData::default()/* use setters */);
18349 /// assert!(x.reaction_deleted_event_data().is_some());
18350 /// assert!(x.message_created_event_data().is_none());
18351 /// assert!(x.message_updated_event_data().is_none());
18352 /// assert!(x.message_deleted_event_data().is_none());
18353 /// assert!(x.message_batch_created_event_data().is_none());
18354 /// assert!(x.message_batch_updated_event_data().is_none());
18355 /// assert!(x.message_batch_deleted_event_data().is_none());
18356 /// assert!(x.space_updated_event_data().is_none());
18357 /// assert!(x.space_batch_updated_event_data().is_none());
18358 /// assert!(x.membership_created_event_data().is_none());
18359 /// assert!(x.membership_updated_event_data().is_none());
18360 /// assert!(x.membership_deleted_event_data().is_none());
18361 /// assert!(x.membership_batch_created_event_data().is_none());
18362 /// assert!(x.membership_batch_updated_event_data().is_none());
18363 /// assert!(x.membership_batch_deleted_event_data().is_none());
18364 /// assert!(x.reaction_created_event_data().is_none());
18365 /// assert!(x.reaction_batch_created_event_data().is_none());
18366 /// assert!(x.reaction_batch_deleted_event_data().is_none());
18367 /// ```
18368 pub fn set_reaction_deleted_event_data<
18369 T: std::convert::Into<std::boxed::Box<crate::model::ReactionDeletedEventData>>,
18370 >(
18371 mut self,
18372 v: T,
18373 ) -> Self {
18374 self.payload = std::option::Option::Some(
18375 crate::model::space_event::Payload::ReactionDeletedEventData(v.into()),
18376 );
18377 self
18378 }
18379
18380 /// The value of [payload][crate::model::SpaceEvent::payload]
18381 /// if it holds a `ReactionBatchCreatedEventData`, `None` if the field is not set or
18382 /// holds a different branch.
18383 pub fn reaction_batch_created_event_data(
18384 &self,
18385 ) -> std::option::Option<&std::boxed::Box<crate::model::ReactionBatchCreatedEventData>> {
18386 #[allow(unreachable_patterns)]
18387 self.payload.as_ref().and_then(|v| match v {
18388 crate::model::space_event::Payload::ReactionBatchCreatedEventData(v) => {
18389 std::option::Option::Some(v)
18390 }
18391 _ => std::option::Option::None,
18392 })
18393 }
18394
18395 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
18396 /// to hold a `ReactionBatchCreatedEventData`.
18397 ///
18398 /// Note that all the setters affecting `payload` are
18399 /// mutually exclusive.
18400 ///
18401 /// # Example
18402 /// ```ignore,no_run
18403 /// # use google_chat_v1::model::SpaceEvent;
18404 /// use google_chat_v1::model::ReactionBatchCreatedEventData;
18405 /// let x = SpaceEvent::new().set_reaction_batch_created_event_data(ReactionBatchCreatedEventData::default()/* use setters */);
18406 /// assert!(x.reaction_batch_created_event_data().is_some());
18407 /// assert!(x.message_created_event_data().is_none());
18408 /// assert!(x.message_updated_event_data().is_none());
18409 /// assert!(x.message_deleted_event_data().is_none());
18410 /// assert!(x.message_batch_created_event_data().is_none());
18411 /// assert!(x.message_batch_updated_event_data().is_none());
18412 /// assert!(x.message_batch_deleted_event_data().is_none());
18413 /// assert!(x.space_updated_event_data().is_none());
18414 /// assert!(x.space_batch_updated_event_data().is_none());
18415 /// assert!(x.membership_created_event_data().is_none());
18416 /// assert!(x.membership_updated_event_data().is_none());
18417 /// assert!(x.membership_deleted_event_data().is_none());
18418 /// assert!(x.membership_batch_created_event_data().is_none());
18419 /// assert!(x.membership_batch_updated_event_data().is_none());
18420 /// assert!(x.membership_batch_deleted_event_data().is_none());
18421 /// assert!(x.reaction_created_event_data().is_none());
18422 /// assert!(x.reaction_deleted_event_data().is_none());
18423 /// assert!(x.reaction_batch_deleted_event_data().is_none());
18424 /// ```
18425 pub fn set_reaction_batch_created_event_data<
18426 T: std::convert::Into<std::boxed::Box<crate::model::ReactionBatchCreatedEventData>>,
18427 >(
18428 mut self,
18429 v: T,
18430 ) -> Self {
18431 self.payload = std::option::Option::Some(
18432 crate::model::space_event::Payload::ReactionBatchCreatedEventData(v.into()),
18433 );
18434 self
18435 }
18436
18437 /// The value of [payload][crate::model::SpaceEvent::payload]
18438 /// if it holds a `ReactionBatchDeletedEventData`, `None` if the field is not set or
18439 /// holds a different branch.
18440 pub fn reaction_batch_deleted_event_data(
18441 &self,
18442 ) -> std::option::Option<&std::boxed::Box<crate::model::ReactionBatchDeletedEventData>> {
18443 #[allow(unreachable_patterns)]
18444 self.payload.as_ref().and_then(|v| match v {
18445 crate::model::space_event::Payload::ReactionBatchDeletedEventData(v) => {
18446 std::option::Option::Some(v)
18447 }
18448 _ => std::option::Option::None,
18449 })
18450 }
18451
18452 /// Sets the value of [payload][crate::model::SpaceEvent::payload]
18453 /// to hold a `ReactionBatchDeletedEventData`.
18454 ///
18455 /// Note that all the setters affecting `payload` are
18456 /// mutually exclusive.
18457 ///
18458 /// # Example
18459 /// ```ignore,no_run
18460 /// # use google_chat_v1::model::SpaceEvent;
18461 /// use google_chat_v1::model::ReactionBatchDeletedEventData;
18462 /// let x = SpaceEvent::new().set_reaction_batch_deleted_event_data(ReactionBatchDeletedEventData::default()/* use setters */);
18463 /// assert!(x.reaction_batch_deleted_event_data().is_some());
18464 /// assert!(x.message_created_event_data().is_none());
18465 /// assert!(x.message_updated_event_data().is_none());
18466 /// assert!(x.message_deleted_event_data().is_none());
18467 /// assert!(x.message_batch_created_event_data().is_none());
18468 /// assert!(x.message_batch_updated_event_data().is_none());
18469 /// assert!(x.message_batch_deleted_event_data().is_none());
18470 /// assert!(x.space_updated_event_data().is_none());
18471 /// assert!(x.space_batch_updated_event_data().is_none());
18472 /// assert!(x.membership_created_event_data().is_none());
18473 /// assert!(x.membership_updated_event_data().is_none());
18474 /// assert!(x.membership_deleted_event_data().is_none());
18475 /// assert!(x.membership_batch_created_event_data().is_none());
18476 /// assert!(x.membership_batch_updated_event_data().is_none());
18477 /// assert!(x.membership_batch_deleted_event_data().is_none());
18478 /// assert!(x.reaction_created_event_data().is_none());
18479 /// assert!(x.reaction_deleted_event_data().is_none());
18480 /// assert!(x.reaction_batch_created_event_data().is_none());
18481 /// ```
18482 pub fn set_reaction_batch_deleted_event_data<
18483 T: std::convert::Into<std::boxed::Box<crate::model::ReactionBatchDeletedEventData>>,
18484 >(
18485 mut self,
18486 v: T,
18487 ) -> Self {
18488 self.payload = std::option::Option::Some(
18489 crate::model::space_event::Payload::ReactionBatchDeletedEventData(v.into()),
18490 );
18491 self
18492 }
18493}
18494
18495impl wkt::message::Message for SpaceEvent {
18496 fn typename() -> &'static str {
18497 "type.googleapis.com/google.chat.v1.SpaceEvent"
18498 }
18499}
18500
18501/// Defines additional types related to [SpaceEvent].
18502pub mod space_event {
18503 #[allow(unused_imports)]
18504 use super::*;
18505
18506 #[allow(missing_docs)]
18507 #[derive(Clone, Debug, PartialEq)]
18508 #[non_exhaustive]
18509 pub enum Payload {
18510 /// Event payload for a new message.
18511 ///
18512 /// Event type: `google.workspace.chat.message.v1.created`
18513 MessageCreatedEventData(std::boxed::Box<crate::model::MessageCreatedEventData>),
18514 /// Event payload for an updated message.
18515 ///
18516 /// Event type: `google.workspace.chat.message.v1.updated`
18517 MessageUpdatedEventData(std::boxed::Box<crate::model::MessageUpdatedEventData>),
18518 /// Event payload for a deleted message.
18519 ///
18520 /// Event type: `google.workspace.chat.message.v1.deleted`
18521 MessageDeletedEventData(std::boxed::Box<crate::model::MessageDeletedEventData>),
18522 /// Event payload for multiple new messages.
18523 ///
18524 /// Event type: `google.workspace.chat.message.v1.batchCreated`
18525 MessageBatchCreatedEventData(std::boxed::Box<crate::model::MessageBatchCreatedEventData>),
18526 /// Event payload for multiple updated messages.
18527 ///
18528 /// Event type: `google.workspace.chat.message.v1.batchUpdated`
18529 MessageBatchUpdatedEventData(std::boxed::Box<crate::model::MessageBatchUpdatedEventData>),
18530 /// Event payload for multiple deleted messages.
18531 ///
18532 /// Event type: `google.workspace.chat.message.v1.batchDeleted`
18533 MessageBatchDeletedEventData(std::boxed::Box<crate::model::MessageBatchDeletedEventData>),
18534 /// Event payload for a space update.
18535 ///
18536 /// Event type: `google.workspace.chat.space.v1.updated`
18537 SpaceUpdatedEventData(std::boxed::Box<crate::model::SpaceUpdatedEventData>),
18538 /// Event payload for multiple updates to a space.
18539 ///
18540 /// Event type: `google.workspace.chat.space.v1.batchUpdated`
18541 SpaceBatchUpdatedEventData(std::boxed::Box<crate::model::SpaceBatchUpdatedEventData>),
18542 /// Event payload for a new membership.
18543 ///
18544 /// Event type: `google.workspace.chat.membership.v1.created`
18545 MembershipCreatedEventData(std::boxed::Box<crate::model::MembershipCreatedEventData>),
18546 /// Event payload for an updated membership.
18547 ///
18548 /// Event type: `google.workspace.chat.membership.v1.updated`
18549 MembershipUpdatedEventData(std::boxed::Box<crate::model::MembershipUpdatedEventData>),
18550 /// Event payload for a deleted membership.
18551 ///
18552 /// Event type: `google.workspace.chat.membership.v1.deleted`
18553 MembershipDeletedEventData(std::boxed::Box<crate::model::MembershipDeletedEventData>),
18554 /// Event payload for multiple new memberships.
18555 ///
18556 /// Event type: `google.workspace.chat.membership.v1.batchCreated`
18557 MembershipBatchCreatedEventData(
18558 std::boxed::Box<crate::model::MembershipBatchCreatedEventData>,
18559 ),
18560 /// Event payload for multiple updated memberships.
18561 ///
18562 /// Event type: `google.workspace.chat.membership.v1.batchUpdated`
18563 MembershipBatchUpdatedEventData(
18564 std::boxed::Box<crate::model::MembershipBatchUpdatedEventData>,
18565 ),
18566 /// Event payload for multiple deleted memberships.
18567 ///
18568 /// Event type: `google.workspace.chat.membership.v1.batchDeleted`
18569 MembershipBatchDeletedEventData(
18570 std::boxed::Box<crate::model::MembershipBatchDeletedEventData>,
18571 ),
18572 /// Event payload for a new reaction.
18573 ///
18574 /// Event type: `google.workspace.chat.reaction.v1.created`
18575 ReactionCreatedEventData(std::boxed::Box<crate::model::ReactionCreatedEventData>),
18576 /// Event payload for a deleted reaction.
18577 ///
18578 /// Event type: `google.workspace.chat.reaction.v1.deleted`
18579 ReactionDeletedEventData(std::boxed::Box<crate::model::ReactionDeletedEventData>),
18580 /// Event payload for multiple new reactions.
18581 ///
18582 /// Event type: `google.workspace.chat.reaction.v1.batchCreated`
18583 ReactionBatchCreatedEventData(std::boxed::Box<crate::model::ReactionBatchCreatedEventData>),
18584 /// Event payload for multiple deleted reactions.
18585 ///
18586 /// Event type: `google.workspace.chat.reaction.v1.batchDeleted`
18587 ReactionBatchDeletedEventData(std::boxed::Box<crate::model::ReactionBatchDeletedEventData>),
18588 }
18589}
18590
18591/// Request message for getting a space event.
18592#[derive(Clone, Default, PartialEq)]
18593#[non_exhaustive]
18594pub struct GetSpaceEventRequest {
18595 /// Required. The resource name of the space event.
18596 ///
18597 /// Format: `spaces/{space}/spaceEvents/{spaceEvent}`
18598 pub name: std::string::String,
18599
18600 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18601}
18602
18603impl GetSpaceEventRequest {
18604 /// Creates a new default instance.
18605 pub fn new() -> Self {
18606 std::default::Default::default()
18607 }
18608
18609 /// Sets the value of [name][crate::model::GetSpaceEventRequest::name].
18610 ///
18611 /// # Example
18612 /// ```ignore,no_run
18613 /// # use google_chat_v1::model::GetSpaceEventRequest;
18614 /// # let space_id = "space_id";
18615 /// # let space_event_id = "space_event_id";
18616 /// let x = GetSpaceEventRequest::new().set_name(format!("spaces/{space_id}/spaceEvents/{space_event_id}"));
18617 /// ```
18618 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18619 self.name = v.into();
18620 self
18621 }
18622}
18623
18624impl wkt::message::Message for GetSpaceEventRequest {
18625 fn typename() -> &'static str {
18626 "type.googleapis.com/google.chat.v1.GetSpaceEventRequest"
18627 }
18628}
18629
18630/// Request message for listing space events.
18631#[derive(Clone, Default, PartialEq)]
18632#[non_exhaustive]
18633pub struct ListSpaceEventsRequest {
18634 /// Required. Resource name of the [Google Chat
18635 /// space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces)
18636 /// where the events occurred.
18637 ///
18638 /// Format: `spaces/{space}`.
18639 pub parent: std::string::String,
18640
18641 /// Optional. The maximum number of space events returned. The service might
18642 /// return fewer than this value.
18643 ///
18644 /// Negative values return an `INVALID_ARGUMENT` error.
18645 pub page_size: i32,
18646
18647 /// Optional. A page token, received from a previous list space events call.
18648 /// Provide this to retrieve the subsequent page.
18649 ///
18650 /// When paginating, all other parameters provided to list space events must
18651 /// match the call that provided the page token. Passing different values to
18652 /// the other parameters might lead to unexpected results.
18653 pub page_token: std::string::String,
18654
18655 /// Required. A query filter.
18656 ///
18657 /// You must specify at least one event type (`event_type`)
18658 /// using the has `:` operator. To filter by multiple event types, use the `OR`
18659 /// operator. Omit batch event types in your filter. The request automatically
18660 /// returns any related batch events. For example, if you filter by new
18661 /// reactions
18662 /// (`google.workspace.chat.reaction.v1.created`), the server also returns
18663 /// batch new reactions events
18664 /// (`google.workspace.chat.reaction.v1.batchCreated`). For a list of supported
18665 /// event types, see the [`SpaceEvents` reference
18666 /// documentation](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.event_type).
18667 ///
18668 /// Optionally, you can also filter by start time (`start_time`) and
18669 /// end time (`end_time`):
18670 ///
18671 /// * `start_time`: Exclusive timestamp from which to start listing space
18672 /// events.
18673 /// You can list events that occurred up to 28 days ago. If unspecified, lists
18674 /// space events from the past 28 days.
18675 /// * `end_time`: Inclusive timestamp until which space events are listed.
18676 /// If unspecified, lists events up to the time of the request.
18677 ///
18678 /// To specify a start or end time, use the equals `=` operator and format in
18679 /// [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339). To filter by both
18680 /// `start_time` and `end_time`, use the `AND` operator.
18681 ///
18682 /// For example, the following queries are valid:
18683 ///
18684 /// ```norust
18685 /// start_time="2023-08-23T19:20:33+00:00" AND
18686 /// end_time="2023-08-23T19:21:54+00:00"
18687 /// ```
18688 ///
18689 /// ```norust
18690 /// start_time="2023-08-23T19:20:33+00:00" AND
18691 /// (event_types:"google.workspace.chat.space.v1.updated" OR
18692 /// event_types:"google.workspace.chat.message.v1.created")
18693 /// ```
18694 ///
18695 /// The following queries are invalid:
18696 ///
18697 /// ```norust
18698 /// start_time="2023-08-23T19:20:33+00:00" OR
18699 /// end_time="2023-08-23T19:21:54+00:00"
18700 /// ```
18701 ///
18702 /// ```norust
18703 /// event_types:"google.workspace.chat.space.v1.updated" AND
18704 /// event_types:"google.workspace.chat.message.v1.created"
18705 /// ```
18706 ///
18707 /// Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
18708 /// error.
18709 pub filter: std::string::String,
18710
18711 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18712}
18713
18714impl ListSpaceEventsRequest {
18715 /// Creates a new default instance.
18716 pub fn new() -> Self {
18717 std::default::Default::default()
18718 }
18719
18720 /// Sets the value of [parent][crate::model::ListSpaceEventsRequest::parent].
18721 ///
18722 /// # Example
18723 /// ```ignore,no_run
18724 /// # use google_chat_v1::model::ListSpaceEventsRequest;
18725 /// # let space_id = "space_id";
18726 /// let x = ListSpaceEventsRequest::new().set_parent(format!("spaces/{space_id}"));
18727 /// ```
18728 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18729 self.parent = v.into();
18730 self
18731 }
18732
18733 /// Sets the value of [page_size][crate::model::ListSpaceEventsRequest::page_size].
18734 ///
18735 /// # Example
18736 /// ```ignore,no_run
18737 /// # use google_chat_v1::model::ListSpaceEventsRequest;
18738 /// let x = ListSpaceEventsRequest::new().set_page_size(42);
18739 /// ```
18740 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18741 self.page_size = v.into();
18742 self
18743 }
18744
18745 /// Sets the value of [page_token][crate::model::ListSpaceEventsRequest::page_token].
18746 ///
18747 /// # Example
18748 /// ```ignore,no_run
18749 /// # use google_chat_v1::model::ListSpaceEventsRequest;
18750 /// let x = ListSpaceEventsRequest::new().set_page_token("example");
18751 /// ```
18752 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18753 self.page_token = v.into();
18754 self
18755 }
18756
18757 /// Sets the value of [filter][crate::model::ListSpaceEventsRequest::filter].
18758 ///
18759 /// # Example
18760 /// ```ignore,no_run
18761 /// # use google_chat_v1::model::ListSpaceEventsRequest;
18762 /// let x = ListSpaceEventsRequest::new().set_filter("example");
18763 /// ```
18764 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18765 self.filter = v.into();
18766 self
18767 }
18768}
18769
18770impl wkt::message::Message for ListSpaceEventsRequest {
18771 fn typename() -> &'static str {
18772 "type.googleapis.com/google.chat.v1.ListSpaceEventsRequest"
18773 }
18774}
18775
18776/// Response message for listing space events.
18777#[derive(Clone, Default, PartialEq)]
18778#[non_exhaustive]
18779pub struct ListSpaceEventsResponse {
18780 /// Results are returned in chronological order (oldest event first).
18781 /// Note: The `permissionSettings` field is not returned in the Space
18782 /// object for list requests.
18783 pub space_events: std::vec::Vec<crate::model::SpaceEvent>,
18784
18785 /// Continuation token used to fetch more events.
18786 /// If this field is omitted, there are no subsequent pages.
18787 pub next_page_token: std::string::String,
18788
18789 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18790}
18791
18792impl ListSpaceEventsResponse {
18793 /// Creates a new default instance.
18794 pub fn new() -> Self {
18795 std::default::Default::default()
18796 }
18797
18798 /// Sets the value of [space_events][crate::model::ListSpaceEventsResponse::space_events].
18799 ///
18800 /// # Example
18801 /// ```ignore,no_run
18802 /// # use google_chat_v1::model::ListSpaceEventsResponse;
18803 /// use google_chat_v1::model::SpaceEvent;
18804 /// let x = ListSpaceEventsResponse::new()
18805 /// .set_space_events([
18806 /// SpaceEvent::default()/* use setters */,
18807 /// SpaceEvent::default()/* use (different) setters */,
18808 /// ]);
18809 /// ```
18810 pub fn set_space_events<T, V>(mut self, v: T) -> Self
18811 where
18812 T: std::iter::IntoIterator<Item = V>,
18813 V: std::convert::Into<crate::model::SpaceEvent>,
18814 {
18815 use std::iter::Iterator;
18816 self.space_events = v.into_iter().map(|i| i.into()).collect();
18817 self
18818 }
18819
18820 /// Sets the value of [next_page_token][crate::model::ListSpaceEventsResponse::next_page_token].
18821 ///
18822 /// # Example
18823 /// ```ignore,no_run
18824 /// # use google_chat_v1::model::ListSpaceEventsResponse;
18825 /// let x = ListSpaceEventsResponse::new().set_next_page_token("example");
18826 /// ```
18827 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18828 self.next_page_token = v.into();
18829 self
18830 }
18831}
18832
18833impl wkt::message::Message for ListSpaceEventsResponse {
18834 fn typename() -> &'static str {
18835 "type.googleapis.com/google.chat.v1.ListSpaceEventsResponse"
18836 }
18837}
18838
18839#[doc(hidden)]
18840impl google_cloud_gax::paginator::internal::PageableResponse for ListSpaceEventsResponse {
18841 type PageItem = crate::model::SpaceEvent;
18842
18843 fn items(self) -> std::vec::Vec<Self::PageItem> {
18844 self.space_events
18845 }
18846
18847 fn next_page_token(&self) -> std::string::String {
18848 use std::clone::Clone;
18849 self.next_page_token.clone()
18850 }
18851}
18852
18853/// The notification setting of a user in a space.
18854#[derive(Clone, Default, PartialEq)]
18855#[non_exhaustive]
18856pub struct SpaceNotificationSetting {
18857 /// Identifier. The resource name of the space notification setting.
18858 /// Format: `users/{user}/spaces/{space}/spaceNotificationSetting`.
18859 pub name: std::string::String,
18860
18861 /// The notification setting.
18862 pub notification_setting:
18863 std::option::Option<crate::model::space_notification_setting::NotificationSetting>,
18864
18865 /// The space notification mute setting.
18866 pub mute_setting: std::option::Option<crate::model::space_notification_setting::MuteSetting>,
18867
18868 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18869}
18870
18871impl SpaceNotificationSetting {
18872 /// Creates a new default instance.
18873 pub fn new() -> Self {
18874 std::default::Default::default()
18875 }
18876
18877 /// Sets the value of [name][crate::model::SpaceNotificationSetting::name].
18878 ///
18879 /// # Example
18880 /// ```ignore,no_run
18881 /// # use google_chat_v1::model::SpaceNotificationSetting;
18882 /// # let user_id = "user_id";
18883 /// # let space_id = "space_id";
18884 /// let x = SpaceNotificationSetting::new().set_name(format!("users/{user_id}/spaces/{space_id}/spaceNotificationSetting"));
18885 /// ```
18886 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18887 self.name = v.into();
18888 self
18889 }
18890
18891 /// Sets the value of [notification_setting][crate::model::SpaceNotificationSetting::notification_setting].
18892 ///
18893 /// # Example
18894 /// ```ignore,no_run
18895 /// # use google_chat_v1::model::SpaceNotificationSetting;
18896 /// use google_chat_v1::model::space_notification_setting::NotificationSetting;
18897 /// let x0 = SpaceNotificationSetting::new().set_notification_setting(NotificationSetting::All);
18898 /// let x1 = SpaceNotificationSetting::new().set_notification_setting(NotificationSetting::MainConversations);
18899 /// let x2 = SpaceNotificationSetting::new().set_notification_setting(NotificationSetting::ForYou);
18900 /// ```
18901 pub fn set_notification_setting<T>(mut self, v: T) -> Self
18902 where
18903 T: std::convert::Into<crate::model::space_notification_setting::NotificationSetting>,
18904 {
18905 self.notification_setting = std::option::Option::Some(v.into());
18906 self
18907 }
18908
18909 /// Sets or clears the value of [notification_setting][crate::model::SpaceNotificationSetting::notification_setting].
18910 ///
18911 /// # Example
18912 /// ```ignore,no_run
18913 /// # use google_chat_v1::model::SpaceNotificationSetting;
18914 /// use google_chat_v1::model::space_notification_setting::NotificationSetting;
18915 /// let x0 = SpaceNotificationSetting::new().set_or_clear_notification_setting(Some(NotificationSetting::All));
18916 /// let x1 = SpaceNotificationSetting::new().set_or_clear_notification_setting(Some(NotificationSetting::MainConversations));
18917 /// let x2 = SpaceNotificationSetting::new().set_or_clear_notification_setting(Some(NotificationSetting::ForYou));
18918 /// let x_none = SpaceNotificationSetting::new().set_or_clear_notification_setting(None::<NotificationSetting>);
18919 /// ```
18920 pub fn set_or_clear_notification_setting<T>(mut self, v: std::option::Option<T>) -> Self
18921 where
18922 T: std::convert::Into<crate::model::space_notification_setting::NotificationSetting>,
18923 {
18924 self.notification_setting = v.map(|x| x.into());
18925 self
18926 }
18927
18928 /// Sets the value of [mute_setting][crate::model::SpaceNotificationSetting::mute_setting].
18929 ///
18930 /// # Example
18931 /// ```ignore,no_run
18932 /// # use google_chat_v1::model::SpaceNotificationSetting;
18933 /// use google_chat_v1::model::space_notification_setting::MuteSetting;
18934 /// let x0 = SpaceNotificationSetting::new().set_mute_setting(MuteSetting::Unmuted);
18935 /// let x1 = SpaceNotificationSetting::new().set_mute_setting(MuteSetting::Muted);
18936 /// ```
18937 pub fn set_mute_setting<T>(mut self, v: T) -> Self
18938 where
18939 T: std::convert::Into<crate::model::space_notification_setting::MuteSetting>,
18940 {
18941 self.mute_setting = std::option::Option::Some(v.into());
18942 self
18943 }
18944
18945 /// Sets or clears the value of [mute_setting][crate::model::SpaceNotificationSetting::mute_setting].
18946 ///
18947 /// # Example
18948 /// ```ignore,no_run
18949 /// # use google_chat_v1::model::SpaceNotificationSetting;
18950 /// use google_chat_v1::model::space_notification_setting::MuteSetting;
18951 /// let x0 = SpaceNotificationSetting::new().set_or_clear_mute_setting(Some(MuteSetting::Unmuted));
18952 /// let x1 = SpaceNotificationSetting::new().set_or_clear_mute_setting(Some(MuteSetting::Muted));
18953 /// let x_none = SpaceNotificationSetting::new().set_or_clear_mute_setting(None::<MuteSetting>);
18954 /// ```
18955 pub fn set_or_clear_mute_setting<T>(mut self, v: std::option::Option<T>) -> Self
18956 where
18957 T: std::convert::Into<crate::model::space_notification_setting::MuteSetting>,
18958 {
18959 self.mute_setting = v.map(|x| x.into());
18960 self
18961 }
18962}
18963
18964impl wkt::message::Message for SpaceNotificationSetting {
18965 fn typename() -> &'static str {
18966 "type.googleapis.com/google.chat.v1.SpaceNotificationSetting"
18967 }
18968}
18969
18970/// Defines additional types related to [SpaceNotificationSetting].
18971pub mod space_notification_setting {
18972 #[allow(unused_imports)]
18973 use super::*;
18974
18975 /// The notification setting types. Other types might be supported in the
18976 /// future.
18977 ///
18978 /// # Working with unknown values
18979 ///
18980 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18981 /// additional enum variants at any time. Adding new variants is not considered
18982 /// a breaking change. Applications should write their code in anticipation of:
18983 ///
18984 /// - New values appearing in future releases of the client library, **and**
18985 /// - New values received dynamically, without application changes.
18986 ///
18987 /// Please consult the [Working with enums] section in the user guide for some
18988 /// guidelines.
18989 ///
18990 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18991 #[derive(Clone, Debug, PartialEq)]
18992 #[non_exhaustive]
18993 pub enum NotificationSetting {
18994 /// Reserved.
18995 Unspecified,
18996 /// Notifications are triggered by @mentions, followed threads, first
18997 /// message of new threads. All new threads are automatically followed,
18998 /// unless manually unfollowed by the user.
18999 All,
19000 /// The notification is triggered by @mentions, followed threads, first
19001 /// message of new threads. Not available for 1:1 direct messages.
19002 MainConversations,
19003 /// The notification is triggered by @mentions, followed threads. Not
19004 /// available for 1:1 direct messages.
19005 ForYou,
19006 /// Notification is off.
19007 Off,
19008 /// If set, the enum was initialized with an unknown value.
19009 ///
19010 /// Applications can examine the value using [NotificationSetting::value] or
19011 /// [NotificationSetting::name].
19012 UnknownValue(notification_setting::UnknownValue),
19013 }
19014
19015 #[doc(hidden)]
19016 pub mod notification_setting {
19017 #[allow(unused_imports)]
19018 use super::*;
19019 #[derive(Clone, Debug, PartialEq)]
19020 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19021 }
19022
19023 impl NotificationSetting {
19024 /// Gets the enum value.
19025 ///
19026 /// Returns `None` if the enum contains an unknown value deserialized from
19027 /// the string representation of enums.
19028 pub fn value(&self) -> std::option::Option<i32> {
19029 match self {
19030 Self::Unspecified => std::option::Option::Some(0),
19031 Self::All => std::option::Option::Some(1),
19032 Self::MainConversations => std::option::Option::Some(2),
19033 Self::ForYou => std::option::Option::Some(3),
19034 Self::Off => std::option::Option::Some(4),
19035 Self::UnknownValue(u) => u.0.value(),
19036 }
19037 }
19038
19039 /// Gets the enum value as a string.
19040 ///
19041 /// Returns `None` if the enum contains an unknown value deserialized from
19042 /// the integer representation of enums.
19043 pub fn name(&self) -> std::option::Option<&str> {
19044 match self {
19045 Self::Unspecified => std::option::Option::Some("NOTIFICATION_SETTING_UNSPECIFIED"),
19046 Self::All => std::option::Option::Some("ALL"),
19047 Self::MainConversations => std::option::Option::Some("MAIN_CONVERSATIONS"),
19048 Self::ForYou => std::option::Option::Some("FOR_YOU"),
19049 Self::Off => std::option::Option::Some("OFF"),
19050 Self::UnknownValue(u) => u.0.name(),
19051 }
19052 }
19053 }
19054
19055 impl std::default::Default for NotificationSetting {
19056 fn default() -> Self {
19057 use std::convert::From;
19058 Self::from(0)
19059 }
19060 }
19061
19062 impl std::fmt::Display for NotificationSetting {
19063 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19064 wkt::internal::display_enum(f, self.name(), self.value())
19065 }
19066 }
19067
19068 impl std::convert::From<i32> for NotificationSetting {
19069 fn from(value: i32) -> Self {
19070 match value {
19071 0 => Self::Unspecified,
19072 1 => Self::All,
19073 2 => Self::MainConversations,
19074 3 => Self::ForYou,
19075 4 => Self::Off,
19076 _ => Self::UnknownValue(notification_setting::UnknownValue(
19077 wkt::internal::UnknownEnumValue::Integer(value),
19078 )),
19079 }
19080 }
19081 }
19082
19083 impl std::convert::From<&str> for NotificationSetting {
19084 fn from(value: &str) -> Self {
19085 use std::string::ToString;
19086 match value {
19087 "NOTIFICATION_SETTING_UNSPECIFIED" => Self::Unspecified,
19088 "ALL" => Self::All,
19089 "MAIN_CONVERSATIONS" => Self::MainConversations,
19090 "FOR_YOU" => Self::ForYou,
19091 "OFF" => Self::Off,
19092 _ => Self::UnknownValue(notification_setting::UnknownValue(
19093 wkt::internal::UnknownEnumValue::String(value.to_string()),
19094 )),
19095 }
19096 }
19097 }
19098
19099 impl serde::ser::Serialize for NotificationSetting {
19100 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19101 where
19102 S: serde::Serializer,
19103 {
19104 match self {
19105 Self::Unspecified => serializer.serialize_i32(0),
19106 Self::All => serializer.serialize_i32(1),
19107 Self::MainConversations => serializer.serialize_i32(2),
19108 Self::ForYou => serializer.serialize_i32(3),
19109 Self::Off => serializer.serialize_i32(4),
19110 Self::UnknownValue(u) => u.0.serialize(serializer),
19111 }
19112 }
19113 }
19114
19115 impl<'de> serde::de::Deserialize<'de> for NotificationSetting {
19116 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19117 where
19118 D: serde::Deserializer<'de>,
19119 {
19120 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NotificationSetting>::new(
19121 ".google.chat.v1.SpaceNotificationSetting.NotificationSetting",
19122 ))
19123 }
19124 }
19125
19126 /// The space notification mute setting types.
19127 ///
19128 /// # Working with unknown values
19129 ///
19130 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19131 /// additional enum variants at any time. Adding new variants is not considered
19132 /// a breaking change. Applications should write their code in anticipation of:
19133 ///
19134 /// - New values appearing in future releases of the client library, **and**
19135 /// - New values received dynamically, without application changes.
19136 ///
19137 /// Please consult the [Working with enums] section in the user guide for some
19138 /// guidelines.
19139 ///
19140 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19141 #[derive(Clone, Debug, PartialEq)]
19142 #[non_exhaustive]
19143 pub enum MuteSetting {
19144 /// Reserved.
19145 Unspecified,
19146 /// The user will receive notifications for the space based on the
19147 /// notification setting.
19148 Unmuted,
19149 /// The user will not receive any notifications for the space, regardless of
19150 /// the notification setting.
19151 Muted,
19152 /// If set, the enum was initialized with an unknown value.
19153 ///
19154 /// Applications can examine the value using [MuteSetting::value] or
19155 /// [MuteSetting::name].
19156 UnknownValue(mute_setting::UnknownValue),
19157 }
19158
19159 #[doc(hidden)]
19160 pub mod mute_setting {
19161 #[allow(unused_imports)]
19162 use super::*;
19163 #[derive(Clone, Debug, PartialEq)]
19164 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19165 }
19166
19167 impl MuteSetting {
19168 /// Gets the enum value.
19169 ///
19170 /// Returns `None` if the enum contains an unknown value deserialized from
19171 /// the string representation of enums.
19172 pub fn value(&self) -> std::option::Option<i32> {
19173 match self {
19174 Self::Unspecified => std::option::Option::Some(0),
19175 Self::Unmuted => std::option::Option::Some(1),
19176 Self::Muted => std::option::Option::Some(2),
19177 Self::UnknownValue(u) => u.0.value(),
19178 }
19179 }
19180
19181 /// Gets the enum value as a string.
19182 ///
19183 /// Returns `None` if the enum contains an unknown value deserialized from
19184 /// the integer representation of enums.
19185 pub fn name(&self) -> std::option::Option<&str> {
19186 match self {
19187 Self::Unspecified => std::option::Option::Some("MUTE_SETTING_UNSPECIFIED"),
19188 Self::Unmuted => std::option::Option::Some("UNMUTED"),
19189 Self::Muted => std::option::Option::Some("MUTED"),
19190 Self::UnknownValue(u) => u.0.name(),
19191 }
19192 }
19193 }
19194
19195 impl std::default::Default for MuteSetting {
19196 fn default() -> Self {
19197 use std::convert::From;
19198 Self::from(0)
19199 }
19200 }
19201
19202 impl std::fmt::Display for MuteSetting {
19203 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19204 wkt::internal::display_enum(f, self.name(), self.value())
19205 }
19206 }
19207
19208 impl std::convert::From<i32> for MuteSetting {
19209 fn from(value: i32) -> Self {
19210 match value {
19211 0 => Self::Unspecified,
19212 1 => Self::Unmuted,
19213 2 => Self::Muted,
19214 _ => Self::UnknownValue(mute_setting::UnknownValue(
19215 wkt::internal::UnknownEnumValue::Integer(value),
19216 )),
19217 }
19218 }
19219 }
19220
19221 impl std::convert::From<&str> for MuteSetting {
19222 fn from(value: &str) -> Self {
19223 use std::string::ToString;
19224 match value {
19225 "MUTE_SETTING_UNSPECIFIED" => Self::Unspecified,
19226 "UNMUTED" => Self::Unmuted,
19227 "MUTED" => Self::Muted,
19228 _ => Self::UnknownValue(mute_setting::UnknownValue(
19229 wkt::internal::UnknownEnumValue::String(value.to_string()),
19230 )),
19231 }
19232 }
19233 }
19234
19235 impl serde::ser::Serialize for MuteSetting {
19236 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19237 where
19238 S: serde::Serializer,
19239 {
19240 match self {
19241 Self::Unspecified => serializer.serialize_i32(0),
19242 Self::Unmuted => serializer.serialize_i32(1),
19243 Self::Muted => serializer.serialize_i32(2),
19244 Self::UnknownValue(u) => u.0.serialize(serializer),
19245 }
19246 }
19247 }
19248
19249 impl<'de> serde::de::Deserialize<'de> for MuteSetting {
19250 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19251 where
19252 D: serde::Deserializer<'de>,
19253 {
19254 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MuteSetting>::new(
19255 ".google.chat.v1.SpaceNotificationSetting.MuteSetting",
19256 ))
19257 }
19258 }
19259}
19260
19261/// Request message to get space notification setting.
19262/// Only supports getting notification setting for the calling user.
19263#[derive(Clone, Default, PartialEq)]
19264#[non_exhaustive]
19265pub struct GetSpaceNotificationSettingRequest {
19266 /// Required. Format: users/{user}/spaces/{space}/spaceNotificationSetting
19267 ///
19268 /// - `users/me/spaces/{space}/spaceNotificationSetting`, OR
19269 /// - `users/user@example.com/spaces/{space}/spaceNotificationSetting`, OR
19270 /// - `users/123456789/spaces/{space}/spaceNotificationSetting`.
19271 /// Note: Only the caller's user id or email is allowed in the path.
19272 pub name: std::string::String,
19273
19274 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19275}
19276
19277impl GetSpaceNotificationSettingRequest {
19278 /// Creates a new default instance.
19279 pub fn new() -> Self {
19280 std::default::Default::default()
19281 }
19282
19283 /// Sets the value of [name][crate::model::GetSpaceNotificationSettingRequest::name].
19284 ///
19285 /// # Example
19286 /// ```ignore,no_run
19287 /// # use google_chat_v1::model::GetSpaceNotificationSettingRequest;
19288 /// # let user_id = "user_id";
19289 /// # let space_id = "space_id";
19290 /// let x = GetSpaceNotificationSettingRequest::new().set_name(format!("users/{user_id}/spaces/{space_id}/spaceNotificationSetting"));
19291 /// ```
19292 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19293 self.name = v.into();
19294 self
19295 }
19296}
19297
19298impl wkt::message::Message for GetSpaceNotificationSettingRequest {
19299 fn typename() -> &'static str {
19300 "type.googleapis.com/google.chat.v1.GetSpaceNotificationSettingRequest"
19301 }
19302}
19303
19304/// Request to update the space notification settings.
19305/// Only supports updating notification setting for the calling user.
19306#[derive(Clone, Default, PartialEq)]
19307#[non_exhaustive]
19308pub struct UpdateSpaceNotificationSettingRequest {
19309 /// Required. The resource name for the space notification settings must be
19310 /// populated in the form of
19311 /// `users/{user}/spaces/{space}/spaceNotificationSetting`. Only fields
19312 /// specified by `update_mask` are updated.
19313 pub space_notification_setting: std::option::Option<crate::model::SpaceNotificationSetting>,
19314
19315 /// Required. Supported field paths:
19316 ///
19317 /// - `notification_setting`
19318 ///
19319 /// - `mute_setting`
19320 ///
19321 pub update_mask: std::option::Option<wkt::FieldMask>,
19322
19323 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19324}
19325
19326impl UpdateSpaceNotificationSettingRequest {
19327 /// Creates a new default instance.
19328 pub fn new() -> Self {
19329 std::default::Default::default()
19330 }
19331
19332 /// Sets the value of [space_notification_setting][crate::model::UpdateSpaceNotificationSettingRequest::space_notification_setting].
19333 ///
19334 /// # Example
19335 /// ```ignore,no_run
19336 /// # use google_chat_v1::model::UpdateSpaceNotificationSettingRequest;
19337 /// use google_chat_v1::model::SpaceNotificationSetting;
19338 /// let x = UpdateSpaceNotificationSettingRequest::new().set_space_notification_setting(SpaceNotificationSetting::default()/* use setters */);
19339 /// ```
19340 pub fn set_space_notification_setting<T>(mut self, v: T) -> Self
19341 where
19342 T: std::convert::Into<crate::model::SpaceNotificationSetting>,
19343 {
19344 self.space_notification_setting = std::option::Option::Some(v.into());
19345 self
19346 }
19347
19348 /// Sets or clears the value of [space_notification_setting][crate::model::UpdateSpaceNotificationSettingRequest::space_notification_setting].
19349 ///
19350 /// # Example
19351 /// ```ignore,no_run
19352 /// # use google_chat_v1::model::UpdateSpaceNotificationSettingRequest;
19353 /// use google_chat_v1::model::SpaceNotificationSetting;
19354 /// let x = UpdateSpaceNotificationSettingRequest::new().set_or_clear_space_notification_setting(Some(SpaceNotificationSetting::default()/* use setters */));
19355 /// let x = UpdateSpaceNotificationSettingRequest::new().set_or_clear_space_notification_setting(None::<SpaceNotificationSetting>);
19356 /// ```
19357 pub fn set_or_clear_space_notification_setting<T>(mut self, v: std::option::Option<T>) -> Self
19358 where
19359 T: std::convert::Into<crate::model::SpaceNotificationSetting>,
19360 {
19361 self.space_notification_setting = v.map(|x| x.into());
19362 self
19363 }
19364
19365 /// Sets the value of [update_mask][crate::model::UpdateSpaceNotificationSettingRequest::update_mask].
19366 ///
19367 /// # Example
19368 /// ```ignore,no_run
19369 /// # use google_chat_v1::model::UpdateSpaceNotificationSettingRequest;
19370 /// use wkt::FieldMask;
19371 /// let x = UpdateSpaceNotificationSettingRequest::new().set_update_mask(FieldMask::default()/* use setters */);
19372 /// ```
19373 pub fn set_update_mask<T>(mut self, v: T) -> Self
19374 where
19375 T: std::convert::Into<wkt::FieldMask>,
19376 {
19377 self.update_mask = std::option::Option::Some(v.into());
19378 self
19379 }
19380
19381 /// Sets or clears the value of [update_mask][crate::model::UpdateSpaceNotificationSettingRequest::update_mask].
19382 ///
19383 /// # Example
19384 /// ```ignore,no_run
19385 /// # use google_chat_v1::model::UpdateSpaceNotificationSettingRequest;
19386 /// use wkt::FieldMask;
19387 /// let x = UpdateSpaceNotificationSettingRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
19388 /// let x = UpdateSpaceNotificationSettingRequest::new().set_or_clear_update_mask(None::<FieldMask>);
19389 /// ```
19390 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
19391 where
19392 T: std::convert::Into<wkt::FieldMask>,
19393 {
19394 self.update_mask = v.map(|x| x.into());
19395 self
19396 }
19397}
19398
19399impl wkt::message::Message for UpdateSpaceNotificationSettingRequest {
19400 fn typename() -> &'static str {
19401 "type.googleapis.com/google.chat.v1.UpdateSpaceNotificationSettingRequest"
19402 }
19403}
19404
19405/// A user's read state within a space, used to identify read and unread
19406/// messages.
19407#[derive(Clone, Default, PartialEq)]
19408#[non_exhaustive]
19409pub struct SpaceReadState {
19410 /// Resource name of the space read state.
19411 ///
19412 /// Format: `users/{user}/spaces/{space}/spaceReadState`
19413 pub name: std::string::String,
19414
19415 /// Optional. The time when the user's space read state was updated. Usually
19416 /// this corresponds with either the timestamp of the last read message, or a
19417 /// timestamp specified by the user to mark the last read position in a space.
19418 pub last_read_time: std::option::Option<wkt::Timestamp>,
19419
19420 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19421}
19422
19423impl SpaceReadState {
19424 /// Creates a new default instance.
19425 pub fn new() -> Self {
19426 std::default::Default::default()
19427 }
19428
19429 /// Sets the value of [name][crate::model::SpaceReadState::name].
19430 ///
19431 /// # Example
19432 /// ```ignore,no_run
19433 /// # use google_chat_v1::model::SpaceReadState;
19434 /// # let user_id = "user_id";
19435 /// # let space_id = "space_id";
19436 /// let x = SpaceReadState::new().set_name(format!("users/{user_id}/spaces/{space_id}/spaceReadState"));
19437 /// ```
19438 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19439 self.name = v.into();
19440 self
19441 }
19442
19443 /// Sets the value of [last_read_time][crate::model::SpaceReadState::last_read_time].
19444 ///
19445 /// # Example
19446 /// ```ignore,no_run
19447 /// # use google_chat_v1::model::SpaceReadState;
19448 /// use wkt::Timestamp;
19449 /// let x = SpaceReadState::new().set_last_read_time(Timestamp::default()/* use setters */);
19450 /// ```
19451 pub fn set_last_read_time<T>(mut self, v: T) -> Self
19452 where
19453 T: std::convert::Into<wkt::Timestamp>,
19454 {
19455 self.last_read_time = std::option::Option::Some(v.into());
19456 self
19457 }
19458
19459 /// Sets or clears the value of [last_read_time][crate::model::SpaceReadState::last_read_time].
19460 ///
19461 /// # Example
19462 /// ```ignore,no_run
19463 /// # use google_chat_v1::model::SpaceReadState;
19464 /// use wkt::Timestamp;
19465 /// let x = SpaceReadState::new().set_or_clear_last_read_time(Some(Timestamp::default()/* use setters */));
19466 /// let x = SpaceReadState::new().set_or_clear_last_read_time(None::<Timestamp>);
19467 /// ```
19468 pub fn set_or_clear_last_read_time<T>(mut self, v: std::option::Option<T>) -> Self
19469 where
19470 T: std::convert::Into<wkt::Timestamp>,
19471 {
19472 self.last_read_time = v.map(|x| x.into());
19473 self
19474 }
19475}
19476
19477impl wkt::message::Message for SpaceReadState {
19478 fn typename() -> &'static str {
19479 "type.googleapis.com/google.chat.v1.SpaceReadState"
19480 }
19481}
19482
19483/// Request message for GetSpaceReadState API.
19484#[derive(Clone, Default, PartialEq)]
19485#[non_exhaustive]
19486pub struct GetSpaceReadStateRequest {
19487 /// Required. Resource name of the space read state to retrieve.
19488 ///
19489 /// Only supports getting read state for the calling user.
19490 ///
19491 /// To refer to the calling user, set one of the following:
19492 ///
19493 /// - The `me` alias. For example, `users/me/spaces/{space}/spaceReadState`.
19494 ///
19495 /// - Their Workspace email address. For example,
19496 /// `users/user@example.com/spaces/{space}/spaceReadState`.
19497 ///
19498 /// - Their user id. For example,
19499 /// `users/123456789/spaces/{space}/spaceReadState`.
19500 ///
19501 ///
19502 /// Format: users/{user}/spaces/{space}/spaceReadState
19503 pub name: std::string::String,
19504
19505 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19506}
19507
19508impl GetSpaceReadStateRequest {
19509 /// Creates a new default instance.
19510 pub fn new() -> Self {
19511 std::default::Default::default()
19512 }
19513
19514 /// Sets the value of [name][crate::model::GetSpaceReadStateRequest::name].
19515 ///
19516 /// # Example
19517 /// ```ignore,no_run
19518 /// # use google_chat_v1::model::GetSpaceReadStateRequest;
19519 /// # let user_id = "user_id";
19520 /// # let space_id = "space_id";
19521 /// let x = GetSpaceReadStateRequest::new().set_name(format!("users/{user_id}/spaces/{space_id}/spaceReadState"));
19522 /// ```
19523 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19524 self.name = v.into();
19525 self
19526 }
19527}
19528
19529impl wkt::message::Message for GetSpaceReadStateRequest {
19530 fn typename() -> &'static str {
19531 "type.googleapis.com/google.chat.v1.GetSpaceReadStateRequest"
19532 }
19533}
19534
19535/// Request message for UpdateSpaceReadState API.
19536#[derive(Clone, Default, PartialEq)]
19537#[non_exhaustive]
19538pub struct UpdateSpaceReadStateRequest {
19539 /// Required. The space read state and fields to update.
19540 ///
19541 /// Only supports updating read state for the calling user.
19542 ///
19543 /// To refer to the calling user, set one of the following:
19544 ///
19545 /// - The `me` alias. For example, `users/me/spaces/{space}/spaceReadState`.
19546 ///
19547 /// - Their Workspace email address. For example,
19548 /// `users/user@example.com/spaces/{space}/spaceReadState`.
19549 ///
19550 /// - Their user id. For example,
19551 /// `users/123456789/spaces/{space}/spaceReadState`.
19552 ///
19553 ///
19554 /// Format: users/{user}/spaces/{space}/spaceReadState
19555 pub space_read_state: std::option::Option<crate::model::SpaceReadState>,
19556
19557 /// Required. The field paths to update. Currently supported field paths:
19558 ///
19559 /// - `last_read_time`
19560 ///
19561 /// When the `last_read_time` is before the latest message create time, the
19562 /// space appears as unread in the UI.
19563 ///
19564 /// To mark the space as read, set `last_read_time` to any value later (larger)
19565 /// than the latest message create time. The `last_read_time` is coerced to
19566 /// match the latest message create time. Note that the space read state only
19567 /// affects the read state of messages that are visible in the space's
19568 /// top-level conversation. Replies in threads are unaffected by this
19569 /// timestamp, and instead rely on the thread read state.
19570 pub update_mask: std::option::Option<wkt::FieldMask>,
19571
19572 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19573}
19574
19575impl UpdateSpaceReadStateRequest {
19576 /// Creates a new default instance.
19577 pub fn new() -> Self {
19578 std::default::Default::default()
19579 }
19580
19581 /// Sets the value of [space_read_state][crate::model::UpdateSpaceReadStateRequest::space_read_state].
19582 ///
19583 /// # Example
19584 /// ```ignore,no_run
19585 /// # use google_chat_v1::model::UpdateSpaceReadStateRequest;
19586 /// use google_chat_v1::model::SpaceReadState;
19587 /// let x = UpdateSpaceReadStateRequest::new().set_space_read_state(SpaceReadState::default()/* use setters */);
19588 /// ```
19589 pub fn set_space_read_state<T>(mut self, v: T) -> Self
19590 where
19591 T: std::convert::Into<crate::model::SpaceReadState>,
19592 {
19593 self.space_read_state = std::option::Option::Some(v.into());
19594 self
19595 }
19596
19597 /// Sets or clears the value of [space_read_state][crate::model::UpdateSpaceReadStateRequest::space_read_state].
19598 ///
19599 /// # Example
19600 /// ```ignore,no_run
19601 /// # use google_chat_v1::model::UpdateSpaceReadStateRequest;
19602 /// use google_chat_v1::model::SpaceReadState;
19603 /// let x = UpdateSpaceReadStateRequest::new().set_or_clear_space_read_state(Some(SpaceReadState::default()/* use setters */));
19604 /// let x = UpdateSpaceReadStateRequest::new().set_or_clear_space_read_state(None::<SpaceReadState>);
19605 /// ```
19606 pub fn set_or_clear_space_read_state<T>(mut self, v: std::option::Option<T>) -> Self
19607 where
19608 T: std::convert::Into<crate::model::SpaceReadState>,
19609 {
19610 self.space_read_state = v.map(|x| x.into());
19611 self
19612 }
19613
19614 /// Sets the value of [update_mask][crate::model::UpdateSpaceReadStateRequest::update_mask].
19615 ///
19616 /// # Example
19617 /// ```ignore,no_run
19618 /// # use google_chat_v1::model::UpdateSpaceReadStateRequest;
19619 /// use wkt::FieldMask;
19620 /// let x = UpdateSpaceReadStateRequest::new().set_update_mask(FieldMask::default()/* use setters */);
19621 /// ```
19622 pub fn set_update_mask<T>(mut self, v: T) -> Self
19623 where
19624 T: std::convert::Into<wkt::FieldMask>,
19625 {
19626 self.update_mask = std::option::Option::Some(v.into());
19627 self
19628 }
19629
19630 /// Sets or clears the value of [update_mask][crate::model::UpdateSpaceReadStateRequest::update_mask].
19631 ///
19632 /// # Example
19633 /// ```ignore,no_run
19634 /// # use google_chat_v1::model::UpdateSpaceReadStateRequest;
19635 /// use wkt::FieldMask;
19636 /// let x = UpdateSpaceReadStateRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
19637 /// let x = UpdateSpaceReadStateRequest::new().set_or_clear_update_mask(None::<FieldMask>);
19638 /// ```
19639 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
19640 where
19641 T: std::convert::Into<wkt::FieldMask>,
19642 {
19643 self.update_mask = v.map(|x| x.into());
19644 self
19645 }
19646}
19647
19648impl wkt::message::Message for UpdateSpaceReadStateRequest {
19649 fn typename() -> &'static str {
19650 "type.googleapis.com/google.chat.v1.UpdateSpaceReadStateRequest"
19651 }
19652}
19653
19654/// Request to create a space and add specified users to it.
19655#[derive(Clone, Default, PartialEq)]
19656#[non_exhaustive]
19657pub struct SetUpSpaceRequest {
19658 /// Required. The `Space.spaceType` field is required.
19659 ///
19660 /// To create a space, set `Space.spaceType` to `SPACE` and set
19661 /// `Space.displayName`. If you receive the error message `ALREADY_EXISTS` when
19662 /// setting up a space, try a different `displayName`. An existing space
19663 /// within the Google Workspace organization might already use this display
19664 /// name.
19665 ///
19666 /// To create a group chat, set `Space.spaceType` to
19667 /// `GROUP_CHAT`. Don't set `Space.displayName`.
19668 ///
19669 /// To create a 1:1 conversation between humans,
19670 /// set `Space.spaceType` to `DIRECT_MESSAGE` and set
19671 /// `Space.singleUserBotDm` to `false`. Don't set `Space.displayName` or
19672 /// `Space.spaceDetails`.
19673 ///
19674 /// To create an 1:1 conversation between a human and the calling Chat app, set
19675 /// `Space.spaceType` to `DIRECT_MESSAGE` and
19676 /// `Space.singleUserBotDm` to `true`. Don't set `Space.displayName` or
19677 /// `Space.spaceDetails`.
19678 ///
19679 /// If a `DIRECT_MESSAGE` space already exists, that space is returned instead
19680 /// of creating a new space.
19681 pub space: std::option::Option<crate::model::Space>,
19682
19683 /// Optional. A unique identifier for this request.
19684 /// A random UUID is recommended.
19685 /// Specifying an existing request ID returns the space created with that ID
19686 /// instead of creating a new space.
19687 /// Specifying an existing request ID from the same Chat app with a different
19688 /// authenticated user returns an error.
19689 pub request_id: std::string::String,
19690
19691 /// Optional. The Google Chat users or groups to invite to join the space. Omit
19692 /// the calling user, as they are added automatically.
19693 ///
19694 /// The set currently allows up to 49 memberships (in addition to the caller).
19695 ///
19696 /// For human membership, the `Membership.member` field must contain a `user`
19697 /// with `name` populated (format: `users/{user}`) and `type` set to
19698 /// `User.Type.HUMAN`. You can only add human users when setting up a space
19699 /// (adding Chat apps is only supported for direct message setup with the
19700 /// calling app). You can also add members using the user's email as an alias
19701 /// for {user}. For example, the `user.name` can be `users/example@gmail.com`.
19702 /// To invite Gmail users or users from external Google Workspace domains,
19703 /// user's email must be used for `{user}`.
19704 ///
19705 /// For Google group membership, the `Membership.group_member` field must
19706 /// contain a `group` with `name` populated (format `groups/{group}`). You
19707 /// can only add Google groups when setting `Space.spaceType` to `SPACE`.
19708 ///
19709 /// Optional when setting `Space.spaceType` to `SPACE`.
19710 ///
19711 /// Required when setting `Space.spaceType` to `GROUP_CHAT`, along with at
19712 /// least two memberships.
19713 ///
19714 /// Required when setting `Space.spaceType` to `DIRECT_MESSAGE` with a human
19715 /// user, along with exactly one membership.
19716 ///
19717 /// Must be empty when creating a 1:1 conversation between a human and the
19718 /// calling Chat app (when setting `Space.spaceType` to
19719 /// `DIRECT_MESSAGE` and `Space.singleUserBotDm` to `true`).
19720 pub memberships: std::vec::Vec<crate::model::Membership>,
19721
19722 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19723}
19724
19725impl SetUpSpaceRequest {
19726 /// Creates a new default instance.
19727 pub fn new() -> Self {
19728 std::default::Default::default()
19729 }
19730
19731 /// Sets the value of [space][crate::model::SetUpSpaceRequest::space].
19732 ///
19733 /// # Example
19734 /// ```ignore,no_run
19735 /// # use google_chat_v1::model::SetUpSpaceRequest;
19736 /// use google_chat_v1::model::Space;
19737 /// let x = SetUpSpaceRequest::new().set_space(Space::default()/* use setters */);
19738 /// ```
19739 pub fn set_space<T>(mut self, v: T) -> Self
19740 where
19741 T: std::convert::Into<crate::model::Space>,
19742 {
19743 self.space = std::option::Option::Some(v.into());
19744 self
19745 }
19746
19747 /// Sets or clears the value of [space][crate::model::SetUpSpaceRequest::space].
19748 ///
19749 /// # Example
19750 /// ```ignore,no_run
19751 /// # use google_chat_v1::model::SetUpSpaceRequest;
19752 /// use google_chat_v1::model::Space;
19753 /// let x = SetUpSpaceRequest::new().set_or_clear_space(Some(Space::default()/* use setters */));
19754 /// let x = SetUpSpaceRequest::new().set_or_clear_space(None::<Space>);
19755 /// ```
19756 pub fn set_or_clear_space<T>(mut self, v: std::option::Option<T>) -> Self
19757 where
19758 T: std::convert::Into<crate::model::Space>,
19759 {
19760 self.space = v.map(|x| x.into());
19761 self
19762 }
19763
19764 /// Sets the value of [request_id][crate::model::SetUpSpaceRequest::request_id].
19765 ///
19766 /// # Example
19767 /// ```ignore,no_run
19768 /// # use google_chat_v1::model::SetUpSpaceRequest;
19769 /// let x = SetUpSpaceRequest::new().set_request_id("example");
19770 /// ```
19771 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19772 self.request_id = v.into();
19773 self
19774 }
19775
19776 /// Sets the value of [memberships][crate::model::SetUpSpaceRequest::memberships].
19777 ///
19778 /// # Example
19779 /// ```ignore,no_run
19780 /// # use google_chat_v1::model::SetUpSpaceRequest;
19781 /// use google_chat_v1::model::Membership;
19782 /// let x = SetUpSpaceRequest::new()
19783 /// .set_memberships([
19784 /// Membership::default()/* use setters */,
19785 /// Membership::default()/* use (different) setters */,
19786 /// ]);
19787 /// ```
19788 pub fn set_memberships<T, V>(mut self, v: T) -> Self
19789 where
19790 T: std::iter::IntoIterator<Item = V>,
19791 V: std::convert::Into<crate::model::Membership>,
19792 {
19793 use std::iter::Iterator;
19794 self.memberships = v.into_iter().map(|i| i.into()).collect();
19795 self
19796 }
19797}
19798
19799impl wkt::message::Message for SetUpSpaceRequest {
19800 fn typename() -> &'static str {
19801 "type.googleapis.com/google.chat.v1.SetUpSpaceRequest"
19802 }
19803}
19804
19805/// A user's read state within a thread, used to identify read and unread
19806/// messages.
19807#[derive(Clone, Default, PartialEq)]
19808#[non_exhaustive]
19809pub struct ThreadReadState {
19810 /// Resource name of the thread read state.
19811 ///
19812 /// Format: `users/{user}/spaces/{space}/threads/{thread}/threadReadState`
19813 pub name: std::string::String,
19814
19815 /// The time when the user's thread read state was updated. Usually this
19816 /// corresponds with the timestamp of the last read message in a thread.
19817 pub last_read_time: std::option::Option<wkt::Timestamp>,
19818
19819 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19820}
19821
19822impl ThreadReadState {
19823 /// Creates a new default instance.
19824 pub fn new() -> Self {
19825 std::default::Default::default()
19826 }
19827
19828 /// Sets the value of [name][crate::model::ThreadReadState::name].
19829 ///
19830 /// # Example
19831 /// ```ignore,no_run
19832 /// # use google_chat_v1::model::ThreadReadState;
19833 /// # let user_id = "user_id";
19834 /// # let space_id = "space_id";
19835 /// # let thread_id = "thread_id";
19836 /// let x = ThreadReadState::new().set_name(format!("users/{user_id}/spaces/{space_id}/threads/{thread_id}/threadReadState"));
19837 /// ```
19838 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19839 self.name = v.into();
19840 self
19841 }
19842
19843 /// Sets the value of [last_read_time][crate::model::ThreadReadState::last_read_time].
19844 ///
19845 /// # Example
19846 /// ```ignore,no_run
19847 /// # use google_chat_v1::model::ThreadReadState;
19848 /// use wkt::Timestamp;
19849 /// let x = ThreadReadState::new().set_last_read_time(Timestamp::default()/* use setters */);
19850 /// ```
19851 pub fn set_last_read_time<T>(mut self, v: T) -> Self
19852 where
19853 T: std::convert::Into<wkt::Timestamp>,
19854 {
19855 self.last_read_time = std::option::Option::Some(v.into());
19856 self
19857 }
19858
19859 /// Sets or clears the value of [last_read_time][crate::model::ThreadReadState::last_read_time].
19860 ///
19861 /// # Example
19862 /// ```ignore,no_run
19863 /// # use google_chat_v1::model::ThreadReadState;
19864 /// use wkt::Timestamp;
19865 /// let x = ThreadReadState::new().set_or_clear_last_read_time(Some(Timestamp::default()/* use setters */));
19866 /// let x = ThreadReadState::new().set_or_clear_last_read_time(None::<Timestamp>);
19867 /// ```
19868 pub fn set_or_clear_last_read_time<T>(mut self, v: std::option::Option<T>) -> Self
19869 where
19870 T: std::convert::Into<wkt::Timestamp>,
19871 {
19872 self.last_read_time = v.map(|x| x.into());
19873 self
19874 }
19875}
19876
19877impl wkt::message::Message for ThreadReadState {
19878 fn typename() -> &'static str {
19879 "type.googleapis.com/google.chat.v1.ThreadReadState"
19880 }
19881}
19882
19883/// Request message for GetThreadReadStateRequest API.
19884#[derive(Clone, Default, PartialEq)]
19885#[non_exhaustive]
19886pub struct GetThreadReadStateRequest {
19887 /// Required. Resource name of the thread read state to retrieve.
19888 ///
19889 /// Only supports getting read state for the calling user.
19890 ///
19891 /// To refer to the calling user, set one of the following:
19892 ///
19893 /// - The `me` alias. For example,
19894 /// `users/me/spaces/{space}/threads/{thread}/threadReadState`.
19895 ///
19896 /// - Their Workspace email address. For example,
19897 /// `users/user@example.com/spaces/{space}/threads/{thread}/threadReadState`.
19898 ///
19899 /// - Their user id. For example,
19900 /// `users/123456789/spaces/{space}/threads/{thread}/threadReadState`.
19901 ///
19902 ///
19903 /// Format: users/{user}/spaces/{space}/threads/{thread}/threadReadState
19904 pub name: std::string::String,
19905
19906 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19907}
19908
19909impl GetThreadReadStateRequest {
19910 /// Creates a new default instance.
19911 pub fn new() -> Self {
19912 std::default::Default::default()
19913 }
19914
19915 /// Sets the value of [name][crate::model::GetThreadReadStateRequest::name].
19916 ///
19917 /// # Example
19918 /// ```ignore,no_run
19919 /// # use google_chat_v1::model::GetThreadReadStateRequest;
19920 /// # let user_id = "user_id";
19921 /// # let space_id = "space_id";
19922 /// # let thread_id = "thread_id";
19923 /// let x = GetThreadReadStateRequest::new().set_name(format!("users/{user_id}/spaces/{space_id}/threads/{thread_id}/threadReadState"));
19924 /// ```
19925 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19926 self.name = v.into();
19927 self
19928 }
19929}
19930
19931impl wkt::message::Message for GetThreadReadStateRequest {
19932 fn typename() -> &'static str {
19933 "type.googleapis.com/google.chat.v1.GetThreadReadStateRequest"
19934 }
19935}
19936
19937/// A user in Google Chat.
19938/// When returned as an output from a request, if your Chat app [authenticates as
19939/// a
19940/// user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
19941/// the output for a `User` resource only populates the user's `name` and `type`.
19942#[derive(Clone, Default, PartialEq)]
19943#[non_exhaustive]
19944pub struct User {
19945 /// Resource name for a Google Chat [user][google.chat.v1.User].
19946 ///
19947 /// Format: `users/{user}`. `users/app` can be used as an alias for the calling
19948 /// app [bot][google.chat.v1.User.Type.BOT] user.
19949 ///
19950 /// For [human users][google.chat.v1.User.Type.HUMAN], `{user}` is the same
19951 /// user identifier as:
19952 ///
19953 /// - the `id` for the
19954 /// [Person](https://developers.google.com/people/api/rest/v1/people) in the
19955 /// People API. For example, `users/123456789` in Chat API represents the same
19956 /// person as the `123456789` Person profile ID in People API.
19957 ///
19958 /// - the `id` for a
19959 /// [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users)
19960 /// in the Admin SDK Directory API.
19961 ///
19962 /// - the user's email address can be used as an alias for `{user}` in API
19963 /// requests. For example, if the People API Person profile ID for
19964 /// `user@example.com` is `123456789`, you can use `users/user@example.com` as
19965 /// an alias to reference `users/123456789`. Only the canonical resource name
19966 /// (for example `users/123456789`) will be returned from the API.
19967 ///
19968 ///
19969 /// [google.chat.v1.User]: crate::model::User
19970 /// [google.chat.v1.User.Type.BOT]: crate::model::user::Type::Bot
19971 /// [google.chat.v1.User.Type.HUMAN]: crate::model::user::Type::Human
19972 pub name: std::string::String,
19973
19974 /// Output only. The user's display name.
19975 pub display_name: std::string::String,
19976
19977 /// Unique identifier of the user's Google Workspace domain.
19978 pub domain_id: std::string::String,
19979
19980 /// User type.
19981 pub r#type: crate::model::user::Type,
19982
19983 /// Output only. When `true`, the user is deleted or their profile is not
19984 /// visible.
19985 pub is_anonymous: bool,
19986
19987 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19988}
19989
19990impl User {
19991 /// Creates a new default instance.
19992 pub fn new() -> Self {
19993 std::default::Default::default()
19994 }
19995
19996 /// Sets the value of [name][crate::model::User::name].
19997 ///
19998 /// # Example
19999 /// ```ignore,no_run
20000 /// # use google_chat_v1::model::User;
20001 /// let x = User::new().set_name("example");
20002 /// ```
20003 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20004 self.name = v.into();
20005 self
20006 }
20007
20008 /// Sets the value of [display_name][crate::model::User::display_name].
20009 ///
20010 /// # Example
20011 /// ```ignore,no_run
20012 /// # use google_chat_v1::model::User;
20013 /// let x = User::new().set_display_name("example");
20014 /// ```
20015 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20016 self.display_name = v.into();
20017 self
20018 }
20019
20020 /// Sets the value of [domain_id][crate::model::User::domain_id].
20021 ///
20022 /// # Example
20023 /// ```ignore,no_run
20024 /// # use google_chat_v1::model::User;
20025 /// let x = User::new().set_domain_id("example");
20026 /// ```
20027 pub fn set_domain_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20028 self.domain_id = v.into();
20029 self
20030 }
20031
20032 /// Sets the value of [r#type][crate::model::User::type].
20033 ///
20034 /// # Example
20035 /// ```ignore,no_run
20036 /// # use google_chat_v1::model::User;
20037 /// use google_chat_v1::model::user::Type;
20038 /// let x0 = User::new().set_type(Type::Human);
20039 /// let x1 = User::new().set_type(Type::Bot);
20040 /// ```
20041 pub fn set_type<T: std::convert::Into<crate::model::user::Type>>(mut self, v: T) -> Self {
20042 self.r#type = v.into();
20043 self
20044 }
20045
20046 /// Sets the value of [is_anonymous][crate::model::User::is_anonymous].
20047 ///
20048 /// # Example
20049 /// ```ignore,no_run
20050 /// # use google_chat_v1::model::User;
20051 /// let x = User::new().set_is_anonymous(true);
20052 /// ```
20053 pub fn set_is_anonymous<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
20054 self.is_anonymous = v.into();
20055 self
20056 }
20057}
20058
20059impl wkt::message::Message for User {
20060 fn typename() -> &'static str {
20061 "type.googleapis.com/google.chat.v1.User"
20062 }
20063}
20064
20065/// Defines additional types related to [User].
20066pub mod user {
20067 #[allow(unused_imports)]
20068 use super::*;
20069
20070 /// Enum for [Type].
20071 ///
20072 /// # Working with unknown values
20073 ///
20074 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
20075 /// additional enum variants at any time. Adding new variants is not considered
20076 /// a breaking change. Applications should write their code in anticipation of:
20077 ///
20078 /// - New values appearing in future releases of the client library, **and**
20079 /// - New values received dynamically, without application changes.
20080 ///
20081 /// Please consult the [Working with enums] section in the user guide for some
20082 /// guidelines.
20083 ///
20084 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
20085 #[derive(Clone, Debug, PartialEq)]
20086 #[non_exhaustive]
20087 pub enum Type {
20088 /// Default value for the enum. DO NOT USE.
20089 Unspecified,
20090 /// Human user.
20091 Human,
20092 /// Chat app user.
20093 Bot,
20094 /// If set, the enum was initialized with an unknown value.
20095 ///
20096 /// Applications can examine the value using [Type::value] or
20097 /// [Type::name].
20098 UnknownValue(r#type::UnknownValue),
20099 }
20100
20101 #[doc(hidden)]
20102 pub mod r#type {
20103 #[allow(unused_imports)]
20104 use super::*;
20105 #[derive(Clone, Debug, PartialEq)]
20106 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20107 }
20108
20109 impl Type {
20110 /// Gets the enum value.
20111 ///
20112 /// Returns `None` if the enum contains an unknown value deserialized from
20113 /// the string representation of enums.
20114 pub fn value(&self) -> std::option::Option<i32> {
20115 match self {
20116 Self::Unspecified => std::option::Option::Some(0),
20117 Self::Human => std::option::Option::Some(1),
20118 Self::Bot => std::option::Option::Some(2),
20119 Self::UnknownValue(u) => u.0.value(),
20120 }
20121 }
20122
20123 /// Gets the enum value as a string.
20124 ///
20125 /// Returns `None` if the enum contains an unknown value deserialized from
20126 /// the integer representation of enums.
20127 pub fn name(&self) -> std::option::Option<&str> {
20128 match self {
20129 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
20130 Self::Human => std::option::Option::Some("HUMAN"),
20131 Self::Bot => std::option::Option::Some("BOT"),
20132 Self::UnknownValue(u) => u.0.name(),
20133 }
20134 }
20135 }
20136
20137 impl std::default::Default for Type {
20138 fn default() -> Self {
20139 use std::convert::From;
20140 Self::from(0)
20141 }
20142 }
20143
20144 impl std::fmt::Display for Type {
20145 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20146 wkt::internal::display_enum(f, self.name(), self.value())
20147 }
20148 }
20149
20150 impl std::convert::From<i32> for Type {
20151 fn from(value: i32) -> Self {
20152 match value {
20153 0 => Self::Unspecified,
20154 1 => Self::Human,
20155 2 => Self::Bot,
20156 _ => Self::UnknownValue(r#type::UnknownValue(
20157 wkt::internal::UnknownEnumValue::Integer(value),
20158 )),
20159 }
20160 }
20161 }
20162
20163 impl std::convert::From<&str> for Type {
20164 fn from(value: &str) -> Self {
20165 use std::string::ToString;
20166 match value {
20167 "TYPE_UNSPECIFIED" => Self::Unspecified,
20168 "HUMAN" => Self::Human,
20169 "BOT" => Self::Bot,
20170 _ => Self::UnknownValue(r#type::UnknownValue(
20171 wkt::internal::UnknownEnumValue::String(value.to_string()),
20172 )),
20173 }
20174 }
20175 }
20176
20177 impl serde::ser::Serialize for Type {
20178 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20179 where
20180 S: serde::Serializer,
20181 {
20182 match self {
20183 Self::Unspecified => serializer.serialize_i32(0),
20184 Self::Human => serializer.serialize_i32(1),
20185 Self::Bot => serializer.serialize_i32(2),
20186 Self::UnknownValue(u) => u.0.serialize(serializer),
20187 }
20188 }
20189 }
20190
20191 impl<'de> serde::de::Deserialize<'de> for Type {
20192 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20193 where
20194 D: serde::Deserializer<'de>,
20195 {
20196 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
20197 ".google.chat.v1.User.Type",
20198 ))
20199 }
20200 }
20201}
20202
20203/// A widget is a UI element that presents text and images.
20204#[derive(Clone, Default, PartialEq)]
20205#[non_exhaustive]
20206pub struct WidgetMarkup {
20207 /// A list of buttons. Buttons is also `oneof data` and only one of these
20208 /// fields should be set.
20209 pub buttons: std::vec::Vec<crate::model::widget_markup::Button>,
20210
20211 /// A `WidgetMarkup` can only have one of the following items. You can use
20212 /// multiple `WidgetMarkup` fields to display more items.
20213 pub data: std::option::Option<crate::model::widget_markup::Data>,
20214
20215 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20216}
20217
20218impl WidgetMarkup {
20219 /// Creates a new default instance.
20220 pub fn new() -> Self {
20221 std::default::Default::default()
20222 }
20223
20224 /// Sets the value of [buttons][crate::model::WidgetMarkup::buttons].
20225 ///
20226 /// # Example
20227 /// ```ignore,no_run
20228 /// # use google_chat_v1::model::WidgetMarkup;
20229 /// use google_chat_v1::model::widget_markup::Button;
20230 /// let x = WidgetMarkup::new()
20231 /// .set_buttons([
20232 /// Button::default()/* use setters */,
20233 /// Button::default()/* use (different) setters */,
20234 /// ]);
20235 /// ```
20236 pub fn set_buttons<T, V>(mut self, v: T) -> Self
20237 where
20238 T: std::iter::IntoIterator<Item = V>,
20239 V: std::convert::Into<crate::model::widget_markup::Button>,
20240 {
20241 use std::iter::Iterator;
20242 self.buttons = v.into_iter().map(|i| i.into()).collect();
20243 self
20244 }
20245
20246 /// Sets the value of [data][crate::model::WidgetMarkup::data].
20247 ///
20248 /// Note that all the setters affecting `data` are mutually
20249 /// exclusive.
20250 ///
20251 /// # Example
20252 /// ```ignore,no_run
20253 /// # use google_chat_v1::model::WidgetMarkup;
20254 /// use google_chat_v1::model::widget_markup::TextParagraph;
20255 /// let x = WidgetMarkup::new().set_data(Some(
20256 /// google_chat_v1::model::widget_markup::Data::TextParagraph(TextParagraph::default().into())));
20257 /// ```
20258 pub fn set_data<
20259 T: std::convert::Into<std::option::Option<crate::model::widget_markup::Data>>,
20260 >(
20261 mut self,
20262 v: T,
20263 ) -> Self {
20264 self.data = v.into();
20265 self
20266 }
20267
20268 /// The value of [data][crate::model::WidgetMarkup::data]
20269 /// if it holds a `TextParagraph`, `None` if the field is not set or
20270 /// holds a different branch.
20271 pub fn text_paragraph(
20272 &self,
20273 ) -> std::option::Option<&std::boxed::Box<crate::model::widget_markup::TextParagraph>> {
20274 #[allow(unreachable_patterns)]
20275 self.data.as_ref().and_then(|v| match v {
20276 crate::model::widget_markup::Data::TextParagraph(v) => std::option::Option::Some(v),
20277 _ => std::option::Option::None,
20278 })
20279 }
20280
20281 /// Sets the value of [data][crate::model::WidgetMarkup::data]
20282 /// to hold a `TextParagraph`.
20283 ///
20284 /// Note that all the setters affecting `data` are
20285 /// mutually exclusive.
20286 ///
20287 /// # Example
20288 /// ```ignore,no_run
20289 /// # use google_chat_v1::model::WidgetMarkup;
20290 /// use google_chat_v1::model::widget_markup::TextParagraph;
20291 /// let x = WidgetMarkup::new().set_text_paragraph(TextParagraph::default()/* use setters */);
20292 /// assert!(x.text_paragraph().is_some());
20293 /// assert!(x.image().is_none());
20294 /// assert!(x.key_value().is_none());
20295 /// ```
20296 pub fn set_text_paragraph<
20297 T: std::convert::Into<std::boxed::Box<crate::model::widget_markup::TextParagraph>>,
20298 >(
20299 mut self,
20300 v: T,
20301 ) -> Self {
20302 self.data =
20303 std::option::Option::Some(crate::model::widget_markup::Data::TextParagraph(v.into()));
20304 self
20305 }
20306
20307 /// The value of [data][crate::model::WidgetMarkup::data]
20308 /// if it holds a `Image`, `None` if the field is not set or
20309 /// holds a different branch.
20310 pub fn image(
20311 &self,
20312 ) -> std::option::Option<&std::boxed::Box<crate::model::widget_markup::Image>> {
20313 #[allow(unreachable_patterns)]
20314 self.data.as_ref().and_then(|v| match v {
20315 crate::model::widget_markup::Data::Image(v) => std::option::Option::Some(v),
20316 _ => std::option::Option::None,
20317 })
20318 }
20319
20320 /// Sets the value of [data][crate::model::WidgetMarkup::data]
20321 /// to hold a `Image`.
20322 ///
20323 /// Note that all the setters affecting `data` are
20324 /// mutually exclusive.
20325 ///
20326 /// # Example
20327 /// ```ignore,no_run
20328 /// # use google_chat_v1::model::WidgetMarkup;
20329 /// use google_chat_v1::model::widget_markup::Image;
20330 /// let x = WidgetMarkup::new().set_image(Image::default()/* use setters */);
20331 /// assert!(x.image().is_some());
20332 /// assert!(x.text_paragraph().is_none());
20333 /// assert!(x.key_value().is_none());
20334 /// ```
20335 pub fn set_image<T: std::convert::Into<std::boxed::Box<crate::model::widget_markup::Image>>>(
20336 mut self,
20337 v: T,
20338 ) -> Self {
20339 self.data = std::option::Option::Some(crate::model::widget_markup::Data::Image(v.into()));
20340 self
20341 }
20342
20343 /// The value of [data][crate::model::WidgetMarkup::data]
20344 /// if it holds a `KeyValue`, `None` if the field is not set or
20345 /// holds a different branch.
20346 pub fn key_value(
20347 &self,
20348 ) -> std::option::Option<&std::boxed::Box<crate::model::widget_markup::KeyValue>> {
20349 #[allow(unreachable_patterns)]
20350 self.data.as_ref().and_then(|v| match v {
20351 crate::model::widget_markup::Data::KeyValue(v) => std::option::Option::Some(v),
20352 _ => std::option::Option::None,
20353 })
20354 }
20355
20356 /// Sets the value of [data][crate::model::WidgetMarkup::data]
20357 /// to hold a `KeyValue`.
20358 ///
20359 /// Note that all the setters affecting `data` are
20360 /// mutually exclusive.
20361 ///
20362 /// # Example
20363 /// ```ignore,no_run
20364 /// # use google_chat_v1::model::WidgetMarkup;
20365 /// use google_chat_v1::model::widget_markup::KeyValue;
20366 /// let x = WidgetMarkup::new().set_key_value(KeyValue::default()/* use setters */);
20367 /// assert!(x.key_value().is_some());
20368 /// assert!(x.text_paragraph().is_none());
20369 /// assert!(x.image().is_none());
20370 /// ```
20371 pub fn set_key_value<
20372 T: std::convert::Into<std::boxed::Box<crate::model::widget_markup::KeyValue>>,
20373 >(
20374 mut self,
20375 v: T,
20376 ) -> Self {
20377 self.data =
20378 std::option::Option::Some(crate::model::widget_markup::Data::KeyValue(v.into()));
20379 self
20380 }
20381}
20382
20383impl wkt::message::Message for WidgetMarkup {
20384 fn typename() -> &'static str {
20385 "type.googleapis.com/google.chat.v1.WidgetMarkup"
20386 }
20387}
20388
20389/// Defines additional types related to [WidgetMarkup].
20390pub mod widget_markup {
20391 #[allow(unused_imports)]
20392 use super::*;
20393
20394 /// A paragraph of text. Formatted text supported. For more information
20395 /// about formatting text, see
20396 /// [Formatting text in Google Chat
20397 /// apps](https://developers.google.com/workspace/chat/format-messages#card-formatting)
20398 /// and
20399 /// [Formatting
20400 /// text in Google Workspace
20401 /// Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting).
20402 #[derive(Clone, Default, PartialEq)]
20403 #[non_exhaustive]
20404 pub struct TextParagraph {
20405 #[allow(missing_docs)]
20406 pub text: std::string::String,
20407
20408 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20409 }
20410
20411 impl TextParagraph {
20412 /// Creates a new default instance.
20413 pub fn new() -> Self {
20414 std::default::Default::default()
20415 }
20416
20417 /// Sets the value of [text][crate::model::widget_markup::TextParagraph::text].
20418 ///
20419 /// # Example
20420 /// ```ignore,no_run
20421 /// # use google_chat_v1::model::widget_markup::TextParagraph;
20422 /// let x = TextParagraph::new().set_text("example");
20423 /// ```
20424 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20425 self.text = v.into();
20426 self
20427 }
20428 }
20429
20430 impl wkt::message::Message for TextParagraph {
20431 fn typename() -> &'static str {
20432 "type.googleapis.com/google.chat.v1.WidgetMarkup.TextParagraph"
20433 }
20434 }
20435
20436 /// A button. Can be a text button or an image button.
20437 #[derive(Clone, Default, PartialEq)]
20438 #[non_exhaustive]
20439 pub struct Button {
20440 #[allow(missing_docs)]
20441 pub r#type: std::option::Option<crate::model::widget_markup::button::Type>,
20442
20443 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20444 }
20445
20446 impl Button {
20447 /// Creates a new default instance.
20448 pub fn new() -> Self {
20449 std::default::Default::default()
20450 }
20451
20452 /// Sets the value of [r#type][crate::model::widget_markup::Button::type].
20453 ///
20454 /// Note that all the setters affecting `r#type` are mutually
20455 /// exclusive.
20456 ///
20457 /// # Example
20458 /// ```ignore,no_run
20459 /// # use google_chat_v1::model::widget_markup::Button;
20460 /// use google_chat_v1::model::widget_markup::TextButton;
20461 /// let x = Button::new().set_type(Some(
20462 /// google_chat_v1::model::widget_markup::button::Type::TextButton(TextButton::default().into())));
20463 /// ```
20464 pub fn set_type<
20465 T: std::convert::Into<std::option::Option<crate::model::widget_markup::button::Type>>,
20466 >(
20467 mut self,
20468 v: T,
20469 ) -> Self {
20470 self.r#type = v.into();
20471 self
20472 }
20473
20474 /// The value of [r#type][crate::model::widget_markup::Button::r#type]
20475 /// if it holds a `TextButton`, `None` if the field is not set or
20476 /// holds a different branch.
20477 pub fn text_button(
20478 &self,
20479 ) -> std::option::Option<&std::boxed::Box<crate::model::widget_markup::TextButton>>
20480 {
20481 #[allow(unreachable_patterns)]
20482 self.r#type.as_ref().and_then(|v| match v {
20483 crate::model::widget_markup::button::Type::TextButton(v) => {
20484 std::option::Option::Some(v)
20485 }
20486 _ => std::option::Option::None,
20487 })
20488 }
20489
20490 /// Sets the value of [r#type][crate::model::widget_markup::Button::r#type]
20491 /// to hold a `TextButton`.
20492 ///
20493 /// Note that all the setters affecting `r#type` are
20494 /// mutually exclusive.
20495 ///
20496 /// # Example
20497 /// ```ignore,no_run
20498 /// # use google_chat_v1::model::widget_markup::Button;
20499 /// use google_chat_v1::model::widget_markup::TextButton;
20500 /// let x = Button::new().set_text_button(TextButton::default()/* use setters */);
20501 /// assert!(x.text_button().is_some());
20502 /// assert!(x.image_button().is_none());
20503 /// ```
20504 pub fn set_text_button<
20505 T: std::convert::Into<std::boxed::Box<crate::model::widget_markup::TextButton>>,
20506 >(
20507 mut self,
20508 v: T,
20509 ) -> Self {
20510 self.r#type = std::option::Option::Some(
20511 crate::model::widget_markup::button::Type::TextButton(v.into()),
20512 );
20513 self
20514 }
20515
20516 /// The value of [r#type][crate::model::widget_markup::Button::r#type]
20517 /// if it holds a `ImageButton`, `None` if the field is not set or
20518 /// holds a different branch.
20519 pub fn image_button(
20520 &self,
20521 ) -> std::option::Option<&std::boxed::Box<crate::model::widget_markup::ImageButton>>
20522 {
20523 #[allow(unreachable_patterns)]
20524 self.r#type.as_ref().and_then(|v| match v {
20525 crate::model::widget_markup::button::Type::ImageButton(v) => {
20526 std::option::Option::Some(v)
20527 }
20528 _ => std::option::Option::None,
20529 })
20530 }
20531
20532 /// Sets the value of [r#type][crate::model::widget_markup::Button::r#type]
20533 /// to hold a `ImageButton`.
20534 ///
20535 /// Note that all the setters affecting `r#type` are
20536 /// mutually exclusive.
20537 ///
20538 /// # Example
20539 /// ```ignore,no_run
20540 /// # use google_chat_v1::model::widget_markup::Button;
20541 /// use google_chat_v1::model::widget_markup::ImageButton;
20542 /// let x = Button::new().set_image_button(ImageButton::default()/* use setters */);
20543 /// assert!(x.image_button().is_some());
20544 /// assert!(x.text_button().is_none());
20545 /// ```
20546 pub fn set_image_button<
20547 T: std::convert::Into<std::boxed::Box<crate::model::widget_markup::ImageButton>>,
20548 >(
20549 mut self,
20550 v: T,
20551 ) -> Self {
20552 self.r#type = std::option::Option::Some(
20553 crate::model::widget_markup::button::Type::ImageButton(v.into()),
20554 );
20555 self
20556 }
20557 }
20558
20559 impl wkt::message::Message for Button {
20560 fn typename() -> &'static str {
20561 "type.googleapis.com/google.chat.v1.WidgetMarkup.Button"
20562 }
20563 }
20564
20565 /// Defines additional types related to [Button].
20566 pub mod button {
20567 #[allow(unused_imports)]
20568 use super::*;
20569
20570 #[allow(missing_docs)]
20571 #[derive(Clone, Debug, PartialEq)]
20572 #[non_exhaustive]
20573 pub enum Type {
20574 /// A button with text and `onclick` action.
20575 TextButton(std::boxed::Box<crate::model::widget_markup::TextButton>),
20576 /// A button with image and `onclick` action.
20577 ImageButton(std::boxed::Box<crate::model::widget_markup::ImageButton>),
20578 }
20579 }
20580
20581 /// A button with text and `onclick` action.
20582 #[derive(Clone, Default, PartialEq)]
20583 #[non_exhaustive]
20584 pub struct TextButton {
20585 /// The text of the button.
20586 pub text: std::string::String,
20587
20588 /// The `onclick` action of the button.
20589 pub on_click: std::option::Option<crate::model::widget_markup::OnClick>,
20590
20591 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20592 }
20593
20594 impl TextButton {
20595 /// Creates a new default instance.
20596 pub fn new() -> Self {
20597 std::default::Default::default()
20598 }
20599
20600 /// Sets the value of [text][crate::model::widget_markup::TextButton::text].
20601 ///
20602 /// # Example
20603 /// ```ignore,no_run
20604 /// # use google_chat_v1::model::widget_markup::TextButton;
20605 /// let x = TextButton::new().set_text("example");
20606 /// ```
20607 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20608 self.text = v.into();
20609 self
20610 }
20611
20612 /// Sets the value of [on_click][crate::model::widget_markup::TextButton::on_click].
20613 ///
20614 /// # Example
20615 /// ```ignore,no_run
20616 /// # use google_chat_v1::model::widget_markup::TextButton;
20617 /// use google_chat_v1::model::widget_markup::OnClick;
20618 /// let x = TextButton::new().set_on_click(OnClick::default()/* use setters */);
20619 /// ```
20620 pub fn set_on_click<T>(mut self, v: T) -> Self
20621 where
20622 T: std::convert::Into<crate::model::widget_markup::OnClick>,
20623 {
20624 self.on_click = std::option::Option::Some(v.into());
20625 self
20626 }
20627
20628 /// Sets or clears the value of [on_click][crate::model::widget_markup::TextButton::on_click].
20629 ///
20630 /// # Example
20631 /// ```ignore,no_run
20632 /// # use google_chat_v1::model::widget_markup::TextButton;
20633 /// use google_chat_v1::model::widget_markup::OnClick;
20634 /// let x = TextButton::new().set_or_clear_on_click(Some(OnClick::default()/* use setters */));
20635 /// let x = TextButton::new().set_or_clear_on_click(None::<OnClick>);
20636 /// ```
20637 pub fn set_or_clear_on_click<T>(mut self, v: std::option::Option<T>) -> Self
20638 where
20639 T: std::convert::Into<crate::model::widget_markup::OnClick>,
20640 {
20641 self.on_click = v.map(|x| x.into());
20642 self
20643 }
20644 }
20645
20646 impl wkt::message::Message for TextButton {
20647 fn typename() -> &'static str {
20648 "type.googleapis.com/google.chat.v1.WidgetMarkup.TextButton"
20649 }
20650 }
20651
20652 /// A UI element contains a key (label) and a value (content). This
20653 /// element can also contain some actions such as `onclick` button.
20654 #[derive(Clone, Default, PartialEq)]
20655 #[non_exhaustive]
20656 pub struct KeyValue {
20657 /// The text of the top label. Formatted text supported. For more information
20658 /// about formatting text, see
20659 /// [Formatting text in Google Chat
20660 /// apps](https://developers.google.com/workspace/chat/format-messages#card-formatting)
20661 /// and
20662 /// [Formatting
20663 /// text in Google Workspace
20664 /// Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting).
20665 pub top_label: std::string::String,
20666
20667 /// The text of the content. Formatted text supported and always required.
20668 /// For more information
20669 /// about formatting text, see
20670 /// [Formatting text in Google Chat
20671 /// apps](https://developers.google.com/workspace/chat/format-messages#card-formatting)
20672 /// and
20673 /// [Formatting
20674 /// text in Google Workspace
20675 /// Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting).
20676 pub content: std::string::String,
20677
20678 /// If the content should be multiline.
20679 pub content_multiline: bool,
20680
20681 /// The text of the bottom label. Formatted text supported. For more
20682 /// information about formatting text, see [Formatting text in Google Chat
20683 /// apps](https://developers.google.com/workspace/chat/format-messages#card-formatting)
20684 /// and
20685 /// [Formatting
20686 /// text in Google Workspace
20687 /// Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting).
20688 pub bottom_label: std::string::String,
20689
20690 /// The `onclick` action. Only the top label, bottom label, and content
20691 /// region are clickable.
20692 pub on_click: std::option::Option<crate::model::widget_markup::OnClick>,
20693
20694 /// At least one of icons, `top_label` and `bottom_label` must be defined.
20695 pub icons: std::option::Option<crate::model::widget_markup::key_value::Icons>,
20696
20697 /// A control widget. You can set either `button` or `switch_widget`,
20698 /// but not both.
20699 pub control: std::option::Option<crate::model::widget_markup::key_value::Control>,
20700
20701 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20702 }
20703
20704 impl KeyValue {
20705 /// Creates a new default instance.
20706 pub fn new() -> Self {
20707 std::default::Default::default()
20708 }
20709
20710 /// Sets the value of [top_label][crate::model::widget_markup::KeyValue::top_label].
20711 ///
20712 /// # Example
20713 /// ```ignore,no_run
20714 /// # use google_chat_v1::model::widget_markup::KeyValue;
20715 /// let x = KeyValue::new().set_top_label("example");
20716 /// ```
20717 pub fn set_top_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20718 self.top_label = v.into();
20719 self
20720 }
20721
20722 /// Sets the value of [content][crate::model::widget_markup::KeyValue::content].
20723 ///
20724 /// # Example
20725 /// ```ignore,no_run
20726 /// # use google_chat_v1::model::widget_markup::KeyValue;
20727 /// let x = KeyValue::new().set_content("example");
20728 /// ```
20729 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20730 self.content = v.into();
20731 self
20732 }
20733
20734 /// Sets the value of [content_multiline][crate::model::widget_markup::KeyValue::content_multiline].
20735 ///
20736 /// # Example
20737 /// ```ignore,no_run
20738 /// # use google_chat_v1::model::widget_markup::KeyValue;
20739 /// let x = KeyValue::new().set_content_multiline(true);
20740 /// ```
20741 pub fn set_content_multiline<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
20742 self.content_multiline = v.into();
20743 self
20744 }
20745
20746 /// Sets the value of [bottom_label][crate::model::widget_markup::KeyValue::bottom_label].
20747 ///
20748 /// # Example
20749 /// ```ignore,no_run
20750 /// # use google_chat_v1::model::widget_markup::KeyValue;
20751 /// let x = KeyValue::new().set_bottom_label("example");
20752 /// ```
20753 pub fn set_bottom_label<T: std::convert::Into<std::string::String>>(
20754 mut self,
20755 v: T,
20756 ) -> Self {
20757 self.bottom_label = v.into();
20758 self
20759 }
20760
20761 /// Sets the value of [on_click][crate::model::widget_markup::KeyValue::on_click].
20762 ///
20763 /// # Example
20764 /// ```ignore,no_run
20765 /// # use google_chat_v1::model::widget_markup::KeyValue;
20766 /// use google_chat_v1::model::widget_markup::OnClick;
20767 /// let x = KeyValue::new().set_on_click(OnClick::default()/* use setters */);
20768 /// ```
20769 pub fn set_on_click<T>(mut self, v: T) -> Self
20770 where
20771 T: std::convert::Into<crate::model::widget_markup::OnClick>,
20772 {
20773 self.on_click = std::option::Option::Some(v.into());
20774 self
20775 }
20776
20777 /// Sets or clears the value of [on_click][crate::model::widget_markup::KeyValue::on_click].
20778 ///
20779 /// # Example
20780 /// ```ignore,no_run
20781 /// # use google_chat_v1::model::widget_markup::KeyValue;
20782 /// use google_chat_v1::model::widget_markup::OnClick;
20783 /// let x = KeyValue::new().set_or_clear_on_click(Some(OnClick::default()/* use setters */));
20784 /// let x = KeyValue::new().set_or_clear_on_click(None::<OnClick>);
20785 /// ```
20786 pub fn set_or_clear_on_click<T>(mut self, v: std::option::Option<T>) -> Self
20787 where
20788 T: std::convert::Into<crate::model::widget_markup::OnClick>,
20789 {
20790 self.on_click = v.map(|x| x.into());
20791 self
20792 }
20793
20794 /// Sets the value of [icons][crate::model::widget_markup::KeyValue::icons].
20795 ///
20796 /// Note that all the setters affecting `icons` are mutually
20797 /// exclusive.
20798 ///
20799 /// # Example
20800 /// ```ignore,no_run
20801 /// # use google_chat_v1::model::widget_markup::KeyValue;
20802 /// use google_chat_v1::model::widget_markup::Icon;
20803 /// let x0 = KeyValue::new().set_icons(Some(
20804 /// google_chat_v1::model::widget_markup::key_value::Icons::Icon(Icon::Airplane)));
20805 /// let x1 = KeyValue::new().set_icons(Some(
20806 /// google_chat_v1::model::widget_markup::key_value::Icons::Icon(Icon::Bookmark)));
20807 /// let x2 = KeyValue::new().set_icons(Some(
20808 /// google_chat_v1::model::widget_markup::key_value::Icons::Icon(Icon::Bus)));
20809 /// ```
20810 pub fn set_icons<
20811 T: std::convert::Into<std::option::Option<crate::model::widget_markup::key_value::Icons>>,
20812 >(
20813 mut self,
20814 v: T,
20815 ) -> Self {
20816 self.icons = v.into();
20817 self
20818 }
20819
20820 /// The value of [icons][crate::model::widget_markup::KeyValue::icons]
20821 /// if it holds a `Icon`, `None` if the field is not set or
20822 /// holds a different branch.
20823 pub fn icon(&self) -> std::option::Option<&crate::model::widget_markup::Icon> {
20824 #[allow(unreachable_patterns)]
20825 self.icons.as_ref().and_then(|v| match v {
20826 crate::model::widget_markup::key_value::Icons::Icon(v) => {
20827 std::option::Option::Some(v)
20828 }
20829 _ => std::option::Option::None,
20830 })
20831 }
20832
20833 /// Sets the value of [icons][crate::model::widget_markup::KeyValue::icons]
20834 /// to hold a `Icon`.
20835 ///
20836 /// Note that all the setters affecting `icons` are
20837 /// mutually exclusive.
20838 ///
20839 /// # Example
20840 /// ```ignore,no_run
20841 /// # use google_chat_v1::model::widget_markup::KeyValue;
20842 /// use google_chat_v1::model::widget_markup::Icon;
20843 /// let x0 = KeyValue::new().set_icon(Icon::Airplane);
20844 /// let x1 = KeyValue::new().set_icon(Icon::Bookmark);
20845 /// let x2 = KeyValue::new().set_icon(Icon::Bus);
20846 /// assert!(x0.icon().is_some());
20847 /// assert!(x0.icon_url().is_none());
20848 /// assert!(x1.icon().is_some());
20849 /// assert!(x1.icon_url().is_none());
20850 /// assert!(x2.icon().is_some());
20851 /// assert!(x2.icon_url().is_none());
20852 /// ```
20853 pub fn set_icon<T: std::convert::Into<crate::model::widget_markup::Icon>>(
20854 mut self,
20855 v: T,
20856 ) -> Self {
20857 self.icons = std::option::Option::Some(
20858 crate::model::widget_markup::key_value::Icons::Icon(v.into()),
20859 );
20860 self
20861 }
20862
20863 /// The value of [icons][crate::model::widget_markup::KeyValue::icons]
20864 /// if it holds a `IconUrl`, `None` if the field is not set or
20865 /// holds a different branch.
20866 pub fn icon_url(&self) -> std::option::Option<&std::string::String> {
20867 #[allow(unreachable_patterns)]
20868 self.icons.as_ref().and_then(|v| match v {
20869 crate::model::widget_markup::key_value::Icons::IconUrl(v) => {
20870 std::option::Option::Some(v)
20871 }
20872 _ => std::option::Option::None,
20873 })
20874 }
20875
20876 /// Sets the value of [icons][crate::model::widget_markup::KeyValue::icons]
20877 /// to hold a `IconUrl`.
20878 ///
20879 /// Note that all the setters affecting `icons` are
20880 /// mutually exclusive.
20881 ///
20882 /// # Example
20883 /// ```ignore,no_run
20884 /// # use google_chat_v1::model::widget_markup::KeyValue;
20885 /// let x = KeyValue::new().set_icon_url("example");
20886 /// assert!(x.icon_url().is_some());
20887 /// assert!(x.icon().is_none());
20888 /// ```
20889 pub fn set_icon_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20890 self.icons = std::option::Option::Some(
20891 crate::model::widget_markup::key_value::Icons::IconUrl(v.into()),
20892 );
20893 self
20894 }
20895
20896 /// Sets the value of [control][crate::model::widget_markup::KeyValue::control].
20897 ///
20898 /// Note that all the setters affecting `control` are mutually
20899 /// exclusive.
20900 ///
20901 /// # Example
20902 /// ```ignore,no_run
20903 /// # use google_chat_v1::model::widget_markup::KeyValue;
20904 /// use google_chat_v1::model::widget_markup::Button;
20905 /// let x = KeyValue::new().set_control(Some(
20906 /// google_chat_v1::model::widget_markup::key_value::Control::Button(Button::default().into())));
20907 /// ```
20908 pub fn set_control<
20909 T: std::convert::Into<
20910 std::option::Option<crate::model::widget_markup::key_value::Control>,
20911 >,
20912 >(
20913 mut self,
20914 v: T,
20915 ) -> Self {
20916 self.control = v.into();
20917 self
20918 }
20919
20920 /// The value of [control][crate::model::widget_markup::KeyValue::control]
20921 /// if it holds a `Button`, `None` if the field is not set or
20922 /// holds a different branch.
20923 pub fn button(
20924 &self,
20925 ) -> std::option::Option<&std::boxed::Box<crate::model::widget_markup::Button>> {
20926 #[allow(unreachable_patterns)]
20927 self.control.as_ref().and_then(|v| match v {
20928 crate::model::widget_markup::key_value::Control::Button(v) => {
20929 std::option::Option::Some(v)
20930 }
20931 _ => std::option::Option::None,
20932 })
20933 }
20934
20935 /// Sets the value of [control][crate::model::widget_markup::KeyValue::control]
20936 /// to hold a `Button`.
20937 ///
20938 /// Note that all the setters affecting `control` are
20939 /// mutually exclusive.
20940 ///
20941 /// # Example
20942 /// ```ignore,no_run
20943 /// # use google_chat_v1::model::widget_markup::KeyValue;
20944 /// use google_chat_v1::model::widget_markup::Button;
20945 /// let x = KeyValue::new().set_button(Button::default()/* use setters */);
20946 /// assert!(x.button().is_some());
20947 /// ```
20948 pub fn set_button<
20949 T: std::convert::Into<std::boxed::Box<crate::model::widget_markup::Button>>,
20950 >(
20951 mut self,
20952 v: T,
20953 ) -> Self {
20954 self.control = std::option::Option::Some(
20955 crate::model::widget_markup::key_value::Control::Button(v.into()),
20956 );
20957 self
20958 }
20959 }
20960
20961 impl wkt::message::Message for KeyValue {
20962 fn typename() -> &'static str {
20963 "type.googleapis.com/google.chat.v1.WidgetMarkup.KeyValue"
20964 }
20965 }
20966
20967 /// Defines additional types related to [KeyValue].
20968 pub mod key_value {
20969 #[allow(unused_imports)]
20970 use super::*;
20971
20972 /// At least one of icons, `top_label` and `bottom_label` must be defined.
20973 #[derive(Clone, Debug, PartialEq)]
20974 #[non_exhaustive]
20975 pub enum Icons {
20976 /// An enum value that's replaced by the Chat API with the
20977 /// corresponding icon image.
20978 Icon(crate::model::widget_markup::Icon),
20979 /// The icon specified by a URL.
20980 IconUrl(std::string::String),
20981 }
20982
20983 /// A control widget. You can set either `button` or `switch_widget`,
20984 /// but not both.
20985 #[derive(Clone, Debug, PartialEq)]
20986 #[non_exhaustive]
20987 pub enum Control {
20988 /// A button that can be clicked to trigger an action.
20989 Button(std::boxed::Box<crate::model::widget_markup::Button>),
20990 }
20991 }
20992
20993 /// An image that's specified by a URL and can have an `onclick` action.
20994 #[derive(Clone, Default, PartialEq)]
20995 #[non_exhaustive]
20996 pub struct Image {
20997 /// The URL of the image.
20998 pub image_url: std::string::String,
20999
21000 /// The `onclick` action.
21001 pub on_click: std::option::Option<crate::model::widget_markup::OnClick>,
21002
21003 /// The aspect ratio of this image (width and height). This field lets you
21004 /// reserve the right height for the image while waiting for it to load.
21005 /// It's not meant to override the built-in aspect ratio of the image.
21006 /// If unset, the server fills it by prefetching the image.
21007 pub aspect_ratio: f64,
21008
21009 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21010 }
21011
21012 impl Image {
21013 /// Creates a new default instance.
21014 pub fn new() -> Self {
21015 std::default::Default::default()
21016 }
21017
21018 /// Sets the value of [image_url][crate::model::widget_markup::Image::image_url].
21019 ///
21020 /// # Example
21021 /// ```ignore,no_run
21022 /// # use google_chat_v1::model::widget_markup::Image;
21023 /// let x = Image::new().set_image_url("example");
21024 /// ```
21025 pub fn set_image_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21026 self.image_url = v.into();
21027 self
21028 }
21029
21030 /// Sets the value of [on_click][crate::model::widget_markup::Image::on_click].
21031 ///
21032 /// # Example
21033 /// ```ignore,no_run
21034 /// # use google_chat_v1::model::widget_markup::Image;
21035 /// use google_chat_v1::model::widget_markup::OnClick;
21036 /// let x = Image::new().set_on_click(OnClick::default()/* use setters */);
21037 /// ```
21038 pub fn set_on_click<T>(mut self, v: T) -> Self
21039 where
21040 T: std::convert::Into<crate::model::widget_markup::OnClick>,
21041 {
21042 self.on_click = std::option::Option::Some(v.into());
21043 self
21044 }
21045
21046 /// Sets or clears the value of [on_click][crate::model::widget_markup::Image::on_click].
21047 ///
21048 /// # Example
21049 /// ```ignore,no_run
21050 /// # use google_chat_v1::model::widget_markup::Image;
21051 /// use google_chat_v1::model::widget_markup::OnClick;
21052 /// let x = Image::new().set_or_clear_on_click(Some(OnClick::default()/* use setters */));
21053 /// let x = Image::new().set_or_clear_on_click(None::<OnClick>);
21054 /// ```
21055 pub fn set_or_clear_on_click<T>(mut self, v: std::option::Option<T>) -> Self
21056 where
21057 T: std::convert::Into<crate::model::widget_markup::OnClick>,
21058 {
21059 self.on_click = v.map(|x| x.into());
21060 self
21061 }
21062
21063 /// Sets the value of [aspect_ratio][crate::model::widget_markup::Image::aspect_ratio].
21064 ///
21065 /// # Example
21066 /// ```ignore,no_run
21067 /// # use google_chat_v1::model::widget_markup::Image;
21068 /// let x = Image::new().set_aspect_ratio(42.0);
21069 /// ```
21070 pub fn set_aspect_ratio<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
21071 self.aspect_ratio = v.into();
21072 self
21073 }
21074 }
21075
21076 impl wkt::message::Message for Image {
21077 fn typename() -> &'static str {
21078 "type.googleapis.com/google.chat.v1.WidgetMarkup.Image"
21079 }
21080 }
21081
21082 /// An image button with an `onclick` action.
21083 #[derive(Clone, Default, PartialEq)]
21084 #[non_exhaustive]
21085 pub struct ImageButton {
21086 /// The `onclick` action.
21087 pub on_click: std::option::Option<crate::model::widget_markup::OnClick>,
21088
21089 /// The name of this `image_button` that's used for accessibility.
21090 /// Default value is provided if this name isn't specified.
21091 pub name: std::string::String,
21092
21093 /// The icon can be specified by an `Icon` `enum` or a URL.
21094 pub icons: std::option::Option<crate::model::widget_markup::image_button::Icons>,
21095
21096 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21097 }
21098
21099 impl ImageButton {
21100 /// Creates a new default instance.
21101 pub fn new() -> Self {
21102 std::default::Default::default()
21103 }
21104
21105 /// Sets the value of [on_click][crate::model::widget_markup::ImageButton::on_click].
21106 ///
21107 /// # Example
21108 /// ```ignore,no_run
21109 /// # use google_chat_v1::model::widget_markup::ImageButton;
21110 /// use google_chat_v1::model::widget_markup::OnClick;
21111 /// let x = ImageButton::new().set_on_click(OnClick::default()/* use setters */);
21112 /// ```
21113 pub fn set_on_click<T>(mut self, v: T) -> Self
21114 where
21115 T: std::convert::Into<crate::model::widget_markup::OnClick>,
21116 {
21117 self.on_click = std::option::Option::Some(v.into());
21118 self
21119 }
21120
21121 /// Sets or clears the value of [on_click][crate::model::widget_markup::ImageButton::on_click].
21122 ///
21123 /// # Example
21124 /// ```ignore,no_run
21125 /// # use google_chat_v1::model::widget_markup::ImageButton;
21126 /// use google_chat_v1::model::widget_markup::OnClick;
21127 /// let x = ImageButton::new().set_or_clear_on_click(Some(OnClick::default()/* use setters */));
21128 /// let x = ImageButton::new().set_or_clear_on_click(None::<OnClick>);
21129 /// ```
21130 pub fn set_or_clear_on_click<T>(mut self, v: std::option::Option<T>) -> Self
21131 where
21132 T: std::convert::Into<crate::model::widget_markup::OnClick>,
21133 {
21134 self.on_click = v.map(|x| x.into());
21135 self
21136 }
21137
21138 /// Sets the value of [name][crate::model::widget_markup::ImageButton::name].
21139 ///
21140 /// # Example
21141 /// ```ignore,no_run
21142 /// # use google_chat_v1::model::widget_markup::ImageButton;
21143 /// let x = ImageButton::new().set_name("example");
21144 /// ```
21145 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21146 self.name = v.into();
21147 self
21148 }
21149
21150 /// Sets the value of [icons][crate::model::widget_markup::ImageButton::icons].
21151 ///
21152 /// Note that all the setters affecting `icons` are mutually
21153 /// exclusive.
21154 ///
21155 /// # Example
21156 /// ```ignore,no_run
21157 /// # use google_chat_v1::model::widget_markup::ImageButton;
21158 /// use google_chat_v1::model::widget_markup::Icon;
21159 /// let x0 = ImageButton::new().set_icons(Some(
21160 /// google_chat_v1::model::widget_markup::image_button::Icons::Icon(Icon::Airplane)));
21161 /// let x1 = ImageButton::new().set_icons(Some(
21162 /// google_chat_v1::model::widget_markup::image_button::Icons::Icon(Icon::Bookmark)));
21163 /// let x2 = ImageButton::new().set_icons(Some(
21164 /// google_chat_v1::model::widget_markup::image_button::Icons::Icon(Icon::Bus)));
21165 /// ```
21166 pub fn set_icons<
21167 T: std::convert::Into<
21168 std::option::Option<crate::model::widget_markup::image_button::Icons>,
21169 >,
21170 >(
21171 mut self,
21172 v: T,
21173 ) -> Self {
21174 self.icons = v.into();
21175 self
21176 }
21177
21178 /// The value of [icons][crate::model::widget_markup::ImageButton::icons]
21179 /// if it holds a `Icon`, `None` if the field is not set or
21180 /// holds a different branch.
21181 pub fn icon(&self) -> std::option::Option<&crate::model::widget_markup::Icon> {
21182 #[allow(unreachable_patterns)]
21183 self.icons.as_ref().and_then(|v| match v {
21184 crate::model::widget_markup::image_button::Icons::Icon(v) => {
21185 std::option::Option::Some(v)
21186 }
21187 _ => std::option::Option::None,
21188 })
21189 }
21190
21191 /// Sets the value of [icons][crate::model::widget_markup::ImageButton::icons]
21192 /// to hold a `Icon`.
21193 ///
21194 /// Note that all the setters affecting `icons` are
21195 /// mutually exclusive.
21196 ///
21197 /// # Example
21198 /// ```ignore,no_run
21199 /// # use google_chat_v1::model::widget_markup::ImageButton;
21200 /// use google_chat_v1::model::widget_markup::Icon;
21201 /// let x0 = ImageButton::new().set_icon(Icon::Airplane);
21202 /// let x1 = ImageButton::new().set_icon(Icon::Bookmark);
21203 /// let x2 = ImageButton::new().set_icon(Icon::Bus);
21204 /// assert!(x0.icon().is_some());
21205 /// assert!(x0.icon_url().is_none());
21206 /// assert!(x1.icon().is_some());
21207 /// assert!(x1.icon_url().is_none());
21208 /// assert!(x2.icon().is_some());
21209 /// assert!(x2.icon_url().is_none());
21210 /// ```
21211 pub fn set_icon<T: std::convert::Into<crate::model::widget_markup::Icon>>(
21212 mut self,
21213 v: T,
21214 ) -> Self {
21215 self.icons = std::option::Option::Some(
21216 crate::model::widget_markup::image_button::Icons::Icon(v.into()),
21217 );
21218 self
21219 }
21220
21221 /// The value of [icons][crate::model::widget_markup::ImageButton::icons]
21222 /// if it holds a `IconUrl`, `None` if the field is not set or
21223 /// holds a different branch.
21224 pub fn icon_url(&self) -> std::option::Option<&std::string::String> {
21225 #[allow(unreachable_patterns)]
21226 self.icons.as_ref().and_then(|v| match v {
21227 crate::model::widget_markup::image_button::Icons::IconUrl(v) => {
21228 std::option::Option::Some(v)
21229 }
21230 _ => std::option::Option::None,
21231 })
21232 }
21233
21234 /// Sets the value of [icons][crate::model::widget_markup::ImageButton::icons]
21235 /// to hold a `IconUrl`.
21236 ///
21237 /// Note that all the setters affecting `icons` are
21238 /// mutually exclusive.
21239 ///
21240 /// # Example
21241 /// ```ignore,no_run
21242 /// # use google_chat_v1::model::widget_markup::ImageButton;
21243 /// let x = ImageButton::new().set_icon_url("example");
21244 /// assert!(x.icon_url().is_some());
21245 /// assert!(x.icon().is_none());
21246 /// ```
21247 pub fn set_icon_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21248 self.icons = std::option::Option::Some(
21249 crate::model::widget_markup::image_button::Icons::IconUrl(v.into()),
21250 );
21251 self
21252 }
21253 }
21254
21255 impl wkt::message::Message for ImageButton {
21256 fn typename() -> &'static str {
21257 "type.googleapis.com/google.chat.v1.WidgetMarkup.ImageButton"
21258 }
21259 }
21260
21261 /// Defines additional types related to [ImageButton].
21262 pub mod image_button {
21263 #[allow(unused_imports)]
21264 use super::*;
21265
21266 /// The icon can be specified by an `Icon` `enum` or a URL.
21267 #[derive(Clone, Debug, PartialEq)]
21268 #[non_exhaustive]
21269 pub enum Icons {
21270 /// The icon specified by an `enum` that indices to an icon provided by
21271 /// Chat API.
21272 Icon(crate::model::widget_markup::Icon),
21273 /// The icon specified by a URL.
21274 IconUrl(std::string::String),
21275 }
21276 }
21277
21278 /// An `onclick` action (for example, open a link).
21279 #[derive(Clone, Default, PartialEq)]
21280 #[non_exhaustive]
21281 pub struct OnClick {
21282 #[allow(missing_docs)]
21283 pub data: std::option::Option<crate::model::widget_markup::on_click::Data>,
21284
21285 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21286 }
21287
21288 impl OnClick {
21289 /// Creates a new default instance.
21290 pub fn new() -> Self {
21291 std::default::Default::default()
21292 }
21293
21294 /// Sets the value of [data][crate::model::widget_markup::OnClick::data].
21295 ///
21296 /// Note that all the setters affecting `data` are mutually
21297 /// exclusive.
21298 ///
21299 /// # Example
21300 /// ```ignore,no_run
21301 /// # use google_chat_v1::model::widget_markup::OnClick;
21302 /// use google_chat_v1::model::widget_markup::FormAction;
21303 /// let x = OnClick::new().set_data(Some(
21304 /// google_chat_v1::model::widget_markup::on_click::Data::Action(FormAction::default().into())));
21305 /// ```
21306 pub fn set_data<
21307 T: std::convert::Into<std::option::Option<crate::model::widget_markup::on_click::Data>>,
21308 >(
21309 mut self,
21310 v: T,
21311 ) -> Self {
21312 self.data = v.into();
21313 self
21314 }
21315
21316 /// The value of [data][crate::model::widget_markup::OnClick::data]
21317 /// if it holds a `Action`, `None` if the field is not set or
21318 /// holds a different branch.
21319 pub fn action(
21320 &self,
21321 ) -> std::option::Option<&std::boxed::Box<crate::model::widget_markup::FormAction>>
21322 {
21323 #[allow(unreachable_patterns)]
21324 self.data.as_ref().and_then(|v| match v {
21325 crate::model::widget_markup::on_click::Data::Action(v) => {
21326 std::option::Option::Some(v)
21327 }
21328 _ => std::option::Option::None,
21329 })
21330 }
21331
21332 /// Sets the value of [data][crate::model::widget_markup::OnClick::data]
21333 /// to hold a `Action`.
21334 ///
21335 /// Note that all the setters affecting `data` are
21336 /// mutually exclusive.
21337 ///
21338 /// # Example
21339 /// ```ignore,no_run
21340 /// # use google_chat_v1::model::widget_markup::OnClick;
21341 /// use google_chat_v1::model::widget_markup::FormAction;
21342 /// let x = OnClick::new().set_action(FormAction::default()/* use setters */);
21343 /// assert!(x.action().is_some());
21344 /// assert!(x.open_link().is_none());
21345 /// ```
21346 pub fn set_action<
21347 T: std::convert::Into<std::boxed::Box<crate::model::widget_markup::FormAction>>,
21348 >(
21349 mut self,
21350 v: T,
21351 ) -> Self {
21352 self.data = std::option::Option::Some(
21353 crate::model::widget_markup::on_click::Data::Action(v.into()),
21354 );
21355 self
21356 }
21357
21358 /// The value of [data][crate::model::widget_markup::OnClick::data]
21359 /// if it holds a `OpenLink`, `None` if the field is not set or
21360 /// holds a different branch.
21361 pub fn open_link(
21362 &self,
21363 ) -> std::option::Option<&std::boxed::Box<crate::model::widget_markup::OpenLink>> {
21364 #[allow(unreachable_patterns)]
21365 self.data.as_ref().and_then(|v| match v {
21366 crate::model::widget_markup::on_click::Data::OpenLink(v) => {
21367 std::option::Option::Some(v)
21368 }
21369 _ => std::option::Option::None,
21370 })
21371 }
21372
21373 /// Sets the value of [data][crate::model::widget_markup::OnClick::data]
21374 /// to hold a `OpenLink`.
21375 ///
21376 /// Note that all the setters affecting `data` are
21377 /// mutually exclusive.
21378 ///
21379 /// # Example
21380 /// ```ignore,no_run
21381 /// # use google_chat_v1::model::widget_markup::OnClick;
21382 /// use google_chat_v1::model::widget_markup::OpenLink;
21383 /// let x = OnClick::new().set_open_link(OpenLink::default()/* use setters */);
21384 /// assert!(x.open_link().is_some());
21385 /// assert!(x.action().is_none());
21386 /// ```
21387 pub fn set_open_link<
21388 T: std::convert::Into<std::boxed::Box<crate::model::widget_markup::OpenLink>>,
21389 >(
21390 mut self,
21391 v: T,
21392 ) -> Self {
21393 self.data = std::option::Option::Some(
21394 crate::model::widget_markup::on_click::Data::OpenLink(v.into()),
21395 );
21396 self
21397 }
21398 }
21399
21400 impl wkt::message::Message for OnClick {
21401 fn typename() -> &'static str {
21402 "type.googleapis.com/google.chat.v1.WidgetMarkup.OnClick"
21403 }
21404 }
21405
21406 /// Defines additional types related to [OnClick].
21407 pub mod on_click {
21408 #[allow(unused_imports)]
21409 use super::*;
21410
21411 #[allow(missing_docs)]
21412 #[derive(Clone, Debug, PartialEq)]
21413 #[non_exhaustive]
21414 pub enum Data {
21415 /// A form action is triggered by this `onclick` action if specified.
21416 Action(std::boxed::Box<crate::model::widget_markup::FormAction>),
21417 /// This `onclick` action triggers an open link action if specified.
21418 OpenLink(std::boxed::Box<crate::model::widget_markup::OpenLink>),
21419 }
21420 }
21421
21422 /// A link that opens a new window.
21423 #[derive(Clone, Default, PartialEq)]
21424 #[non_exhaustive]
21425 pub struct OpenLink {
21426 /// The URL to open.
21427 pub url: std::string::String,
21428
21429 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21430 }
21431
21432 impl OpenLink {
21433 /// Creates a new default instance.
21434 pub fn new() -> Self {
21435 std::default::Default::default()
21436 }
21437
21438 /// Sets the value of [url][crate::model::widget_markup::OpenLink::url].
21439 ///
21440 /// # Example
21441 /// ```ignore,no_run
21442 /// # use google_chat_v1::model::widget_markup::OpenLink;
21443 /// let x = OpenLink::new().set_url("example");
21444 /// ```
21445 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21446 self.url = v.into();
21447 self
21448 }
21449 }
21450
21451 impl wkt::message::Message for OpenLink {
21452 fn typename() -> &'static str {
21453 "type.googleapis.com/google.chat.v1.WidgetMarkup.OpenLink"
21454 }
21455 }
21456
21457 /// A form action describes the behavior when the form is submitted.
21458 /// For example, you can invoke Apps Script to handle the form.
21459 #[derive(Clone, Default, PartialEq)]
21460 #[non_exhaustive]
21461 pub struct FormAction {
21462 /// The method name is used to identify which part of the form triggered the
21463 /// form submission. This information is echoed back to the Chat app as part
21464 /// of the card click event. You can use the same method name for several
21465 /// elements that trigger a common behavior.
21466 pub action_method_name: std::string::String,
21467
21468 /// List of action parameters.
21469 pub parameters: std::vec::Vec<crate::model::widget_markup::form_action::ActionParameter>,
21470
21471 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21472 }
21473
21474 impl FormAction {
21475 /// Creates a new default instance.
21476 pub fn new() -> Self {
21477 std::default::Default::default()
21478 }
21479
21480 /// Sets the value of [action_method_name][crate::model::widget_markup::FormAction::action_method_name].
21481 ///
21482 /// # Example
21483 /// ```ignore,no_run
21484 /// # use google_chat_v1::model::widget_markup::FormAction;
21485 /// let x = FormAction::new().set_action_method_name("example");
21486 /// ```
21487 pub fn set_action_method_name<T: std::convert::Into<std::string::String>>(
21488 mut self,
21489 v: T,
21490 ) -> Self {
21491 self.action_method_name = v.into();
21492 self
21493 }
21494
21495 /// Sets the value of [parameters][crate::model::widget_markup::FormAction::parameters].
21496 ///
21497 /// # Example
21498 /// ```ignore,no_run
21499 /// # use google_chat_v1::model::widget_markup::FormAction;
21500 /// use google_chat_v1::model::widget_markup::form_action::ActionParameter;
21501 /// let x = FormAction::new()
21502 /// .set_parameters([
21503 /// ActionParameter::default()/* use setters */,
21504 /// ActionParameter::default()/* use (different) setters */,
21505 /// ]);
21506 /// ```
21507 pub fn set_parameters<T, V>(mut self, v: T) -> Self
21508 where
21509 T: std::iter::IntoIterator<Item = V>,
21510 V: std::convert::Into<crate::model::widget_markup::form_action::ActionParameter>,
21511 {
21512 use std::iter::Iterator;
21513 self.parameters = v.into_iter().map(|i| i.into()).collect();
21514 self
21515 }
21516 }
21517
21518 impl wkt::message::Message for FormAction {
21519 fn typename() -> &'static str {
21520 "type.googleapis.com/google.chat.v1.WidgetMarkup.FormAction"
21521 }
21522 }
21523
21524 /// Defines additional types related to [FormAction].
21525 pub mod form_action {
21526 #[allow(unused_imports)]
21527 use super::*;
21528
21529 /// List of string parameters to supply when the action method is invoked.
21530 /// For example, consider three snooze buttons: snooze now, snooze one day,
21531 /// snooze next week. You might use `action method = snooze()`, passing the
21532 /// snooze type and snooze time in the list of string parameters.
21533 #[derive(Clone, Default, PartialEq)]
21534 #[non_exhaustive]
21535 pub struct ActionParameter {
21536 /// The name of the parameter for the action script.
21537 pub key: std::string::String,
21538
21539 /// The value of the parameter.
21540 pub value: std::string::String,
21541
21542 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21543 }
21544
21545 impl ActionParameter {
21546 /// Creates a new default instance.
21547 pub fn new() -> Self {
21548 std::default::Default::default()
21549 }
21550
21551 /// Sets the value of [key][crate::model::widget_markup::form_action::ActionParameter::key].
21552 ///
21553 /// # Example
21554 /// ```ignore,no_run
21555 /// # use google_chat_v1::model::widget_markup::form_action::ActionParameter;
21556 /// let x = ActionParameter::new().set_key("example");
21557 /// ```
21558 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21559 self.key = v.into();
21560 self
21561 }
21562
21563 /// Sets the value of [value][crate::model::widget_markup::form_action::ActionParameter::value].
21564 ///
21565 /// # Example
21566 /// ```ignore,no_run
21567 /// # use google_chat_v1::model::widget_markup::form_action::ActionParameter;
21568 /// let x = ActionParameter::new().set_value("example");
21569 /// ```
21570 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21571 self.value = v.into();
21572 self
21573 }
21574 }
21575
21576 impl wkt::message::Message for ActionParameter {
21577 fn typename() -> &'static str {
21578 "type.googleapis.com/google.chat.v1.WidgetMarkup.FormAction.ActionParameter"
21579 }
21580 }
21581 }
21582
21583 /// The set of supported icons.
21584 ///
21585 /// # Working with unknown values
21586 ///
21587 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21588 /// additional enum variants at any time. Adding new variants is not considered
21589 /// a breaking change. Applications should write their code in anticipation of:
21590 ///
21591 /// - New values appearing in future releases of the client library, **and**
21592 /// - New values received dynamically, without application changes.
21593 ///
21594 /// Please consult the [Working with enums] section in the user guide for some
21595 /// guidelines.
21596 ///
21597 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
21598 #[derive(Clone, Debug, PartialEq)]
21599 #[non_exhaustive]
21600 pub enum Icon {
21601 #[allow(missing_docs)]
21602 Unspecified,
21603 #[allow(missing_docs)]
21604 Airplane,
21605 #[allow(missing_docs)]
21606 Bookmark,
21607 #[allow(missing_docs)]
21608 Bus,
21609 #[allow(missing_docs)]
21610 Car,
21611 #[allow(missing_docs)]
21612 Clock,
21613 #[allow(missing_docs)]
21614 ConfirmationNumberIcon,
21615 #[allow(missing_docs)]
21616 Dollar,
21617 #[allow(missing_docs)]
21618 Description,
21619 #[allow(missing_docs)]
21620 Email,
21621 #[allow(missing_docs)]
21622 EventPerformer,
21623 #[allow(missing_docs)]
21624 EventSeat,
21625 #[allow(missing_docs)]
21626 FlightArrival,
21627 #[allow(missing_docs)]
21628 FlightDeparture,
21629 #[allow(missing_docs)]
21630 Hotel,
21631 #[allow(missing_docs)]
21632 HotelRoomType,
21633 #[allow(missing_docs)]
21634 Invite,
21635 #[allow(missing_docs)]
21636 MapPin,
21637 #[allow(missing_docs)]
21638 Membership,
21639 #[allow(missing_docs)]
21640 MultiplePeople,
21641 #[allow(missing_docs)]
21642 Offer,
21643 #[allow(missing_docs)]
21644 Person,
21645 #[allow(missing_docs)]
21646 Phone,
21647 #[allow(missing_docs)]
21648 RestaurantIcon,
21649 #[allow(missing_docs)]
21650 ShoppingCart,
21651 #[allow(missing_docs)]
21652 Star,
21653 #[allow(missing_docs)]
21654 Store,
21655 #[allow(missing_docs)]
21656 Ticket,
21657 #[allow(missing_docs)]
21658 Train,
21659 #[allow(missing_docs)]
21660 VideoCamera,
21661 #[allow(missing_docs)]
21662 VideoPlay,
21663 /// If set, the enum was initialized with an unknown value.
21664 ///
21665 /// Applications can examine the value using [Icon::value] or
21666 /// [Icon::name].
21667 UnknownValue(icon::UnknownValue),
21668 }
21669
21670 #[doc(hidden)]
21671 pub mod icon {
21672 #[allow(unused_imports)]
21673 use super::*;
21674 #[derive(Clone, Debug, PartialEq)]
21675 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21676 }
21677
21678 impl Icon {
21679 /// Gets the enum value.
21680 ///
21681 /// Returns `None` if the enum contains an unknown value deserialized from
21682 /// the string representation of enums.
21683 pub fn value(&self) -> std::option::Option<i32> {
21684 match self {
21685 Self::Unspecified => std::option::Option::Some(0),
21686 Self::Airplane => std::option::Option::Some(1),
21687 Self::Bookmark => std::option::Option::Some(26),
21688 Self::Bus => std::option::Option::Some(25),
21689 Self::Car => std::option::Option::Some(9),
21690 Self::Clock => std::option::Option::Some(2),
21691 Self::ConfirmationNumberIcon => std::option::Option::Some(12),
21692 Self::Dollar => std::option::Option::Some(14),
21693 Self::Description => std::option::Option::Some(27),
21694 Self::Email => std::option::Option::Some(10),
21695 Self::EventPerformer => std::option::Option::Some(20),
21696 Self::EventSeat => std::option::Option::Some(21),
21697 Self::FlightArrival => std::option::Option::Some(16),
21698 Self::FlightDeparture => std::option::Option::Some(15),
21699 Self::Hotel => std::option::Option::Some(6),
21700 Self::HotelRoomType => std::option::Option::Some(17),
21701 Self::Invite => std::option::Option::Some(19),
21702 Self::MapPin => std::option::Option::Some(3),
21703 Self::Membership => std::option::Option::Some(24),
21704 Self::MultiplePeople => std::option::Option::Some(18),
21705 Self::Offer => std::option::Option::Some(30),
21706 Self::Person => std::option::Option::Some(11),
21707 Self::Phone => std::option::Option::Some(13),
21708 Self::RestaurantIcon => std::option::Option::Some(7),
21709 Self::ShoppingCart => std::option::Option::Some(8),
21710 Self::Star => std::option::Option::Some(5),
21711 Self::Store => std::option::Option::Some(22),
21712 Self::Ticket => std::option::Option::Some(4),
21713 Self::Train => std::option::Option::Some(23),
21714 Self::VideoCamera => std::option::Option::Some(28),
21715 Self::VideoPlay => std::option::Option::Some(29),
21716 Self::UnknownValue(u) => u.0.value(),
21717 }
21718 }
21719
21720 /// Gets the enum value as a string.
21721 ///
21722 /// Returns `None` if the enum contains an unknown value deserialized from
21723 /// the integer representation of enums.
21724 pub fn name(&self) -> std::option::Option<&str> {
21725 match self {
21726 Self::Unspecified => std::option::Option::Some("ICON_UNSPECIFIED"),
21727 Self::Airplane => std::option::Option::Some("AIRPLANE"),
21728 Self::Bookmark => std::option::Option::Some("BOOKMARK"),
21729 Self::Bus => std::option::Option::Some("BUS"),
21730 Self::Car => std::option::Option::Some("CAR"),
21731 Self::Clock => std::option::Option::Some("CLOCK"),
21732 Self::ConfirmationNumberIcon => {
21733 std::option::Option::Some("CONFIRMATION_NUMBER_ICON")
21734 }
21735 Self::Dollar => std::option::Option::Some("DOLLAR"),
21736 Self::Description => std::option::Option::Some("DESCRIPTION"),
21737 Self::Email => std::option::Option::Some("EMAIL"),
21738 Self::EventPerformer => std::option::Option::Some("EVENT_PERFORMER"),
21739 Self::EventSeat => std::option::Option::Some("EVENT_SEAT"),
21740 Self::FlightArrival => std::option::Option::Some("FLIGHT_ARRIVAL"),
21741 Self::FlightDeparture => std::option::Option::Some("FLIGHT_DEPARTURE"),
21742 Self::Hotel => std::option::Option::Some("HOTEL"),
21743 Self::HotelRoomType => std::option::Option::Some("HOTEL_ROOM_TYPE"),
21744 Self::Invite => std::option::Option::Some("INVITE"),
21745 Self::MapPin => std::option::Option::Some("MAP_PIN"),
21746 Self::Membership => std::option::Option::Some("MEMBERSHIP"),
21747 Self::MultiplePeople => std::option::Option::Some("MULTIPLE_PEOPLE"),
21748 Self::Offer => std::option::Option::Some("OFFER"),
21749 Self::Person => std::option::Option::Some("PERSON"),
21750 Self::Phone => std::option::Option::Some("PHONE"),
21751 Self::RestaurantIcon => std::option::Option::Some("RESTAURANT_ICON"),
21752 Self::ShoppingCart => std::option::Option::Some("SHOPPING_CART"),
21753 Self::Star => std::option::Option::Some("STAR"),
21754 Self::Store => std::option::Option::Some("STORE"),
21755 Self::Ticket => std::option::Option::Some("TICKET"),
21756 Self::Train => std::option::Option::Some("TRAIN"),
21757 Self::VideoCamera => std::option::Option::Some("VIDEO_CAMERA"),
21758 Self::VideoPlay => std::option::Option::Some("VIDEO_PLAY"),
21759 Self::UnknownValue(u) => u.0.name(),
21760 }
21761 }
21762 }
21763
21764 impl std::default::Default for Icon {
21765 fn default() -> Self {
21766 use std::convert::From;
21767 Self::from(0)
21768 }
21769 }
21770
21771 impl std::fmt::Display for Icon {
21772 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
21773 wkt::internal::display_enum(f, self.name(), self.value())
21774 }
21775 }
21776
21777 impl std::convert::From<i32> for Icon {
21778 fn from(value: i32) -> Self {
21779 match value {
21780 0 => Self::Unspecified,
21781 1 => Self::Airplane,
21782 2 => Self::Clock,
21783 3 => Self::MapPin,
21784 4 => Self::Ticket,
21785 5 => Self::Star,
21786 6 => Self::Hotel,
21787 7 => Self::RestaurantIcon,
21788 8 => Self::ShoppingCart,
21789 9 => Self::Car,
21790 10 => Self::Email,
21791 11 => Self::Person,
21792 12 => Self::ConfirmationNumberIcon,
21793 13 => Self::Phone,
21794 14 => Self::Dollar,
21795 15 => Self::FlightDeparture,
21796 16 => Self::FlightArrival,
21797 17 => Self::HotelRoomType,
21798 18 => Self::MultiplePeople,
21799 19 => Self::Invite,
21800 20 => Self::EventPerformer,
21801 21 => Self::EventSeat,
21802 22 => Self::Store,
21803 23 => Self::Train,
21804 24 => Self::Membership,
21805 25 => Self::Bus,
21806 26 => Self::Bookmark,
21807 27 => Self::Description,
21808 28 => Self::VideoCamera,
21809 29 => Self::VideoPlay,
21810 30 => Self::Offer,
21811 _ => Self::UnknownValue(icon::UnknownValue(
21812 wkt::internal::UnknownEnumValue::Integer(value),
21813 )),
21814 }
21815 }
21816 }
21817
21818 impl std::convert::From<&str> for Icon {
21819 fn from(value: &str) -> Self {
21820 use std::string::ToString;
21821 match value {
21822 "ICON_UNSPECIFIED" => Self::Unspecified,
21823 "AIRPLANE" => Self::Airplane,
21824 "BOOKMARK" => Self::Bookmark,
21825 "BUS" => Self::Bus,
21826 "CAR" => Self::Car,
21827 "CLOCK" => Self::Clock,
21828 "CONFIRMATION_NUMBER_ICON" => Self::ConfirmationNumberIcon,
21829 "DOLLAR" => Self::Dollar,
21830 "DESCRIPTION" => Self::Description,
21831 "EMAIL" => Self::Email,
21832 "EVENT_PERFORMER" => Self::EventPerformer,
21833 "EVENT_SEAT" => Self::EventSeat,
21834 "FLIGHT_ARRIVAL" => Self::FlightArrival,
21835 "FLIGHT_DEPARTURE" => Self::FlightDeparture,
21836 "HOTEL" => Self::Hotel,
21837 "HOTEL_ROOM_TYPE" => Self::HotelRoomType,
21838 "INVITE" => Self::Invite,
21839 "MAP_PIN" => Self::MapPin,
21840 "MEMBERSHIP" => Self::Membership,
21841 "MULTIPLE_PEOPLE" => Self::MultiplePeople,
21842 "OFFER" => Self::Offer,
21843 "PERSON" => Self::Person,
21844 "PHONE" => Self::Phone,
21845 "RESTAURANT_ICON" => Self::RestaurantIcon,
21846 "SHOPPING_CART" => Self::ShoppingCart,
21847 "STAR" => Self::Star,
21848 "STORE" => Self::Store,
21849 "TICKET" => Self::Ticket,
21850 "TRAIN" => Self::Train,
21851 "VIDEO_CAMERA" => Self::VideoCamera,
21852 "VIDEO_PLAY" => Self::VideoPlay,
21853 _ => Self::UnknownValue(icon::UnknownValue(
21854 wkt::internal::UnknownEnumValue::String(value.to_string()),
21855 )),
21856 }
21857 }
21858 }
21859
21860 impl serde::ser::Serialize for Icon {
21861 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21862 where
21863 S: serde::Serializer,
21864 {
21865 match self {
21866 Self::Unspecified => serializer.serialize_i32(0),
21867 Self::Airplane => serializer.serialize_i32(1),
21868 Self::Bookmark => serializer.serialize_i32(26),
21869 Self::Bus => serializer.serialize_i32(25),
21870 Self::Car => serializer.serialize_i32(9),
21871 Self::Clock => serializer.serialize_i32(2),
21872 Self::ConfirmationNumberIcon => serializer.serialize_i32(12),
21873 Self::Dollar => serializer.serialize_i32(14),
21874 Self::Description => serializer.serialize_i32(27),
21875 Self::Email => serializer.serialize_i32(10),
21876 Self::EventPerformer => serializer.serialize_i32(20),
21877 Self::EventSeat => serializer.serialize_i32(21),
21878 Self::FlightArrival => serializer.serialize_i32(16),
21879 Self::FlightDeparture => serializer.serialize_i32(15),
21880 Self::Hotel => serializer.serialize_i32(6),
21881 Self::HotelRoomType => serializer.serialize_i32(17),
21882 Self::Invite => serializer.serialize_i32(19),
21883 Self::MapPin => serializer.serialize_i32(3),
21884 Self::Membership => serializer.serialize_i32(24),
21885 Self::MultiplePeople => serializer.serialize_i32(18),
21886 Self::Offer => serializer.serialize_i32(30),
21887 Self::Person => serializer.serialize_i32(11),
21888 Self::Phone => serializer.serialize_i32(13),
21889 Self::RestaurantIcon => serializer.serialize_i32(7),
21890 Self::ShoppingCart => serializer.serialize_i32(8),
21891 Self::Star => serializer.serialize_i32(5),
21892 Self::Store => serializer.serialize_i32(22),
21893 Self::Ticket => serializer.serialize_i32(4),
21894 Self::Train => serializer.serialize_i32(23),
21895 Self::VideoCamera => serializer.serialize_i32(28),
21896 Self::VideoPlay => serializer.serialize_i32(29),
21897 Self::UnknownValue(u) => u.0.serialize(serializer),
21898 }
21899 }
21900 }
21901
21902 impl<'de> serde::de::Deserialize<'de> for Icon {
21903 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21904 where
21905 D: serde::Deserializer<'de>,
21906 {
21907 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Icon>::new(
21908 ".google.chat.v1.WidgetMarkup.Icon",
21909 ))
21910 }
21911 }
21912
21913 /// A `WidgetMarkup` can only have one of the following items. You can use
21914 /// multiple `WidgetMarkup` fields to display more items.
21915 #[derive(Clone, Debug, PartialEq)]
21916 #[non_exhaustive]
21917 pub enum Data {
21918 /// Display a text paragraph in this widget.
21919 TextParagraph(std::boxed::Box<crate::model::widget_markup::TextParagraph>),
21920 /// Display an image in this widget.
21921 Image(std::boxed::Box<crate::model::widget_markup::Image>),
21922 /// Display a key value item in this widget.
21923 KeyValue(std::boxed::Box<crate::model::widget_markup::KeyValue>),
21924 }
21925}
21926
21927/// Type of the annotation.
21928///
21929/// # Working with unknown values
21930///
21931/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21932/// additional enum variants at any time. Adding new variants is not considered
21933/// a breaking change. Applications should write their code in anticipation of:
21934///
21935/// - New values appearing in future releases of the client library, **and**
21936/// - New values received dynamically, without application changes.
21937///
21938/// Please consult the [Working with enums] section in the user guide for some
21939/// guidelines.
21940///
21941/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
21942#[derive(Clone, Debug, PartialEq)]
21943#[non_exhaustive]
21944pub enum AnnotationType {
21945 /// Default value for the enum. Don't use.
21946 Unspecified,
21947 /// A user is mentioned.
21948 UserMention,
21949 /// A slash command is invoked.
21950 SlashCommand,
21951 /// A rich link annotation.
21952 RichLink,
21953 /// A custom emoji annotation.
21954 CustomEmoji,
21955 /// If set, the enum was initialized with an unknown value.
21956 ///
21957 /// Applications can examine the value using [AnnotationType::value] or
21958 /// [AnnotationType::name].
21959 UnknownValue(annotation_type::UnknownValue),
21960}
21961
21962#[doc(hidden)]
21963pub mod annotation_type {
21964 #[allow(unused_imports)]
21965 use super::*;
21966 #[derive(Clone, Debug, PartialEq)]
21967 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21968}
21969
21970impl AnnotationType {
21971 /// Gets the enum value.
21972 ///
21973 /// Returns `None` if the enum contains an unknown value deserialized from
21974 /// the string representation of enums.
21975 pub fn value(&self) -> std::option::Option<i32> {
21976 match self {
21977 Self::Unspecified => std::option::Option::Some(0),
21978 Self::UserMention => std::option::Option::Some(1),
21979 Self::SlashCommand => std::option::Option::Some(2),
21980 Self::RichLink => std::option::Option::Some(3),
21981 Self::CustomEmoji => std::option::Option::Some(4),
21982 Self::UnknownValue(u) => u.0.value(),
21983 }
21984 }
21985
21986 /// Gets the enum value as a string.
21987 ///
21988 /// Returns `None` if the enum contains an unknown value deserialized from
21989 /// the integer representation of enums.
21990 pub fn name(&self) -> std::option::Option<&str> {
21991 match self {
21992 Self::Unspecified => std::option::Option::Some("ANNOTATION_TYPE_UNSPECIFIED"),
21993 Self::UserMention => std::option::Option::Some("USER_MENTION"),
21994 Self::SlashCommand => std::option::Option::Some("SLASH_COMMAND"),
21995 Self::RichLink => std::option::Option::Some("RICH_LINK"),
21996 Self::CustomEmoji => std::option::Option::Some("CUSTOM_EMOJI"),
21997 Self::UnknownValue(u) => u.0.name(),
21998 }
21999 }
22000}
22001
22002impl std::default::Default for AnnotationType {
22003 fn default() -> Self {
22004 use std::convert::From;
22005 Self::from(0)
22006 }
22007}
22008
22009impl std::fmt::Display for AnnotationType {
22010 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
22011 wkt::internal::display_enum(f, self.name(), self.value())
22012 }
22013}
22014
22015impl std::convert::From<i32> for AnnotationType {
22016 fn from(value: i32) -> Self {
22017 match value {
22018 0 => Self::Unspecified,
22019 1 => Self::UserMention,
22020 2 => Self::SlashCommand,
22021 3 => Self::RichLink,
22022 4 => Self::CustomEmoji,
22023 _ => Self::UnknownValue(annotation_type::UnknownValue(
22024 wkt::internal::UnknownEnumValue::Integer(value),
22025 )),
22026 }
22027 }
22028}
22029
22030impl std::convert::From<&str> for AnnotationType {
22031 fn from(value: &str) -> Self {
22032 use std::string::ToString;
22033 match value {
22034 "ANNOTATION_TYPE_UNSPECIFIED" => Self::Unspecified,
22035 "USER_MENTION" => Self::UserMention,
22036 "SLASH_COMMAND" => Self::SlashCommand,
22037 "RICH_LINK" => Self::RichLink,
22038 "CUSTOM_EMOJI" => Self::CustomEmoji,
22039 _ => Self::UnknownValue(annotation_type::UnknownValue(
22040 wkt::internal::UnknownEnumValue::String(value.to_string()),
22041 )),
22042 }
22043 }
22044}
22045
22046impl serde::ser::Serialize for AnnotationType {
22047 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22048 where
22049 S: serde::Serializer,
22050 {
22051 match self {
22052 Self::Unspecified => serializer.serialize_i32(0),
22053 Self::UserMention => serializer.serialize_i32(1),
22054 Self::SlashCommand => serializer.serialize_i32(2),
22055 Self::RichLink => serializer.serialize_i32(3),
22056 Self::CustomEmoji => serializer.serialize_i32(4),
22057 Self::UnknownValue(u) => u.0.serialize(serializer),
22058 }
22059 }
22060}
22061
22062impl<'de> serde::de::Deserialize<'de> for AnnotationType {
22063 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22064 where
22065 D: serde::Deserializer<'de>,
22066 {
22067 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AnnotationType>::new(
22068 ".google.chat.v1.AnnotationType",
22069 ))
22070 }
22071}
22072
22073/// The history state for messages and spaces. Specifies how long messages and
22074/// conversation threads are kept after creation.
22075///
22076/// # Working with unknown values
22077///
22078/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22079/// additional enum variants at any time. Adding new variants is not considered
22080/// a breaking change. Applications should write their code in anticipation of:
22081///
22082/// - New values appearing in future releases of the client library, **and**
22083/// - New values received dynamically, without application changes.
22084///
22085/// Please consult the [Working with enums] section in the user guide for some
22086/// guidelines.
22087///
22088/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22089#[derive(Clone, Debug, PartialEq)]
22090#[non_exhaustive]
22091pub enum HistoryState {
22092 /// Default value. Do not use.
22093 Unspecified,
22094 /// History off. [Messages and threads are kept for 24
22095 /// hours](https://support.google.com/chat/answer/7664687).
22096 HistoryOff,
22097 /// History on. The organization's [Vault retention
22098 /// rules](https://support.google.com/vault/answer/7657597) specify for
22099 /// how long messages and threads are kept.
22100 HistoryOn,
22101 /// If set, the enum was initialized with an unknown value.
22102 ///
22103 /// Applications can examine the value using [HistoryState::value] or
22104 /// [HistoryState::name].
22105 UnknownValue(history_state::UnknownValue),
22106}
22107
22108#[doc(hidden)]
22109pub mod history_state {
22110 #[allow(unused_imports)]
22111 use super::*;
22112 #[derive(Clone, Debug, PartialEq)]
22113 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22114}
22115
22116impl HistoryState {
22117 /// Gets the enum value.
22118 ///
22119 /// Returns `None` if the enum contains an unknown value deserialized from
22120 /// the string representation of enums.
22121 pub fn value(&self) -> std::option::Option<i32> {
22122 match self {
22123 Self::Unspecified => std::option::Option::Some(0),
22124 Self::HistoryOff => std::option::Option::Some(1),
22125 Self::HistoryOn => std::option::Option::Some(2),
22126 Self::UnknownValue(u) => u.0.value(),
22127 }
22128 }
22129
22130 /// Gets the enum value as a string.
22131 ///
22132 /// Returns `None` if the enum contains an unknown value deserialized from
22133 /// the integer representation of enums.
22134 pub fn name(&self) -> std::option::Option<&str> {
22135 match self {
22136 Self::Unspecified => std::option::Option::Some("HISTORY_STATE_UNSPECIFIED"),
22137 Self::HistoryOff => std::option::Option::Some("HISTORY_OFF"),
22138 Self::HistoryOn => std::option::Option::Some("HISTORY_ON"),
22139 Self::UnknownValue(u) => u.0.name(),
22140 }
22141 }
22142}
22143
22144impl std::default::Default for HistoryState {
22145 fn default() -> Self {
22146 use std::convert::From;
22147 Self::from(0)
22148 }
22149}
22150
22151impl std::fmt::Display for HistoryState {
22152 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
22153 wkt::internal::display_enum(f, self.name(), self.value())
22154 }
22155}
22156
22157impl std::convert::From<i32> for HistoryState {
22158 fn from(value: i32) -> Self {
22159 match value {
22160 0 => Self::Unspecified,
22161 1 => Self::HistoryOff,
22162 2 => Self::HistoryOn,
22163 _ => Self::UnknownValue(history_state::UnknownValue(
22164 wkt::internal::UnknownEnumValue::Integer(value),
22165 )),
22166 }
22167 }
22168}
22169
22170impl std::convert::From<&str> for HistoryState {
22171 fn from(value: &str) -> Self {
22172 use std::string::ToString;
22173 match value {
22174 "HISTORY_STATE_UNSPECIFIED" => Self::Unspecified,
22175 "HISTORY_OFF" => Self::HistoryOff,
22176 "HISTORY_ON" => Self::HistoryOn,
22177 _ => Self::UnknownValue(history_state::UnknownValue(
22178 wkt::internal::UnknownEnumValue::String(value.to_string()),
22179 )),
22180 }
22181 }
22182}
22183
22184impl serde::ser::Serialize for HistoryState {
22185 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22186 where
22187 S: serde::Serializer,
22188 {
22189 match self {
22190 Self::Unspecified => serializer.serialize_i32(0),
22191 Self::HistoryOff => serializer.serialize_i32(1),
22192 Self::HistoryOn => serializer.serialize_i32(2),
22193 Self::UnknownValue(u) => u.0.serialize(serializer),
22194 }
22195 }
22196}
22197
22198impl<'de> serde::de::Deserialize<'de> for HistoryState {
22199 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22200 where
22201 D: serde::Deserializer<'de>,
22202 {
22203 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HistoryState>::new(
22204 ".google.chat.v1.HistoryState",
22205 ))
22206 }
22207}
22208
22209/// Specifies the markup syntax used to format the Chat message text.
22210/// Applies to the `text` field of the `Message` resource.
22211///
22212/// # Working with unknown values
22213///
22214/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22215/// additional enum variants at any time. Adding new variants is not considered
22216/// a breaking change. Applications should write their code in anticipation of:
22217///
22218/// - New values appearing in future releases of the client library, **and**
22219/// - New values received dynamically, without application changes.
22220///
22221/// Please consult the [Working with enums] section in the user guide for some
22222/// guidelines.
22223///
22224/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22225#[derive(Clone, Debug, PartialEq)]
22226#[non_exhaustive]
22227pub enum MarkupSyntax {
22228 /// Represents the unspecified value.
22229 Unspecified,
22230 /// Uses Google Chat's markup syntax.
22231 /// See
22232 /// <https://developers.google.com/workspace/chat/format-messages#format-texts>
22233 /// for more information.
22234 Chat,
22235 /// Uses Markdown syntax. This syntax is based on the
22236 /// [CommonMark](https://commonmark.org/help/) specification, with additional
22237 /// extensions.
22238 /// See
22239 /// <https://developers.google.com/workspace/chat/format-messages#format-texts>
22240 /// for more information.
22241 Markdown,
22242 /// If set, the enum was initialized with an unknown value.
22243 ///
22244 /// Applications can examine the value using [MarkupSyntax::value] or
22245 /// [MarkupSyntax::name].
22246 UnknownValue(markup_syntax::UnknownValue),
22247}
22248
22249#[doc(hidden)]
22250pub mod markup_syntax {
22251 #[allow(unused_imports)]
22252 use super::*;
22253 #[derive(Clone, Debug, PartialEq)]
22254 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22255}
22256
22257impl MarkupSyntax {
22258 /// Gets the enum value.
22259 ///
22260 /// Returns `None` if the enum contains an unknown value deserialized from
22261 /// the string representation of enums.
22262 pub fn value(&self) -> std::option::Option<i32> {
22263 match self {
22264 Self::Unspecified => std::option::Option::Some(0),
22265 Self::Chat => std::option::Option::Some(1),
22266 Self::Markdown => std::option::Option::Some(2),
22267 Self::UnknownValue(u) => u.0.value(),
22268 }
22269 }
22270
22271 /// Gets the enum value as a string.
22272 ///
22273 /// Returns `None` if the enum contains an unknown value deserialized from
22274 /// the integer representation of enums.
22275 pub fn name(&self) -> std::option::Option<&str> {
22276 match self {
22277 Self::Unspecified => std::option::Option::Some("MARKUP_SYNTAX_UNSPECIFIED"),
22278 Self::Chat => std::option::Option::Some("MARKUP_SYNTAX_CHAT"),
22279 Self::Markdown => std::option::Option::Some("MARKUP_SYNTAX_MARKDOWN"),
22280 Self::UnknownValue(u) => u.0.name(),
22281 }
22282 }
22283}
22284
22285impl std::default::Default for MarkupSyntax {
22286 fn default() -> Self {
22287 use std::convert::From;
22288 Self::from(0)
22289 }
22290}
22291
22292impl std::fmt::Display for MarkupSyntax {
22293 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
22294 wkt::internal::display_enum(f, self.name(), self.value())
22295 }
22296}
22297
22298impl std::convert::From<i32> for MarkupSyntax {
22299 fn from(value: i32) -> Self {
22300 match value {
22301 0 => Self::Unspecified,
22302 1 => Self::Chat,
22303 2 => Self::Markdown,
22304 _ => Self::UnknownValue(markup_syntax::UnknownValue(
22305 wkt::internal::UnknownEnumValue::Integer(value),
22306 )),
22307 }
22308 }
22309}
22310
22311impl std::convert::From<&str> for MarkupSyntax {
22312 fn from(value: &str) -> Self {
22313 use std::string::ToString;
22314 match value {
22315 "MARKUP_SYNTAX_UNSPECIFIED" => Self::Unspecified,
22316 "MARKUP_SYNTAX_CHAT" => Self::Chat,
22317 "MARKUP_SYNTAX_MARKDOWN" => Self::Markdown,
22318 _ => Self::UnknownValue(markup_syntax::UnknownValue(
22319 wkt::internal::UnknownEnumValue::String(value.to_string()),
22320 )),
22321 }
22322 }
22323}
22324
22325impl serde::ser::Serialize for MarkupSyntax {
22326 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22327 where
22328 S: serde::Serializer,
22329 {
22330 match self {
22331 Self::Unspecified => serializer.serialize_i32(0),
22332 Self::Chat => serializer.serialize_i32(1),
22333 Self::Markdown => serializer.serialize_i32(2),
22334 Self::UnknownValue(u) => u.0.serialize(serializer),
22335 }
22336 }
22337}
22338
22339impl<'de> serde::de::Deserialize<'de> for MarkupSyntax {
22340 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22341 where
22342 D: serde::Deserializer<'de>,
22343 {
22344 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MarkupSyntax>::new(
22345 ".google.chat.v1.MarkupSyntax",
22346 ))
22347 }
22348}
22349
22350/// A view that specifies which fields should be populated on the
22351/// [`Space`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces)
22352/// resource.
22353/// To ensure compatibility with future releases, we recommend that your code
22354/// account for additional values.
22355///
22356/// # Working with unknown values
22357///
22358/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22359/// additional enum variants at any time. Adding new variants is not considered
22360/// a breaking change. Applications should write their code in anticipation of:
22361///
22362/// - New values appearing in future releases of the client library, **and**
22363/// - New values received dynamically, without application changes.
22364///
22365/// Please consult the [Working with enums] section in the user guide for some
22366/// guidelines.
22367///
22368/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22369#[derive(Clone, Debug, PartialEq)]
22370#[non_exhaustive]
22371pub enum SpaceView {
22372 /// The default / unset value.
22373 Unspecified,
22374 /// Populates only the Space resource name.
22375 ResourceNameOnly,
22376 /// Populates Space resource fields. Note: the `permissionSettings` field
22377 /// will not be populated.
22378 /// Requests that specify SPACE_VIEW_EXPANDED must include scopes that allow
22379 /// reading space data, for example,
22380 /// <https://www.googleapis.com/auth/chat.spaces> or
22381 /// <https://www.googleapis.com/auth/chat.spaces.readonly>.
22382 Expanded,
22383 /// If set, the enum was initialized with an unknown value.
22384 ///
22385 /// Applications can examine the value using [SpaceView::value] or
22386 /// [SpaceView::name].
22387 UnknownValue(space_view::UnknownValue),
22388}
22389
22390#[doc(hidden)]
22391pub mod space_view {
22392 #[allow(unused_imports)]
22393 use super::*;
22394 #[derive(Clone, Debug, PartialEq)]
22395 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22396}
22397
22398impl SpaceView {
22399 /// Gets the enum value.
22400 ///
22401 /// Returns `None` if the enum contains an unknown value deserialized from
22402 /// the string representation of enums.
22403 pub fn value(&self) -> std::option::Option<i32> {
22404 match self {
22405 Self::Unspecified => std::option::Option::Some(0),
22406 Self::ResourceNameOnly => std::option::Option::Some(3),
22407 Self::Expanded => std::option::Option::Some(4),
22408 Self::UnknownValue(u) => u.0.value(),
22409 }
22410 }
22411
22412 /// Gets the enum value as a string.
22413 ///
22414 /// Returns `None` if the enum contains an unknown value deserialized from
22415 /// the integer representation of enums.
22416 pub fn name(&self) -> std::option::Option<&str> {
22417 match self {
22418 Self::Unspecified => std::option::Option::Some("SPACE_VIEW_UNSPECIFIED"),
22419 Self::ResourceNameOnly => std::option::Option::Some("SPACE_VIEW_RESOURCE_NAME_ONLY"),
22420 Self::Expanded => std::option::Option::Some("SPACE_VIEW_EXPANDED"),
22421 Self::UnknownValue(u) => u.0.name(),
22422 }
22423 }
22424}
22425
22426impl std::default::Default for SpaceView {
22427 fn default() -> Self {
22428 use std::convert::From;
22429 Self::from(0)
22430 }
22431}
22432
22433impl std::fmt::Display for SpaceView {
22434 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
22435 wkt::internal::display_enum(f, self.name(), self.value())
22436 }
22437}
22438
22439impl std::convert::From<i32> for SpaceView {
22440 fn from(value: i32) -> Self {
22441 match value {
22442 0 => Self::Unspecified,
22443 3 => Self::ResourceNameOnly,
22444 4 => Self::Expanded,
22445 _ => Self::UnknownValue(space_view::UnknownValue(
22446 wkt::internal::UnknownEnumValue::Integer(value),
22447 )),
22448 }
22449 }
22450}
22451
22452impl std::convert::From<&str> for SpaceView {
22453 fn from(value: &str) -> Self {
22454 use std::string::ToString;
22455 match value {
22456 "SPACE_VIEW_UNSPECIFIED" => Self::Unspecified,
22457 "SPACE_VIEW_RESOURCE_NAME_ONLY" => Self::ResourceNameOnly,
22458 "SPACE_VIEW_EXPANDED" => Self::Expanded,
22459 _ => Self::UnknownValue(space_view::UnknownValue(
22460 wkt::internal::UnknownEnumValue::String(value.to_string()),
22461 )),
22462 }
22463 }
22464}
22465
22466impl serde::ser::Serialize for SpaceView {
22467 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22468 where
22469 S: serde::Serializer,
22470 {
22471 match self {
22472 Self::Unspecified => serializer.serialize_i32(0),
22473 Self::ResourceNameOnly => serializer.serialize_i32(3),
22474 Self::Expanded => serializer.serialize_i32(4),
22475 Self::UnknownValue(u) => u.0.serialize(serializer),
22476 }
22477 }
22478}
22479
22480impl<'de> serde::de::Deserialize<'de> for SpaceView {
22481 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22482 where
22483 D: serde::Deserializer<'de>,
22484 {
22485 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SpaceView>::new(
22486 ".google.chat.v1.SpaceView",
22487 ))
22488 }
22489}