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