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