google_cloud_support_v2/
model.rs

1// Copyright 2025 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::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate reqwest;
26extern crate serde;
27extern crate serde_json;
28extern crate serde_with;
29extern crate std;
30extern crate tracing;
31extern crate wkt;
32
33mod debug;
34mod deserialize;
35mod serialize;
36
37/// An Actor represents an entity that performed an action. For example, an actor
38/// could be a user who posted a comment on a support case, a user who
39/// uploaded an attachment, or a service account that created a support case.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct Actor {
43    /// The name to display for the actor. If not provided, it is inferred from
44    /// credentials supplied during case creation. When an email is provided, a
45    /// display name must also be provided. This will be obfuscated if the user
46    /// is a Google Support agent.
47    pub display_name: std::string::String,
48
49    /// The email address of the actor. If not provided, it is inferred from the
50    /// credentials supplied during case creation. When a name is provided, an
51    /// email must also be provided. If the user is a Google Support agent, this is
52    /// obfuscated.
53    ///
54    /// This field is deprecated. Use `username` instead.
55    #[deprecated]
56    pub email: std::string::String,
57
58    /// Output only. Whether the actor is a Google support actor.
59    pub google_support: bool,
60
61    /// Output only. The username of the actor. It may look like an email or other
62    /// format provided by the identity provider. If not provided, it is inferred
63    /// from the credentials supplied. When a name is provided, a username must
64    /// also be provided. If the user is a Google Support agent, this will not be
65    /// set.
66    pub username: std::string::String,
67
68    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
69}
70
71impl Actor {
72    pub fn new() -> Self {
73        std::default::Default::default()
74    }
75
76    /// Sets the value of [display_name][crate::model::Actor::display_name].
77    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
78        self.display_name = v.into();
79        self
80    }
81
82    /// Sets the value of [email][crate::model::Actor::email].
83    #[deprecated]
84    pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
85        self.email = v.into();
86        self
87    }
88
89    /// Sets the value of [google_support][crate::model::Actor::google_support].
90    pub fn set_google_support<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
91        self.google_support = v.into();
92        self
93    }
94
95    /// Sets the value of [username][crate::model::Actor::username].
96    pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
97        self.username = v.into();
98        self
99    }
100}
101
102impl wkt::message::Message for Actor {
103    fn typename() -> &'static str {
104        "type.googleapis.com/google.cloud.support.v2.Actor"
105    }
106}
107
108/// An Attachment contains metadata about a file that was uploaded to a
109/// case - it is NOT a file itself. That being said, the name of an Attachment
110/// object can be used to download its accompanying file through the
111/// `media.download` endpoint.
112///
113/// While attachments can be uploaded in the console at the
114/// same time as a comment, they're associated on a "case" level, not a
115/// "comment" level.
116#[derive(Clone, Default, PartialEq)]
117#[non_exhaustive]
118pub struct Attachment {
119    /// Output only. Identifier. The resource name of the attachment.
120    pub name: std::string::String,
121
122    /// Output only. The time at which the attachment was created.
123    pub create_time: std::option::Option<wkt::Timestamp>,
124
125    /// Output only. The user who uploaded the attachment. Note, the name and email
126    /// will be obfuscated if the attachment was uploaded by Google support.
127    pub creator: std::option::Option<crate::model::Actor>,
128
129    /// The filename of the attachment (e.g. `"graph.jpg"`).
130    pub filename: std::string::String,
131
132    /// Output only. The MIME type of the attachment (e.g. text/plain).
133    pub mime_type: std::string::String,
134
135    /// Output only. The size of the attachment in bytes.
136    pub size_bytes: i64,
137
138    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
139}
140
141impl Attachment {
142    pub fn new() -> Self {
143        std::default::Default::default()
144    }
145
146    /// Sets the value of [name][crate::model::Attachment::name].
147    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
148        self.name = v.into();
149        self
150    }
151
152    /// Sets the value of [create_time][crate::model::Attachment::create_time].
153    pub fn set_create_time<T>(mut self, v: T) -> Self
154    where
155        T: std::convert::Into<wkt::Timestamp>,
156    {
157        self.create_time = std::option::Option::Some(v.into());
158        self
159    }
160
161    /// Sets or clears the value of [create_time][crate::model::Attachment::create_time].
162    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
163    where
164        T: std::convert::Into<wkt::Timestamp>,
165    {
166        self.create_time = v.map(|x| x.into());
167        self
168    }
169
170    /// Sets the value of [creator][crate::model::Attachment::creator].
171    pub fn set_creator<T>(mut self, v: T) -> Self
172    where
173        T: std::convert::Into<crate::model::Actor>,
174    {
175        self.creator = std::option::Option::Some(v.into());
176        self
177    }
178
179    /// Sets or clears the value of [creator][crate::model::Attachment::creator].
180    pub fn set_or_clear_creator<T>(mut self, v: std::option::Option<T>) -> Self
181    where
182        T: std::convert::Into<crate::model::Actor>,
183    {
184        self.creator = v.map(|x| x.into());
185        self
186    }
187
188    /// Sets the value of [filename][crate::model::Attachment::filename].
189    pub fn set_filename<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
190        self.filename = v.into();
191        self
192    }
193
194    /// Sets the value of [mime_type][crate::model::Attachment::mime_type].
195    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
196        self.mime_type = v.into();
197        self
198    }
199
200    /// Sets the value of [size_bytes][crate::model::Attachment::size_bytes].
201    pub fn set_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
202        self.size_bytes = v.into();
203        self
204    }
205}
206
207impl wkt::message::Message for Attachment {
208    fn typename() -> &'static str {
209        "type.googleapis.com/google.cloud.support.v2.Attachment"
210    }
211}
212
213/// The request message for the ListAttachments endpoint.
214#[derive(Clone, Default, PartialEq)]
215#[non_exhaustive]
216pub struct ListAttachmentsRequest {
217    /// Required. The name of the case for which attachments should be listed.
218    pub parent: std::string::String,
219
220    /// The maximum number of attachments fetched with each request.
221    ///
222    /// If not provided, the default is 10. The maximum page size that will be
223    /// returned is 100.
224    ///
225    /// The size of each page can be smaller than the requested page size and can
226    /// include zero. For example, you could request 100 attachments on one page,
227    /// receive 0, and then on the next page, receive 90.
228    pub page_size: i32,
229
230    /// A token identifying the page of results to return. If unspecified, the
231    /// first page is retrieved.
232    pub page_token: std::string::String,
233
234    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
235}
236
237impl ListAttachmentsRequest {
238    pub fn new() -> Self {
239        std::default::Default::default()
240    }
241
242    /// Sets the value of [parent][crate::model::ListAttachmentsRequest::parent].
243    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
244        self.parent = v.into();
245        self
246    }
247
248    /// Sets the value of [page_size][crate::model::ListAttachmentsRequest::page_size].
249    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
250        self.page_size = v.into();
251        self
252    }
253
254    /// Sets the value of [page_token][crate::model::ListAttachmentsRequest::page_token].
255    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
256        self.page_token = v.into();
257        self
258    }
259}
260
261impl wkt::message::Message for ListAttachmentsRequest {
262    fn typename() -> &'static str {
263        "type.googleapis.com/google.cloud.support.v2.ListAttachmentsRequest"
264    }
265}
266
267/// The response message for the ListAttachments endpoint.
268#[derive(Clone, Default, PartialEq)]
269#[non_exhaustive]
270pub struct ListAttachmentsResponse {
271    /// The list of attachments associated with a case.
272    pub attachments: std::vec::Vec<crate::model::Attachment>,
273
274    /// A token to retrieve the next page of results. Set this in the `page_token`
275    /// field of subsequent `cases.attachments.list` requests. If unspecified,
276    /// there are no more results to retrieve.
277    pub next_page_token: std::string::String,
278
279    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
280}
281
282impl ListAttachmentsResponse {
283    pub fn new() -> Self {
284        std::default::Default::default()
285    }
286
287    /// Sets the value of [attachments][crate::model::ListAttachmentsResponse::attachments].
288    pub fn set_attachments<T, V>(mut self, v: T) -> Self
289    where
290        T: std::iter::IntoIterator<Item = V>,
291        V: std::convert::Into<crate::model::Attachment>,
292    {
293        use std::iter::Iterator;
294        self.attachments = v.into_iter().map(|i| i.into()).collect();
295        self
296    }
297
298    /// Sets the value of [next_page_token][crate::model::ListAttachmentsResponse::next_page_token].
299    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
300        self.next_page_token = v.into();
301        self
302    }
303}
304
305impl wkt::message::Message for ListAttachmentsResponse {
306    fn typename() -> &'static str {
307        "type.googleapis.com/google.cloud.support.v2.ListAttachmentsResponse"
308    }
309}
310
311#[doc(hidden)]
312impl gax::paginator::internal::PageableResponse for ListAttachmentsResponse {
313    type PageItem = crate::model::Attachment;
314
315    fn items(self) -> std::vec::Vec<Self::PageItem> {
316        self.attachments
317    }
318
319    fn next_page_token(&self) -> std::string::String {
320        use std::clone::Clone;
321        self.next_page_token.clone()
322    }
323}
324
325/// A Case is an object that contains the details of a support case. It
326/// contains fields for the time it was created, its priority, its
327/// classification, and more. Cases can also have comments and attachments that
328/// get added over time.
329///
330/// A case is parented by a Google Cloud organization or project.
331///
332/// Organizations are identified by a number, so the name of a case parented by
333/// an organization would look like this:
334///
335/// ```norust
336/// organizations/123/cases/456
337/// ```
338///
339/// Projects have two unique identifiers, an ID and a number, and they look like
340/// this:
341///
342/// ```norust
343/// projects/abc/cases/456
344/// ```
345///
346/// ```norust
347/// projects/123/cases/456
348/// ```
349///
350/// You can use either of them when calling the API. To learn more
351/// about project identifiers, see [AIP-2510](https://google.aip.dev/cloud/2510).
352#[derive(Clone, Default, PartialEq)]
353#[non_exhaustive]
354pub struct Case {
355    /// Identifier. The resource name for the case.
356    pub name: std::string::String,
357
358    /// The short summary of the issue reported in this case.
359    pub display_name: std::string::String,
360
361    /// A broad description of the issue.
362    pub description: std::string::String,
363
364    /// The issue classification applicable to this case.
365    pub classification: std::option::Option<crate::model::CaseClassification>,
366
367    /// The timezone of the user who created the support case.
368    /// It should be in a format IANA recognizes: <https://www.iana.org/time-zones>.
369    /// There is no additional validation done by the API.
370    pub time_zone: std::string::String,
371
372    /// The email addresses to receive updates on this case.
373    pub subscriber_email_addresses: std::vec::Vec<std::string::String>,
374
375    /// Output only. The current status of the support case.
376    pub state: crate::model::case::State,
377
378    /// Output only. The time this case was created.
379    pub create_time: std::option::Option<wkt::Timestamp>,
380
381    /// Output only. The time this case was last updated.
382    pub update_time: std::option::Option<wkt::Timestamp>,
383
384    /// The user who created the case.
385    ///
386    /// Note: The name and email will be obfuscated if the case was created by
387    /// Google Support.
388    pub creator: std::option::Option<crate::model::Actor>,
389
390    /// A user-supplied email address to send case update notifications for. This
391    /// should only be used in BYOID flows, where we cannot infer the user's email
392    /// address directly from their EUCs.
393    pub contact_email: std::string::String,
394
395    /// Whether the case is currently escalated.
396    pub escalated: bool,
397
398    /// Whether this case was created for internal API testing and should not be
399    /// acted on by the support team.
400    pub test_case: bool,
401
402    /// The language the user has requested to receive support in. This should be a
403    /// BCP 47 language code (e.g., `"en"`, `"zh-CN"`, `"zh-TW"`, `"ja"`, `"ko"`).
404    /// If no language or an unsupported language is specified, this field defaults
405    /// to English (en).
406    ///
407    /// Language selection during case creation may affect your available support
408    /// options. For a list of supported languages and their support working hours,
409    /// see: <https://cloud.google.com/support/docs/language-working-hours>
410    pub language_code: std::string::String,
411
412    /// The priority of this case.
413    pub priority: crate::model::case::Priority,
414
415    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
416}
417
418impl Case {
419    pub fn new() -> Self {
420        std::default::Default::default()
421    }
422
423    /// Sets the value of [name][crate::model::Case::name].
424    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
425        self.name = v.into();
426        self
427    }
428
429    /// Sets the value of [display_name][crate::model::Case::display_name].
430    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
431        self.display_name = v.into();
432        self
433    }
434
435    /// Sets the value of [description][crate::model::Case::description].
436    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
437        self.description = v.into();
438        self
439    }
440
441    /// Sets the value of [classification][crate::model::Case::classification].
442    pub fn set_classification<T>(mut self, v: T) -> Self
443    where
444        T: std::convert::Into<crate::model::CaseClassification>,
445    {
446        self.classification = std::option::Option::Some(v.into());
447        self
448    }
449
450    /// Sets or clears the value of [classification][crate::model::Case::classification].
451    pub fn set_or_clear_classification<T>(mut self, v: std::option::Option<T>) -> Self
452    where
453        T: std::convert::Into<crate::model::CaseClassification>,
454    {
455        self.classification = v.map(|x| x.into());
456        self
457    }
458
459    /// Sets the value of [time_zone][crate::model::Case::time_zone].
460    pub fn set_time_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
461        self.time_zone = v.into();
462        self
463    }
464
465    /// Sets the value of [subscriber_email_addresses][crate::model::Case::subscriber_email_addresses].
466    pub fn set_subscriber_email_addresses<T, V>(mut self, v: T) -> Self
467    where
468        T: std::iter::IntoIterator<Item = V>,
469        V: std::convert::Into<std::string::String>,
470    {
471        use std::iter::Iterator;
472        self.subscriber_email_addresses = v.into_iter().map(|i| i.into()).collect();
473        self
474    }
475
476    /// Sets the value of [state][crate::model::Case::state].
477    pub fn set_state<T: std::convert::Into<crate::model::case::State>>(mut self, v: T) -> Self {
478        self.state = v.into();
479        self
480    }
481
482    /// Sets the value of [create_time][crate::model::Case::create_time].
483    pub fn set_create_time<T>(mut self, v: T) -> Self
484    where
485        T: std::convert::Into<wkt::Timestamp>,
486    {
487        self.create_time = std::option::Option::Some(v.into());
488        self
489    }
490
491    /// Sets or clears the value of [create_time][crate::model::Case::create_time].
492    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
493    where
494        T: std::convert::Into<wkt::Timestamp>,
495    {
496        self.create_time = v.map(|x| x.into());
497        self
498    }
499
500    /// Sets the value of [update_time][crate::model::Case::update_time].
501    pub fn set_update_time<T>(mut self, v: T) -> Self
502    where
503        T: std::convert::Into<wkt::Timestamp>,
504    {
505        self.update_time = std::option::Option::Some(v.into());
506        self
507    }
508
509    /// Sets or clears the value of [update_time][crate::model::Case::update_time].
510    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
511    where
512        T: std::convert::Into<wkt::Timestamp>,
513    {
514        self.update_time = v.map(|x| x.into());
515        self
516    }
517
518    /// Sets the value of [creator][crate::model::Case::creator].
519    pub fn set_creator<T>(mut self, v: T) -> Self
520    where
521        T: std::convert::Into<crate::model::Actor>,
522    {
523        self.creator = std::option::Option::Some(v.into());
524        self
525    }
526
527    /// Sets or clears the value of [creator][crate::model::Case::creator].
528    pub fn set_or_clear_creator<T>(mut self, v: std::option::Option<T>) -> Self
529    where
530        T: std::convert::Into<crate::model::Actor>,
531    {
532        self.creator = v.map(|x| x.into());
533        self
534    }
535
536    /// Sets the value of [contact_email][crate::model::Case::contact_email].
537    pub fn set_contact_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
538        self.contact_email = v.into();
539        self
540    }
541
542    /// Sets the value of [escalated][crate::model::Case::escalated].
543    pub fn set_escalated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
544        self.escalated = v.into();
545        self
546    }
547
548    /// Sets the value of [test_case][crate::model::Case::test_case].
549    pub fn set_test_case<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
550        self.test_case = v.into();
551        self
552    }
553
554    /// Sets the value of [language_code][crate::model::Case::language_code].
555    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
556        self.language_code = v.into();
557        self
558    }
559
560    /// Sets the value of [priority][crate::model::Case::priority].
561    pub fn set_priority<T: std::convert::Into<crate::model::case::Priority>>(
562        mut self,
563        v: T,
564    ) -> Self {
565        self.priority = v.into();
566        self
567    }
568}
569
570impl wkt::message::Message for Case {
571    fn typename() -> &'static str {
572        "type.googleapis.com/google.cloud.support.v2.Case"
573    }
574}
575
576/// Defines additional types related to [Case].
577pub mod case {
578    #[allow(unused_imports)]
579    use super::*;
580
581    /// The status of a support case.
582    ///
583    /// # Working with unknown values
584    ///
585    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
586    /// additional enum variants at any time. Adding new variants is not considered
587    /// a breaking change. Applications should write their code in anticipation of:
588    ///
589    /// - New values appearing in future releases of the client library, **and**
590    /// - New values received dynamically, without application changes.
591    ///
592    /// Please consult the [Working with enums] section in the user guide for some
593    /// guidelines.
594    ///
595    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
596    #[derive(Clone, Debug, PartialEq)]
597    #[non_exhaustive]
598    pub enum State {
599        /// Case is in an unknown state.
600        Unspecified,
601        /// The case has been created but no one is assigned to work on it yet.
602        New,
603        /// The case is currently being handled by Google support.
604        InProgressGoogleSupport,
605        /// Google is waiting for a response.
606        ActionRequired,
607        /// A solution has been offered for the case, but it isn't yet closed.
608        SolutionProvided,
609        /// The case has been resolved.
610        Closed,
611        /// If set, the enum was initialized with an unknown value.
612        ///
613        /// Applications can examine the value using [State::value] or
614        /// [State::name].
615        UnknownValue(state::UnknownValue),
616    }
617
618    #[doc(hidden)]
619    pub mod state {
620        #[allow(unused_imports)]
621        use super::*;
622        #[derive(Clone, Debug, PartialEq)]
623        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
624    }
625
626    impl State {
627        /// Gets the enum value.
628        ///
629        /// Returns `None` if the enum contains an unknown value deserialized from
630        /// the string representation of enums.
631        pub fn value(&self) -> std::option::Option<i32> {
632            match self {
633                Self::Unspecified => std::option::Option::Some(0),
634                Self::New => std::option::Option::Some(1),
635                Self::InProgressGoogleSupport => std::option::Option::Some(2),
636                Self::ActionRequired => std::option::Option::Some(3),
637                Self::SolutionProvided => std::option::Option::Some(4),
638                Self::Closed => std::option::Option::Some(5),
639                Self::UnknownValue(u) => u.0.value(),
640            }
641        }
642
643        /// Gets the enum value as a string.
644        ///
645        /// Returns `None` if the enum contains an unknown value deserialized from
646        /// the integer representation of enums.
647        pub fn name(&self) -> std::option::Option<&str> {
648            match self {
649                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
650                Self::New => std::option::Option::Some("NEW"),
651                Self::InProgressGoogleSupport => {
652                    std::option::Option::Some("IN_PROGRESS_GOOGLE_SUPPORT")
653                }
654                Self::ActionRequired => std::option::Option::Some("ACTION_REQUIRED"),
655                Self::SolutionProvided => std::option::Option::Some("SOLUTION_PROVIDED"),
656                Self::Closed => std::option::Option::Some("CLOSED"),
657                Self::UnknownValue(u) => u.0.name(),
658            }
659        }
660    }
661
662    impl std::default::Default for State {
663        fn default() -> Self {
664            use std::convert::From;
665            Self::from(0)
666        }
667    }
668
669    impl std::fmt::Display for State {
670        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
671            wkt::internal::display_enum(f, self.name(), self.value())
672        }
673    }
674
675    impl std::convert::From<i32> for State {
676        fn from(value: i32) -> Self {
677            match value {
678                0 => Self::Unspecified,
679                1 => Self::New,
680                2 => Self::InProgressGoogleSupport,
681                3 => Self::ActionRequired,
682                4 => Self::SolutionProvided,
683                5 => Self::Closed,
684                _ => Self::UnknownValue(state::UnknownValue(
685                    wkt::internal::UnknownEnumValue::Integer(value),
686                )),
687            }
688        }
689    }
690
691    impl std::convert::From<&str> for State {
692        fn from(value: &str) -> Self {
693            use std::string::ToString;
694            match value {
695                "STATE_UNSPECIFIED" => Self::Unspecified,
696                "NEW" => Self::New,
697                "IN_PROGRESS_GOOGLE_SUPPORT" => Self::InProgressGoogleSupport,
698                "ACTION_REQUIRED" => Self::ActionRequired,
699                "SOLUTION_PROVIDED" => Self::SolutionProvided,
700                "CLOSED" => Self::Closed,
701                _ => Self::UnknownValue(state::UnknownValue(
702                    wkt::internal::UnknownEnumValue::String(value.to_string()),
703                )),
704            }
705        }
706    }
707
708    impl serde::ser::Serialize for State {
709        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
710        where
711            S: serde::Serializer,
712        {
713            match self {
714                Self::Unspecified => serializer.serialize_i32(0),
715                Self::New => serializer.serialize_i32(1),
716                Self::InProgressGoogleSupport => serializer.serialize_i32(2),
717                Self::ActionRequired => serializer.serialize_i32(3),
718                Self::SolutionProvided => serializer.serialize_i32(4),
719                Self::Closed => serializer.serialize_i32(5),
720                Self::UnknownValue(u) => u.0.serialize(serializer),
721            }
722        }
723    }
724
725    impl<'de> serde::de::Deserialize<'de> for State {
726        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
727        where
728            D: serde::Deserializer<'de>,
729        {
730            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
731                ".google.cloud.support.v2.Case.State",
732            ))
733        }
734    }
735
736    /// The case Priority. P0 is most urgent and P4 the least.
737    ///
738    /// # Working with unknown values
739    ///
740    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
741    /// additional enum variants at any time. Adding new variants is not considered
742    /// a breaking change. Applications should write their code in anticipation of:
743    ///
744    /// - New values appearing in future releases of the client library, **and**
745    /// - New values received dynamically, without application changes.
746    ///
747    /// Please consult the [Working with enums] section in the user guide for some
748    /// guidelines.
749    ///
750    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
751    #[derive(Clone, Debug, PartialEq)]
752    #[non_exhaustive]
753    pub enum Priority {
754        /// Priority is undefined or has not been set yet.
755        Unspecified,
756        /// Extreme impact on a production service. Service is hard down.
757        P0,
758        /// Critical impact on a production service. Service is currently unusable.
759        P1,
760        /// Severe impact on a production service. Service is usable but greatly
761        /// impaired.
762        P2,
763        /// Medium impact on a production service.  Service is available, but
764        /// moderately impaired.
765        P3,
766        /// General questions or minor issues.  Production service is fully
767        /// available.
768        P4,
769        /// If set, the enum was initialized with an unknown value.
770        ///
771        /// Applications can examine the value using [Priority::value] or
772        /// [Priority::name].
773        UnknownValue(priority::UnknownValue),
774    }
775
776    #[doc(hidden)]
777    pub mod priority {
778        #[allow(unused_imports)]
779        use super::*;
780        #[derive(Clone, Debug, PartialEq)]
781        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
782    }
783
784    impl Priority {
785        /// Gets the enum value.
786        ///
787        /// Returns `None` if the enum contains an unknown value deserialized from
788        /// the string representation of enums.
789        pub fn value(&self) -> std::option::Option<i32> {
790            match self {
791                Self::Unspecified => std::option::Option::Some(0),
792                Self::P0 => std::option::Option::Some(1),
793                Self::P1 => std::option::Option::Some(2),
794                Self::P2 => std::option::Option::Some(3),
795                Self::P3 => std::option::Option::Some(4),
796                Self::P4 => std::option::Option::Some(5),
797                Self::UnknownValue(u) => u.0.value(),
798            }
799        }
800
801        /// Gets the enum value as a string.
802        ///
803        /// Returns `None` if the enum contains an unknown value deserialized from
804        /// the integer representation of enums.
805        pub fn name(&self) -> std::option::Option<&str> {
806            match self {
807                Self::Unspecified => std::option::Option::Some("PRIORITY_UNSPECIFIED"),
808                Self::P0 => std::option::Option::Some("P0"),
809                Self::P1 => std::option::Option::Some("P1"),
810                Self::P2 => std::option::Option::Some("P2"),
811                Self::P3 => std::option::Option::Some("P3"),
812                Self::P4 => std::option::Option::Some("P4"),
813                Self::UnknownValue(u) => u.0.name(),
814            }
815        }
816    }
817
818    impl std::default::Default for Priority {
819        fn default() -> Self {
820            use std::convert::From;
821            Self::from(0)
822        }
823    }
824
825    impl std::fmt::Display for Priority {
826        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
827            wkt::internal::display_enum(f, self.name(), self.value())
828        }
829    }
830
831    impl std::convert::From<i32> for Priority {
832        fn from(value: i32) -> Self {
833            match value {
834                0 => Self::Unspecified,
835                1 => Self::P0,
836                2 => Self::P1,
837                3 => Self::P2,
838                4 => Self::P3,
839                5 => Self::P4,
840                _ => Self::UnknownValue(priority::UnknownValue(
841                    wkt::internal::UnknownEnumValue::Integer(value),
842                )),
843            }
844        }
845    }
846
847    impl std::convert::From<&str> for Priority {
848        fn from(value: &str) -> Self {
849            use std::string::ToString;
850            match value {
851                "PRIORITY_UNSPECIFIED" => Self::Unspecified,
852                "P0" => Self::P0,
853                "P1" => Self::P1,
854                "P2" => Self::P2,
855                "P3" => Self::P3,
856                "P4" => Self::P4,
857                _ => Self::UnknownValue(priority::UnknownValue(
858                    wkt::internal::UnknownEnumValue::String(value.to_string()),
859                )),
860            }
861        }
862    }
863
864    impl serde::ser::Serialize for Priority {
865        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
866        where
867            S: serde::Serializer,
868        {
869            match self {
870                Self::Unspecified => serializer.serialize_i32(0),
871                Self::P0 => serializer.serialize_i32(1),
872                Self::P1 => serializer.serialize_i32(2),
873                Self::P2 => serializer.serialize_i32(3),
874                Self::P3 => serializer.serialize_i32(4),
875                Self::P4 => serializer.serialize_i32(5),
876                Self::UnknownValue(u) => u.0.serialize(serializer),
877            }
878        }
879    }
880
881    impl<'de> serde::de::Deserialize<'de> for Priority {
882        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
883        where
884            D: serde::Deserializer<'de>,
885        {
886            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
887                ".google.cloud.support.v2.Case.Priority",
888            ))
889        }
890    }
891}
892
893/// A Case Classification represents the topic that a case is about. It's very
894/// important to use accurate classifications, because they're
895/// used to route your cases to specialists who can help you.
896///
897/// A classification always has an ID that is its unique identifier.
898/// A valid ID is required when creating a case.
899#[derive(Clone, Default, PartialEq)]
900#[non_exhaustive]
901pub struct CaseClassification {
902    /// The unique ID for a classification. Must be specified for case creation.
903    ///
904    /// To retrieve valid classification IDs for case creation, use
905    /// `caseClassifications.search`.
906    ///
907    /// Classification IDs returned by `caseClassifications.search` are guaranteed
908    /// to be valid for at least 6 months. If a given classification is
909    /// deactiveated, it will immediately stop being returned. After 6 months,
910    /// `case.create` requests using the classification ID will fail.
911    pub id: std::string::String,
912
913    /// A display name for the classification.
914    ///
915    /// The display name is not static and can change. To uniquely and consistently
916    /// identify classifications, use the `CaseClassification.id` field.
917    pub display_name: std::string::String,
918
919    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
920}
921
922impl CaseClassification {
923    pub fn new() -> Self {
924        std::default::Default::default()
925    }
926
927    /// Sets the value of [id][crate::model::CaseClassification::id].
928    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
929        self.id = v.into();
930        self
931    }
932
933    /// Sets the value of [display_name][crate::model::CaseClassification::display_name].
934    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
935        self.display_name = v.into();
936        self
937    }
938}
939
940impl wkt::message::Message for CaseClassification {
941    fn typename() -> &'static str {
942        "type.googleapis.com/google.cloud.support.v2.CaseClassification"
943    }
944}
945
946/// The request message for the GetCase endpoint.
947#[derive(Clone, Default, PartialEq)]
948#[non_exhaustive]
949pub struct GetCaseRequest {
950    /// Required. The full name of a case to be retrieved.
951    pub name: std::string::String,
952
953    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
954}
955
956impl GetCaseRequest {
957    pub fn new() -> Self {
958        std::default::Default::default()
959    }
960
961    /// Sets the value of [name][crate::model::GetCaseRequest::name].
962    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
963        self.name = v.into();
964        self
965    }
966}
967
968impl wkt::message::Message for GetCaseRequest {
969    fn typename() -> &'static str {
970        "type.googleapis.com/google.cloud.support.v2.GetCaseRequest"
971    }
972}
973
974/// The request message for the CreateCase endpoint.
975#[derive(Clone, Default, PartialEq)]
976#[non_exhaustive]
977pub struct CreateCaseRequest {
978    /// Required. The name of the parent under which the case should be created.
979    pub parent: std::string::String,
980
981    /// Required. The case to be created.
982    pub case: std::option::Option<crate::model::Case>,
983
984    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
985}
986
987impl CreateCaseRequest {
988    pub fn new() -> Self {
989        std::default::Default::default()
990    }
991
992    /// Sets the value of [parent][crate::model::CreateCaseRequest::parent].
993    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
994        self.parent = v.into();
995        self
996    }
997
998    /// Sets the value of [case][crate::model::CreateCaseRequest::case].
999    pub fn set_case<T>(mut self, v: T) -> Self
1000    where
1001        T: std::convert::Into<crate::model::Case>,
1002    {
1003        self.case = std::option::Option::Some(v.into());
1004        self
1005    }
1006
1007    /// Sets or clears the value of [case][crate::model::CreateCaseRequest::case].
1008    pub fn set_or_clear_case<T>(mut self, v: std::option::Option<T>) -> Self
1009    where
1010        T: std::convert::Into<crate::model::Case>,
1011    {
1012        self.case = v.map(|x| x.into());
1013        self
1014    }
1015}
1016
1017impl wkt::message::Message for CreateCaseRequest {
1018    fn typename() -> &'static str {
1019        "type.googleapis.com/google.cloud.support.v2.CreateCaseRequest"
1020    }
1021}
1022
1023/// The request message for the ListCases endpoint.
1024#[derive(Clone, Default, PartialEq)]
1025#[non_exhaustive]
1026pub struct ListCasesRequest {
1027    /// Required. The name of a parent to list cases under.
1028    pub parent: std::string::String,
1029
1030    /// An expression used to filter cases.
1031    ///
1032    /// If it's an empty string, then no filtering happens. Otherwise, the endpoint
1033    /// returns the cases that match the filter.
1034    ///
1035    /// Expressions use the following fields separated by `AND` and specified with
1036    /// `=`:
1037    ///
1038    /// - `state`: Can be `OPEN` or `CLOSED`.
1039    /// - `priority`: Can be `P0`, `P1`, `P2`, `P3`, or `P4`. You
1040    ///   can specify multiple values for priority using the `OR` operator. For
1041    ///   example, `priority=P1 OR priority=P2`.
1042    /// - `creator.email`: The email address of the case creator.
1043    ///
1044    /// EXAMPLES:
1045    ///
1046    /// - `state=CLOSED`
1047    /// - `state=OPEN AND creator.email="tester@example.com"`
1048    /// - `state=OPEN AND (priority=P0 OR priority=P1)`
1049    pub filter: std::string::String,
1050
1051    /// The maximum number of cases fetched with each request. Defaults to 10.
1052    pub page_size: i32,
1053
1054    /// A token identifying the page of results to return. If unspecified, the
1055    /// first page is retrieved.
1056    pub page_token: std::string::String,
1057
1058    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1059}
1060
1061impl ListCasesRequest {
1062    pub fn new() -> Self {
1063        std::default::Default::default()
1064    }
1065
1066    /// Sets the value of [parent][crate::model::ListCasesRequest::parent].
1067    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1068        self.parent = v.into();
1069        self
1070    }
1071
1072    /// Sets the value of [filter][crate::model::ListCasesRequest::filter].
1073    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1074        self.filter = v.into();
1075        self
1076    }
1077
1078    /// Sets the value of [page_size][crate::model::ListCasesRequest::page_size].
1079    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1080        self.page_size = v.into();
1081        self
1082    }
1083
1084    /// Sets the value of [page_token][crate::model::ListCasesRequest::page_token].
1085    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1086        self.page_token = v.into();
1087        self
1088    }
1089}
1090
1091impl wkt::message::Message for ListCasesRequest {
1092    fn typename() -> &'static str {
1093        "type.googleapis.com/google.cloud.support.v2.ListCasesRequest"
1094    }
1095}
1096
1097/// The response message for the ListCases endpoint.
1098#[derive(Clone, Default, PartialEq)]
1099#[non_exhaustive]
1100pub struct ListCasesResponse {
1101    /// The list of cases associated with the parent after any
1102    /// filters have been applied.
1103    pub cases: std::vec::Vec<crate::model::Case>,
1104
1105    /// A token to retrieve the next page of results. Set this in the `page_token`
1106    /// field of subsequent `cases.list` requests. If unspecified, there are no
1107    /// more results to retrieve.
1108    pub next_page_token: std::string::String,
1109
1110    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1111}
1112
1113impl ListCasesResponse {
1114    pub fn new() -> Self {
1115        std::default::Default::default()
1116    }
1117
1118    /// Sets the value of [cases][crate::model::ListCasesResponse::cases].
1119    pub fn set_cases<T, V>(mut self, v: T) -> Self
1120    where
1121        T: std::iter::IntoIterator<Item = V>,
1122        V: std::convert::Into<crate::model::Case>,
1123    {
1124        use std::iter::Iterator;
1125        self.cases = v.into_iter().map(|i| i.into()).collect();
1126        self
1127    }
1128
1129    /// Sets the value of [next_page_token][crate::model::ListCasesResponse::next_page_token].
1130    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1131        self.next_page_token = v.into();
1132        self
1133    }
1134}
1135
1136impl wkt::message::Message for ListCasesResponse {
1137    fn typename() -> &'static str {
1138        "type.googleapis.com/google.cloud.support.v2.ListCasesResponse"
1139    }
1140}
1141
1142#[doc(hidden)]
1143impl gax::paginator::internal::PageableResponse for ListCasesResponse {
1144    type PageItem = crate::model::Case;
1145
1146    fn items(self) -> std::vec::Vec<Self::PageItem> {
1147        self.cases
1148    }
1149
1150    fn next_page_token(&self) -> std::string::String {
1151        use std::clone::Clone;
1152        self.next_page_token.clone()
1153    }
1154}
1155
1156/// The request message for the SearchCases endpoint.
1157#[derive(Clone, Default, PartialEq)]
1158#[non_exhaustive]
1159pub struct SearchCasesRequest {
1160    /// The name of the parent resource to search for cases under.
1161    pub parent: std::string::String,
1162
1163    /// An expression used to filter cases.
1164    ///
1165    /// Expressions use the following fields separated by `AND` and specified with
1166    /// `=`:
1167    ///
1168    /// - `organization`: An organization name in the form
1169    ///   `organizations/<organization_id>`.
1170    /// - `project`: A project name in the form `projects/<project_id>`.
1171    /// - `state`: Can be `OPEN` or `CLOSED`.
1172    /// - `priority`: Can be `P0`, `P1`, `P2`, `P3`, or `P4`. You
1173    ///   can specify multiple values for priority using the `OR` operator. For
1174    ///   example, `priority=P1 OR priority=P2`.
1175    /// - `creator.email`: The email address of the case creator.
1176    ///
1177    /// You must specify either `organization` or `project`.
1178    ///
1179    /// To search across `displayName`, `description`, and comments, use a global
1180    /// restriction with no keyword or operator. For example, `"my search"`.
1181    ///
1182    /// To search only cases updated after a certain date, use `update_time`
1183    /// restricted with that particular date, time, and timezone in ISO datetime
1184    /// format. For example, `update_time>"2020-01-01T00:00:00-05:00"`.
1185    /// `update_time` only supports the greater than operator (`>`).
1186    ///
1187    /// Examples:
1188    ///
1189    /// - `organization="organizations/123456789"`
1190    /// - `project="projects/my-project-id"`
1191    /// - `project="projects/123456789"`
1192    /// - `organization="organizations/123456789" AND state=CLOSED`
1193    /// - `project="projects/my-project-id" AND creator.email="tester@example.com"`
1194    /// - `project="projects/my-project-id" AND (priority=P0 OR priority=P1)`
1195    pub query: std::string::String,
1196
1197    /// The maximum number of cases fetched with each request. The default page
1198    /// size is 10.
1199    pub page_size: i32,
1200
1201    /// A token identifying the page of results to return. If unspecified, the
1202    /// first page is retrieved.
1203    pub page_token: std::string::String,
1204
1205    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1206}
1207
1208impl SearchCasesRequest {
1209    pub fn new() -> Self {
1210        std::default::Default::default()
1211    }
1212
1213    /// Sets the value of [parent][crate::model::SearchCasesRequest::parent].
1214    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1215        self.parent = v.into();
1216        self
1217    }
1218
1219    /// Sets the value of [query][crate::model::SearchCasesRequest::query].
1220    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1221        self.query = v.into();
1222        self
1223    }
1224
1225    /// Sets the value of [page_size][crate::model::SearchCasesRequest::page_size].
1226    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1227        self.page_size = v.into();
1228        self
1229    }
1230
1231    /// Sets the value of [page_token][crate::model::SearchCasesRequest::page_token].
1232    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1233        self.page_token = v.into();
1234        self
1235    }
1236}
1237
1238impl wkt::message::Message for SearchCasesRequest {
1239    fn typename() -> &'static str {
1240        "type.googleapis.com/google.cloud.support.v2.SearchCasesRequest"
1241    }
1242}
1243
1244/// The response message for the SearchCases endpoint.
1245#[derive(Clone, Default, PartialEq)]
1246#[non_exhaustive]
1247pub struct SearchCasesResponse {
1248    /// The list of cases associated with the parent after any
1249    /// filters have been applied.
1250    pub cases: std::vec::Vec<crate::model::Case>,
1251
1252    /// A token to retrieve the next page of results. Set this in the
1253    /// `page_token` field of subsequent `cases.search` requests. If unspecified,
1254    /// there are no more results to retrieve.
1255    pub next_page_token: std::string::String,
1256
1257    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1258}
1259
1260impl SearchCasesResponse {
1261    pub fn new() -> Self {
1262        std::default::Default::default()
1263    }
1264
1265    /// Sets the value of [cases][crate::model::SearchCasesResponse::cases].
1266    pub fn set_cases<T, V>(mut self, v: T) -> Self
1267    where
1268        T: std::iter::IntoIterator<Item = V>,
1269        V: std::convert::Into<crate::model::Case>,
1270    {
1271        use std::iter::Iterator;
1272        self.cases = v.into_iter().map(|i| i.into()).collect();
1273        self
1274    }
1275
1276    /// Sets the value of [next_page_token][crate::model::SearchCasesResponse::next_page_token].
1277    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1278        self.next_page_token = v.into();
1279        self
1280    }
1281}
1282
1283impl wkt::message::Message for SearchCasesResponse {
1284    fn typename() -> &'static str {
1285        "type.googleapis.com/google.cloud.support.v2.SearchCasesResponse"
1286    }
1287}
1288
1289#[doc(hidden)]
1290impl gax::paginator::internal::PageableResponse for SearchCasesResponse {
1291    type PageItem = crate::model::Case;
1292
1293    fn items(self) -> std::vec::Vec<Self::PageItem> {
1294        self.cases
1295    }
1296
1297    fn next_page_token(&self) -> std::string::String {
1298        use std::clone::Clone;
1299        self.next_page_token.clone()
1300    }
1301}
1302
1303/// The request message for the EscalateCase endpoint.
1304#[derive(Clone, Default, PartialEq)]
1305#[non_exhaustive]
1306pub struct EscalateCaseRequest {
1307    /// Required. The name of the case to be escalated.
1308    pub name: std::string::String,
1309
1310    /// The escalation information to be sent with the escalation request.
1311    pub escalation: std::option::Option<crate::model::Escalation>,
1312
1313    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1314}
1315
1316impl EscalateCaseRequest {
1317    pub fn new() -> Self {
1318        std::default::Default::default()
1319    }
1320
1321    /// Sets the value of [name][crate::model::EscalateCaseRequest::name].
1322    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1323        self.name = v.into();
1324        self
1325    }
1326
1327    /// Sets the value of [escalation][crate::model::EscalateCaseRequest::escalation].
1328    pub fn set_escalation<T>(mut self, v: T) -> Self
1329    where
1330        T: std::convert::Into<crate::model::Escalation>,
1331    {
1332        self.escalation = std::option::Option::Some(v.into());
1333        self
1334    }
1335
1336    /// Sets or clears the value of [escalation][crate::model::EscalateCaseRequest::escalation].
1337    pub fn set_or_clear_escalation<T>(mut self, v: std::option::Option<T>) -> Self
1338    where
1339        T: std::convert::Into<crate::model::Escalation>,
1340    {
1341        self.escalation = v.map(|x| x.into());
1342        self
1343    }
1344}
1345
1346impl wkt::message::Message for EscalateCaseRequest {
1347    fn typename() -> &'static str {
1348        "type.googleapis.com/google.cloud.support.v2.EscalateCaseRequest"
1349    }
1350}
1351
1352/// The request message for the UpdateCase endpoint
1353#[derive(Clone, Default, PartialEq)]
1354#[non_exhaustive]
1355pub struct UpdateCaseRequest {
1356    /// Required. The case to update.
1357    pub case: std::option::Option<crate::model::Case>,
1358
1359    /// A list of attributes of the case that should be updated. Supported values
1360    /// are `priority`, `display_name`, and `subscriber_email_addresses`. If no
1361    /// fields are specified, all supported fields are updated.
1362    ///
1363    /// Be careful - if you do not provide a field mask, then you might
1364    /// accidentally clear some fields. For example, if you leave the field mask
1365    /// empty and do not provide a value for `subscriber_email_addresses`, then
1366    /// `subscriber_email_addresses` is updated to empty.
1367    pub update_mask: std::option::Option<wkt::FieldMask>,
1368
1369    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1370}
1371
1372impl UpdateCaseRequest {
1373    pub fn new() -> Self {
1374        std::default::Default::default()
1375    }
1376
1377    /// Sets the value of [case][crate::model::UpdateCaseRequest::case].
1378    pub fn set_case<T>(mut self, v: T) -> Self
1379    where
1380        T: std::convert::Into<crate::model::Case>,
1381    {
1382        self.case = std::option::Option::Some(v.into());
1383        self
1384    }
1385
1386    /// Sets or clears the value of [case][crate::model::UpdateCaseRequest::case].
1387    pub fn set_or_clear_case<T>(mut self, v: std::option::Option<T>) -> Self
1388    where
1389        T: std::convert::Into<crate::model::Case>,
1390    {
1391        self.case = v.map(|x| x.into());
1392        self
1393    }
1394
1395    /// Sets the value of [update_mask][crate::model::UpdateCaseRequest::update_mask].
1396    pub fn set_update_mask<T>(mut self, v: T) -> Self
1397    where
1398        T: std::convert::Into<wkt::FieldMask>,
1399    {
1400        self.update_mask = std::option::Option::Some(v.into());
1401        self
1402    }
1403
1404    /// Sets or clears the value of [update_mask][crate::model::UpdateCaseRequest::update_mask].
1405    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1406    where
1407        T: std::convert::Into<wkt::FieldMask>,
1408    {
1409        self.update_mask = v.map(|x| x.into());
1410        self
1411    }
1412}
1413
1414impl wkt::message::Message for UpdateCaseRequest {
1415    fn typename() -> &'static str {
1416        "type.googleapis.com/google.cloud.support.v2.UpdateCaseRequest"
1417    }
1418}
1419
1420/// The request message for the CloseCase endpoint.
1421#[derive(Clone, Default, PartialEq)]
1422#[non_exhaustive]
1423pub struct CloseCaseRequest {
1424    /// Required. The name of the case to close.
1425    pub name: std::string::String,
1426
1427    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1428}
1429
1430impl CloseCaseRequest {
1431    pub fn new() -> Self {
1432        std::default::Default::default()
1433    }
1434
1435    /// Sets the value of [name][crate::model::CloseCaseRequest::name].
1436    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1437        self.name = v.into();
1438        self
1439    }
1440}
1441
1442impl wkt::message::Message for CloseCaseRequest {
1443    fn typename() -> &'static str {
1444        "type.googleapis.com/google.cloud.support.v2.CloseCaseRequest"
1445    }
1446}
1447
1448/// The request message for the SearchCaseClassifications endpoint.
1449#[derive(Clone, Default, PartialEq)]
1450#[non_exhaustive]
1451pub struct SearchCaseClassificationsRequest {
1452    /// An expression used to filter case classifications.
1453    ///
1454    /// If it's an empty string, then no filtering happens. Otherwise, case
1455    /// classifications will be returned that match the filter.
1456    pub query: std::string::String,
1457
1458    /// The maximum number of classifications fetched with each request.
1459    pub page_size: i32,
1460
1461    /// A token identifying the page of results to return. If unspecified, the
1462    /// first page is retrieved.
1463    pub page_token: std::string::String,
1464
1465    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1466}
1467
1468impl SearchCaseClassificationsRequest {
1469    pub fn new() -> Self {
1470        std::default::Default::default()
1471    }
1472
1473    /// Sets the value of [query][crate::model::SearchCaseClassificationsRequest::query].
1474    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1475        self.query = v.into();
1476        self
1477    }
1478
1479    /// Sets the value of [page_size][crate::model::SearchCaseClassificationsRequest::page_size].
1480    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1481        self.page_size = v.into();
1482        self
1483    }
1484
1485    /// Sets the value of [page_token][crate::model::SearchCaseClassificationsRequest::page_token].
1486    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1487        self.page_token = v.into();
1488        self
1489    }
1490}
1491
1492impl wkt::message::Message for SearchCaseClassificationsRequest {
1493    fn typename() -> &'static str {
1494        "type.googleapis.com/google.cloud.support.v2.SearchCaseClassificationsRequest"
1495    }
1496}
1497
1498/// The response message for SearchCaseClassifications endpoint.
1499#[derive(Clone, Default, PartialEq)]
1500#[non_exhaustive]
1501pub struct SearchCaseClassificationsResponse {
1502    /// The classifications retrieved.
1503    pub case_classifications: std::vec::Vec<crate::model::CaseClassification>,
1504
1505    /// A token to retrieve the next page of results. Set this in the `page_token`
1506    /// field of subsequent `caseClassifications.list` requests. If unspecified,
1507    /// there are no more results to retrieve.
1508    pub next_page_token: std::string::String,
1509
1510    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1511}
1512
1513impl SearchCaseClassificationsResponse {
1514    pub fn new() -> Self {
1515        std::default::Default::default()
1516    }
1517
1518    /// Sets the value of [case_classifications][crate::model::SearchCaseClassificationsResponse::case_classifications].
1519    pub fn set_case_classifications<T, V>(mut self, v: T) -> Self
1520    where
1521        T: std::iter::IntoIterator<Item = V>,
1522        V: std::convert::Into<crate::model::CaseClassification>,
1523    {
1524        use std::iter::Iterator;
1525        self.case_classifications = v.into_iter().map(|i| i.into()).collect();
1526        self
1527    }
1528
1529    /// Sets the value of [next_page_token][crate::model::SearchCaseClassificationsResponse::next_page_token].
1530    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1531        self.next_page_token = v.into();
1532        self
1533    }
1534}
1535
1536impl wkt::message::Message for SearchCaseClassificationsResponse {
1537    fn typename() -> &'static str {
1538        "type.googleapis.com/google.cloud.support.v2.SearchCaseClassificationsResponse"
1539    }
1540}
1541
1542#[doc(hidden)]
1543impl gax::paginator::internal::PageableResponse for SearchCaseClassificationsResponse {
1544    type PageItem = crate::model::CaseClassification;
1545
1546    fn items(self) -> std::vec::Vec<Self::PageItem> {
1547        self.case_classifications
1548    }
1549
1550    fn next_page_token(&self) -> std::string::String {
1551        use std::clone::Clone;
1552        self.next_page_token.clone()
1553    }
1554}
1555
1556/// A comment associated with a support case.
1557///
1558/// Case comments are the primary way for Google Support to communicate with a
1559/// user who has opened a case. When a user responds to Google Support, the
1560/// user's responses also appear as comments.
1561#[derive(Clone, Default, PartialEq)]
1562#[non_exhaustive]
1563pub struct Comment {
1564    /// Output only. Identifier. The resource name of the comment.
1565    pub name: std::string::String,
1566
1567    /// Output only. The time when the comment was created.
1568    pub create_time: std::option::Option<wkt::Timestamp>,
1569
1570    /// Output only. The user or Google Support agent who created the comment.
1571    pub creator: std::option::Option<crate::model::Actor>,
1572
1573    /// The full comment body.
1574    ///
1575    /// Maximum of 12800 characters.
1576    pub body: std::string::String,
1577
1578    /// Output only. DEPRECATED. DO NOT USE.
1579    ///
1580    /// A duplicate of the `body` field.
1581    ///
1582    /// This field is only present for legacy reasons.
1583    #[deprecated]
1584    pub plain_text_body: std::string::String,
1585
1586    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1587}
1588
1589impl Comment {
1590    pub fn new() -> Self {
1591        std::default::Default::default()
1592    }
1593
1594    /// Sets the value of [name][crate::model::Comment::name].
1595    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1596        self.name = v.into();
1597        self
1598    }
1599
1600    /// Sets the value of [create_time][crate::model::Comment::create_time].
1601    pub fn set_create_time<T>(mut self, v: T) -> Self
1602    where
1603        T: std::convert::Into<wkt::Timestamp>,
1604    {
1605        self.create_time = std::option::Option::Some(v.into());
1606        self
1607    }
1608
1609    /// Sets or clears the value of [create_time][crate::model::Comment::create_time].
1610    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1611    where
1612        T: std::convert::Into<wkt::Timestamp>,
1613    {
1614        self.create_time = v.map(|x| x.into());
1615        self
1616    }
1617
1618    /// Sets the value of [creator][crate::model::Comment::creator].
1619    pub fn set_creator<T>(mut self, v: T) -> Self
1620    where
1621        T: std::convert::Into<crate::model::Actor>,
1622    {
1623        self.creator = std::option::Option::Some(v.into());
1624        self
1625    }
1626
1627    /// Sets or clears the value of [creator][crate::model::Comment::creator].
1628    pub fn set_or_clear_creator<T>(mut self, v: std::option::Option<T>) -> Self
1629    where
1630        T: std::convert::Into<crate::model::Actor>,
1631    {
1632        self.creator = v.map(|x| x.into());
1633        self
1634    }
1635
1636    /// Sets the value of [body][crate::model::Comment::body].
1637    pub fn set_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1638        self.body = v.into();
1639        self
1640    }
1641
1642    /// Sets the value of [plain_text_body][crate::model::Comment::plain_text_body].
1643    #[deprecated]
1644    pub fn set_plain_text_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1645        self.plain_text_body = v.into();
1646        self
1647    }
1648}
1649
1650impl wkt::message::Message for Comment {
1651    fn typename() -> &'static str {
1652        "type.googleapis.com/google.cloud.support.v2.Comment"
1653    }
1654}
1655
1656/// The request message for the ListComments endpoint.
1657#[derive(Clone, Default, PartialEq)]
1658#[non_exhaustive]
1659pub struct ListCommentsRequest {
1660    /// Required. The name of the case for which to list comments.
1661    pub parent: std::string::String,
1662
1663    /// The maximum number of comments to fetch. Defaults to 10.
1664    pub page_size: i32,
1665
1666    /// A token identifying the page of results to return. If unspecified, the
1667    /// first page is returned.
1668    pub page_token: std::string::String,
1669
1670    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1671}
1672
1673impl ListCommentsRequest {
1674    pub fn new() -> Self {
1675        std::default::Default::default()
1676    }
1677
1678    /// Sets the value of [parent][crate::model::ListCommentsRequest::parent].
1679    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1680        self.parent = v.into();
1681        self
1682    }
1683
1684    /// Sets the value of [page_size][crate::model::ListCommentsRequest::page_size].
1685    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1686        self.page_size = v.into();
1687        self
1688    }
1689
1690    /// Sets the value of [page_token][crate::model::ListCommentsRequest::page_token].
1691    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1692        self.page_token = v.into();
1693        self
1694    }
1695}
1696
1697impl wkt::message::Message for ListCommentsRequest {
1698    fn typename() -> &'static str {
1699        "type.googleapis.com/google.cloud.support.v2.ListCommentsRequest"
1700    }
1701}
1702
1703/// The response message for the ListComments endpoint.
1704#[derive(Clone, Default, PartialEq)]
1705#[non_exhaustive]
1706pub struct ListCommentsResponse {
1707    /// List of the comments associated with the case.
1708    pub comments: std::vec::Vec<crate::model::Comment>,
1709
1710    /// A token to retrieve the next page of results. Set this in the `page_token`
1711    /// field of subsequent `cases.comments.list` requests. If unspecified, there
1712    /// are no more results to retrieve.
1713    pub next_page_token: std::string::String,
1714
1715    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1716}
1717
1718impl ListCommentsResponse {
1719    pub fn new() -> Self {
1720        std::default::Default::default()
1721    }
1722
1723    /// Sets the value of [comments][crate::model::ListCommentsResponse::comments].
1724    pub fn set_comments<T, V>(mut self, v: T) -> Self
1725    where
1726        T: std::iter::IntoIterator<Item = V>,
1727        V: std::convert::Into<crate::model::Comment>,
1728    {
1729        use std::iter::Iterator;
1730        self.comments = v.into_iter().map(|i| i.into()).collect();
1731        self
1732    }
1733
1734    /// Sets the value of [next_page_token][crate::model::ListCommentsResponse::next_page_token].
1735    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1736        self.next_page_token = v.into();
1737        self
1738    }
1739}
1740
1741impl wkt::message::Message for ListCommentsResponse {
1742    fn typename() -> &'static str {
1743        "type.googleapis.com/google.cloud.support.v2.ListCommentsResponse"
1744    }
1745}
1746
1747#[doc(hidden)]
1748impl gax::paginator::internal::PageableResponse for ListCommentsResponse {
1749    type PageItem = crate::model::Comment;
1750
1751    fn items(self) -> std::vec::Vec<Self::PageItem> {
1752        self.comments
1753    }
1754
1755    fn next_page_token(&self) -> std::string::String {
1756        use std::clone::Clone;
1757        self.next_page_token.clone()
1758    }
1759}
1760
1761/// The request message for the CreateComment endpoint.
1762#[derive(Clone, Default, PartialEq)]
1763#[non_exhaustive]
1764pub struct CreateCommentRequest {
1765    /// Required. The name of the case to which the comment should be added.
1766    pub parent: std::string::String,
1767
1768    /// Required. The comment to be added.
1769    pub comment: std::option::Option<crate::model::Comment>,
1770
1771    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1772}
1773
1774impl CreateCommentRequest {
1775    pub fn new() -> Self {
1776        std::default::Default::default()
1777    }
1778
1779    /// Sets the value of [parent][crate::model::CreateCommentRequest::parent].
1780    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1781        self.parent = v.into();
1782        self
1783    }
1784
1785    /// Sets the value of [comment][crate::model::CreateCommentRequest::comment].
1786    pub fn set_comment<T>(mut self, v: T) -> Self
1787    where
1788        T: std::convert::Into<crate::model::Comment>,
1789    {
1790        self.comment = std::option::Option::Some(v.into());
1791        self
1792    }
1793
1794    /// Sets or clears the value of [comment][crate::model::CreateCommentRequest::comment].
1795    pub fn set_or_clear_comment<T>(mut self, v: std::option::Option<T>) -> Self
1796    where
1797        T: std::convert::Into<crate::model::Comment>,
1798    {
1799        self.comment = v.map(|x| x.into());
1800        self
1801    }
1802}
1803
1804impl wkt::message::Message for CreateCommentRequest {
1805    fn typename() -> &'static str {
1806        "type.googleapis.com/google.cloud.support.v2.CreateCommentRequest"
1807    }
1808}
1809
1810/// An escalation of a support case.
1811#[derive(Clone, Default, PartialEq)]
1812#[non_exhaustive]
1813pub struct Escalation {
1814    /// Required. The reason why the Case is being escalated.
1815    pub reason: crate::model::escalation::Reason,
1816
1817    /// Required. A free text description to accompany the `reason` field above.
1818    /// Provides additional context on why the case is being escalated.
1819    pub justification: std::string::String,
1820
1821    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1822}
1823
1824impl Escalation {
1825    pub fn new() -> Self {
1826        std::default::Default::default()
1827    }
1828
1829    /// Sets the value of [reason][crate::model::Escalation::reason].
1830    pub fn set_reason<T: std::convert::Into<crate::model::escalation::Reason>>(
1831        mut self,
1832        v: T,
1833    ) -> Self {
1834        self.reason = v.into();
1835        self
1836    }
1837
1838    /// Sets the value of [justification][crate::model::Escalation::justification].
1839    pub fn set_justification<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1840        self.justification = v.into();
1841        self
1842    }
1843}
1844
1845impl wkt::message::Message for Escalation {
1846    fn typename() -> &'static str {
1847        "type.googleapis.com/google.cloud.support.v2.Escalation"
1848    }
1849}
1850
1851/// Defines additional types related to [Escalation].
1852pub mod escalation {
1853    #[allow(unused_imports)]
1854    use super::*;
1855
1856    /// An enum detailing the possible reasons a case may be escalated.
1857    ///
1858    /// # Working with unknown values
1859    ///
1860    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1861    /// additional enum variants at any time. Adding new variants is not considered
1862    /// a breaking change. Applications should write their code in anticipation of:
1863    ///
1864    /// - New values appearing in future releases of the client library, **and**
1865    /// - New values received dynamically, without application changes.
1866    ///
1867    /// Please consult the [Working with enums] section in the user guide for some
1868    /// guidelines.
1869    ///
1870    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1871    #[derive(Clone, Debug, PartialEq)]
1872    #[non_exhaustive]
1873    pub enum Reason {
1874        /// The escalation reason is in an unknown state or has not been specified.
1875        Unspecified,
1876        /// The case is taking too long to resolve.
1877        ResolutionTime,
1878        /// The support agent does not have the expertise required to successfully
1879        /// resolve the issue.
1880        TechnicalExpertise,
1881        /// The issue is having a significant business impact.
1882        BusinessImpact,
1883        /// If set, the enum was initialized with an unknown value.
1884        ///
1885        /// Applications can examine the value using [Reason::value] or
1886        /// [Reason::name].
1887        UnknownValue(reason::UnknownValue),
1888    }
1889
1890    #[doc(hidden)]
1891    pub mod reason {
1892        #[allow(unused_imports)]
1893        use super::*;
1894        #[derive(Clone, Debug, PartialEq)]
1895        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1896    }
1897
1898    impl Reason {
1899        /// Gets the enum value.
1900        ///
1901        /// Returns `None` if the enum contains an unknown value deserialized from
1902        /// the string representation of enums.
1903        pub fn value(&self) -> std::option::Option<i32> {
1904            match self {
1905                Self::Unspecified => std::option::Option::Some(0),
1906                Self::ResolutionTime => std::option::Option::Some(1),
1907                Self::TechnicalExpertise => std::option::Option::Some(2),
1908                Self::BusinessImpact => std::option::Option::Some(3),
1909                Self::UnknownValue(u) => u.0.value(),
1910            }
1911        }
1912
1913        /// Gets the enum value as a string.
1914        ///
1915        /// Returns `None` if the enum contains an unknown value deserialized from
1916        /// the integer representation of enums.
1917        pub fn name(&self) -> std::option::Option<&str> {
1918            match self {
1919                Self::Unspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
1920                Self::ResolutionTime => std::option::Option::Some("RESOLUTION_TIME"),
1921                Self::TechnicalExpertise => std::option::Option::Some("TECHNICAL_EXPERTISE"),
1922                Self::BusinessImpact => std::option::Option::Some("BUSINESS_IMPACT"),
1923                Self::UnknownValue(u) => u.0.name(),
1924            }
1925        }
1926    }
1927
1928    impl std::default::Default for Reason {
1929        fn default() -> Self {
1930            use std::convert::From;
1931            Self::from(0)
1932        }
1933    }
1934
1935    impl std::fmt::Display for Reason {
1936        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1937            wkt::internal::display_enum(f, self.name(), self.value())
1938        }
1939    }
1940
1941    impl std::convert::From<i32> for Reason {
1942        fn from(value: i32) -> Self {
1943            match value {
1944                0 => Self::Unspecified,
1945                1 => Self::ResolutionTime,
1946                2 => Self::TechnicalExpertise,
1947                3 => Self::BusinessImpact,
1948                _ => Self::UnknownValue(reason::UnknownValue(
1949                    wkt::internal::UnknownEnumValue::Integer(value),
1950                )),
1951            }
1952        }
1953    }
1954
1955    impl std::convert::From<&str> for Reason {
1956        fn from(value: &str) -> Self {
1957            use std::string::ToString;
1958            match value {
1959                "REASON_UNSPECIFIED" => Self::Unspecified,
1960                "RESOLUTION_TIME" => Self::ResolutionTime,
1961                "TECHNICAL_EXPERTISE" => Self::TechnicalExpertise,
1962                "BUSINESS_IMPACT" => Self::BusinessImpact,
1963                _ => Self::UnknownValue(reason::UnknownValue(
1964                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1965                )),
1966            }
1967        }
1968    }
1969
1970    impl serde::ser::Serialize for Reason {
1971        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1972        where
1973            S: serde::Serializer,
1974        {
1975            match self {
1976                Self::Unspecified => serializer.serialize_i32(0),
1977                Self::ResolutionTime => serializer.serialize_i32(1),
1978                Self::TechnicalExpertise => serializer.serialize_i32(2),
1979                Self::BusinessImpact => serializer.serialize_i32(3),
1980                Self::UnknownValue(u) => u.0.serialize(serializer),
1981            }
1982        }
1983    }
1984
1985    impl<'de> serde::de::Deserialize<'de> for Reason {
1986        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1987        where
1988            D: serde::Deserializer<'de>,
1989        {
1990            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Reason>::new(
1991                ".google.cloud.support.v2.Escalation.Reason",
1992            ))
1993        }
1994    }
1995}