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