google_chat1/api.rs
1use std::collections::HashMap;
2use std::cell::RefCell;
3use std::default::Default;
4use std::collections::BTreeMap;
5use serde_json as json;
6use std::io;
7use std::fs;
8use std::mem;
9use std::thread::sleep;
10
11use crate::client;
12
13// ##############
14// UTILITIES ###
15// ############
16
17
18
19
20// ########
21// HUB ###
22// ######
23
24/// Central instance to access all HangoutsChat related resource activities
25///
26/// # Examples
27///
28/// Instantiate a new hub
29///
30/// ```test_harness,no_run
31/// extern crate hyper;
32/// extern crate hyper_rustls;
33/// extern crate yup_oauth2 as oauth2;
34/// extern crate google_chat1 as chat1;
35/// use chat1::api::Message;
36/// use chat1::{Result, Error};
37/// # async fn dox() {
38/// use std::default::Default;
39/// use oauth2;
40/// use chat1::HangoutsChat;
41///
42/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
43/// // `client_secret`, among other things.
44/// let secret: oauth2::ApplicationSecret = Default::default();
45/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
46/// // unless you replace `None` with the desired Flow.
47/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
48/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
49/// // retrieve them from storage.
50/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
51/// secret,
52/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
53/// ).build().await.unwrap();
54/// let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
55/// // As the method needs a request, you would usually fill it with the desired information
56/// // into the respective structure. Some of the parts shown here might not be applicable !
57/// // Values shown here are possibly random and not representative !
58/// let mut req = Message::default();
59///
60/// // You can configure optional parameters by calling the respective setters at will, and
61/// // execute the final call using `doit()`.
62/// // Values shown here are possibly random and not representative !
63/// let result = hub.dms().conversations_messages(req, "parent")
64/// .thread_key("At")
65/// .doit().await;
66///
67/// match result {
68/// Err(e) => match e {
69/// // The Error enum provides details about what exactly happened.
70/// // You can also just use its `Debug`, `Display` or `Error` traits
71/// Error::HttpError(_)
72/// |Error::Io(_)
73/// |Error::MissingAPIKey
74/// |Error::MissingToken(_)
75/// |Error::Cancelled
76/// |Error::UploadSizeLimitExceeded(_, _)
77/// |Error::Failure(_)
78/// |Error::BadRequest(_)
79/// |Error::FieldClash(_)
80/// |Error::JsonDecodeError(_, _) => println!("{}", e),
81/// },
82/// Ok(res) => println!("Success: {:?}", res),
83/// }
84/// # }
85/// ```
86#[derive(Clone)]
87pub struct HangoutsChat<> {
88 client: hyper::Client<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>, hyper::body::Body>,
89 auth: oauth2::authenticator::Authenticator<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>>,
90 _user_agent: String,
91 _base_url: String,
92 _root_url: String,
93}
94
95impl<'a, > client::Hub for HangoutsChat<> {}
96
97impl<'a, > HangoutsChat<> {
98
99 pub fn new(client: hyper::Client<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>, hyper::body::Body>, authenticator: oauth2::authenticator::Authenticator<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>>) -> HangoutsChat<> {
100 HangoutsChat {
101 client,
102 auth: authenticator,
103 _user_agent: "google-api-rust-client/2.0.8".to_string(),
104 _base_url: "https://chat.googleapis.com/".to_string(),
105 _root_url: "https://chat.googleapis.com/".to_string(),
106 }
107 }
108
109 pub fn dms(&'a self) -> DmMethods<'a> {
110 DmMethods { hub: &self }
111 }
112 pub fn media(&'a self) -> MediaMethods<'a> {
113 MediaMethods { hub: &self }
114 }
115 pub fn rooms(&'a self) -> RoomMethods<'a> {
116 RoomMethods { hub: &self }
117 }
118 pub fn spaces(&'a self) -> SpaceMethods<'a> {
119 SpaceMethods { hub: &self }
120 }
121
122 /// Set the user-agent header field to use in all requests to the server.
123 /// It defaults to `google-api-rust-client/2.0.8`.
124 ///
125 /// Returns the previously set user-agent.
126 pub fn user_agent(&mut self, agent_name: String) -> String {
127 mem::replace(&mut self._user_agent, agent_name)
128 }
129
130 /// Set the base url to use in all requests to the server.
131 /// It defaults to `https://chat.googleapis.com/`.
132 ///
133 /// Returns the previously set base url.
134 pub fn base_url(&mut self, new_base_url: String) -> String {
135 mem::replace(&mut self._base_url, new_base_url)
136 }
137
138 /// Set the root url to use in all requests to the server.
139 /// It defaults to `https://chat.googleapis.com/`.
140 ///
141 /// Returns the previously set root url.
142 pub fn root_url(&mut self, new_root_url: String) -> String {
143 mem::replace(&mut self._root_url, new_root_url)
144 }
145}
146
147
148// ############
149// SCHEMAS ###
150// ##########
151/// List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
152///
153/// This type is not used in any activity, and only used as *part* of another schema.
154///
155#[derive(Default, Clone, Debug, Serialize, Deserialize)]
156pub struct ActionParameter {
157 /// The name of the parameter for the action script.
158 pub key: Option<String>,
159 /// The value of the parameter.
160 pub value: Option<String>,
161}
162
163impl client::Part for ActionParameter {}
164
165
166/// Parameters that a bot can use to configure how it's response is posted.
167///
168/// This type is not used in any activity, and only used as *part* of another schema.
169///
170#[derive(Default, Clone, Debug, Serialize, Deserialize)]
171pub struct ActionResponse {
172 /// The type of bot response.
173 #[serde(rename="type")]
174 pub type_: Option<String>,
175 /// URL for users to auth or config. (Only for REQUEST_CONFIG response types.)
176 pub url: Option<String>,
177}
178
179impl client::Part for ActionResponse {}
180
181
182/// Annotations associated with the plain-text body of the message. Example plain-text message body: ``` Hello @FooBot how are you!" ``` The corresponding annotations metadata: ``` "annotations":[{ "type":"USER_MENTION", "startIndex":6, "length":7, "userMention": { "user": { "name":"users/107946847022116401880", "displayName":"FooBot", "avatarUrl":"https://goo.gl/aeDtrS", "type":"BOT" }, "type":"MENTION" } }] ```
183///
184/// This type is not used in any activity, and only used as *part* of another schema.
185///
186#[derive(Default, Clone, Debug, Serialize, Deserialize)]
187pub struct Annotation {
188 /// Length of the substring in the plain-text message body this annotation corresponds to.
189 pub length: Option<i32>,
190 /// The metadata for a slash command.
191 #[serde(rename="slashCommand")]
192 pub slash_command: Option<SlashCommandMetadata>,
193 /// Start index (0-based, inclusive) in the plain-text message body this annotation corresponds to.
194 #[serde(rename="startIndex")]
195 pub start_index: Option<i32>,
196 /// The type of this annotation.
197 #[serde(rename="type")]
198 pub type_: Option<String>,
199 /// The metadata of user mention.
200 #[serde(rename="userMention")]
201 pub user_mention: Option<UserMentionMetadata>,
202}
203
204impl client::Part for Annotation {}
205
206
207/// An attachment in Hangouts Chat.
208///
209/// # Activities
210///
211/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
212/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
213///
214/// * [messages attachments get spaces](SpaceMessageAttachmentGetCall) (response)
215///
216#[derive(Default, Clone, Debug, Serialize, Deserialize)]
217pub struct Attachment {
218 /// A reference to the attachment data. This is used with the media API to download the attachment data.
219 #[serde(rename="attachmentDataRef")]
220 pub attachment_data_ref: Option<AttachmentDataRef>,
221 /// The original file name for the content, not the full path.
222 #[serde(rename="contentName")]
223 pub content_name: Option<String>,
224 /// The content type (MIME type) of the file.
225 #[serde(rename="contentType")]
226 pub content_type: Option<String>,
227 /// Output only. The download URL which should be used to allow a human user to download the attachment. Bots should not use this URL to download attachment content.
228 #[serde(rename="downloadUri")]
229 pub download_uri: Option<String>,
230 /// A reference to the drive attachment. This is used with the Drive API.
231 #[serde(rename="driveDataRef")]
232 pub drive_data_ref: Option<DriveDataRef>,
233 /// Resource name of the attachment, in the form "spaces/*/messages/*/attachments/*".
234 pub name: Option<String>,
235 /// The source of the attachment.
236 pub source: Option<String>,
237 /// Output only. The thumbnail URL which should be used to preview the attachment to a human user. Bots should not use this URL to download attachment content.
238 #[serde(rename="thumbnailUri")]
239 pub thumbnail_uri: Option<String>,
240}
241
242impl client::ResponseResult for Attachment {}
243
244
245/// A reference to the data of an attachment.
246///
247/// This type is not used in any activity, and only used as *part* of another schema.
248///
249#[derive(Default, Clone, Debug, Serialize, Deserialize)]
250pub struct AttachmentDataRef {
251 /// The resource name of the attachment data. This is used with the media API to download the attachment data.
252 #[serde(rename="resourceName")]
253 pub resource_name: Option<String>,
254}
255
256impl client::Part for AttachmentDataRef {}
257
258
259/// A button. Can be a text button or an image button.
260///
261/// This type is not used in any activity, and only used as *part* of another schema.
262///
263#[derive(Default, Clone, Debug, Serialize, Deserialize)]
264pub struct Button {
265 /// A button with image and onclick action.
266 #[serde(rename="imageButton")]
267 pub image_button: Option<ImageButton>,
268 /// A button with text and onclick action.
269 #[serde(rename="textButton")]
270 pub text_button: Option<TextButton>,
271}
272
273impl client::Part for Button {}
274
275
276/// A card is a UI element that can contain UI widgets such as texts, images.
277///
278/// This type is not used in any activity, and only used as *part* of another schema.
279///
280#[derive(Default, Clone, Debug, Serialize, Deserialize)]
281pub struct Card {
282 /// The actions of this card.
283 #[serde(rename="cardActions")]
284 pub card_actions: Option<Vec<CardAction>>,
285 /// The header of the card. A header usually contains a title and an image.
286 pub header: Option<CardHeader>,
287 /// Name of the card.
288 pub name: Option<String>,
289 /// Sections are separated by a line divider.
290 pub sections: Option<Vec<Section>>,
291}
292
293impl client::Part for Card {}
294
295
296/// A card action is the action associated with the card. For an invoice card, a typical action would be: delete invoice, email invoice or open the invoice in browser.
297///
298/// This type is not used in any activity, and only used as *part* of another schema.
299///
300#[derive(Default, Clone, Debug, Serialize, Deserialize)]
301pub struct CardAction {
302 /// The label used to be displayed in the action menu item.
303 #[serde(rename="actionLabel")]
304 pub action_label: Option<String>,
305 /// The onclick action for this action item.
306 #[serde(rename="onClick")]
307 pub on_click: Option<OnClick>,
308}
309
310impl client::Part for CardAction {}
311
312
313/// There is no detailed description.
314///
315/// This type is not used in any activity, and only used as *part* of another schema.
316///
317#[derive(Default, Clone, Debug, Serialize, Deserialize)]
318pub struct CardHeader {
319 /// The image's type (e.g. square border or circular border).
320 #[serde(rename="imageStyle")]
321 pub image_style: Option<String>,
322 /// The URL of the image in the card header.
323 #[serde(rename="imageUrl")]
324 pub image_url: Option<String>,
325 /// The subtitle of the card header.
326 pub subtitle: Option<String>,
327 /// The title must be specified. The header has a fixed height: if both a title and subtitle is specified, each will take up 1 line. If only the title is specified, it will take up both lines.
328 pub title: Option<String>,
329}
330
331impl client::Part for CardHeader {}
332
333
334/// A reference to the data of a drive attachment.
335///
336/// This type is not used in any activity, and only used as *part* of another schema.
337///
338#[derive(Default, Clone, Debug, Serialize, Deserialize)]
339pub struct DriveDataRef {
340 /// The id for the drive file, for use with the Drive API.
341 #[serde(rename="driveFileId")]
342 pub drive_file_id: Option<String>,
343}
344
345impl client::Part for DriveDataRef {}
346
347
348/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`.
349///
350/// # Activities
351///
352/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
353/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
354///
355/// * [messages delete spaces](SpaceMessageDeleteCall) (response)
356///
357#[derive(Default, Clone, Debug, Serialize, Deserialize)]
358pub struct Empty { _never_set: Option<bool> }
359
360impl client::ResponseResult for Empty {}
361
362
363/// A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form.
364///
365/// This type is not used in any activity, and only used as *part* of another schema.
366///
367#[derive(Default, Clone, Debug, Serialize, Deserialize)]
368pub struct FormAction {
369 /// The method name is used to identify which part of the form triggered the form submission. This information is echoed back to the bot as part of the card click event. The same method name can be used for several elements that trigger a common behavior if desired.
370 #[serde(rename="actionMethodName")]
371 pub action_method_name: Option<String>,
372 /// List of action parameters.
373 pub parameters: Option<Vec<ActionParameter>>,
374}
375
376impl client::Part for FormAction {}
377
378
379/// An image that is specified by a URL and can have an onclick action.
380///
381/// This type is not used in any activity, and only used as *part* of another schema.
382///
383#[derive(Default, Clone, Debug, Serialize, Deserialize)]
384pub struct Image {
385 /// The aspect ratio of this image (width/height). This field allows clients to reserve the right height for the image while waiting for it to load. It's not meant to override the native aspect ratio of the image. If unset, the server fills it by prefetching the image.
386 #[serde(rename="aspectRatio")]
387 pub aspect_ratio: Option<f64>,
388 /// The URL of the image.
389 #[serde(rename="imageUrl")]
390 pub image_url: Option<String>,
391 /// The onclick action.
392 #[serde(rename="onClick")]
393 pub on_click: Option<OnClick>,
394}
395
396impl client::Part for Image {}
397
398
399/// An image button with an onclick action.
400///
401/// This type is not used in any activity, and only used as *part* of another schema.
402///
403#[derive(Default, Clone, Debug, Serialize, Deserialize)]
404pub struct ImageButton {
405 /// The icon specified by an enum that indices to an icon provided by Chat API.
406 pub icon: Option<String>,
407 /// The icon specified by a URL.
408 #[serde(rename="iconUrl")]
409 pub icon_url: Option<String>,
410 /// The name of this image_button which will be used for accessibility. Default value will be provided if developers don't specify.
411 pub name: Option<String>,
412 /// The onclick action.
413 #[serde(rename="onClick")]
414 pub on_click: Option<OnClick>,
415}
416
417impl client::Part for ImageButton {}
418
419
420/// A UI element contains a key (label) and a value (content). And this element may also contain some actions such as onclick button.
421///
422/// This type is not used in any activity, and only used as *part* of another schema.
423///
424#[derive(Default, Clone, Debug, Serialize, Deserialize)]
425pub struct KeyValue {
426 /// The text of the bottom label. Formatted text supported.
427 #[serde(rename="bottomLabel")]
428 pub bottom_label: Option<String>,
429 /// A button that can be clicked to trigger an action.
430 pub button: Option<Button>,
431 /// The text of the content. Formatted text supported and always required.
432 pub content: Option<String>,
433 /// If the content should be multiline.
434 #[serde(rename="contentMultiline")]
435 pub content_multiline: Option<bool>,
436 /// An enum value that will be replaced by the Chat API with the corresponding icon image.
437 pub icon: Option<String>,
438 /// The icon specified by a URL.
439 #[serde(rename="iconUrl")]
440 pub icon_url: Option<String>,
441 /// The onclick action. Only the top label, bottom label and content region are clickable.
442 #[serde(rename="onClick")]
443 pub on_click: Option<OnClick>,
444 /// The text of the top label. Formatted text supported.
445 #[serde(rename="topLabel")]
446 pub top_label: Option<String>,
447}
448
449impl client::Part for KeyValue {}
450
451
452/// There is no detailed description.
453///
454/// # Activities
455///
456/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
457/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
458///
459/// * [members list spaces](SpaceMemberListCall) (response)
460///
461#[derive(Default, Clone, Debug, Serialize, Deserialize)]
462pub struct ListMembershipsResponse {
463 /// List of memberships in the requested (or first) page.
464 pub memberships: Option<Vec<Membership>>,
465 /// Continuation token to retrieve the next page of results. It will be empty for the last page of results.
466 #[serde(rename="nextPageToken")]
467 pub next_page_token: Option<String>,
468}
469
470impl client::ResponseResult for ListMembershipsResponse {}
471
472
473/// There is no detailed description.
474///
475/// # Activities
476///
477/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
478/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
479///
480/// * [list spaces](SpaceListCall) (response)
481///
482#[derive(Default, Clone, Debug, Serialize, Deserialize)]
483pub struct ListSpacesResponse {
484 /// Continuation token to retrieve the next page of results. It will be empty for the last page of results. Tokens expire in an hour. An error is thrown if an expired token is passed.
485 #[serde(rename="nextPageToken")]
486 pub next_page_token: Option<String>,
487 /// List of spaces in the requested (or first) page.
488 pub spaces: Option<Vec<Space>>,
489}
490
491impl client::ResponseResult for ListSpacesResponse {}
492
493
494/// Media resource.
495///
496/// # Activities
497///
498/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
499/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
500///
501/// * [download media](MediaDownloadCall) (response)
502///
503#[derive(Default, Clone, Debug, Serialize, Deserialize)]
504pub struct Media {
505 /// Name of the media resource.
506 #[serde(rename="resourceName")]
507 pub resource_name: Option<String>,
508}
509
510impl client::ResponseResult for Media {}
511
512
513/// Represents a membership relation in Hangouts Chat.
514///
515/// # Activities
516///
517/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
518/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
519///
520/// * [members get spaces](SpaceMemberGetCall) (response)
521///
522#[derive(Default, Clone, Debug, Serialize, Deserialize)]
523pub struct Membership {
524 /// The creation time of the membership a.k.a the time at which the member joined the space, if applicable.
525 #[serde(rename="createTime")]
526 pub create_time: Option<String>,
527 /// A User in Hangout Chat
528 pub member: Option<User>,
529 /// no description provided
530 pub name: Option<String>,
531 /// State of the membership.
532 pub state: Option<String>,
533}
534
535impl client::ResponseResult for Membership {}
536
537
538/// A message in Hangouts Chat.
539///
540/// # Activities
541///
542/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
543/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
544///
545/// * [conversations messages dms](DmConversationMessageCall) (request|response)
546/// * [messages dms](DmMessageCall) (request|response)
547/// * [webhooks dms](DmWebhookCall) (request|response)
548/// * [conversations messages rooms](RoomConversationMessageCall) (request|response)
549/// * [messages rooms](RoomMessageCall) (request|response)
550/// * [webhooks rooms](RoomWebhookCall) (request|response)
551/// * [messages create spaces](SpaceMessageCreateCall) (request|response)
552/// * [messages get spaces](SpaceMessageGetCall) (response)
553/// * [messages update spaces](SpaceMessageUpdateCall) (request|response)
554/// * [webhooks spaces](SpaceWebhookCall) (request|response)
555///
556#[derive(Default, Clone, Debug, Serialize, Deserialize)]
557pub struct Message {
558 /// Input only. Parameters that a bot can use to configure how its response is posted.
559 #[serde(rename="actionResponse")]
560 pub action_response: Option<ActionResponse>,
561 /// Output only. Annotations associated with the text in this message.
562 pub annotations: Option<Vec<Annotation>>,
563 /// Plain-text body of the message with all bot mentions stripped out.
564 #[serde(rename="argumentText")]
565 pub argument_text: Option<String>,
566 /// User uploaded attachment.
567 pub attachment: Option<Vec<Attachment>>,
568 /// Rich, formatted and interactive cards that can be used to display UI elements such as: formatted texts, buttons, clickable images. Cards are normally displayed below the plain-text body of the message.
569 pub cards: Option<Vec<Card>>,
570 /// Output only. The time at which the message was created in Hangouts Chat server.
571 #[serde(rename="createTime")]
572 pub create_time: Option<String>,
573 /// A plain-text description of the message's cards, used when the actual cards cannot be displayed (e.g. mobile notifications).
574 #[serde(rename="fallbackText")]
575 pub fallback_text: Option<String>,
576 /// no description provided
577 pub name: Option<String>,
578 /// Text for generating preview chips. This text will not be displayed to the user, but any links to images, web pages, videos, etc. included here will generate preview chips.
579 #[serde(rename="previewText")]
580 pub preview_text: Option<String>,
581 /// The user who created the message.
582 pub sender: Option<User>,
583 /// Slash command information, if applicable.
584 #[serde(rename="slashCommand")]
585 pub slash_command: Option<SlashCommand>,
586 /// The space the message belongs to.
587 pub space: Option<Space>,
588 /// Plain-text body of the message.
589 pub text: Option<String>,
590 /// The thread the message belongs to.
591 pub thread: Option<Thread>,
592}
593
594impl client::RequestValue for Message {}
595impl client::ResponseResult for Message {}
596
597
598/// An onclick action (e.g. open a link).
599///
600/// This type is not used in any activity, and only used as *part* of another schema.
601///
602#[derive(Default, Clone, Debug, Serialize, Deserialize)]
603pub struct OnClick {
604 /// A form action will be triggered by this onclick if specified.
605 pub action: Option<FormAction>,
606 /// This onclick triggers an open link action if specified.
607 #[serde(rename="openLink")]
608 pub open_link: Option<OpenLink>,
609}
610
611impl client::Part for OnClick {}
612
613
614/// A link that opens a new window.
615///
616/// This type is not used in any activity, and only used as *part* of another schema.
617///
618#[derive(Default, Clone, Debug, Serialize, Deserialize)]
619pub struct OpenLink {
620 /// The URL to open.
621 pub url: Option<String>,
622}
623
624impl client::Part for OpenLink {}
625
626
627/// A section contains a collection of widgets that are rendered (vertically) in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties (e.g. float).
628///
629/// This type is not used in any activity, and only used as *part* of another schema.
630///
631#[derive(Default, Clone, Debug, Serialize, Deserialize)]
632pub struct Section {
633 /// The header of the section, text formatted supported.
634 pub header: Option<String>,
635 /// A section must contain at least 1 widget.
636 pub widgets: Option<Vec<WidgetMarkup>>,
637}
638
639impl client::Part for Section {}
640
641
642/// A Slash Command in Chat.
643///
644/// This type is not used in any activity, and only used as *part* of another schema.
645///
646#[derive(Default, Clone, Debug, Serialize, Deserialize)]
647pub struct SlashCommand {
648 /// The id of the slash command invoked.
649 #[serde(rename="commandId")]
650 pub command_id: Option<String>,
651}
652
653impl client::Part for SlashCommand {}
654
655
656/// Annotation metadata for slash commands (/).
657///
658/// This type is not used in any activity, and only used as *part* of another schema.
659///
660#[derive(Default, Clone, Debug, Serialize, Deserialize)]
661pub struct SlashCommandMetadata {
662 /// The bot whose command was invoked.
663 pub bot: Option<User>,
664 /// The command id of the invoked slash command.
665 #[serde(rename="commandId")]
666 pub command_id: Option<String>,
667 /// The name of the invoked slash command.
668 #[serde(rename="commandName")]
669 pub command_name: Option<String>,
670 /// Indicating whether the slash command is for a dialog.
671 #[serde(rename="triggersDialog")]
672 pub triggers_dialog: Option<bool>,
673 /// The type of slash command.
674 #[serde(rename="type")]
675 pub type_: Option<String>,
676}
677
678impl client::Part for SlashCommandMetadata {}
679
680
681/// A room or DM in Hangouts Chat.
682///
683/// # Activities
684///
685/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
686/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
687///
688/// * [members get spaces](SpaceMemberGetCall) (none)
689/// * [members list spaces](SpaceMemberListCall) (none)
690/// * [messages attachments get spaces](SpaceMessageAttachmentGetCall) (none)
691/// * [messages create spaces](SpaceMessageCreateCall) (none)
692/// * [messages delete spaces](SpaceMessageDeleteCall) (none)
693/// * [messages get spaces](SpaceMessageGetCall) (none)
694/// * [messages update spaces](SpaceMessageUpdateCall) (none)
695/// * [get spaces](SpaceGetCall) (response)
696/// * [list spaces](SpaceListCall) (none)
697/// * [webhooks spaces](SpaceWebhookCall) (none)
698///
699#[derive(Default, Clone, Debug, Serialize, Deserialize)]
700pub struct Space {
701 /// Output only. The display name (only if the space is a room). Please note that this field might not be populated in direct messages between humans.
702 #[serde(rename="displayName")]
703 pub display_name: Option<String>,
704 /// Resource name of the space, in the form "spaces/*". Example: spaces/AAAAMpdlehYs
705 pub name: Option<String>,
706 /// Whether the space is a DM between a bot and a single human.
707 #[serde(rename="singleUserBotDm")]
708 pub single_user_bot_dm: Option<bool>,
709 /// Whether the messages are threaded in this space.
710 pub threaded: Option<bool>,
711 /// Output only. The type of a space. This is deprecated. Use `single_user_bot_dm` instead.
712 #[serde(rename="type")]
713 pub type_: Option<String>,
714}
715
716impl client::Resource for Space {}
717impl client::ResponseResult for Space {}
718
719
720/// A button with text and onclick action.
721///
722/// This type is not used in any activity, and only used as *part* of another schema.
723///
724#[derive(Default, Clone, Debug, Serialize, Deserialize)]
725pub struct TextButton {
726 /// The onclick action of the button.
727 #[serde(rename="onClick")]
728 pub on_click: Option<OnClick>,
729 /// The text of the button.
730 pub text: Option<String>,
731}
732
733impl client::Part for TextButton {}
734
735
736/// A paragraph of text. Formatted text supported.
737///
738/// This type is not used in any activity, and only used as *part* of another schema.
739///
740#[derive(Default, Clone, Debug, Serialize, Deserialize)]
741pub struct TextParagraph {
742 /// no description provided
743 pub text: Option<String>,
744}
745
746impl client::Part for TextParagraph {}
747
748
749/// A thread in Hangouts Chat.
750///
751/// This type is not used in any activity, and only used as *part* of another schema.
752///
753#[derive(Default, Clone, Debug, Serialize, Deserialize)]
754pub struct Thread {
755 /// Resource name, in the form "spaces/*/threads/*". Example: spaces/AAAAMpdlehY/threads/UMxbHmzDlr4
756 pub name: Option<String>,
757}
758
759impl client::Part for Thread {}
760
761
762/// A user in Google Chat.
763///
764/// This type is not used in any activity, and only used as *part* of another schema.
765///
766#[derive(Default, Clone, Debug, Serialize, Deserialize)]
767pub struct User {
768 /// The user's display name.
769 #[serde(rename="displayName")]
770 pub display_name: Option<String>,
771 /// Obfuscated domain information.
772 #[serde(rename="domainId")]
773 pub domain_id: Option<String>,
774 /// True when the user is deleted or the user's profile is not visible.
775 #[serde(rename="isAnonymous")]
776 pub is_anonymous: Option<bool>,
777 /// Resource name, in the format "users/*".
778 pub name: Option<String>,
779 /// User type.
780 #[serde(rename="type")]
781 pub type_: Option<String>,
782}
783
784impl client::Part for User {}
785
786
787/// Annotation metadata for user mentions (@).
788///
789/// This type is not used in any activity, and only used as *part* of another schema.
790///
791#[derive(Default, Clone, Debug, Serialize, Deserialize)]
792pub struct UserMentionMetadata {
793 /// The type of user mention.
794 #[serde(rename="type")]
795 pub type_: Option<String>,
796 /// The user mentioned.
797 pub user: Option<User>,
798}
799
800impl client::Part for UserMentionMetadata {}
801
802
803/// A widget is a UI element that presents texts, images, etc.
804///
805/// This type is not used in any activity, and only used as *part* of another schema.
806///
807#[derive(Default, Clone, Debug, Serialize, Deserialize)]
808pub struct WidgetMarkup {
809 /// A list of buttons. Buttons is also oneof data and only one of these fields should be set.
810 pub buttons: Option<Vec<Button>>,
811 /// Display an image in this widget.
812 pub image: Option<Image>,
813 /// Display a key value item in this widget.
814 #[serde(rename="keyValue")]
815 pub key_value: Option<KeyValue>,
816 /// Display a text paragraph in this widget.
817 #[serde(rename="textParagraph")]
818 pub text_paragraph: Option<TextParagraph>,
819}
820
821impl client::Part for WidgetMarkup {}
822
823
824
825// ###################
826// MethodBuilders ###
827// #################
828
829/// A builder providing access to all methods supported on *dm* resources.
830/// It is not used directly, but through the `HangoutsChat` hub.
831///
832/// # Example
833///
834/// Instantiate a resource builder
835///
836/// ```test_harness,no_run
837/// extern crate hyper;
838/// extern crate hyper_rustls;
839/// extern crate yup_oauth2 as oauth2;
840/// extern crate google_chat1 as chat1;
841///
842/// # async fn dox() {
843/// use std::default::Default;
844/// use oauth2;
845/// use chat1::HangoutsChat;
846///
847/// let secret: oauth2::ApplicationSecret = Default::default();
848/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
849/// secret,
850/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
851/// ).build().await.unwrap();
852/// let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
853/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
854/// // like `conversations_messages(...)`, `messages(...)` and `webhooks(...)`
855/// // to build up your call.
856/// let rb = hub.dms();
857/// # }
858/// ```
859pub struct DmMethods<'a>
860 where {
861
862 hub: &'a HangoutsChat<>,
863}
864
865impl<'a> client::MethodsBuilder for DmMethods<'a> {}
866
867impl<'a> DmMethods<'a> {
868
869 /// Create a builder to help you perform the following task:
870 ///
871 /// Legacy path for creating message. Calling these will result in a BadRequest response.
872 ///
873 /// # Arguments
874 ///
875 /// * `request` - No description provided.
876 /// * `parent` - Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
877 pub fn conversations_messages(&self, request: Message, parent: &str) -> DmConversationMessageCall<'a> {
878 DmConversationMessageCall {
879 hub: self.hub,
880 _request: request,
881 _parent: parent.to_string(),
882 _thread_key: Default::default(),
883 _delegate: Default::default(),
884 _additional_params: Default::default(),
885 }
886 }
887
888 /// Create a builder to help you perform the following task:
889 ///
890 /// Legacy path for creating message. Calling these will result in a BadRequest response.
891 ///
892 /// # Arguments
893 ///
894 /// * `request` - No description provided.
895 /// * `parent` - Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
896 pub fn messages(&self, request: Message, parent: &str) -> DmMessageCall<'a> {
897 DmMessageCall {
898 hub: self.hub,
899 _request: request,
900 _parent: parent.to_string(),
901 _thread_key: Default::default(),
902 _delegate: Default::default(),
903 _additional_params: Default::default(),
904 }
905 }
906
907 /// Create a builder to help you perform the following task:
908 ///
909 /// Legacy path for creating message. Calling these will result in a BadRequest response.
910 ///
911 /// # Arguments
912 ///
913 /// * `request` - No description provided.
914 /// * `parent` - Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
915 pub fn webhooks(&self, request: Message, parent: &str) -> DmWebhookCall<'a> {
916 DmWebhookCall {
917 hub: self.hub,
918 _request: request,
919 _parent: parent.to_string(),
920 _thread_key: Default::default(),
921 _delegate: Default::default(),
922 _additional_params: Default::default(),
923 }
924 }
925}
926
927
928
929/// A builder providing access to all methods supported on *media* resources.
930/// It is not used directly, but through the `HangoutsChat` hub.
931///
932/// # Example
933///
934/// Instantiate a resource builder
935///
936/// ```test_harness,no_run
937/// extern crate hyper;
938/// extern crate hyper_rustls;
939/// extern crate yup_oauth2 as oauth2;
940/// extern crate google_chat1 as chat1;
941///
942/// # async fn dox() {
943/// use std::default::Default;
944/// use oauth2;
945/// use chat1::HangoutsChat;
946///
947/// let secret: oauth2::ApplicationSecret = Default::default();
948/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
949/// secret,
950/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
951/// ).build().await.unwrap();
952/// let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
953/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
954/// // like `download(...)`
955/// // to build up your call.
956/// let rb = hub.media();
957/// # }
958/// ```
959pub struct MediaMethods<'a>
960 where {
961
962 hub: &'a HangoutsChat<>,
963}
964
965impl<'a> client::MethodsBuilder for MediaMethods<'a> {}
966
967impl<'a> MediaMethods<'a> {
968
969 /// Create a builder to help you perform the following task:
970 ///
971 /// Downloads media. Download is supported on the URI `/v1/media/{+name}?alt=media`.
972 ///
973 /// # Arguments
974 ///
975 /// * `resourceName` - Name of the media that is being downloaded. See ReadRequest.resource_name.
976 pub fn download(&self, resource_name: &str) -> MediaDownloadCall<'a> {
977 MediaDownloadCall {
978 hub: self.hub,
979 _resource_name: resource_name.to_string(),
980 _delegate: Default::default(),
981 _additional_params: Default::default(),
982 }
983 }
984}
985
986
987
988/// A builder providing access to all methods supported on *room* resources.
989/// It is not used directly, but through the `HangoutsChat` hub.
990///
991/// # Example
992///
993/// Instantiate a resource builder
994///
995/// ```test_harness,no_run
996/// extern crate hyper;
997/// extern crate hyper_rustls;
998/// extern crate yup_oauth2 as oauth2;
999/// extern crate google_chat1 as chat1;
1000///
1001/// # async fn dox() {
1002/// use std::default::Default;
1003/// use oauth2;
1004/// use chat1::HangoutsChat;
1005///
1006/// let secret: oauth2::ApplicationSecret = Default::default();
1007/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1008/// secret,
1009/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1010/// ).build().await.unwrap();
1011/// let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
1012/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1013/// // like `conversations_messages(...)`, `messages(...)` and `webhooks(...)`
1014/// // to build up your call.
1015/// let rb = hub.rooms();
1016/// # }
1017/// ```
1018pub struct RoomMethods<'a>
1019 where {
1020
1021 hub: &'a HangoutsChat<>,
1022}
1023
1024impl<'a> client::MethodsBuilder for RoomMethods<'a> {}
1025
1026impl<'a> RoomMethods<'a> {
1027
1028 /// Create a builder to help you perform the following task:
1029 ///
1030 /// Legacy path for creating message. Calling these will result in a BadRequest response.
1031 ///
1032 /// # Arguments
1033 ///
1034 /// * `request` - No description provided.
1035 /// * `parent` - Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
1036 pub fn conversations_messages(&self, request: Message, parent: &str) -> RoomConversationMessageCall<'a> {
1037 RoomConversationMessageCall {
1038 hub: self.hub,
1039 _request: request,
1040 _parent: parent.to_string(),
1041 _thread_key: Default::default(),
1042 _delegate: Default::default(),
1043 _additional_params: Default::default(),
1044 }
1045 }
1046
1047 /// Create a builder to help you perform the following task:
1048 ///
1049 /// Legacy path for creating message. Calling these will result in a BadRequest response.
1050 ///
1051 /// # Arguments
1052 ///
1053 /// * `request` - No description provided.
1054 /// * `parent` - Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
1055 pub fn messages(&self, request: Message, parent: &str) -> RoomMessageCall<'a> {
1056 RoomMessageCall {
1057 hub: self.hub,
1058 _request: request,
1059 _parent: parent.to_string(),
1060 _thread_key: Default::default(),
1061 _delegate: Default::default(),
1062 _additional_params: Default::default(),
1063 }
1064 }
1065
1066 /// Create a builder to help you perform the following task:
1067 ///
1068 /// Legacy path for creating message. Calling these will result in a BadRequest response.
1069 ///
1070 /// # Arguments
1071 ///
1072 /// * `request` - No description provided.
1073 /// * `parent` - Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
1074 pub fn webhooks(&self, request: Message, parent: &str) -> RoomWebhookCall<'a> {
1075 RoomWebhookCall {
1076 hub: self.hub,
1077 _request: request,
1078 _parent: parent.to_string(),
1079 _thread_key: Default::default(),
1080 _delegate: Default::default(),
1081 _additional_params: Default::default(),
1082 }
1083 }
1084}
1085
1086
1087
1088/// A builder providing access to all methods supported on *space* resources.
1089/// It is not used directly, but through the `HangoutsChat` hub.
1090///
1091/// # Example
1092///
1093/// Instantiate a resource builder
1094///
1095/// ```test_harness,no_run
1096/// extern crate hyper;
1097/// extern crate hyper_rustls;
1098/// extern crate yup_oauth2 as oauth2;
1099/// extern crate google_chat1 as chat1;
1100///
1101/// # async fn dox() {
1102/// use std::default::Default;
1103/// use oauth2;
1104/// use chat1::HangoutsChat;
1105///
1106/// let secret: oauth2::ApplicationSecret = Default::default();
1107/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1108/// secret,
1109/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1110/// ).build().await.unwrap();
1111/// let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
1112/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1113/// // like `get(...)`, `list(...)`, `members_get(...)`, `members_list(...)`, `messages_attachments_get(...)`, `messages_create(...)`, `messages_delete(...)`, `messages_get(...)`, `messages_update(...)` and `webhooks(...)`
1114/// // to build up your call.
1115/// let rb = hub.spaces();
1116/// # }
1117/// ```
1118pub struct SpaceMethods<'a>
1119 where {
1120
1121 hub: &'a HangoutsChat<>,
1122}
1123
1124impl<'a> client::MethodsBuilder for SpaceMethods<'a> {}
1125
1126impl<'a> SpaceMethods<'a> {
1127
1128 /// Create a builder to help you perform the following task:
1129 ///
1130 /// Returns a membership.
1131 ///
1132 /// # Arguments
1133 ///
1134 /// * `name` - Required. Resource name of the membership to be retrieved, in the form "spaces/*/members/*". Example: spaces/AAAAMpdlehY/members/105115627578887013105
1135 pub fn members_get(&self, name: &str) -> SpaceMemberGetCall<'a> {
1136 SpaceMemberGetCall {
1137 hub: self.hub,
1138 _name: name.to_string(),
1139 _delegate: Default::default(),
1140 _additional_params: Default::default(),
1141 }
1142 }
1143
1144 /// Create a builder to help you perform the following task:
1145 ///
1146 /// Lists human memberships in a space.
1147 ///
1148 /// # Arguments
1149 ///
1150 /// * `parent` - Required. The resource name of the space for which membership list is to be fetched, in the form "spaces/*". Example: spaces/AAAAMpdlehY
1151 pub fn members_list(&self, parent: &str) -> SpaceMemberListCall<'a> {
1152 SpaceMemberListCall {
1153 hub: self.hub,
1154 _parent: parent.to_string(),
1155 _page_token: Default::default(),
1156 _page_size: Default::default(),
1157 _delegate: Default::default(),
1158 _additional_params: Default::default(),
1159 }
1160 }
1161
1162 /// Create a builder to help you perform the following task:
1163 ///
1164 /// Gets the metadata of a message attachment. The attachment data is fetched using the media API.
1165 ///
1166 /// # Arguments
1167 ///
1168 /// * `name` - Resource name of the attachment, in the form "spaces/*/messages/*/attachments/*".
1169 pub fn messages_attachments_get(&self, name: &str) -> SpaceMessageAttachmentGetCall<'a> {
1170 SpaceMessageAttachmentGetCall {
1171 hub: self.hub,
1172 _name: name.to_string(),
1173 _delegate: Default::default(),
1174 _additional_params: Default::default(),
1175 }
1176 }
1177
1178 /// Create a builder to help you perform the following task:
1179 ///
1180 /// Creates a message.
1181 ///
1182 /// # Arguments
1183 ///
1184 /// * `request` - No description provided.
1185 /// * `parent` - Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
1186 pub fn messages_create(&self, request: Message, parent: &str) -> SpaceMessageCreateCall<'a> {
1187 SpaceMessageCreateCall {
1188 hub: self.hub,
1189 _request: request,
1190 _parent: parent.to_string(),
1191 _thread_key: Default::default(),
1192 _delegate: Default::default(),
1193 _additional_params: Default::default(),
1194 }
1195 }
1196
1197 /// Create a builder to help you perform the following task:
1198 ///
1199 /// Deletes a message.
1200 ///
1201 /// # Arguments
1202 ///
1203 /// * `name` - Required. Resource name of the message to be deleted, in the form "spaces/*/messages/*" Example: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4
1204 pub fn messages_delete(&self, name: &str) -> SpaceMessageDeleteCall<'a> {
1205 SpaceMessageDeleteCall {
1206 hub: self.hub,
1207 _name: name.to_string(),
1208 _delegate: Default::default(),
1209 _additional_params: Default::default(),
1210 }
1211 }
1212
1213 /// Create a builder to help you perform the following task:
1214 ///
1215 /// Returns a message.
1216 ///
1217 /// # Arguments
1218 ///
1219 /// * `name` - Required. Resource name of the message to be retrieved, in the form "spaces/*/messages/*". Example: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4
1220 pub fn messages_get(&self, name: &str) -> SpaceMessageGetCall<'a> {
1221 SpaceMessageGetCall {
1222 hub: self.hub,
1223 _name: name.to_string(),
1224 _delegate: Default::default(),
1225 _additional_params: Default::default(),
1226 }
1227 }
1228
1229 /// Create a builder to help you perform the following task:
1230 ///
1231 /// Updates a message.
1232 ///
1233 /// # Arguments
1234 ///
1235 /// * `request` - No description provided.
1236 /// * `name` - No description provided.
1237 pub fn messages_update(&self, request: Message, name: &str) -> SpaceMessageUpdateCall<'a> {
1238 SpaceMessageUpdateCall {
1239 hub: self.hub,
1240 _request: request,
1241 _name: name.to_string(),
1242 _update_mask: Default::default(),
1243 _delegate: Default::default(),
1244 _additional_params: Default::default(),
1245 }
1246 }
1247
1248 /// Create a builder to help you perform the following task:
1249 ///
1250 /// Returns a space.
1251 ///
1252 /// # Arguments
1253 ///
1254 /// * `name` - Required. Resource name of the space, in the form "spaces/*". Example: spaces/AAAAMpdlehY
1255 pub fn get(&self, name: &str) -> SpaceGetCall<'a> {
1256 SpaceGetCall {
1257 hub: self.hub,
1258 _name: name.to_string(),
1259 _delegate: Default::default(),
1260 _additional_params: Default::default(),
1261 }
1262 }
1263
1264 /// Create a builder to help you perform the following task:
1265 ///
1266 /// Lists spaces the caller is a member of.
1267 pub fn list(&self) -> SpaceListCall<'a> {
1268 SpaceListCall {
1269 hub: self.hub,
1270 _page_token: Default::default(),
1271 _page_size: Default::default(),
1272 _delegate: Default::default(),
1273 _additional_params: Default::default(),
1274 }
1275 }
1276
1277 /// Create a builder to help you perform the following task:
1278 ///
1279 /// Legacy path for creating message. Calling these will result in a BadRequest response.
1280 ///
1281 /// # Arguments
1282 ///
1283 /// * `request` - No description provided.
1284 /// * `parent` - Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
1285 pub fn webhooks(&self, request: Message, parent: &str) -> SpaceWebhookCall<'a> {
1286 SpaceWebhookCall {
1287 hub: self.hub,
1288 _request: request,
1289 _parent: parent.to_string(),
1290 _thread_key: Default::default(),
1291 _delegate: Default::default(),
1292 _additional_params: Default::default(),
1293 }
1294 }
1295}
1296
1297
1298
1299
1300
1301// ###################
1302// CallBuilders ###
1303// #################
1304
1305/// Legacy path for creating message. Calling these will result in a BadRequest response.
1306///
1307/// A builder for the *conversations.messages* method supported by a *dm* resource.
1308/// It is not used directly, but through a `DmMethods` instance.
1309///
1310/// # Example
1311///
1312/// Instantiate a resource method builder
1313///
1314/// ```test_harness,no_run
1315/// # extern crate hyper;
1316/// # extern crate hyper_rustls;
1317/// # extern crate yup_oauth2 as oauth2;
1318/// # extern crate google_chat1 as chat1;
1319/// use chat1::api::Message;
1320/// # async fn dox() {
1321/// # use std::default::Default;
1322/// # use oauth2;
1323/// # use chat1::HangoutsChat;
1324///
1325/// # let secret: oauth2::ApplicationSecret = Default::default();
1326/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1327/// # secret,
1328/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1329/// # ).build().await.unwrap();
1330/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
1331/// // As the method needs a request, you would usually fill it with the desired information
1332/// // into the respective structure. Some of the parts shown here might not be applicable !
1333/// // Values shown here are possibly random and not representative !
1334/// let mut req = Message::default();
1335///
1336/// // You can configure optional parameters by calling the respective setters at will, and
1337/// // execute the final call using `doit()`.
1338/// // Values shown here are possibly random and not representative !
1339/// let result = hub.dms().conversations_messages(req, "parent")
1340/// .thread_key("sed")
1341/// .doit().await;
1342/// # }
1343/// ```
1344pub struct DmConversationMessageCall<'a>
1345 where {
1346
1347 hub: &'a HangoutsChat<>,
1348 _request: Message,
1349 _parent: String,
1350 _thread_key: Option<String>,
1351 _delegate: Option<&'a mut dyn client::Delegate>,
1352 _additional_params: HashMap<String, String>,
1353}
1354
1355impl<'a> client::CallBuilder for DmConversationMessageCall<'a> {}
1356
1357impl<'a> DmConversationMessageCall<'a> {
1358
1359
1360 /// Perform the operation you have build so far.
1361 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Message)> {
1362 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
1363 use std::io::{Read, Seek};
1364 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
1365 use client::ToParts;
1366 let mut dd = client::DefaultDelegate;
1367 let mut dlg: &mut dyn client::Delegate = match self._delegate {
1368 Some(d) => d,
1369 None => &mut dd
1370 };
1371 dlg.begin(client::MethodInfo { id: "chat.dms.conversations.messages",
1372 http_method: hyper::Method::POST });
1373 let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
1374 params.push(("parent", self._parent.to_string()));
1375 if let Some(value) = self._thread_key {
1376 params.push(("threadKey", value.to_string()));
1377 }
1378 for &field in ["alt", "parent", "threadKey"].iter() {
1379 if self._additional_params.contains_key(field) {
1380 dlg.finished(false);
1381 return Err(client::Error::FieldClash(field));
1382 }
1383 }
1384 for (name, value) in self._additional_params.iter() {
1385 params.push((&name, value.clone()));
1386 }
1387
1388 params.push(("alt", "json".to_string()));
1389
1390 let mut url = self.hub._base_url.clone() + "v1/{+parent}/messages";
1391
1392 let key = dlg.api_key();
1393 match key {
1394 Some(value) => params.push(("key", value)),
1395 None => {
1396 dlg.finished(false);
1397 return Err(client::Error::MissingAPIKey)
1398 }
1399 }
1400
1401 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1402 let mut replace_with = String::new();
1403 for &(name, ref value) in params.iter() {
1404 if name == param_name {
1405 replace_with = value.to_string();
1406 break;
1407 }
1408 }
1409 if find_this.as_bytes()[1] == '+' as u8 {
1410 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
1411 }
1412 url = url.replace(find_this, &replace_with);
1413 }
1414 {
1415 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
1416 for param_name in ["parent"].iter() {
1417 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
1418 indices_for_removal.push(index);
1419 }
1420 }
1421 for &index in indices_for_removal.iter() {
1422 params.remove(index);
1423 }
1424 }
1425
1426 let url = url::Url::parse_with_params(&url, params).unwrap();
1427
1428 let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
1429 let mut request_value_reader =
1430 {
1431 let mut value = json::value::to_value(&self._request).expect("serde to work");
1432 client::remove_json_null_values(&mut value);
1433 let mut dst = io::Cursor::new(Vec::with_capacity(128));
1434 json::to_writer(&mut dst, &value).unwrap();
1435 dst
1436 };
1437 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
1438 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
1439
1440
1441 loop {
1442 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
1443 let mut req_result = {
1444 let client = &self.hub.client;
1445 dlg.pre_request();
1446 let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string())
1447 .header(USER_AGENT, self.hub._user_agent.clone());
1448
1449
1450 let request = req_builder
1451 .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
1452 .header(CONTENT_LENGTH, request_size as u64)
1453 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
1454
1455 client.request(request.unwrap()).await
1456
1457 };
1458
1459 match req_result {
1460 Err(err) => {
1461 if let client::Retry::After(d) = dlg.http_error(&err) {
1462 sleep(d);
1463 continue;
1464 }
1465 dlg.finished(false);
1466 return Err(client::Error::HttpError(err))
1467 }
1468 Ok(mut res) => {
1469 if !res.status().is_success() {
1470 let res_body_string = client::get_body_as_string(res.body_mut()).await;
1471
1472 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
1473 let server_error = json::from_str::<client::ServerError>(&res_body_string)
1474 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
1475 .ok();
1476
1477 if let client::Retry::After(d) = dlg.http_failure(&res,
1478 json_server_error,
1479 server_error) {
1480 sleep(d);
1481 continue;
1482 }
1483 dlg.finished(false);
1484 return match json::from_str::<client::ErrorResponse>(&res_body_string){
1485 Err(_) => Err(client::Error::Failure(res)),
1486 Ok(serr) => Err(client::Error::BadRequest(serr))
1487 }
1488 }
1489 let result_value = {
1490 let res_body_string = client::get_body_as_string(res.body_mut()).await;
1491
1492 match json::from_str(&res_body_string) {
1493 Ok(decoded) => (res, decoded),
1494 Err(err) => {
1495 dlg.response_json_decode_error(&res_body_string, &err);
1496 return Err(client::Error::JsonDecodeError(res_body_string, err));
1497 }
1498 }
1499 };
1500
1501 dlg.finished(true);
1502 return Ok(result_value)
1503 }
1504 }
1505 }
1506 }
1507
1508
1509 ///
1510 /// Sets the *request* property to the given value.
1511 ///
1512 /// Even though the property as already been set when instantiating this call,
1513 /// we provide this method for API completeness.
1514 pub fn request(mut self, new_value: Message) -> DmConversationMessageCall<'a> {
1515 self._request = new_value;
1516 self
1517 }
1518 /// Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
1519 ///
1520 /// Sets the *parent* path property to the given value.
1521 ///
1522 /// Even though the property as already been set when instantiating this call,
1523 /// we provide this method for API completeness.
1524 pub fn parent(mut self, new_value: &str) -> DmConversationMessageCall<'a> {
1525 self._parent = new_value.to_string();
1526 self
1527 }
1528 /// Opaque thread identifier string that can be specified to group messages into a single thread. If this is the first message with a given thread identifier, a new thread is created. Subsequent messages with the same thread identifier will be posted into the same thread. This relieves bots and webhooks from having to store the Hangouts Chat thread ID of a thread (created earlier by them) to post further updates to it. Has no effect if thread field, corresponding to an existing thread, is set in message.
1529 ///
1530 /// Sets the *thread key* query property to the given value.
1531 pub fn thread_key(mut self, new_value: &str) -> DmConversationMessageCall<'a> {
1532 self._thread_key = Some(new_value.to_string());
1533 self
1534 }
1535 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1536 /// while executing the actual API request.
1537 ///
1538 /// It should be used to handle progress information, and to implement a certain level of resilience.
1539 ///
1540 /// Sets the *delegate* property to the given value.
1541 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> DmConversationMessageCall<'a> {
1542 self._delegate = Some(new_value);
1543 self
1544 }
1545
1546 /// Set any additional parameter of the query string used in the request.
1547 /// It should be used to set parameters which are not yet available through their own
1548 /// setters.
1549 ///
1550 /// Please note that this method must not be used to set any of the known parameters
1551 /// which have their own setter method. If done anyway, the request will fail.
1552 ///
1553 /// # Additional Parameters
1554 ///
1555 /// * *$.xgafv* (query-string) - V1 error format.
1556 /// * *access_token* (query-string) - OAuth access token.
1557 /// * *alt* (query-string) - Data format for response.
1558 /// * *callback* (query-string) - JSONP
1559 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1560 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1561 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1562 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1563 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1564 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1565 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1566 pub fn param<T>(mut self, name: T, value: T) -> DmConversationMessageCall<'a>
1567 where T: AsRef<str> {
1568 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
1569 self
1570 }
1571
1572}
1573
1574
1575/// Legacy path for creating message. Calling these will result in a BadRequest response.
1576///
1577/// A builder for the *messages* method supported by a *dm* resource.
1578/// It is not used directly, but through a `DmMethods` instance.
1579///
1580/// # Example
1581///
1582/// Instantiate a resource method builder
1583///
1584/// ```test_harness,no_run
1585/// # extern crate hyper;
1586/// # extern crate hyper_rustls;
1587/// # extern crate yup_oauth2 as oauth2;
1588/// # extern crate google_chat1 as chat1;
1589/// use chat1::api::Message;
1590/// # async fn dox() {
1591/// # use std::default::Default;
1592/// # use oauth2;
1593/// # use chat1::HangoutsChat;
1594///
1595/// # let secret: oauth2::ApplicationSecret = Default::default();
1596/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1597/// # secret,
1598/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1599/// # ).build().await.unwrap();
1600/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
1601/// // As the method needs a request, you would usually fill it with the desired information
1602/// // into the respective structure. Some of the parts shown here might not be applicable !
1603/// // Values shown here are possibly random and not representative !
1604/// let mut req = Message::default();
1605///
1606/// // You can configure optional parameters by calling the respective setters at will, and
1607/// // execute the final call using `doit()`.
1608/// // Values shown here are possibly random and not representative !
1609/// let result = hub.dms().messages(req, "parent")
1610/// .thread_key("takimata")
1611/// .doit().await;
1612/// # }
1613/// ```
1614pub struct DmMessageCall<'a>
1615 where {
1616
1617 hub: &'a HangoutsChat<>,
1618 _request: Message,
1619 _parent: String,
1620 _thread_key: Option<String>,
1621 _delegate: Option<&'a mut dyn client::Delegate>,
1622 _additional_params: HashMap<String, String>,
1623}
1624
1625impl<'a> client::CallBuilder for DmMessageCall<'a> {}
1626
1627impl<'a> DmMessageCall<'a> {
1628
1629
1630 /// Perform the operation you have build so far.
1631 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Message)> {
1632 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
1633 use std::io::{Read, Seek};
1634 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
1635 use client::ToParts;
1636 let mut dd = client::DefaultDelegate;
1637 let mut dlg: &mut dyn client::Delegate = match self._delegate {
1638 Some(d) => d,
1639 None => &mut dd
1640 };
1641 dlg.begin(client::MethodInfo { id: "chat.dms.messages",
1642 http_method: hyper::Method::POST });
1643 let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
1644 params.push(("parent", self._parent.to_string()));
1645 if let Some(value) = self._thread_key {
1646 params.push(("threadKey", value.to_string()));
1647 }
1648 for &field in ["alt", "parent", "threadKey"].iter() {
1649 if self._additional_params.contains_key(field) {
1650 dlg.finished(false);
1651 return Err(client::Error::FieldClash(field));
1652 }
1653 }
1654 for (name, value) in self._additional_params.iter() {
1655 params.push((&name, value.clone()));
1656 }
1657
1658 params.push(("alt", "json".to_string()));
1659
1660 let mut url = self.hub._base_url.clone() + "v1/{+parent}/messages";
1661
1662 let key = dlg.api_key();
1663 match key {
1664 Some(value) => params.push(("key", value)),
1665 None => {
1666 dlg.finished(false);
1667 return Err(client::Error::MissingAPIKey)
1668 }
1669 }
1670
1671 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1672 let mut replace_with = String::new();
1673 for &(name, ref value) in params.iter() {
1674 if name == param_name {
1675 replace_with = value.to_string();
1676 break;
1677 }
1678 }
1679 if find_this.as_bytes()[1] == '+' as u8 {
1680 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
1681 }
1682 url = url.replace(find_this, &replace_with);
1683 }
1684 {
1685 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
1686 for param_name in ["parent"].iter() {
1687 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
1688 indices_for_removal.push(index);
1689 }
1690 }
1691 for &index in indices_for_removal.iter() {
1692 params.remove(index);
1693 }
1694 }
1695
1696 let url = url::Url::parse_with_params(&url, params).unwrap();
1697
1698 let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
1699 let mut request_value_reader =
1700 {
1701 let mut value = json::value::to_value(&self._request).expect("serde to work");
1702 client::remove_json_null_values(&mut value);
1703 let mut dst = io::Cursor::new(Vec::with_capacity(128));
1704 json::to_writer(&mut dst, &value).unwrap();
1705 dst
1706 };
1707 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
1708 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
1709
1710
1711 loop {
1712 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
1713 let mut req_result = {
1714 let client = &self.hub.client;
1715 dlg.pre_request();
1716 let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string())
1717 .header(USER_AGENT, self.hub._user_agent.clone());
1718
1719
1720 let request = req_builder
1721 .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
1722 .header(CONTENT_LENGTH, request_size as u64)
1723 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
1724
1725 client.request(request.unwrap()).await
1726
1727 };
1728
1729 match req_result {
1730 Err(err) => {
1731 if let client::Retry::After(d) = dlg.http_error(&err) {
1732 sleep(d);
1733 continue;
1734 }
1735 dlg.finished(false);
1736 return Err(client::Error::HttpError(err))
1737 }
1738 Ok(mut res) => {
1739 if !res.status().is_success() {
1740 let res_body_string = client::get_body_as_string(res.body_mut()).await;
1741
1742 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
1743 let server_error = json::from_str::<client::ServerError>(&res_body_string)
1744 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
1745 .ok();
1746
1747 if let client::Retry::After(d) = dlg.http_failure(&res,
1748 json_server_error,
1749 server_error) {
1750 sleep(d);
1751 continue;
1752 }
1753 dlg.finished(false);
1754 return match json::from_str::<client::ErrorResponse>(&res_body_string){
1755 Err(_) => Err(client::Error::Failure(res)),
1756 Ok(serr) => Err(client::Error::BadRequest(serr))
1757 }
1758 }
1759 let result_value = {
1760 let res_body_string = client::get_body_as_string(res.body_mut()).await;
1761
1762 match json::from_str(&res_body_string) {
1763 Ok(decoded) => (res, decoded),
1764 Err(err) => {
1765 dlg.response_json_decode_error(&res_body_string, &err);
1766 return Err(client::Error::JsonDecodeError(res_body_string, err));
1767 }
1768 }
1769 };
1770
1771 dlg.finished(true);
1772 return Ok(result_value)
1773 }
1774 }
1775 }
1776 }
1777
1778
1779 ///
1780 /// Sets the *request* property to the given value.
1781 ///
1782 /// Even though the property as already been set when instantiating this call,
1783 /// we provide this method for API completeness.
1784 pub fn request(mut self, new_value: Message) -> DmMessageCall<'a> {
1785 self._request = new_value;
1786 self
1787 }
1788 /// Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
1789 ///
1790 /// Sets the *parent* path property to the given value.
1791 ///
1792 /// Even though the property as already been set when instantiating this call,
1793 /// we provide this method for API completeness.
1794 pub fn parent(mut self, new_value: &str) -> DmMessageCall<'a> {
1795 self._parent = new_value.to_string();
1796 self
1797 }
1798 /// Opaque thread identifier string that can be specified to group messages into a single thread. If this is the first message with a given thread identifier, a new thread is created. Subsequent messages with the same thread identifier will be posted into the same thread. This relieves bots and webhooks from having to store the Hangouts Chat thread ID of a thread (created earlier by them) to post further updates to it. Has no effect if thread field, corresponding to an existing thread, is set in message.
1799 ///
1800 /// Sets the *thread key* query property to the given value.
1801 pub fn thread_key(mut self, new_value: &str) -> DmMessageCall<'a> {
1802 self._thread_key = Some(new_value.to_string());
1803 self
1804 }
1805 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1806 /// while executing the actual API request.
1807 ///
1808 /// It should be used to handle progress information, and to implement a certain level of resilience.
1809 ///
1810 /// Sets the *delegate* property to the given value.
1811 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> DmMessageCall<'a> {
1812 self._delegate = Some(new_value);
1813 self
1814 }
1815
1816 /// Set any additional parameter of the query string used in the request.
1817 /// It should be used to set parameters which are not yet available through their own
1818 /// setters.
1819 ///
1820 /// Please note that this method must not be used to set any of the known parameters
1821 /// which have their own setter method. If done anyway, the request will fail.
1822 ///
1823 /// # Additional Parameters
1824 ///
1825 /// * *$.xgafv* (query-string) - V1 error format.
1826 /// * *access_token* (query-string) - OAuth access token.
1827 /// * *alt* (query-string) - Data format for response.
1828 /// * *callback* (query-string) - JSONP
1829 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1830 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1831 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1832 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1833 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1834 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1835 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1836 pub fn param<T>(mut self, name: T, value: T) -> DmMessageCall<'a>
1837 where T: AsRef<str> {
1838 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
1839 self
1840 }
1841
1842}
1843
1844
1845/// Legacy path for creating message. Calling these will result in a BadRequest response.
1846///
1847/// A builder for the *webhooks* method supported by a *dm* resource.
1848/// It is not used directly, but through a `DmMethods` instance.
1849///
1850/// # Example
1851///
1852/// Instantiate a resource method builder
1853///
1854/// ```test_harness,no_run
1855/// # extern crate hyper;
1856/// # extern crate hyper_rustls;
1857/// # extern crate yup_oauth2 as oauth2;
1858/// # extern crate google_chat1 as chat1;
1859/// use chat1::api::Message;
1860/// # async fn dox() {
1861/// # use std::default::Default;
1862/// # use oauth2;
1863/// # use chat1::HangoutsChat;
1864///
1865/// # let secret: oauth2::ApplicationSecret = Default::default();
1866/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1867/// # secret,
1868/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1869/// # ).build().await.unwrap();
1870/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
1871/// // As the method needs a request, you would usually fill it with the desired information
1872/// // into the respective structure. Some of the parts shown here might not be applicable !
1873/// // Values shown here are possibly random and not representative !
1874/// let mut req = Message::default();
1875///
1876/// // You can configure optional parameters by calling the respective setters at will, and
1877/// // execute the final call using `doit()`.
1878/// // Values shown here are possibly random and not representative !
1879/// let result = hub.dms().webhooks(req, "parent")
1880/// .thread_key("duo")
1881/// .doit().await;
1882/// # }
1883/// ```
1884pub struct DmWebhookCall<'a>
1885 where {
1886
1887 hub: &'a HangoutsChat<>,
1888 _request: Message,
1889 _parent: String,
1890 _thread_key: Option<String>,
1891 _delegate: Option<&'a mut dyn client::Delegate>,
1892 _additional_params: HashMap<String, String>,
1893}
1894
1895impl<'a> client::CallBuilder for DmWebhookCall<'a> {}
1896
1897impl<'a> DmWebhookCall<'a> {
1898
1899
1900 /// Perform the operation you have build so far.
1901 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Message)> {
1902 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
1903 use std::io::{Read, Seek};
1904 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
1905 use client::ToParts;
1906 let mut dd = client::DefaultDelegate;
1907 let mut dlg: &mut dyn client::Delegate = match self._delegate {
1908 Some(d) => d,
1909 None => &mut dd
1910 };
1911 dlg.begin(client::MethodInfo { id: "chat.dms.webhooks",
1912 http_method: hyper::Method::POST });
1913 let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
1914 params.push(("parent", self._parent.to_string()));
1915 if let Some(value) = self._thread_key {
1916 params.push(("threadKey", value.to_string()));
1917 }
1918 for &field in ["alt", "parent", "threadKey"].iter() {
1919 if self._additional_params.contains_key(field) {
1920 dlg.finished(false);
1921 return Err(client::Error::FieldClash(field));
1922 }
1923 }
1924 for (name, value) in self._additional_params.iter() {
1925 params.push((&name, value.clone()));
1926 }
1927
1928 params.push(("alt", "json".to_string()));
1929
1930 let mut url = self.hub._base_url.clone() + "v1/{+parent}/webhooks";
1931
1932 let key = dlg.api_key();
1933 match key {
1934 Some(value) => params.push(("key", value)),
1935 None => {
1936 dlg.finished(false);
1937 return Err(client::Error::MissingAPIKey)
1938 }
1939 }
1940
1941 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1942 let mut replace_with = String::new();
1943 for &(name, ref value) in params.iter() {
1944 if name == param_name {
1945 replace_with = value.to_string();
1946 break;
1947 }
1948 }
1949 if find_this.as_bytes()[1] == '+' as u8 {
1950 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
1951 }
1952 url = url.replace(find_this, &replace_with);
1953 }
1954 {
1955 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
1956 for param_name in ["parent"].iter() {
1957 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
1958 indices_for_removal.push(index);
1959 }
1960 }
1961 for &index in indices_for_removal.iter() {
1962 params.remove(index);
1963 }
1964 }
1965
1966 let url = url::Url::parse_with_params(&url, params).unwrap();
1967
1968 let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
1969 let mut request_value_reader =
1970 {
1971 let mut value = json::value::to_value(&self._request).expect("serde to work");
1972 client::remove_json_null_values(&mut value);
1973 let mut dst = io::Cursor::new(Vec::with_capacity(128));
1974 json::to_writer(&mut dst, &value).unwrap();
1975 dst
1976 };
1977 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
1978 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
1979
1980
1981 loop {
1982 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
1983 let mut req_result = {
1984 let client = &self.hub.client;
1985 dlg.pre_request();
1986 let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string())
1987 .header(USER_AGENT, self.hub._user_agent.clone());
1988
1989
1990 let request = req_builder
1991 .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
1992 .header(CONTENT_LENGTH, request_size as u64)
1993 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
1994
1995 client.request(request.unwrap()).await
1996
1997 };
1998
1999 match req_result {
2000 Err(err) => {
2001 if let client::Retry::After(d) = dlg.http_error(&err) {
2002 sleep(d);
2003 continue;
2004 }
2005 dlg.finished(false);
2006 return Err(client::Error::HttpError(err))
2007 }
2008 Ok(mut res) => {
2009 if !res.status().is_success() {
2010 let res_body_string = client::get_body_as_string(res.body_mut()).await;
2011
2012 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
2013 let server_error = json::from_str::<client::ServerError>(&res_body_string)
2014 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
2015 .ok();
2016
2017 if let client::Retry::After(d) = dlg.http_failure(&res,
2018 json_server_error,
2019 server_error) {
2020 sleep(d);
2021 continue;
2022 }
2023 dlg.finished(false);
2024 return match json::from_str::<client::ErrorResponse>(&res_body_string){
2025 Err(_) => Err(client::Error::Failure(res)),
2026 Ok(serr) => Err(client::Error::BadRequest(serr))
2027 }
2028 }
2029 let result_value = {
2030 let res_body_string = client::get_body_as_string(res.body_mut()).await;
2031
2032 match json::from_str(&res_body_string) {
2033 Ok(decoded) => (res, decoded),
2034 Err(err) => {
2035 dlg.response_json_decode_error(&res_body_string, &err);
2036 return Err(client::Error::JsonDecodeError(res_body_string, err));
2037 }
2038 }
2039 };
2040
2041 dlg.finished(true);
2042 return Ok(result_value)
2043 }
2044 }
2045 }
2046 }
2047
2048
2049 ///
2050 /// Sets the *request* property to the given value.
2051 ///
2052 /// Even though the property as already been set when instantiating this call,
2053 /// we provide this method for API completeness.
2054 pub fn request(mut self, new_value: Message) -> DmWebhookCall<'a> {
2055 self._request = new_value;
2056 self
2057 }
2058 /// Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
2059 ///
2060 /// Sets the *parent* path property to the given value.
2061 ///
2062 /// Even though the property as already been set when instantiating this call,
2063 /// we provide this method for API completeness.
2064 pub fn parent(mut self, new_value: &str) -> DmWebhookCall<'a> {
2065 self._parent = new_value.to_string();
2066 self
2067 }
2068 /// Opaque thread identifier string that can be specified to group messages into a single thread. If this is the first message with a given thread identifier, a new thread is created. Subsequent messages with the same thread identifier will be posted into the same thread. This relieves bots and webhooks from having to store the Hangouts Chat thread ID of a thread (created earlier by them) to post further updates to it. Has no effect if thread field, corresponding to an existing thread, is set in message.
2069 ///
2070 /// Sets the *thread key* query property to the given value.
2071 pub fn thread_key(mut self, new_value: &str) -> DmWebhookCall<'a> {
2072 self._thread_key = Some(new_value.to_string());
2073 self
2074 }
2075 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2076 /// while executing the actual API request.
2077 ///
2078 /// It should be used to handle progress information, and to implement a certain level of resilience.
2079 ///
2080 /// Sets the *delegate* property to the given value.
2081 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> DmWebhookCall<'a> {
2082 self._delegate = Some(new_value);
2083 self
2084 }
2085
2086 /// Set any additional parameter of the query string used in the request.
2087 /// It should be used to set parameters which are not yet available through their own
2088 /// setters.
2089 ///
2090 /// Please note that this method must not be used to set any of the known parameters
2091 /// which have their own setter method. If done anyway, the request will fail.
2092 ///
2093 /// # Additional Parameters
2094 ///
2095 /// * *$.xgafv* (query-string) - V1 error format.
2096 /// * *access_token* (query-string) - OAuth access token.
2097 /// * *alt* (query-string) - Data format for response.
2098 /// * *callback* (query-string) - JSONP
2099 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2100 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2101 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2102 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2103 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2104 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2105 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2106 pub fn param<T>(mut self, name: T, value: T) -> DmWebhookCall<'a>
2107 where T: AsRef<str> {
2108 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
2109 self
2110 }
2111
2112}
2113
2114
2115/// Downloads media. Download is supported on the URI `/v1/media/{+name}?alt=media`.
2116///
2117/// This method supports **media download**. To enable it, adjust the builder like this:
2118/// `.param("alt", "media")`.
2119/// Please note that due to missing multi-part support on the server side, you will only receive the media,
2120/// but not the `Media` structure that you would usually get. The latter will be a default value.
2121///
2122/// A builder for the *download* method supported by a *media* resource.
2123/// It is not used directly, but through a `MediaMethods` instance.
2124///
2125/// # Example
2126///
2127/// Instantiate a resource method builder
2128///
2129/// ```test_harness,no_run
2130/// # extern crate hyper;
2131/// # extern crate hyper_rustls;
2132/// # extern crate yup_oauth2 as oauth2;
2133/// # extern crate google_chat1 as chat1;
2134/// # async fn dox() {
2135/// # use std::default::Default;
2136/// # use oauth2;
2137/// # use chat1::HangoutsChat;
2138///
2139/// # let secret: oauth2::ApplicationSecret = Default::default();
2140/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2141/// # secret,
2142/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2143/// # ).build().await.unwrap();
2144/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
2145/// // You can configure optional parameters by calling the respective setters at will, and
2146/// // execute the final call using `doit()`.
2147/// // Values shown here are possibly random and not representative !
2148/// let result = hub.media().download("resourceName")
2149/// .doit().await;
2150/// # }
2151/// ```
2152pub struct MediaDownloadCall<'a>
2153 where {
2154
2155 hub: &'a HangoutsChat<>,
2156 _resource_name: String,
2157 _delegate: Option<&'a mut dyn client::Delegate>,
2158 _additional_params: HashMap<String, String>,
2159}
2160
2161impl<'a> client::CallBuilder for MediaDownloadCall<'a> {}
2162
2163impl<'a> MediaDownloadCall<'a> {
2164
2165
2166 /// Perform the operation you have build so far.
2167 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Media)> {
2168 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
2169 use std::io::{Read, Seek};
2170 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
2171 use client::ToParts;
2172 let mut dd = client::DefaultDelegate;
2173 let mut dlg: &mut dyn client::Delegate = match self._delegate {
2174 Some(d) => d,
2175 None => &mut dd
2176 };
2177 dlg.begin(client::MethodInfo { id: "chat.media.download",
2178 http_method: hyper::Method::GET });
2179 let mut params: Vec<(&str, String)> = Vec::with_capacity(2 + self._additional_params.len());
2180 params.push(("resourceName", self._resource_name.to_string()));
2181 for &field in ["resourceName"].iter() {
2182 if self._additional_params.contains_key(field) {
2183 dlg.finished(false);
2184 return Err(client::Error::FieldClash(field));
2185 }
2186 }
2187 for (name, value) in self._additional_params.iter() {
2188 params.push((&name, value.clone()));
2189 }
2190
2191 let (json_field_missing, enable_resource_parsing) = {
2192 let mut enable = true;
2193 let mut field_present = true;
2194 for &(name, ref value) in params.iter() {
2195 if name == "alt" {
2196 field_present = false;
2197 if <String as AsRef<str>>::as_ref(&value) != "json" {
2198 enable = false;
2199 }
2200 break;
2201 }
2202 }
2203 (field_present, enable)
2204 };
2205 if json_field_missing {
2206 params.push(("alt", "json".to_string()));
2207 }
2208
2209 let mut url = self.hub._base_url.clone() + "v1/media/{+resourceName}";
2210
2211 let key = dlg.api_key();
2212 match key {
2213 Some(value) => params.push(("key", value)),
2214 None => {
2215 dlg.finished(false);
2216 return Err(client::Error::MissingAPIKey)
2217 }
2218 }
2219
2220 for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() {
2221 let mut replace_with = String::new();
2222 for &(name, ref value) in params.iter() {
2223 if name == param_name {
2224 replace_with = value.to_string();
2225 break;
2226 }
2227 }
2228 if find_this.as_bytes()[1] == '+' as u8 {
2229 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
2230 }
2231 url = url.replace(find_this, &replace_with);
2232 }
2233 {
2234 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
2235 for param_name in ["resourceName"].iter() {
2236 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
2237 indices_for_removal.push(index);
2238 }
2239 }
2240 for &index in indices_for_removal.iter() {
2241 params.remove(index);
2242 }
2243 }
2244
2245 let url = url::Url::parse_with_params(&url, params).unwrap();
2246
2247
2248
2249 loop {
2250 let mut req_result = {
2251 let client = &self.hub.client;
2252 dlg.pre_request();
2253 let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string())
2254 .header(USER_AGENT, self.hub._user_agent.clone());
2255
2256
2257 let request = req_builder
2258 .body(hyper::body::Body::empty());
2259
2260 client.request(request.unwrap()).await
2261
2262 };
2263
2264 match req_result {
2265 Err(err) => {
2266 if let client::Retry::After(d) = dlg.http_error(&err) {
2267 sleep(d);
2268 continue;
2269 }
2270 dlg.finished(false);
2271 return Err(client::Error::HttpError(err))
2272 }
2273 Ok(mut res) => {
2274 if !res.status().is_success() {
2275 let res_body_string = client::get_body_as_string(res.body_mut()).await;
2276
2277 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
2278 let server_error = json::from_str::<client::ServerError>(&res_body_string)
2279 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
2280 .ok();
2281
2282 if let client::Retry::After(d) = dlg.http_failure(&res,
2283 json_server_error,
2284 server_error) {
2285 sleep(d);
2286 continue;
2287 }
2288 dlg.finished(false);
2289 return match json::from_str::<client::ErrorResponse>(&res_body_string){
2290 Err(_) => Err(client::Error::Failure(res)),
2291 Ok(serr) => Err(client::Error::BadRequest(serr))
2292 }
2293 }
2294 let result_value = if enable_resource_parsing {
2295 let res_body_string = client::get_body_as_string(res.body_mut()).await;
2296
2297 match json::from_str(&res_body_string) {
2298 Ok(decoded) => (res, decoded),
2299 Err(err) => {
2300 dlg.response_json_decode_error(&res_body_string, &err);
2301 return Err(client::Error::JsonDecodeError(res_body_string, err));
2302 }
2303 }
2304 } else { (res, Default::default()) };
2305
2306 dlg.finished(true);
2307 return Ok(result_value)
2308 }
2309 }
2310 }
2311 }
2312
2313
2314 /// Name of the media that is being downloaded. See ReadRequest.resource_name.
2315 ///
2316 /// Sets the *resource name* path property to the given value.
2317 ///
2318 /// Even though the property as already been set when instantiating this call,
2319 /// we provide this method for API completeness.
2320 pub fn resource_name(mut self, new_value: &str) -> MediaDownloadCall<'a> {
2321 self._resource_name = new_value.to_string();
2322 self
2323 }
2324 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2325 /// while executing the actual API request.
2326 ///
2327 /// It should be used to handle progress information, and to implement a certain level of resilience.
2328 ///
2329 /// Sets the *delegate* property to the given value.
2330 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> MediaDownloadCall<'a> {
2331 self._delegate = Some(new_value);
2332 self
2333 }
2334
2335 /// Set any additional parameter of the query string used in the request.
2336 /// It should be used to set parameters which are not yet available through their own
2337 /// setters.
2338 ///
2339 /// Please note that this method must not be used to set any of the known parameters
2340 /// which have their own setter method. If done anyway, the request will fail.
2341 ///
2342 /// # Additional Parameters
2343 ///
2344 /// * *$.xgafv* (query-string) - V1 error format.
2345 /// * *access_token* (query-string) - OAuth access token.
2346 /// * *alt* (query-string) - Data format for response.
2347 /// * *callback* (query-string) - JSONP
2348 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2349 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2350 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2351 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2352 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2353 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2354 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2355 pub fn param<T>(mut self, name: T, value: T) -> MediaDownloadCall<'a>
2356 where T: AsRef<str> {
2357 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
2358 self
2359 }
2360
2361}
2362
2363
2364/// Legacy path for creating message. Calling these will result in a BadRequest response.
2365///
2366/// A builder for the *conversations.messages* method supported by a *room* resource.
2367/// It is not used directly, but through a `RoomMethods` instance.
2368///
2369/// # Example
2370///
2371/// Instantiate a resource method builder
2372///
2373/// ```test_harness,no_run
2374/// # extern crate hyper;
2375/// # extern crate hyper_rustls;
2376/// # extern crate yup_oauth2 as oauth2;
2377/// # extern crate google_chat1 as chat1;
2378/// use chat1::api::Message;
2379/// # async fn dox() {
2380/// # use std::default::Default;
2381/// # use oauth2;
2382/// # use chat1::HangoutsChat;
2383///
2384/// # let secret: oauth2::ApplicationSecret = Default::default();
2385/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2386/// # secret,
2387/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2388/// # ).build().await.unwrap();
2389/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
2390/// // As the method needs a request, you would usually fill it with the desired information
2391/// // into the respective structure. Some of the parts shown here might not be applicable !
2392/// // Values shown here are possibly random and not representative !
2393/// let mut req = Message::default();
2394///
2395/// // You can configure optional parameters by calling the respective setters at will, and
2396/// // execute the final call using `doit()`.
2397/// // Values shown here are possibly random and not representative !
2398/// let result = hub.rooms().conversations_messages(req, "parent")
2399/// .thread_key("Lorem")
2400/// .doit().await;
2401/// # }
2402/// ```
2403pub struct RoomConversationMessageCall<'a>
2404 where {
2405
2406 hub: &'a HangoutsChat<>,
2407 _request: Message,
2408 _parent: String,
2409 _thread_key: Option<String>,
2410 _delegate: Option<&'a mut dyn client::Delegate>,
2411 _additional_params: HashMap<String, String>,
2412}
2413
2414impl<'a> client::CallBuilder for RoomConversationMessageCall<'a> {}
2415
2416impl<'a> RoomConversationMessageCall<'a> {
2417
2418
2419 /// Perform the operation you have build so far.
2420 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Message)> {
2421 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
2422 use std::io::{Read, Seek};
2423 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
2424 use client::ToParts;
2425 let mut dd = client::DefaultDelegate;
2426 let mut dlg: &mut dyn client::Delegate = match self._delegate {
2427 Some(d) => d,
2428 None => &mut dd
2429 };
2430 dlg.begin(client::MethodInfo { id: "chat.rooms.conversations.messages",
2431 http_method: hyper::Method::POST });
2432 let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
2433 params.push(("parent", self._parent.to_string()));
2434 if let Some(value) = self._thread_key {
2435 params.push(("threadKey", value.to_string()));
2436 }
2437 for &field in ["alt", "parent", "threadKey"].iter() {
2438 if self._additional_params.contains_key(field) {
2439 dlg.finished(false);
2440 return Err(client::Error::FieldClash(field));
2441 }
2442 }
2443 for (name, value) in self._additional_params.iter() {
2444 params.push((&name, value.clone()));
2445 }
2446
2447 params.push(("alt", "json".to_string()));
2448
2449 let mut url = self.hub._base_url.clone() + "v1/{+parent}/messages";
2450
2451 let key = dlg.api_key();
2452 match key {
2453 Some(value) => params.push(("key", value)),
2454 None => {
2455 dlg.finished(false);
2456 return Err(client::Error::MissingAPIKey)
2457 }
2458 }
2459
2460 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2461 let mut replace_with = String::new();
2462 for &(name, ref value) in params.iter() {
2463 if name == param_name {
2464 replace_with = value.to_string();
2465 break;
2466 }
2467 }
2468 if find_this.as_bytes()[1] == '+' as u8 {
2469 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
2470 }
2471 url = url.replace(find_this, &replace_with);
2472 }
2473 {
2474 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
2475 for param_name in ["parent"].iter() {
2476 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
2477 indices_for_removal.push(index);
2478 }
2479 }
2480 for &index in indices_for_removal.iter() {
2481 params.remove(index);
2482 }
2483 }
2484
2485 let url = url::Url::parse_with_params(&url, params).unwrap();
2486
2487 let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
2488 let mut request_value_reader =
2489 {
2490 let mut value = json::value::to_value(&self._request).expect("serde to work");
2491 client::remove_json_null_values(&mut value);
2492 let mut dst = io::Cursor::new(Vec::with_capacity(128));
2493 json::to_writer(&mut dst, &value).unwrap();
2494 dst
2495 };
2496 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
2497 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
2498
2499
2500 loop {
2501 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
2502 let mut req_result = {
2503 let client = &self.hub.client;
2504 dlg.pre_request();
2505 let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string())
2506 .header(USER_AGENT, self.hub._user_agent.clone());
2507
2508
2509 let request = req_builder
2510 .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
2511 .header(CONTENT_LENGTH, request_size as u64)
2512 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
2513
2514 client.request(request.unwrap()).await
2515
2516 };
2517
2518 match req_result {
2519 Err(err) => {
2520 if let client::Retry::After(d) = dlg.http_error(&err) {
2521 sleep(d);
2522 continue;
2523 }
2524 dlg.finished(false);
2525 return Err(client::Error::HttpError(err))
2526 }
2527 Ok(mut res) => {
2528 if !res.status().is_success() {
2529 let res_body_string = client::get_body_as_string(res.body_mut()).await;
2530
2531 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
2532 let server_error = json::from_str::<client::ServerError>(&res_body_string)
2533 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
2534 .ok();
2535
2536 if let client::Retry::After(d) = dlg.http_failure(&res,
2537 json_server_error,
2538 server_error) {
2539 sleep(d);
2540 continue;
2541 }
2542 dlg.finished(false);
2543 return match json::from_str::<client::ErrorResponse>(&res_body_string){
2544 Err(_) => Err(client::Error::Failure(res)),
2545 Ok(serr) => Err(client::Error::BadRequest(serr))
2546 }
2547 }
2548 let result_value = {
2549 let res_body_string = client::get_body_as_string(res.body_mut()).await;
2550
2551 match json::from_str(&res_body_string) {
2552 Ok(decoded) => (res, decoded),
2553 Err(err) => {
2554 dlg.response_json_decode_error(&res_body_string, &err);
2555 return Err(client::Error::JsonDecodeError(res_body_string, err));
2556 }
2557 }
2558 };
2559
2560 dlg.finished(true);
2561 return Ok(result_value)
2562 }
2563 }
2564 }
2565 }
2566
2567
2568 ///
2569 /// Sets the *request* property to the given value.
2570 ///
2571 /// Even though the property as already been set when instantiating this call,
2572 /// we provide this method for API completeness.
2573 pub fn request(mut self, new_value: Message) -> RoomConversationMessageCall<'a> {
2574 self._request = new_value;
2575 self
2576 }
2577 /// Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
2578 ///
2579 /// Sets the *parent* path property to the given value.
2580 ///
2581 /// Even though the property as already been set when instantiating this call,
2582 /// we provide this method for API completeness.
2583 pub fn parent(mut self, new_value: &str) -> RoomConversationMessageCall<'a> {
2584 self._parent = new_value.to_string();
2585 self
2586 }
2587 /// Opaque thread identifier string that can be specified to group messages into a single thread. If this is the first message with a given thread identifier, a new thread is created. Subsequent messages with the same thread identifier will be posted into the same thread. This relieves bots and webhooks from having to store the Hangouts Chat thread ID of a thread (created earlier by them) to post further updates to it. Has no effect if thread field, corresponding to an existing thread, is set in message.
2588 ///
2589 /// Sets the *thread key* query property to the given value.
2590 pub fn thread_key(mut self, new_value: &str) -> RoomConversationMessageCall<'a> {
2591 self._thread_key = Some(new_value.to_string());
2592 self
2593 }
2594 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2595 /// while executing the actual API request.
2596 ///
2597 /// It should be used to handle progress information, and to implement a certain level of resilience.
2598 ///
2599 /// Sets the *delegate* property to the given value.
2600 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> RoomConversationMessageCall<'a> {
2601 self._delegate = Some(new_value);
2602 self
2603 }
2604
2605 /// Set any additional parameter of the query string used in the request.
2606 /// It should be used to set parameters which are not yet available through their own
2607 /// setters.
2608 ///
2609 /// Please note that this method must not be used to set any of the known parameters
2610 /// which have their own setter method. If done anyway, the request will fail.
2611 ///
2612 /// # Additional Parameters
2613 ///
2614 /// * *$.xgafv* (query-string) - V1 error format.
2615 /// * *access_token* (query-string) - OAuth access token.
2616 /// * *alt* (query-string) - Data format for response.
2617 /// * *callback* (query-string) - JSONP
2618 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2619 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2620 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2621 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2622 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2623 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2624 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2625 pub fn param<T>(mut self, name: T, value: T) -> RoomConversationMessageCall<'a>
2626 where T: AsRef<str> {
2627 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
2628 self
2629 }
2630
2631}
2632
2633
2634/// Legacy path for creating message. Calling these will result in a BadRequest response.
2635///
2636/// A builder for the *messages* method supported by a *room* resource.
2637/// It is not used directly, but through a `RoomMethods` instance.
2638///
2639/// # Example
2640///
2641/// Instantiate a resource method builder
2642///
2643/// ```test_harness,no_run
2644/// # extern crate hyper;
2645/// # extern crate hyper_rustls;
2646/// # extern crate yup_oauth2 as oauth2;
2647/// # extern crate google_chat1 as chat1;
2648/// use chat1::api::Message;
2649/// # async fn dox() {
2650/// # use std::default::Default;
2651/// # use oauth2;
2652/// # use chat1::HangoutsChat;
2653///
2654/// # let secret: oauth2::ApplicationSecret = Default::default();
2655/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2656/// # secret,
2657/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2658/// # ).build().await.unwrap();
2659/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
2660/// // As the method needs a request, you would usually fill it with the desired information
2661/// // into the respective structure. Some of the parts shown here might not be applicable !
2662/// // Values shown here are possibly random and not representative !
2663/// let mut req = Message::default();
2664///
2665/// // You can configure optional parameters by calling the respective setters at will, and
2666/// // execute the final call using `doit()`.
2667/// // Values shown here are possibly random and not representative !
2668/// let result = hub.rooms().messages(req, "parent")
2669/// .thread_key("eos")
2670/// .doit().await;
2671/// # }
2672/// ```
2673pub struct RoomMessageCall<'a>
2674 where {
2675
2676 hub: &'a HangoutsChat<>,
2677 _request: Message,
2678 _parent: String,
2679 _thread_key: Option<String>,
2680 _delegate: Option<&'a mut dyn client::Delegate>,
2681 _additional_params: HashMap<String, String>,
2682}
2683
2684impl<'a> client::CallBuilder for RoomMessageCall<'a> {}
2685
2686impl<'a> RoomMessageCall<'a> {
2687
2688
2689 /// Perform the operation you have build so far.
2690 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Message)> {
2691 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
2692 use std::io::{Read, Seek};
2693 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
2694 use client::ToParts;
2695 let mut dd = client::DefaultDelegate;
2696 let mut dlg: &mut dyn client::Delegate = match self._delegate {
2697 Some(d) => d,
2698 None => &mut dd
2699 };
2700 dlg.begin(client::MethodInfo { id: "chat.rooms.messages",
2701 http_method: hyper::Method::POST });
2702 let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
2703 params.push(("parent", self._parent.to_string()));
2704 if let Some(value) = self._thread_key {
2705 params.push(("threadKey", value.to_string()));
2706 }
2707 for &field in ["alt", "parent", "threadKey"].iter() {
2708 if self._additional_params.contains_key(field) {
2709 dlg.finished(false);
2710 return Err(client::Error::FieldClash(field));
2711 }
2712 }
2713 for (name, value) in self._additional_params.iter() {
2714 params.push((&name, value.clone()));
2715 }
2716
2717 params.push(("alt", "json".to_string()));
2718
2719 let mut url = self.hub._base_url.clone() + "v1/{+parent}/messages";
2720
2721 let key = dlg.api_key();
2722 match key {
2723 Some(value) => params.push(("key", value)),
2724 None => {
2725 dlg.finished(false);
2726 return Err(client::Error::MissingAPIKey)
2727 }
2728 }
2729
2730 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2731 let mut replace_with = String::new();
2732 for &(name, ref value) in params.iter() {
2733 if name == param_name {
2734 replace_with = value.to_string();
2735 break;
2736 }
2737 }
2738 if find_this.as_bytes()[1] == '+' as u8 {
2739 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
2740 }
2741 url = url.replace(find_this, &replace_with);
2742 }
2743 {
2744 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
2745 for param_name in ["parent"].iter() {
2746 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
2747 indices_for_removal.push(index);
2748 }
2749 }
2750 for &index in indices_for_removal.iter() {
2751 params.remove(index);
2752 }
2753 }
2754
2755 let url = url::Url::parse_with_params(&url, params).unwrap();
2756
2757 let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
2758 let mut request_value_reader =
2759 {
2760 let mut value = json::value::to_value(&self._request).expect("serde to work");
2761 client::remove_json_null_values(&mut value);
2762 let mut dst = io::Cursor::new(Vec::with_capacity(128));
2763 json::to_writer(&mut dst, &value).unwrap();
2764 dst
2765 };
2766 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
2767 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
2768
2769
2770 loop {
2771 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
2772 let mut req_result = {
2773 let client = &self.hub.client;
2774 dlg.pre_request();
2775 let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string())
2776 .header(USER_AGENT, self.hub._user_agent.clone());
2777
2778
2779 let request = req_builder
2780 .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
2781 .header(CONTENT_LENGTH, request_size as u64)
2782 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
2783
2784 client.request(request.unwrap()).await
2785
2786 };
2787
2788 match req_result {
2789 Err(err) => {
2790 if let client::Retry::After(d) = dlg.http_error(&err) {
2791 sleep(d);
2792 continue;
2793 }
2794 dlg.finished(false);
2795 return Err(client::Error::HttpError(err))
2796 }
2797 Ok(mut res) => {
2798 if !res.status().is_success() {
2799 let res_body_string = client::get_body_as_string(res.body_mut()).await;
2800
2801 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
2802 let server_error = json::from_str::<client::ServerError>(&res_body_string)
2803 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
2804 .ok();
2805
2806 if let client::Retry::After(d) = dlg.http_failure(&res,
2807 json_server_error,
2808 server_error) {
2809 sleep(d);
2810 continue;
2811 }
2812 dlg.finished(false);
2813 return match json::from_str::<client::ErrorResponse>(&res_body_string){
2814 Err(_) => Err(client::Error::Failure(res)),
2815 Ok(serr) => Err(client::Error::BadRequest(serr))
2816 }
2817 }
2818 let result_value = {
2819 let res_body_string = client::get_body_as_string(res.body_mut()).await;
2820
2821 match json::from_str(&res_body_string) {
2822 Ok(decoded) => (res, decoded),
2823 Err(err) => {
2824 dlg.response_json_decode_error(&res_body_string, &err);
2825 return Err(client::Error::JsonDecodeError(res_body_string, err));
2826 }
2827 }
2828 };
2829
2830 dlg.finished(true);
2831 return Ok(result_value)
2832 }
2833 }
2834 }
2835 }
2836
2837
2838 ///
2839 /// Sets the *request* property to the given value.
2840 ///
2841 /// Even though the property as already been set when instantiating this call,
2842 /// we provide this method for API completeness.
2843 pub fn request(mut self, new_value: Message) -> RoomMessageCall<'a> {
2844 self._request = new_value;
2845 self
2846 }
2847 /// Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
2848 ///
2849 /// Sets the *parent* path property to the given value.
2850 ///
2851 /// Even though the property as already been set when instantiating this call,
2852 /// we provide this method for API completeness.
2853 pub fn parent(mut self, new_value: &str) -> RoomMessageCall<'a> {
2854 self._parent = new_value.to_string();
2855 self
2856 }
2857 /// Opaque thread identifier string that can be specified to group messages into a single thread. If this is the first message with a given thread identifier, a new thread is created. Subsequent messages with the same thread identifier will be posted into the same thread. This relieves bots and webhooks from having to store the Hangouts Chat thread ID of a thread (created earlier by them) to post further updates to it. Has no effect if thread field, corresponding to an existing thread, is set in message.
2858 ///
2859 /// Sets the *thread key* query property to the given value.
2860 pub fn thread_key(mut self, new_value: &str) -> RoomMessageCall<'a> {
2861 self._thread_key = Some(new_value.to_string());
2862 self
2863 }
2864 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2865 /// while executing the actual API request.
2866 ///
2867 /// It should be used to handle progress information, and to implement a certain level of resilience.
2868 ///
2869 /// Sets the *delegate* property to the given value.
2870 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> RoomMessageCall<'a> {
2871 self._delegate = Some(new_value);
2872 self
2873 }
2874
2875 /// Set any additional parameter of the query string used in the request.
2876 /// It should be used to set parameters which are not yet available through their own
2877 /// setters.
2878 ///
2879 /// Please note that this method must not be used to set any of the known parameters
2880 /// which have their own setter method. If done anyway, the request will fail.
2881 ///
2882 /// # Additional Parameters
2883 ///
2884 /// * *$.xgafv* (query-string) - V1 error format.
2885 /// * *access_token* (query-string) - OAuth access token.
2886 /// * *alt* (query-string) - Data format for response.
2887 /// * *callback* (query-string) - JSONP
2888 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2889 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2890 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2891 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2892 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2893 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2894 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2895 pub fn param<T>(mut self, name: T, value: T) -> RoomMessageCall<'a>
2896 where T: AsRef<str> {
2897 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
2898 self
2899 }
2900
2901}
2902
2903
2904/// Legacy path for creating message. Calling these will result in a BadRequest response.
2905///
2906/// A builder for the *webhooks* method supported by a *room* resource.
2907/// It is not used directly, but through a `RoomMethods` instance.
2908///
2909/// # Example
2910///
2911/// Instantiate a resource method builder
2912///
2913/// ```test_harness,no_run
2914/// # extern crate hyper;
2915/// # extern crate hyper_rustls;
2916/// # extern crate yup_oauth2 as oauth2;
2917/// # extern crate google_chat1 as chat1;
2918/// use chat1::api::Message;
2919/// # async fn dox() {
2920/// # use std::default::Default;
2921/// # use oauth2;
2922/// # use chat1::HangoutsChat;
2923///
2924/// # let secret: oauth2::ApplicationSecret = Default::default();
2925/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2926/// # secret,
2927/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2928/// # ).build().await.unwrap();
2929/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
2930/// // As the method needs a request, you would usually fill it with the desired information
2931/// // into the respective structure. Some of the parts shown here might not be applicable !
2932/// // Values shown here are possibly random and not representative !
2933/// let mut req = Message::default();
2934///
2935/// // You can configure optional parameters by calling the respective setters at will, and
2936/// // execute the final call using `doit()`.
2937/// // Values shown here are possibly random and not representative !
2938/// let result = hub.rooms().webhooks(req, "parent")
2939/// .thread_key("ea")
2940/// .doit().await;
2941/// # }
2942/// ```
2943pub struct RoomWebhookCall<'a>
2944 where {
2945
2946 hub: &'a HangoutsChat<>,
2947 _request: Message,
2948 _parent: String,
2949 _thread_key: Option<String>,
2950 _delegate: Option<&'a mut dyn client::Delegate>,
2951 _additional_params: HashMap<String, String>,
2952}
2953
2954impl<'a> client::CallBuilder for RoomWebhookCall<'a> {}
2955
2956impl<'a> RoomWebhookCall<'a> {
2957
2958
2959 /// Perform the operation you have build so far.
2960 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Message)> {
2961 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
2962 use std::io::{Read, Seek};
2963 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
2964 use client::ToParts;
2965 let mut dd = client::DefaultDelegate;
2966 let mut dlg: &mut dyn client::Delegate = match self._delegate {
2967 Some(d) => d,
2968 None => &mut dd
2969 };
2970 dlg.begin(client::MethodInfo { id: "chat.rooms.webhooks",
2971 http_method: hyper::Method::POST });
2972 let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
2973 params.push(("parent", self._parent.to_string()));
2974 if let Some(value) = self._thread_key {
2975 params.push(("threadKey", value.to_string()));
2976 }
2977 for &field in ["alt", "parent", "threadKey"].iter() {
2978 if self._additional_params.contains_key(field) {
2979 dlg.finished(false);
2980 return Err(client::Error::FieldClash(field));
2981 }
2982 }
2983 for (name, value) in self._additional_params.iter() {
2984 params.push((&name, value.clone()));
2985 }
2986
2987 params.push(("alt", "json".to_string()));
2988
2989 let mut url = self.hub._base_url.clone() + "v1/{+parent}/webhooks";
2990
2991 let key = dlg.api_key();
2992 match key {
2993 Some(value) => params.push(("key", value)),
2994 None => {
2995 dlg.finished(false);
2996 return Err(client::Error::MissingAPIKey)
2997 }
2998 }
2999
3000 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3001 let mut replace_with = String::new();
3002 for &(name, ref value) in params.iter() {
3003 if name == param_name {
3004 replace_with = value.to_string();
3005 break;
3006 }
3007 }
3008 if find_this.as_bytes()[1] == '+' as u8 {
3009 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
3010 }
3011 url = url.replace(find_this, &replace_with);
3012 }
3013 {
3014 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
3015 for param_name in ["parent"].iter() {
3016 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
3017 indices_for_removal.push(index);
3018 }
3019 }
3020 for &index in indices_for_removal.iter() {
3021 params.remove(index);
3022 }
3023 }
3024
3025 let url = url::Url::parse_with_params(&url, params).unwrap();
3026
3027 let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
3028 let mut request_value_reader =
3029 {
3030 let mut value = json::value::to_value(&self._request).expect("serde to work");
3031 client::remove_json_null_values(&mut value);
3032 let mut dst = io::Cursor::new(Vec::with_capacity(128));
3033 json::to_writer(&mut dst, &value).unwrap();
3034 dst
3035 };
3036 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
3037 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
3038
3039
3040 loop {
3041 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
3042 let mut req_result = {
3043 let client = &self.hub.client;
3044 dlg.pre_request();
3045 let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string())
3046 .header(USER_AGENT, self.hub._user_agent.clone());
3047
3048
3049 let request = req_builder
3050 .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
3051 .header(CONTENT_LENGTH, request_size as u64)
3052 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
3053
3054 client.request(request.unwrap()).await
3055
3056 };
3057
3058 match req_result {
3059 Err(err) => {
3060 if let client::Retry::After(d) = dlg.http_error(&err) {
3061 sleep(d);
3062 continue;
3063 }
3064 dlg.finished(false);
3065 return Err(client::Error::HttpError(err))
3066 }
3067 Ok(mut res) => {
3068 if !res.status().is_success() {
3069 let res_body_string = client::get_body_as_string(res.body_mut()).await;
3070
3071 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
3072 let server_error = json::from_str::<client::ServerError>(&res_body_string)
3073 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
3074 .ok();
3075
3076 if let client::Retry::After(d) = dlg.http_failure(&res,
3077 json_server_error,
3078 server_error) {
3079 sleep(d);
3080 continue;
3081 }
3082 dlg.finished(false);
3083 return match json::from_str::<client::ErrorResponse>(&res_body_string){
3084 Err(_) => Err(client::Error::Failure(res)),
3085 Ok(serr) => Err(client::Error::BadRequest(serr))
3086 }
3087 }
3088 let result_value = {
3089 let res_body_string = client::get_body_as_string(res.body_mut()).await;
3090
3091 match json::from_str(&res_body_string) {
3092 Ok(decoded) => (res, decoded),
3093 Err(err) => {
3094 dlg.response_json_decode_error(&res_body_string, &err);
3095 return Err(client::Error::JsonDecodeError(res_body_string, err));
3096 }
3097 }
3098 };
3099
3100 dlg.finished(true);
3101 return Ok(result_value)
3102 }
3103 }
3104 }
3105 }
3106
3107
3108 ///
3109 /// Sets the *request* property to the given value.
3110 ///
3111 /// Even though the property as already been set when instantiating this call,
3112 /// we provide this method for API completeness.
3113 pub fn request(mut self, new_value: Message) -> RoomWebhookCall<'a> {
3114 self._request = new_value;
3115 self
3116 }
3117 /// Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
3118 ///
3119 /// Sets the *parent* path property to the given value.
3120 ///
3121 /// Even though the property as already been set when instantiating this call,
3122 /// we provide this method for API completeness.
3123 pub fn parent(mut self, new_value: &str) -> RoomWebhookCall<'a> {
3124 self._parent = new_value.to_string();
3125 self
3126 }
3127 /// Opaque thread identifier string that can be specified to group messages into a single thread. If this is the first message with a given thread identifier, a new thread is created. Subsequent messages with the same thread identifier will be posted into the same thread. This relieves bots and webhooks from having to store the Hangouts Chat thread ID of a thread (created earlier by them) to post further updates to it. Has no effect if thread field, corresponding to an existing thread, is set in message.
3128 ///
3129 /// Sets the *thread key* query property to the given value.
3130 pub fn thread_key(mut self, new_value: &str) -> RoomWebhookCall<'a> {
3131 self._thread_key = Some(new_value.to_string());
3132 self
3133 }
3134 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3135 /// while executing the actual API request.
3136 ///
3137 /// It should be used to handle progress information, and to implement a certain level of resilience.
3138 ///
3139 /// Sets the *delegate* property to the given value.
3140 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> RoomWebhookCall<'a> {
3141 self._delegate = Some(new_value);
3142 self
3143 }
3144
3145 /// Set any additional parameter of the query string used in the request.
3146 /// It should be used to set parameters which are not yet available through their own
3147 /// setters.
3148 ///
3149 /// Please note that this method must not be used to set any of the known parameters
3150 /// which have their own setter method. If done anyway, the request will fail.
3151 ///
3152 /// # Additional Parameters
3153 ///
3154 /// * *$.xgafv* (query-string) - V1 error format.
3155 /// * *access_token* (query-string) - OAuth access token.
3156 /// * *alt* (query-string) - Data format for response.
3157 /// * *callback* (query-string) - JSONP
3158 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3159 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3160 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3161 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3162 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3163 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3164 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3165 pub fn param<T>(mut self, name: T, value: T) -> RoomWebhookCall<'a>
3166 where T: AsRef<str> {
3167 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
3168 self
3169 }
3170
3171}
3172
3173
3174/// Returns a membership.
3175///
3176/// A builder for the *members.get* method supported by a *space* resource.
3177/// It is not used directly, but through a `SpaceMethods` instance.
3178///
3179/// # Example
3180///
3181/// Instantiate a resource method builder
3182///
3183/// ```test_harness,no_run
3184/// # extern crate hyper;
3185/// # extern crate hyper_rustls;
3186/// # extern crate yup_oauth2 as oauth2;
3187/// # extern crate google_chat1 as chat1;
3188/// # async fn dox() {
3189/// # use std::default::Default;
3190/// # use oauth2;
3191/// # use chat1::HangoutsChat;
3192///
3193/// # let secret: oauth2::ApplicationSecret = Default::default();
3194/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3195/// # secret,
3196/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3197/// # ).build().await.unwrap();
3198/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
3199/// // You can configure optional parameters by calling the respective setters at will, and
3200/// // execute the final call using `doit()`.
3201/// // Values shown here are possibly random and not representative !
3202/// let result = hub.spaces().members_get("name")
3203/// .doit().await;
3204/// # }
3205/// ```
3206pub struct SpaceMemberGetCall<'a>
3207 where {
3208
3209 hub: &'a HangoutsChat<>,
3210 _name: String,
3211 _delegate: Option<&'a mut dyn client::Delegate>,
3212 _additional_params: HashMap<String, String>,
3213}
3214
3215impl<'a> client::CallBuilder for SpaceMemberGetCall<'a> {}
3216
3217impl<'a> SpaceMemberGetCall<'a> {
3218
3219
3220 /// Perform the operation you have build so far.
3221 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Membership)> {
3222 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
3223 use std::io::{Read, Seek};
3224 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
3225 use client::ToParts;
3226 let mut dd = client::DefaultDelegate;
3227 let mut dlg: &mut dyn client::Delegate = match self._delegate {
3228 Some(d) => d,
3229 None => &mut dd
3230 };
3231 dlg.begin(client::MethodInfo { id: "chat.spaces.members.get",
3232 http_method: hyper::Method::GET });
3233 let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
3234 params.push(("name", self._name.to_string()));
3235 for &field in ["alt", "name"].iter() {
3236 if self._additional_params.contains_key(field) {
3237 dlg.finished(false);
3238 return Err(client::Error::FieldClash(field));
3239 }
3240 }
3241 for (name, value) in self._additional_params.iter() {
3242 params.push((&name, value.clone()));
3243 }
3244
3245 params.push(("alt", "json".to_string()));
3246
3247 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3248
3249 let key = dlg.api_key();
3250 match key {
3251 Some(value) => params.push(("key", value)),
3252 None => {
3253 dlg.finished(false);
3254 return Err(client::Error::MissingAPIKey)
3255 }
3256 }
3257
3258 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3259 let mut replace_with = String::new();
3260 for &(name, ref value) in params.iter() {
3261 if name == param_name {
3262 replace_with = value.to_string();
3263 break;
3264 }
3265 }
3266 if find_this.as_bytes()[1] == '+' as u8 {
3267 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
3268 }
3269 url = url.replace(find_this, &replace_with);
3270 }
3271 {
3272 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
3273 for param_name in ["name"].iter() {
3274 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
3275 indices_for_removal.push(index);
3276 }
3277 }
3278 for &index in indices_for_removal.iter() {
3279 params.remove(index);
3280 }
3281 }
3282
3283 let url = url::Url::parse_with_params(&url, params).unwrap();
3284
3285
3286
3287 loop {
3288 let mut req_result = {
3289 let client = &self.hub.client;
3290 dlg.pre_request();
3291 let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string())
3292 .header(USER_AGENT, self.hub._user_agent.clone());
3293
3294
3295 let request = req_builder
3296 .body(hyper::body::Body::empty());
3297
3298 client.request(request.unwrap()).await
3299
3300 };
3301
3302 match req_result {
3303 Err(err) => {
3304 if let client::Retry::After(d) = dlg.http_error(&err) {
3305 sleep(d);
3306 continue;
3307 }
3308 dlg.finished(false);
3309 return Err(client::Error::HttpError(err))
3310 }
3311 Ok(mut res) => {
3312 if !res.status().is_success() {
3313 let res_body_string = client::get_body_as_string(res.body_mut()).await;
3314
3315 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
3316 let server_error = json::from_str::<client::ServerError>(&res_body_string)
3317 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
3318 .ok();
3319
3320 if let client::Retry::After(d) = dlg.http_failure(&res,
3321 json_server_error,
3322 server_error) {
3323 sleep(d);
3324 continue;
3325 }
3326 dlg.finished(false);
3327 return match json::from_str::<client::ErrorResponse>(&res_body_string){
3328 Err(_) => Err(client::Error::Failure(res)),
3329 Ok(serr) => Err(client::Error::BadRequest(serr))
3330 }
3331 }
3332 let result_value = {
3333 let res_body_string = client::get_body_as_string(res.body_mut()).await;
3334
3335 match json::from_str(&res_body_string) {
3336 Ok(decoded) => (res, decoded),
3337 Err(err) => {
3338 dlg.response_json_decode_error(&res_body_string, &err);
3339 return Err(client::Error::JsonDecodeError(res_body_string, err));
3340 }
3341 }
3342 };
3343
3344 dlg.finished(true);
3345 return Ok(result_value)
3346 }
3347 }
3348 }
3349 }
3350
3351
3352 /// Required. Resource name of the membership to be retrieved, in the form "spaces/*/members/*". Example: spaces/AAAAMpdlehY/members/105115627578887013105
3353 ///
3354 /// Sets the *name* path property to the given value.
3355 ///
3356 /// Even though the property as already been set when instantiating this call,
3357 /// we provide this method for API completeness.
3358 pub fn name(mut self, new_value: &str) -> SpaceMemberGetCall<'a> {
3359 self._name = new_value.to_string();
3360 self
3361 }
3362 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3363 /// while executing the actual API request.
3364 ///
3365 /// It should be used to handle progress information, and to implement a certain level of resilience.
3366 ///
3367 /// Sets the *delegate* property to the given value.
3368 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> SpaceMemberGetCall<'a> {
3369 self._delegate = Some(new_value);
3370 self
3371 }
3372
3373 /// Set any additional parameter of the query string used in the request.
3374 /// It should be used to set parameters which are not yet available through their own
3375 /// setters.
3376 ///
3377 /// Please note that this method must not be used to set any of the known parameters
3378 /// which have their own setter method. If done anyway, the request will fail.
3379 ///
3380 /// # Additional Parameters
3381 ///
3382 /// * *$.xgafv* (query-string) - V1 error format.
3383 /// * *access_token* (query-string) - OAuth access token.
3384 /// * *alt* (query-string) - Data format for response.
3385 /// * *callback* (query-string) - JSONP
3386 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3387 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3388 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3389 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3390 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3391 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3392 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3393 pub fn param<T>(mut self, name: T, value: T) -> SpaceMemberGetCall<'a>
3394 where T: AsRef<str> {
3395 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
3396 self
3397 }
3398
3399}
3400
3401
3402/// Lists human memberships in a space.
3403///
3404/// A builder for the *members.list* method supported by a *space* resource.
3405/// It is not used directly, but through a `SpaceMethods` instance.
3406///
3407/// # Example
3408///
3409/// Instantiate a resource method builder
3410///
3411/// ```test_harness,no_run
3412/// # extern crate hyper;
3413/// # extern crate hyper_rustls;
3414/// # extern crate yup_oauth2 as oauth2;
3415/// # extern crate google_chat1 as chat1;
3416/// # async fn dox() {
3417/// # use std::default::Default;
3418/// # use oauth2;
3419/// # use chat1::HangoutsChat;
3420///
3421/// # let secret: oauth2::ApplicationSecret = Default::default();
3422/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3423/// # secret,
3424/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3425/// # ).build().await.unwrap();
3426/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
3427/// // You can configure optional parameters by calling the respective setters at will, and
3428/// // execute the final call using `doit()`.
3429/// // Values shown here are possibly random and not representative !
3430/// let result = hub.spaces().members_list("parent")
3431/// .page_token("amet")
3432/// .page_size(-20)
3433/// .doit().await;
3434/// # }
3435/// ```
3436pub struct SpaceMemberListCall<'a>
3437 where {
3438
3439 hub: &'a HangoutsChat<>,
3440 _parent: String,
3441 _page_token: Option<String>,
3442 _page_size: Option<i32>,
3443 _delegate: Option<&'a mut dyn client::Delegate>,
3444 _additional_params: HashMap<String, String>,
3445}
3446
3447impl<'a> client::CallBuilder for SpaceMemberListCall<'a> {}
3448
3449impl<'a> SpaceMemberListCall<'a> {
3450
3451
3452 /// Perform the operation you have build so far.
3453 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListMembershipsResponse)> {
3454 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
3455 use std::io::{Read, Seek};
3456 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
3457 use client::ToParts;
3458 let mut dd = client::DefaultDelegate;
3459 let mut dlg: &mut dyn client::Delegate = match self._delegate {
3460 Some(d) => d,
3461 None => &mut dd
3462 };
3463 dlg.begin(client::MethodInfo { id: "chat.spaces.members.list",
3464 http_method: hyper::Method::GET });
3465 let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
3466 params.push(("parent", self._parent.to_string()));
3467 if let Some(value) = self._page_token {
3468 params.push(("pageToken", value.to_string()));
3469 }
3470 if let Some(value) = self._page_size {
3471 params.push(("pageSize", value.to_string()));
3472 }
3473 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
3474 if self._additional_params.contains_key(field) {
3475 dlg.finished(false);
3476 return Err(client::Error::FieldClash(field));
3477 }
3478 }
3479 for (name, value) in self._additional_params.iter() {
3480 params.push((&name, value.clone()));
3481 }
3482
3483 params.push(("alt", "json".to_string()));
3484
3485 let mut url = self.hub._base_url.clone() + "v1/{+parent}/members";
3486
3487 let key = dlg.api_key();
3488 match key {
3489 Some(value) => params.push(("key", value)),
3490 None => {
3491 dlg.finished(false);
3492 return Err(client::Error::MissingAPIKey)
3493 }
3494 }
3495
3496 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3497 let mut replace_with = String::new();
3498 for &(name, ref value) in params.iter() {
3499 if name == param_name {
3500 replace_with = value.to_string();
3501 break;
3502 }
3503 }
3504 if find_this.as_bytes()[1] == '+' as u8 {
3505 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
3506 }
3507 url = url.replace(find_this, &replace_with);
3508 }
3509 {
3510 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
3511 for param_name in ["parent"].iter() {
3512 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
3513 indices_for_removal.push(index);
3514 }
3515 }
3516 for &index in indices_for_removal.iter() {
3517 params.remove(index);
3518 }
3519 }
3520
3521 let url = url::Url::parse_with_params(&url, params).unwrap();
3522
3523
3524
3525 loop {
3526 let mut req_result = {
3527 let client = &self.hub.client;
3528 dlg.pre_request();
3529 let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string())
3530 .header(USER_AGENT, self.hub._user_agent.clone());
3531
3532
3533 let request = req_builder
3534 .body(hyper::body::Body::empty());
3535
3536 client.request(request.unwrap()).await
3537
3538 };
3539
3540 match req_result {
3541 Err(err) => {
3542 if let client::Retry::After(d) = dlg.http_error(&err) {
3543 sleep(d);
3544 continue;
3545 }
3546 dlg.finished(false);
3547 return Err(client::Error::HttpError(err))
3548 }
3549 Ok(mut res) => {
3550 if !res.status().is_success() {
3551 let res_body_string = client::get_body_as_string(res.body_mut()).await;
3552
3553 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
3554 let server_error = json::from_str::<client::ServerError>(&res_body_string)
3555 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
3556 .ok();
3557
3558 if let client::Retry::After(d) = dlg.http_failure(&res,
3559 json_server_error,
3560 server_error) {
3561 sleep(d);
3562 continue;
3563 }
3564 dlg.finished(false);
3565 return match json::from_str::<client::ErrorResponse>(&res_body_string){
3566 Err(_) => Err(client::Error::Failure(res)),
3567 Ok(serr) => Err(client::Error::BadRequest(serr))
3568 }
3569 }
3570 let result_value = {
3571 let res_body_string = client::get_body_as_string(res.body_mut()).await;
3572
3573 match json::from_str(&res_body_string) {
3574 Ok(decoded) => (res, decoded),
3575 Err(err) => {
3576 dlg.response_json_decode_error(&res_body_string, &err);
3577 return Err(client::Error::JsonDecodeError(res_body_string, err));
3578 }
3579 }
3580 };
3581
3582 dlg.finished(true);
3583 return Ok(result_value)
3584 }
3585 }
3586 }
3587 }
3588
3589
3590 /// Required. The resource name of the space for which membership list is to be fetched, in the form "spaces/*". Example: spaces/AAAAMpdlehY
3591 ///
3592 /// Sets the *parent* path property to the given value.
3593 ///
3594 /// Even though the property as already been set when instantiating this call,
3595 /// we provide this method for API completeness.
3596 pub fn parent(mut self, new_value: &str) -> SpaceMemberListCall<'a> {
3597 self._parent = new_value.to_string();
3598 self
3599 }
3600 /// A token identifying a page of results the server should return.
3601 ///
3602 /// Sets the *page token* query property to the given value.
3603 pub fn page_token(mut self, new_value: &str) -> SpaceMemberListCall<'a> {
3604 self._page_token = Some(new_value.to_string());
3605 self
3606 }
3607 /// Requested page size. The value is capped at 1000. Server may return fewer results than requested. If unspecified, server will default to 100.
3608 ///
3609 /// Sets the *page size* query property to the given value.
3610 pub fn page_size(mut self, new_value: i32) -> SpaceMemberListCall<'a> {
3611 self._page_size = Some(new_value);
3612 self
3613 }
3614 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3615 /// while executing the actual API request.
3616 ///
3617 /// It should be used to handle progress information, and to implement a certain level of resilience.
3618 ///
3619 /// Sets the *delegate* property to the given value.
3620 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> SpaceMemberListCall<'a> {
3621 self._delegate = Some(new_value);
3622 self
3623 }
3624
3625 /// Set any additional parameter of the query string used in the request.
3626 /// It should be used to set parameters which are not yet available through their own
3627 /// setters.
3628 ///
3629 /// Please note that this method must not be used to set any of the known parameters
3630 /// which have their own setter method. If done anyway, the request will fail.
3631 ///
3632 /// # Additional Parameters
3633 ///
3634 /// * *$.xgafv* (query-string) - V1 error format.
3635 /// * *access_token* (query-string) - OAuth access token.
3636 /// * *alt* (query-string) - Data format for response.
3637 /// * *callback* (query-string) - JSONP
3638 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3639 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3640 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3641 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3642 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3643 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3644 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3645 pub fn param<T>(mut self, name: T, value: T) -> SpaceMemberListCall<'a>
3646 where T: AsRef<str> {
3647 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
3648 self
3649 }
3650
3651}
3652
3653
3654/// Gets the metadata of a message attachment. The attachment data is fetched using the media API.
3655///
3656/// A builder for the *messages.attachments.get* method supported by a *space* resource.
3657/// It is not used directly, but through a `SpaceMethods` instance.
3658///
3659/// # Example
3660///
3661/// Instantiate a resource method builder
3662///
3663/// ```test_harness,no_run
3664/// # extern crate hyper;
3665/// # extern crate hyper_rustls;
3666/// # extern crate yup_oauth2 as oauth2;
3667/// # extern crate google_chat1 as chat1;
3668/// # async fn dox() {
3669/// # use std::default::Default;
3670/// # use oauth2;
3671/// # use chat1::HangoutsChat;
3672///
3673/// # let secret: oauth2::ApplicationSecret = Default::default();
3674/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3675/// # secret,
3676/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3677/// # ).build().await.unwrap();
3678/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
3679/// // You can configure optional parameters by calling the respective setters at will, and
3680/// // execute the final call using `doit()`.
3681/// // Values shown here are possibly random and not representative !
3682/// let result = hub.spaces().messages_attachments_get("name")
3683/// .doit().await;
3684/// # }
3685/// ```
3686pub struct SpaceMessageAttachmentGetCall<'a>
3687 where {
3688
3689 hub: &'a HangoutsChat<>,
3690 _name: String,
3691 _delegate: Option<&'a mut dyn client::Delegate>,
3692 _additional_params: HashMap<String, String>,
3693}
3694
3695impl<'a> client::CallBuilder for SpaceMessageAttachmentGetCall<'a> {}
3696
3697impl<'a> SpaceMessageAttachmentGetCall<'a> {
3698
3699
3700 /// Perform the operation you have build so far.
3701 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Attachment)> {
3702 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
3703 use std::io::{Read, Seek};
3704 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
3705 use client::ToParts;
3706 let mut dd = client::DefaultDelegate;
3707 let mut dlg: &mut dyn client::Delegate = match self._delegate {
3708 Some(d) => d,
3709 None => &mut dd
3710 };
3711 dlg.begin(client::MethodInfo { id: "chat.spaces.messages.attachments.get",
3712 http_method: hyper::Method::GET });
3713 let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
3714 params.push(("name", self._name.to_string()));
3715 for &field in ["alt", "name"].iter() {
3716 if self._additional_params.contains_key(field) {
3717 dlg.finished(false);
3718 return Err(client::Error::FieldClash(field));
3719 }
3720 }
3721 for (name, value) in self._additional_params.iter() {
3722 params.push((&name, value.clone()));
3723 }
3724
3725 params.push(("alt", "json".to_string()));
3726
3727 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3728
3729 let key = dlg.api_key();
3730 match key {
3731 Some(value) => params.push(("key", value)),
3732 None => {
3733 dlg.finished(false);
3734 return Err(client::Error::MissingAPIKey)
3735 }
3736 }
3737
3738 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3739 let mut replace_with = String::new();
3740 for &(name, ref value) in params.iter() {
3741 if name == param_name {
3742 replace_with = value.to_string();
3743 break;
3744 }
3745 }
3746 if find_this.as_bytes()[1] == '+' as u8 {
3747 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
3748 }
3749 url = url.replace(find_this, &replace_with);
3750 }
3751 {
3752 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
3753 for param_name in ["name"].iter() {
3754 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
3755 indices_for_removal.push(index);
3756 }
3757 }
3758 for &index in indices_for_removal.iter() {
3759 params.remove(index);
3760 }
3761 }
3762
3763 let url = url::Url::parse_with_params(&url, params).unwrap();
3764
3765
3766
3767 loop {
3768 let mut req_result = {
3769 let client = &self.hub.client;
3770 dlg.pre_request();
3771 let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string())
3772 .header(USER_AGENT, self.hub._user_agent.clone());
3773
3774
3775 let request = req_builder
3776 .body(hyper::body::Body::empty());
3777
3778 client.request(request.unwrap()).await
3779
3780 };
3781
3782 match req_result {
3783 Err(err) => {
3784 if let client::Retry::After(d) = dlg.http_error(&err) {
3785 sleep(d);
3786 continue;
3787 }
3788 dlg.finished(false);
3789 return Err(client::Error::HttpError(err))
3790 }
3791 Ok(mut res) => {
3792 if !res.status().is_success() {
3793 let res_body_string = client::get_body_as_string(res.body_mut()).await;
3794
3795 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
3796 let server_error = json::from_str::<client::ServerError>(&res_body_string)
3797 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
3798 .ok();
3799
3800 if let client::Retry::After(d) = dlg.http_failure(&res,
3801 json_server_error,
3802 server_error) {
3803 sleep(d);
3804 continue;
3805 }
3806 dlg.finished(false);
3807 return match json::from_str::<client::ErrorResponse>(&res_body_string){
3808 Err(_) => Err(client::Error::Failure(res)),
3809 Ok(serr) => Err(client::Error::BadRequest(serr))
3810 }
3811 }
3812 let result_value = {
3813 let res_body_string = client::get_body_as_string(res.body_mut()).await;
3814
3815 match json::from_str(&res_body_string) {
3816 Ok(decoded) => (res, decoded),
3817 Err(err) => {
3818 dlg.response_json_decode_error(&res_body_string, &err);
3819 return Err(client::Error::JsonDecodeError(res_body_string, err));
3820 }
3821 }
3822 };
3823
3824 dlg.finished(true);
3825 return Ok(result_value)
3826 }
3827 }
3828 }
3829 }
3830
3831
3832 /// Resource name of the attachment, in the form "spaces/*/messages/*/attachments/*".
3833 ///
3834 /// Sets the *name* path property to the given value.
3835 ///
3836 /// Even though the property as already been set when instantiating this call,
3837 /// we provide this method for API completeness.
3838 pub fn name(mut self, new_value: &str) -> SpaceMessageAttachmentGetCall<'a> {
3839 self._name = new_value.to_string();
3840 self
3841 }
3842 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3843 /// while executing the actual API request.
3844 ///
3845 /// It should be used to handle progress information, and to implement a certain level of resilience.
3846 ///
3847 /// Sets the *delegate* property to the given value.
3848 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> SpaceMessageAttachmentGetCall<'a> {
3849 self._delegate = Some(new_value);
3850 self
3851 }
3852
3853 /// Set any additional parameter of the query string used in the request.
3854 /// It should be used to set parameters which are not yet available through their own
3855 /// setters.
3856 ///
3857 /// Please note that this method must not be used to set any of the known parameters
3858 /// which have their own setter method. If done anyway, the request will fail.
3859 ///
3860 /// # Additional Parameters
3861 ///
3862 /// * *$.xgafv* (query-string) - V1 error format.
3863 /// * *access_token* (query-string) - OAuth access token.
3864 /// * *alt* (query-string) - Data format for response.
3865 /// * *callback* (query-string) - JSONP
3866 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3867 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3868 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3869 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3870 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3871 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3872 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3873 pub fn param<T>(mut self, name: T, value: T) -> SpaceMessageAttachmentGetCall<'a>
3874 where T: AsRef<str> {
3875 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
3876 self
3877 }
3878
3879}
3880
3881
3882/// Creates a message.
3883///
3884/// A builder for the *messages.create* method supported by a *space* resource.
3885/// It is not used directly, but through a `SpaceMethods` instance.
3886///
3887/// # Example
3888///
3889/// Instantiate a resource method builder
3890///
3891/// ```test_harness,no_run
3892/// # extern crate hyper;
3893/// # extern crate hyper_rustls;
3894/// # extern crate yup_oauth2 as oauth2;
3895/// # extern crate google_chat1 as chat1;
3896/// use chat1::api::Message;
3897/// # async fn dox() {
3898/// # use std::default::Default;
3899/// # use oauth2;
3900/// # use chat1::HangoutsChat;
3901///
3902/// # let secret: oauth2::ApplicationSecret = Default::default();
3903/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3904/// # secret,
3905/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3906/// # ).build().await.unwrap();
3907/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
3908/// // As the method needs a request, you would usually fill it with the desired information
3909/// // into the respective structure. Some of the parts shown here might not be applicable !
3910/// // Values shown here are possibly random and not representative !
3911/// let mut req = Message::default();
3912///
3913/// // You can configure optional parameters by calling the respective setters at will, and
3914/// // execute the final call using `doit()`.
3915/// // Values shown here are possibly random and not representative !
3916/// let result = hub.spaces().messages_create(req, "parent")
3917/// .thread_key("ut")
3918/// .doit().await;
3919/// # }
3920/// ```
3921pub struct SpaceMessageCreateCall<'a>
3922 where {
3923
3924 hub: &'a HangoutsChat<>,
3925 _request: Message,
3926 _parent: String,
3927 _thread_key: Option<String>,
3928 _delegate: Option<&'a mut dyn client::Delegate>,
3929 _additional_params: HashMap<String, String>,
3930}
3931
3932impl<'a> client::CallBuilder for SpaceMessageCreateCall<'a> {}
3933
3934impl<'a> SpaceMessageCreateCall<'a> {
3935
3936
3937 /// Perform the operation you have build so far.
3938 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Message)> {
3939 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
3940 use std::io::{Read, Seek};
3941 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
3942 use client::ToParts;
3943 let mut dd = client::DefaultDelegate;
3944 let mut dlg: &mut dyn client::Delegate = match self._delegate {
3945 Some(d) => d,
3946 None => &mut dd
3947 };
3948 dlg.begin(client::MethodInfo { id: "chat.spaces.messages.create",
3949 http_method: hyper::Method::POST });
3950 let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
3951 params.push(("parent", self._parent.to_string()));
3952 if let Some(value) = self._thread_key {
3953 params.push(("threadKey", value.to_string()));
3954 }
3955 for &field in ["alt", "parent", "threadKey"].iter() {
3956 if self._additional_params.contains_key(field) {
3957 dlg.finished(false);
3958 return Err(client::Error::FieldClash(field));
3959 }
3960 }
3961 for (name, value) in self._additional_params.iter() {
3962 params.push((&name, value.clone()));
3963 }
3964
3965 params.push(("alt", "json".to_string()));
3966
3967 let mut url = self.hub._base_url.clone() + "v1/{+parent}/messages";
3968
3969 let key = dlg.api_key();
3970 match key {
3971 Some(value) => params.push(("key", value)),
3972 None => {
3973 dlg.finished(false);
3974 return Err(client::Error::MissingAPIKey)
3975 }
3976 }
3977
3978 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3979 let mut replace_with = String::new();
3980 for &(name, ref value) in params.iter() {
3981 if name == param_name {
3982 replace_with = value.to_string();
3983 break;
3984 }
3985 }
3986 if find_this.as_bytes()[1] == '+' as u8 {
3987 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
3988 }
3989 url = url.replace(find_this, &replace_with);
3990 }
3991 {
3992 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
3993 for param_name in ["parent"].iter() {
3994 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
3995 indices_for_removal.push(index);
3996 }
3997 }
3998 for &index in indices_for_removal.iter() {
3999 params.remove(index);
4000 }
4001 }
4002
4003 let url = url::Url::parse_with_params(&url, params).unwrap();
4004
4005 let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
4006 let mut request_value_reader =
4007 {
4008 let mut value = json::value::to_value(&self._request).expect("serde to work");
4009 client::remove_json_null_values(&mut value);
4010 let mut dst = io::Cursor::new(Vec::with_capacity(128));
4011 json::to_writer(&mut dst, &value).unwrap();
4012 dst
4013 };
4014 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
4015 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
4016
4017
4018 loop {
4019 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
4020 let mut req_result = {
4021 let client = &self.hub.client;
4022 dlg.pre_request();
4023 let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string())
4024 .header(USER_AGENT, self.hub._user_agent.clone());
4025
4026
4027 let request = req_builder
4028 .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
4029 .header(CONTENT_LENGTH, request_size as u64)
4030 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
4031
4032 client.request(request.unwrap()).await
4033
4034 };
4035
4036 match req_result {
4037 Err(err) => {
4038 if let client::Retry::After(d) = dlg.http_error(&err) {
4039 sleep(d);
4040 continue;
4041 }
4042 dlg.finished(false);
4043 return Err(client::Error::HttpError(err))
4044 }
4045 Ok(mut res) => {
4046 if !res.status().is_success() {
4047 let res_body_string = client::get_body_as_string(res.body_mut()).await;
4048
4049 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
4050 let server_error = json::from_str::<client::ServerError>(&res_body_string)
4051 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
4052 .ok();
4053
4054 if let client::Retry::After(d) = dlg.http_failure(&res,
4055 json_server_error,
4056 server_error) {
4057 sleep(d);
4058 continue;
4059 }
4060 dlg.finished(false);
4061 return match json::from_str::<client::ErrorResponse>(&res_body_string){
4062 Err(_) => Err(client::Error::Failure(res)),
4063 Ok(serr) => Err(client::Error::BadRequest(serr))
4064 }
4065 }
4066 let result_value = {
4067 let res_body_string = client::get_body_as_string(res.body_mut()).await;
4068
4069 match json::from_str(&res_body_string) {
4070 Ok(decoded) => (res, decoded),
4071 Err(err) => {
4072 dlg.response_json_decode_error(&res_body_string, &err);
4073 return Err(client::Error::JsonDecodeError(res_body_string, err));
4074 }
4075 }
4076 };
4077
4078 dlg.finished(true);
4079 return Ok(result_value)
4080 }
4081 }
4082 }
4083 }
4084
4085
4086 ///
4087 /// Sets the *request* property to the given value.
4088 ///
4089 /// Even though the property as already been set when instantiating this call,
4090 /// we provide this method for API completeness.
4091 pub fn request(mut self, new_value: Message) -> SpaceMessageCreateCall<'a> {
4092 self._request = new_value;
4093 self
4094 }
4095 /// Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
4096 ///
4097 /// Sets the *parent* path property to the given value.
4098 ///
4099 /// Even though the property as already been set when instantiating this call,
4100 /// we provide this method for API completeness.
4101 pub fn parent(mut self, new_value: &str) -> SpaceMessageCreateCall<'a> {
4102 self._parent = new_value.to_string();
4103 self
4104 }
4105 /// Opaque thread identifier string that can be specified to group messages into a single thread. If this is the first message with a given thread identifier, a new thread is created. Subsequent messages with the same thread identifier will be posted into the same thread. This relieves bots and webhooks from having to store the Hangouts Chat thread ID of a thread (created earlier by them) to post further updates to it. Has no effect if thread field, corresponding to an existing thread, is set in message.
4106 ///
4107 /// Sets the *thread key* query property to the given value.
4108 pub fn thread_key(mut self, new_value: &str) -> SpaceMessageCreateCall<'a> {
4109 self._thread_key = Some(new_value.to_string());
4110 self
4111 }
4112 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4113 /// while executing the actual API request.
4114 ///
4115 /// It should be used to handle progress information, and to implement a certain level of resilience.
4116 ///
4117 /// Sets the *delegate* property to the given value.
4118 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> SpaceMessageCreateCall<'a> {
4119 self._delegate = Some(new_value);
4120 self
4121 }
4122
4123 /// Set any additional parameter of the query string used in the request.
4124 /// It should be used to set parameters which are not yet available through their own
4125 /// setters.
4126 ///
4127 /// Please note that this method must not be used to set any of the known parameters
4128 /// which have their own setter method. If done anyway, the request will fail.
4129 ///
4130 /// # Additional Parameters
4131 ///
4132 /// * *$.xgafv* (query-string) - V1 error format.
4133 /// * *access_token* (query-string) - OAuth access token.
4134 /// * *alt* (query-string) - Data format for response.
4135 /// * *callback* (query-string) - JSONP
4136 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4137 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4138 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4139 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4140 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4141 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4142 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4143 pub fn param<T>(mut self, name: T, value: T) -> SpaceMessageCreateCall<'a>
4144 where T: AsRef<str> {
4145 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
4146 self
4147 }
4148
4149}
4150
4151
4152/// Deletes a message.
4153///
4154/// A builder for the *messages.delete* method supported by a *space* resource.
4155/// It is not used directly, but through a `SpaceMethods` instance.
4156///
4157/// # Example
4158///
4159/// Instantiate a resource method builder
4160///
4161/// ```test_harness,no_run
4162/// # extern crate hyper;
4163/// # extern crate hyper_rustls;
4164/// # extern crate yup_oauth2 as oauth2;
4165/// # extern crate google_chat1 as chat1;
4166/// # async fn dox() {
4167/// # use std::default::Default;
4168/// # use oauth2;
4169/// # use chat1::HangoutsChat;
4170///
4171/// # let secret: oauth2::ApplicationSecret = Default::default();
4172/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4173/// # secret,
4174/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4175/// # ).build().await.unwrap();
4176/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
4177/// // You can configure optional parameters by calling the respective setters at will, and
4178/// // execute the final call using `doit()`.
4179/// // Values shown here are possibly random and not representative !
4180/// let result = hub.spaces().messages_delete("name")
4181/// .doit().await;
4182/// # }
4183/// ```
4184pub struct SpaceMessageDeleteCall<'a>
4185 where {
4186
4187 hub: &'a HangoutsChat<>,
4188 _name: String,
4189 _delegate: Option<&'a mut dyn client::Delegate>,
4190 _additional_params: HashMap<String, String>,
4191}
4192
4193impl<'a> client::CallBuilder for SpaceMessageDeleteCall<'a> {}
4194
4195impl<'a> SpaceMessageDeleteCall<'a> {
4196
4197
4198 /// Perform the operation you have build so far.
4199 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Empty)> {
4200 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
4201 use std::io::{Read, Seek};
4202 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
4203 use client::ToParts;
4204 let mut dd = client::DefaultDelegate;
4205 let mut dlg: &mut dyn client::Delegate = match self._delegate {
4206 Some(d) => d,
4207 None => &mut dd
4208 };
4209 dlg.begin(client::MethodInfo { id: "chat.spaces.messages.delete",
4210 http_method: hyper::Method::DELETE });
4211 let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
4212 params.push(("name", self._name.to_string()));
4213 for &field in ["alt", "name"].iter() {
4214 if self._additional_params.contains_key(field) {
4215 dlg.finished(false);
4216 return Err(client::Error::FieldClash(field));
4217 }
4218 }
4219 for (name, value) in self._additional_params.iter() {
4220 params.push((&name, value.clone()));
4221 }
4222
4223 params.push(("alt", "json".to_string()));
4224
4225 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4226
4227 let key = dlg.api_key();
4228 match key {
4229 Some(value) => params.push(("key", value)),
4230 None => {
4231 dlg.finished(false);
4232 return Err(client::Error::MissingAPIKey)
4233 }
4234 }
4235
4236 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4237 let mut replace_with = String::new();
4238 for &(name, ref value) in params.iter() {
4239 if name == param_name {
4240 replace_with = value.to_string();
4241 break;
4242 }
4243 }
4244 if find_this.as_bytes()[1] == '+' as u8 {
4245 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
4246 }
4247 url = url.replace(find_this, &replace_with);
4248 }
4249 {
4250 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
4251 for param_name in ["name"].iter() {
4252 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
4253 indices_for_removal.push(index);
4254 }
4255 }
4256 for &index in indices_for_removal.iter() {
4257 params.remove(index);
4258 }
4259 }
4260
4261 let url = url::Url::parse_with_params(&url, params).unwrap();
4262
4263
4264
4265 loop {
4266 let mut req_result = {
4267 let client = &self.hub.client;
4268 dlg.pre_request();
4269 let mut req_builder = hyper::Request::builder().method(hyper::Method::DELETE).uri(url.clone().into_string())
4270 .header(USER_AGENT, self.hub._user_agent.clone());
4271
4272
4273 let request = req_builder
4274 .body(hyper::body::Body::empty());
4275
4276 client.request(request.unwrap()).await
4277
4278 };
4279
4280 match req_result {
4281 Err(err) => {
4282 if let client::Retry::After(d) = dlg.http_error(&err) {
4283 sleep(d);
4284 continue;
4285 }
4286 dlg.finished(false);
4287 return Err(client::Error::HttpError(err))
4288 }
4289 Ok(mut res) => {
4290 if !res.status().is_success() {
4291 let res_body_string = client::get_body_as_string(res.body_mut()).await;
4292
4293 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
4294 let server_error = json::from_str::<client::ServerError>(&res_body_string)
4295 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
4296 .ok();
4297
4298 if let client::Retry::After(d) = dlg.http_failure(&res,
4299 json_server_error,
4300 server_error) {
4301 sleep(d);
4302 continue;
4303 }
4304 dlg.finished(false);
4305 return match json::from_str::<client::ErrorResponse>(&res_body_string){
4306 Err(_) => Err(client::Error::Failure(res)),
4307 Ok(serr) => Err(client::Error::BadRequest(serr))
4308 }
4309 }
4310 let result_value = {
4311 let res_body_string = client::get_body_as_string(res.body_mut()).await;
4312
4313 match json::from_str(&res_body_string) {
4314 Ok(decoded) => (res, decoded),
4315 Err(err) => {
4316 dlg.response_json_decode_error(&res_body_string, &err);
4317 return Err(client::Error::JsonDecodeError(res_body_string, err));
4318 }
4319 }
4320 };
4321
4322 dlg.finished(true);
4323 return Ok(result_value)
4324 }
4325 }
4326 }
4327 }
4328
4329
4330 /// Required. Resource name of the message to be deleted, in the form "spaces/*/messages/*" Example: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4
4331 ///
4332 /// Sets the *name* path property to the given value.
4333 ///
4334 /// Even though the property as already been set when instantiating this call,
4335 /// we provide this method for API completeness.
4336 pub fn name(mut self, new_value: &str) -> SpaceMessageDeleteCall<'a> {
4337 self._name = new_value.to_string();
4338 self
4339 }
4340 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4341 /// while executing the actual API request.
4342 ///
4343 /// It should be used to handle progress information, and to implement a certain level of resilience.
4344 ///
4345 /// Sets the *delegate* property to the given value.
4346 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> SpaceMessageDeleteCall<'a> {
4347 self._delegate = Some(new_value);
4348 self
4349 }
4350
4351 /// Set any additional parameter of the query string used in the request.
4352 /// It should be used to set parameters which are not yet available through their own
4353 /// setters.
4354 ///
4355 /// Please note that this method must not be used to set any of the known parameters
4356 /// which have their own setter method. If done anyway, the request will fail.
4357 ///
4358 /// # Additional Parameters
4359 ///
4360 /// * *$.xgafv* (query-string) - V1 error format.
4361 /// * *access_token* (query-string) - OAuth access token.
4362 /// * *alt* (query-string) - Data format for response.
4363 /// * *callback* (query-string) - JSONP
4364 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4365 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4366 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4367 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4368 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4369 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4370 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4371 pub fn param<T>(mut self, name: T, value: T) -> SpaceMessageDeleteCall<'a>
4372 where T: AsRef<str> {
4373 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
4374 self
4375 }
4376
4377}
4378
4379
4380/// Returns a message.
4381///
4382/// A builder for the *messages.get* method supported by a *space* resource.
4383/// It is not used directly, but through a `SpaceMethods` instance.
4384///
4385/// # Example
4386///
4387/// Instantiate a resource method builder
4388///
4389/// ```test_harness,no_run
4390/// # extern crate hyper;
4391/// # extern crate hyper_rustls;
4392/// # extern crate yup_oauth2 as oauth2;
4393/// # extern crate google_chat1 as chat1;
4394/// # async fn dox() {
4395/// # use std::default::Default;
4396/// # use oauth2;
4397/// # use chat1::HangoutsChat;
4398///
4399/// # let secret: oauth2::ApplicationSecret = Default::default();
4400/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4401/// # secret,
4402/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4403/// # ).build().await.unwrap();
4404/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
4405/// // You can configure optional parameters by calling the respective setters at will, and
4406/// // execute the final call using `doit()`.
4407/// // Values shown here are possibly random and not representative !
4408/// let result = hub.spaces().messages_get("name")
4409/// .doit().await;
4410/// # }
4411/// ```
4412pub struct SpaceMessageGetCall<'a>
4413 where {
4414
4415 hub: &'a HangoutsChat<>,
4416 _name: String,
4417 _delegate: Option<&'a mut dyn client::Delegate>,
4418 _additional_params: HashMap<String, String>,
4419}
4420
4421impl<'a> client::CallBuilder for SpaceMessageGetCall<'a> {}
4422
4423impl<'a> SpaceMessageGetCall<'a> {
4424
4425
4426 /// Perform the operation you have build so far.
4427 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Message)> {
4428 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
4429 use std::io::{Read, Seek};
4430 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
4431 use client::ToParts;
4432 let mut dd = client::DefaultDelegate;
4433 let mut dlg: &mut dyn client::Delegate = match self._delegate {
4434 Some(d) => d,
4435 None => &mut dd
4436 };
4437 dlg.begin(client::MethodInfo { id: "chat.spaces.messages.get",
4438 http_method: hyper::Method::GET });
4439 let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
4440 params.push(("name", self._name.to_string()));
4441 for &field in ["alt", "name"].iter() {
4442 if self._additional_params.contains_key(field) {
4443 dlg.finished(false);
4444 return Err(client::Error::FieldClash(field));
4445 }
4446 }
4447 for (name, value) in self._additional_params.iter() {
4448 params.push((&name, value.clone()));
4449 }
4450
4451 params.push(("alt", "json".to_string()));
4452
4453 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4454
4455 let key = dlg.api_key();
4456 match key {
4457 Some(value) => params.push(("key", value)),
4458 None => {
4459 dlg.finished(false);
4460 return Err(client::Error::MissingAPIKey)
4461 }
4462 }
4463
4464 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4465 let mut replace_with = String::new();
4466 for &(name, ref value) in params.iter() {
4467 if name == param_name {
4468 replace_with = value.to_string();
4469 break;
4470 }
4471 }
4472 if find_this.as_bytes()[1] == '+' as u8 {
4473 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
4474 }
4475 url = url.replace(find_this, &replace_with);
4476 }
4477 {
4478 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
4479 for param_name in ["name"].iter() {
4480 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
4481 indices_for_removal.push(index);
4482 }
4483 }
4484 for &index in indices_for_removal.iter() {
4485 params.remove(index);
4486 }
4487 }
4488
4489 let url = url::Url::parse_with_params(&url, params).unwrap();
4490
4491
4492
4493 loop {
4494 let mut req_result = {
4495 let client = &self.hub.client;
4496 dlg.pre_request();
4497 let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string())
4498 .header(USER_AGENT, self.hub._user_agent.clone());
4499
4500
4501 let request = req_builder
4502 .body(hyper::body::Body::empty());
4503
4504 client.request(request.unwrap()).await
4505
4506 };
4507
4508 match req_result {
4509 Err(err) => {
4510 if let client::Retry::After(d) = dlg.http_error(&err) {
4511 sleep(d);
4512 continue;
4513 }
4514 dlg.finished(false);
4515 return Err(client::Error::HttpError(err))
4516 }
4517 Ok(mut res) => {
4518 if !res.status().is_success() {
4519 let res_body_string = client::get_body_as_string(res.body_mut()).await;
4520
4521 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
4522 let server_error = json::from_str::<client::ServerError>(&res_body_string)
4523 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
4524 .ok();
4525
4526 if let client::Retry::After(d) = dlg.http_failure(&res,
4527 json_server_error,
4528 server_error) {
4529 sleep(d);
4530 continue;
4531 }
4532 dlg.finished(false);
4533 return match json::from_str::<client::ErrorResponse>(&res_body_string){
4534 Err(_) => Err(client::Error::Failure(res)),
4535 Ok(serr) => Err(client::Error::BadRequest(serr))
4536 }
4537 }
4538 let result_value = {
4539 let res_body_string = client::get_body_as_string(res.body_mut()).await;
4540
4541 match json::from_str(&res_body_string) {
4542 Ok(decoded) => (res, decoded),
4543 Err(err) => {
4544 dlg.response_json_decode_error(&res_body_string, &err);
4545 return Err(client::Error::JsonDecodeError(res_body_string, err));
4546 }
4547 }
4548 };
4549
4550 dlg.finished(true);
4551 return Ok(result_value)
4552 }
4553 }
4554 }
4555 }
4556
4557
4558 /// Required. Resource name of the message to be retrieved, in the form "spaces/*/messages/*". Example: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4
4559 ///
4560 /// Sets the *name* path property to the given value.
4561 ///
4562 /// Even though the property as already been set when instantiating this call,
4563 /// we provide this method for API completeness.
4564 pub fn name(mut self, new_value: &str) -> SpaceMessageGetCall<'a> {
4565 self._name = new_value.to_string();
4566 self
4567 }
4568 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4569 /// while executing the actual API request.
4570 ///
4571 /// It should be used to handle progress information, and to implement a certain level of resilience.
4572 ///
4573 /// Sets the *delegate* property to the given value.
4574 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> SpaceMessageGetCall<'a> {
4575 self._delegate = Some(new_value);
4576 self
4577 }
4578
4579 /// Set any additional parameter of the query string used in the request.
4580 /// It should be used to set parameters which are not yet available through their own
4581 /// setters.
4582 ///
4583 /// Please note that this method must not be used to set any of the known parameters
4584 /// which have their own setter method. If done anyway, the request will fail.
4585 ///
4586 /// # Additional Parameters
4587 ///
4588 /// * *$.xgafv* (query-string) - V1 error format.
4589 /// * *access_token* (query-string) - OAuth access token.
4590 /// * *alt* (query-string) - Data format for response.
4591 /// * *callback* (query-string) - JSONP
4592 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4593 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4594 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4595 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4596 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4597 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4598 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4599 pub fn param<T>(mut self, name: T, value: T) -> SpaceMessageGetCall<'a>
4600 where T: AsRef<str> {
4601 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
4602 self
4603 }
4604
4605}
4606
4607
4608/// Updates a message.
4609///
4610/// A builder for the *messages.update* method supported by a *space* resource.
4611/// It is not used directly, but through a `SpaceMethods` instance.
4612///
4613/// # Example
4614///
4615/// Instantiate a resource method builder
4616///
4617/// ```test_harness,no_run
4618/// # extern crate hyper;
4619/// # extern crate hyper_rustls;
4620/// # extern crate yup_oauth2 as oauth2;
4621/// # extern crate google_chat1 as chat1;
4622/// use chat1::api::Message;
4623/// # async fn dox() {
4624/// # use std::default::Default;
4625/// # use oauth2;
4626/// # use chat1::HangoutsChat;
4627///
4628/// # let secret: oauth2::ApplicationSecret = Default::default();
4629/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4630/// # secret,
4631/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4632/// # ).build().await.unwrap();
4633/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
4634/// // As the method needs a request, you would usually fill it with the desired information
4635/// // into the respective structure. Some of the parts shown here might not be applicable !
4636/// // Values shown here are possibly random and not representative !
4637/// let mut req = Message::default();
4638///
4639/// // You can configure optional parameters by calling the respective setters at will, and
4640/// // execute the final call using `doit()`.
4641/// // Values shown here are possibly random and not representative !
4642/// let result = hub.spaces().messages_update(req, "name")
4643/// .update_mask("ipsum")
4644/// .doit().await;
4645/// # }
4646/// ```
4647pub struct SpaceMessageUpdateCall<'a>
4648 where {
4649
4650 hub: &'a HangoutsChat<>,
4651 _request: Message,
4652 _name: String,
4653 _update_mask: Option<String>,
4654 _delegate: Option<&'a mut dyn client::Delegate>,
4655 _additional_params: HashMap<String, String>,
4656}
4657
4658impl<'a> client::CallBuilder for SpaceMessageUpdateCall<'a> {}
4659
4660impl<'a> SpaceMessageUpdateCall<'a> {
4661
4662
4663 /// Perform the operation you have build so far.
4664 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Message)> {
4665 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
4666 use std::io::{Read, Seek};
4667 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
4668 use client::ToParts;
4669 let mut dd = client::DefaultDelegate;
4670 let mut dlg: &mut dyn client::Delegate = match self._delegate {
4671 Some(d) => d,
4672 None => &mut dd
4673 };
4674 dlg.begin(client::MethodInfo { id: "chat.spaces.messages.update",
4675 http_method: hyper::Method::PUT });
4676 let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
4677 params.push(("name", self._name.to_string()));
4678 if let Some(value) = self._update_mask {
4679 params.push(("updateMask", value.to_string()));
4680 }
4681 for &field in ["alt", "name", "updateMask"].iter() {
4682 if self._additional_params.contains_key(field) {
4683 dlg.finished(false);
4684 return Err(client::Error::FieldClash(field));
4685 }
4686 }
4687 for (name, value) in self._additional_params.iter() {
4688 params.push((&name, value.clone()));
4689 }
4690
4691 params.push(("alt", "json".to_string()));
4692
4693 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4694
4695 let key = dlg.api_key();
4696 match key {
4697 Some(value) => params.push(("key", value)),
4698 None => {
4699 dlg.finished(false);
4700 return Err(client::Error::MissingAPIKey)
4701 }
4702 }
4703
4704 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4705 let mut replace_with = String::new();
4706 for &(name, ref value) in params.iter() {
4707 if name == param_name {
4708 replace_with = value.to_string();
4709 break;
4710 }
4711 }
4712 if find_this.as_bytes()[1] == '+' as u8 {
4713 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
4714 }
4715 url = url.replace(find_this, &replace_with);
4716 }
4717 {
4718 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
4719 for param_name in ["name"].iter() {
4720 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
4721 indices_for_removal.push(index);
4722 }
4723 }
4724 for &index in indices_for_removal.iter() {
4725 params.remove(index);
4726 }
4727 }
4728
4729 let url = url::Url::parse_with_params(&url, params).unwrap();
4730
4731 let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
4732 let mut request_value_reader =
4733 {
4734 let mut value = json::value::to_value(&self._request).expect("serde to work");
4735 client::remove_json_null_values(&mut value);
4736 let mut dst = io::Cursor::new(Vec::with_capacity(128));
4737 json::to_writer(&mut dst, &value).unwrap();
4738 dst
4739 };
4740 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
4741 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
4742
4743
4744 loop {
4745 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
4746 let mut req_result = {
4747 let client = &self.hub.client;
4748 dlg.pre_request();
4749 let mut req_builder = hyper::Request::builder().method(hyper::Method::PUT).uri(url.clone().into_string())
4750 .header(USER_AGENT, self.hub._user_agent.clone());
4751
4752
4753 let request = req_builder
4754 .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
4755 .header(CONTENT_LENGTH, request_size as u64)
4756 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
4757
4758 client.request(request.unwrap()).await
4759
4760 };
4761
4762 match req_result {
4763 Err(err) => {
4764 if let client::Retry::After(d) = dlg.http_error(&err) {
4765 sleep(d);
4766 continue;
4767 }
4768 dlg.finished(false);
4769 return Err(client::Error::HttpError(err))
4770 }
4771 Ok(mut res) => {
4772 if !res.status().is_success() {
4773 let res_body_string = client::get_body_as_string(res.body_mut()).await;
4774
4775 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
4776 let server_error = json::from_str::<client::ServerError>(&res_body_string)
4777 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
4778 .ok();
4779
4780 if let client::Retry::After(d) = dlg.http_failure(&res,
4781 json_server_error,
4782 server_error) {
4783 sleep(d);
4784 continue;
4785 }
4786 dlg.finished(false);
4787 return match json::from_str::<client::ErrorResponse>(&res_body_string){
4788 Err(_) => Err(client::Error::Failure(res)),
4789 Ok(serr) => Err(client::Error::BadRequest(serr))
4790 }
4791 }
4792 let result_value = {
4793 let res_body_string = client::get_body_as_string(res.body_mut()).await;
4794
4795 match json::from_str(&res_body_string) {
4796 Ok(decoded) => (res, decoded),
4797 Err(err) => {
4798 dlg.response_json_decode_error(&res_body_string, &err);
4799 return Err(client::Error::JsonDecodeError(res_body_string, err));
4800 }
4801 }
4802 };
4803
4804 dlg.finished(true);
4805 return Ok(result_value)
4806 }
4807 }
4808 }
4809 }
4810
4811
4812 ///
4813 /// Sets the *request* property to the given value.
4814 ///
4815 /// Even though the property as already been set when instantiating this call,
4816 /// we provide this method for API completeness.
4817 pub fn request(mut self, new_value: Message) -> SpaceMessageUpdateCall<'a> {
4818 self._request = new_value;
4819 self
4820 }
4821 ///
4822 /// Sets the *name* path property to the given value.
4823 ///
4824 /// Even though the property as already been set when instantiating this call,
4825 /// we provide this method for API completeness.
4826 pub fn name(mut self, new_value: &str) -> SpaceMessageUpdateCall<'a> {
4827 self._name = new_value.to_string();
4828 self
4829 }
4830 /// Required. The field paths to be updated, comma separated if there are multiple. Currently supported field paths: * text * cards
4831 ///
4832 /// Sets the *update mask* query property to the given value.
4833 pub fn update_mask(mut self, new_value: &str) -> SpaceMessageUpdateCall<'a> {
4834 self._update_mask = Some(new_value.to_string());
4835 self
4836 }
4837 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4838 /// while executing the actual API request.
4839 ///
4840 /// It should be used to handle progress information, and to implement a certain level of resilience.
4841 ///
4842 /// Sets the *delegate* property to the given value.
4843 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> SpaceMessageUpdateCall<'a> {
4844 self._delegate = Some(new_value);
4845 self
4846 }
4847
4848 /// Set any additional parameter of the query string used in the request.
4849 /// It should be used to set parameters which are not yet available through their own
4850 /// setters.
4851 ///
4852 /// Please note that this method must not be used to set any of the known parameters
4853 /// which have their own setter method. If done anyway, the request will fail.
4854 ///
4855 /// # Additional Parameters
4856 ///
4857 /// * *$.xgafv* (query-string) - V1 error format.
4858 /// * *access_token* (query-string) - OAuth access token.
4859 /// * *alt* (query-string) - Data format for response.
4860 /// * *callback* (query-string) - JSONP
4861 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4862 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4863 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4864 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4865 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4866 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4867 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4868 pub fn param<T>(mut self, name: T, value: T) -> SpaceMessageUpdateCall<'a>
4869 where T: AsRef<str> {
4870 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
4871 self
4872 }
4873
4874}
4875
4876
4877/// Returns a space.
4878///
4879/// A builder for the *get* method supported by a *space* resource.
4880/// It is not used directly, but through a `SpaceMethods` instance.
4881///
4882/// # Example
4883///
4884/// Instantiate a resource method builder
4885///
4886/// ```test_harness,no_run
4887/// # extern crate hyper;
4888/// # extern crate hyper_rustls;
4889/// # extern crate yup_oauth2 as oauth2;
4890/// # extern crate google_chat1 as chat1;
4891/// # async fn dox() {
4892/// # use std::default::Default;
4893/// # use oauth2;
4894/// # use chat1::HangoutsChat;
4895///
4896/// # let secret: oauth2::ApplicationSecret = Default::default();
4897/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4898/// # secret,
4899/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4900/// # ).build().await.unwrap();
4901/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
4902/// // You can configure optional parameters by calling the respective setters at will, and
4903/// // execute the final call using `doit()`.
4904/// // Values shown here are possibly random and not representative !
4905/// let result = hub.spaces().get("name")
4906/// .doit().await;
4907/// # }
4908/// ```
4909pub struct SpaceGetCall<'a>
4910 where {
4911
4912 hub: &'a HangoutsChat<>,
4913 _name: String,
4914 _delegate: Option<&'a mut dyn client::Delegate>,
4915 _additional_params: HashMap<String, String>,
4916}
4917
4918impl<'a> client::CallBuilder for SpaceGetCall<'a> {}
4919
4920impl<'a> SpaceGetCall<'a> {
4921
4922
4923 /// Perform the operation you have build so far.
4924 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Space)> {
4925 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
4926 use std::io::{Read, Seek};
4927 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
4928 use client::ToParts;
4929 let mut dd = client::DefaultDelegate;
4930 let mut dlg: &mut dyn client::Delegate = match self._delegate {
4931 Some(d) => d,
4932 None => &mut dd
4933 };
4934 dlg.begin(client::MethodInfo { id: "chat.spaces.get",
4935 http_method: hyper::Method::GET });
4936 let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
4937 params.push(("name", self._name.to_string()));
4938 for &field in ["alt", "name"].iter() {
4939 if self._additional_params.contains_key(field) {
4940 dlg.finished(false);
4941 return Err(client::Error::FieldClash(field));
4942 }
4943 }
4944 for (name, value) in self._additional_params.iter() {
4945 params.push((&name, value.clone()));
4946 }
4947
4948 params.push(("alt", "json".to_string()));
4949
4950 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4951
4952 let key = dlg.api_key();
4953 match key {
4954 Some(value) => params.push(("key", value)),
4955 None => {
4956 dlg.finished(false);
4957 return Err(client::Error::MissingAPIKey)
4958 }
4959 }
4960
4961 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4962 let mut replace_with = String::new();
4963 for &(name, ref value) in params.iter() {
4964 if name == param_name {
4965 replace_with = value.to_string();
4966 break;
4967 }
4968 }
4969 if find_this.as_bytes()[1] == '+' as u8 {
4970 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
4971 }
4972 url = url.replace(find_this, &replace_with);
4973 }
4974 {
4975 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
4976 for param_name in ["name"].iter() {
4977 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
4978 indices_for_removal.push(index);
4979 }
4980 }
4981 for &index in indices_for_removal.iter() {
4982 params.remove(index);
4983 }
4984 }
4985
4986 let url = url::Url::parse_with_params(&url, params).unwrap();
4987
4988
4989
4990 loop {
4991 let mut req_result = {
4992 let client = &self.hub.client;
4993 dlg.pre_request();
4994 let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string())
4995 .header(USER_AGENT, self.hub._user_agent.clone());
4996
4997
4998 let request = req_builder
4999 .body(hyper::body::Body::empty());
5000
5001 client.request(request.unwrap()).await
5002
5003 };
5004
5005 match req_result {
5006 Err(err) => {
5007 if let client::Retry::After(d) = dlg.http_error(&err) {
5008 sleep(d);
5009 continue;
5010 }
5011 dlg.finished(false);
5012 return Err(client::Error::HttpError(err))
5013 }
5014 Ok(mut res) => {
5015 if !res.status().is_success() {
5016 let res_body_string = client::get_body_as_string(res.body_mut()).await;
5017
5018 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
5019 let server_error = json::from_str::<client::ServerError>(&res_body_string)
5020 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
5021 .ok();
5022
5023 if let client::Retry::After(d) = dlg.http_failure(&res,
5024 json_server_error,
5025 server_error) {
5026 sleep(d);
5027 continue;
5028 }
5029 dlg.finished(false);
5030 return match json::from_str::<client::ErrorResponse>(&res_body_string){
5031 Err(_) => Err(client::Error::Failure(res)),
5032 Ok(serr) => Err(client::Error::BadRequest(serr))
5033 }
5034 }
5035 let result_value = {
5036 let res_body_string = client::get_body_as_string(res.body_mut()).await;
5037
5038 match json::from_str(&res_body_string) {
5039 Ok(decoded) => (res, decoded),
5040 Err(err) => {
5041 dlg.response_json_decode_error(&res_body_string, &err);
5042 return Err(client::Error::JsonDecodeError(res_body_string, err));
5043 }
5044 }
5045 };
5046
5047 dlg.finished(true);
5048 return Ok(result_value)
5049 }
5050 }
5051 }
5052 }
5053
5054
5055 /// Required. Resource name of the space, in the form "spaces/*". Example: spaces/AAAAMpdlehY
5056 ///
5057 /// Sets the *name* path property to the given value.
5058 ///
5059 /// Even though the property as already been set when instantiating this call,
5060 /// we provide this method for API completeness.
5061 pub fn name(mut self, new_value: &str) -> SpaceGetCall<'a> {
5062 self._name = new_value.to_string();
5063 self
5064 }
5065 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5066 /// while executing the actual API request.
5067 ///
5068 /// It should be used to handle progress information, and to implement a certain level of resilience.
5069 ///
5070 /// Sets the *delegate* property to the given value.
5071 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> SpaceGetCall<'a> {
5072 self._delegate = Some(new_value);
5073 self
5074 }
5075
5076 /// Set any additional parameter of the query string used in the request.
5077 /// It should be used to set parameters which are not yet available through their own
5078 /// setters.
5079 ///
5080 /// Please note that this method must not be used to set any of the known parameters
5081 /// which have their own setter method. If done anyway, the request will fail.
5082 ///
5083 /// # Additional Parameters
5084 ///
5085 /// * *$.xgafv* (query-string) - V1 error format.
5086 /// * *access_token* (query-string) - OAuth access token.
5087 /// * *alt* (query-string) - Data format for response.
5088 /// * *callback* (query-string) - JSONP
5089 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5090 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5091 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5092 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5093 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5094 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5095 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5096 pub fn param<T>(mut self, name: T, value: T) -> SpaceGetCall<'a>
5097 where T: AsRef<str> {
5098 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
5099 self
5100 }
5101
5102}
5103
5104
5105/// Lists spaces the caller is a member of.
5106///
5107/// A builder for the *list* method supported by a *space* resource.
5108/// It is not used directly, but through a `SpaceMethods` instance.
5109///
5110/// # Example
5111///
5112/// Instantiate a resource method builder
5113///
5114/// ```test_harness,no_run
5115/// # extern crate hyper;
5116/// # extern crate hyper_rustls;
5117/// # extern crate yup_oauth2 as oauth2;
5118/// # extern crate google_chat1 as chat1;
5119/// # async fn dox() {
5120/// # use std::default::Default;
5121/// # use oauth2;
5122/// # use chat1::HangoutsChat;
5123///
5124/// # let secret: oauth2::ApplicationSecret = Default::default();
5125/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5126/// # secret,
5127/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5128/// # ).build().await.unwrap();
5129/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
5130/// // You can configure optional parameters by calling the respective setters at will, and
5131/// // execute the final call using `doit()`.
5132/// // Values shown here are possibly random and not representative !
5133/// let result = hub.spaces().list()
5134/// .page_token("est")
5135/// .page_size(-62)
5136/// .doit().await;
5137/// # }
5138/// ```
5139pub struct SpaceListCall<'a>
5140 where {
5141
5142 hub: &'a HangoutsChat<>,
5143 _page_token: Option<String>,
5144 _page_size: Option<i32>,
5145 _delegate: Option<&'a mut dyn client::Delegate>,
5146 _additional_params: HashMap<String, String>,
5147}
5148
5149impl<'a> client::CallBuilder for SpaceListCall<'a> {}
5150
5151impl<'a> SpaceListCall<'a> {
5152
5153
5154 /// Perform the operation you have build so far.
5155 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListSpacesResponse)> {
5156 use std::io::{Read, Seek};
5157 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
5158 use client::ToParts;
5159 let mut dd = client::DefaultDelegate;
5160 let mut dlg: &mut dyn client::Delegate = match self._delegate {
5161 Some(d) => d,
5162 None => &mut dd
5163 };
5164 dlg.begin(client::MethodInfo { id: "chat.spaces.list",
5165 http_method: hyper::Method::GET });
5166 let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
5167 if let Some(value) = self._page_token {
5168 params.push(("pageToken", value.to_string()));
5169 }
5170 if let Some(value) = self._page_size {
5171 params.push(("pageSize", value.to_string()));
5172 }
5173 for &field in ["alt", "pageToken", "pageSize"].iter() {
5174 if self._additional_params.contains_key(field) {
5175 dlg.finished(false);
5176 return Err(client::Error::FieldClash(field));
5177 }
5178 }
5179 for (name, value) in self._additional_params.iter() {
5180 params.push((&name, value.clone()));
5181 }
5182
5183 params.push(("alt", "json".to_string()));
5184
5185 let mut url = self.hub._base_url.clone() + "v1/spaces";
5186
5187 let key = dlg.api_key();
5188 match key {
5189 Some(value) => params.push(("key", value)),
5190 None => {
5191 dlg.finished(false);
5192 return Err(client::Error::MissingAPIKey)
5193 }
5194 }
5195
5196
5197 let url = url::Url::parse_with_params(&url, params).unwrap();
5198
5199
5200
5201 loop {
5202 let mut req_result = {
5203 let client = &self.hub.client;
5204 dlg.pre_request();
5205 let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string())
5206 .header(USER_AGENT, self.hub._user_agent.clone());
5207
5208
5209 let request = req_builder
5210 .body(hyper::body::Body::empty());
5211
5212 client.request(request.unwrap()).await
5213
5214 };
5215
5216 match req_result {
5217 Err(err) => {
5218 if let client::Retry::After(d) = dlg.http_error(&err) {
5219 sleep(d);
5220 continue;
5221 }
5222 dlg.finished(false);
5223 return Err(client::Error::HttpError(err))
5224 }
5225 Ok(mut res) => {
5226 if !res.status().is_success() {
5227 let res_body_string = client::get_body_as_string(res.body_mut()).await;
5228
5229 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
5230 let server_error = json::from_str::<client::ServerError>(&res_body_string)
5231 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
5232 .ok();
5233
5234 if let client::Retry::After(d) = dlg.http_failure(&res,
5235 json_server_error,
5236 server_error) {
5237 sleep(d);
5238 continue;
5239 }
5240 dlg.finished(false);
5241 return match json::from_str::<client::ErrorResponse>(&res_body_string){
5242 Err(_) => Err(client::Error::Failure(res)),
5243 Ok(serr) => Err(client::Error::BadRequest(serr))
5244 }
5245 }
5246 let result_value = {
5247 let res_body_string = client::get_body_as_string(res.body_mut()).await;
5248
5249 match json::from_str(&res_body_string) {
5250 Ok(decoded) => (res, decoded),
5251 Err(err) => {
5252 dlg.response_json_decode_error(&res_body_string, &err);
5253 return Err(client::Error::JsonDecodeError(res_body_string, err));
5254 }
5255 }
5256 };
5257
5258 dlg.finished(true);
5259 return Ok(result_value)
5260 }
5261 }
5262 }
5263 }
5264
5265
5266 /// A token identifying a page of results the server should return.
5267 ///
5268 /// Sets the *page token* query property to the given value.
5269 pub fn page_token(mut self, new_value: &str) -> SpaceListCall<'a> {
5270 self._page_token = Some(new_value.to_string());
5271 self
5272 }
5273 /// Requested page size. The value is capped at 1000. Server may return fewer results than requested. If unspecified, server will default to 100.
5274 ///
5275 /// Sets the *page size* query property to the given value.
5276 pub fn page_size(mut self, new_value: i32) -> SpaceListCall<'a> {
5277 self._page_size = Some(new_value);
5278 self
5279 }
5280 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5281 /// while executing the actual API request.
5282 ///
5283 /// It should be used to handle progress information, and to implement a certain level of resilience.
5284 ///
5285 /// Sets the *delegate* property to the given value.
5286 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> SpaceListCall<'a> {
5287 self._delegate = Some(new_value);
5288 self
5289 }
5290
5291 /// Set any additional parameter of the query string used in the request.
5292 /// It should be used to set parameters which are not yet available through their own
5293 /// setters.
5294 ///
5295 /// Please note that this method must not be used to set any of the known parameters
5296 /// which have their own setter method. If done anyway, the request will fail.
5297 ///
5298 /// # Additional Parameters
5299 ///
5300 /// * *$.xgafv* (query-string) - V1 error format.
5301 /// * *access_token* (query-string) - OAuth access token.
5302 /// * *alt* (query-string) - Data format for response.
5303 /// * *callback* (query-string) - JSONP
5304 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5305 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5306 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5307 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5308 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5309 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5310 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5311 pub fn param<T>(mut self, name: T, value: T) -> SpaceListCall<'a>
5312 where T: AsRef<str> {
5313 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
5314 self
5315 }
5316
5317}
5318
5319
5320/// Legacy path for creating message. Calling these will result in a BadRequest response.
5321///
5322/// A builder for the *webhooks* method supported by a *space* resource.
5323/// It is not used directly, but through a `SpaceMethods` instance.
5324///
5325/// # Example
5326///
5327/// Instantiate a resource method builder
5328///
5329/// ```test_harness,no_run
5330/// # extern crate hyper;
5331/// # extern crate hyper_rustls;
5332/// # extern crate yup_oauth2 as oauth2;
5333/// # extern crate google_chat1 as chat1;
5334/// use chat1::api::Message;
5335/// # async fn dox() {
5336/// # use std::default::Default;
5337/// # use oauth2;
5338/// # use chat1::HangoutsChat;
5339///
5340/// # let secret: oauth2::ApplicationSecret = Default::default();
5341/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5342/// # secret,
5343/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5344/// # ).build().await.unwrap();
5345/// # let mut hub = HangoutsChat::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
5346/// // As the method needs a request, you would usually fill it with the desired information
5347/// // into the respective structure. Some of the parts shown here might not be applicable !
5348/// // Values shown here are possibly random and not representative !
5349/// let mut req = Message::default();
5350///
5351/// // You can configure optional parameters by calling the respective setters at will, and
5352/// // execute the final call using `doit()`.
5353/// // Values shown here are possibly random and not representative !
5354/// let result = hub.spaces().webhooks(req, "parent")
5355/// .thread_key("dolor")
5356/// .doit().await;
5357/// # }
5358/// ```
5359pub struct SpaceWebhookCall<'a>
5360 where {
5361
5362 hub: &'a HangoutsChat<>,
5363 _request: Message,
5364 _parent: String,
5365 _thread_key: Option<String>,
5366 _delegate: Option<&'a mut dyn client::Delegate>,
5367 _additional_params: HashMap<String, String>,
5368}
5369
5370impl<'a> client::CallBuilder for SpaceWebhookCall<'a> {}
5371
5372impl<'a> SpaceWebhookCall<'a> {
5373
5374
5375 /// Perform the operation you have build so far.
5376 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Message)> {
5377 use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
5378 use std::io::{Read, Seek};
5379 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
5380 use client::ToParts;
5381 let mut dd = client::DefaultDelegate;
5382 let mut dlg: &mut dyn client::Delegate = match self._delegate {
5383 Some(d) => d,
5384 None => &mut dd
5385 };
5386 dlg.begin(client::MethodInfo { id: "chat.spaces.webhooks",
5387 http_method: hyper::Method::POST });
5388 let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
5389 params.push(("parent", self._parent.to_string()));
5390 if let Some(value) = self._thread_key {
5391 params.push(("threadKey", value.to_string()));
5392 }
5393 for &field in ["alt", "parent", "threadKey"].iter() {
5394 if self._additional_params.contains_key(field) {
5395 dlg.finished(false);
5396 return Err(client::Error::FieldClash(field));
5397 }
5398 }
5399 for (name, value) in self._additional_params.iter() {
5400 params.push((&name, value.clone()));
5401 }
5402
5403 params.push(("alt", "json".to_string()));
5404
5405 let mut url = self.hub._base_url.clone() + "v1/{+parent}/webhooks";
5406
5407 let key = dlg.api_key();
5408 match key {
5409 Some(value) => params.push(("key", value)),
5410 None => {
5411 dlg.finished(false);
5412 return Err(client::Error::MissingAPIKey)
5413 }
5414 }
5415
5416 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5417 let mut replace_with = String::new();
5418 for &(name, ref value) in params.iter() {
5419 if name == param_name {
5420 replace_with = value.to_string();
5421 break;
5422 }
5423 }
5424 if find_this.as_bytes()[1] == '+' as u8 {
5425 replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
5426 }
5427 url = url.replace(find_this, &replace_with);
5428 }
5429 {
5430 let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
5431 for param_name in ["parent"].iter() {
5432 if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
5433 indices_for_removal.push(index);
5434 }
5435 }
5436 for &index in indices_for_removal.iter() {
5437 params.remove(index);
5438 }
5439 }
5440
5441 let url = url::Url::parse_with_params(&url, params).unwrap();
5442
5443 let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
5444 let mut request_value_reader =
5445 {
5446 let mut value = json::value::to_value(&self._request).expect("serde to work");
5447 client::remove_json_null_values(&mut value);
5448 let mut dst = io::Cursor::new(Vec::with_capacity(128));
5449 json::to_writer(&mut dst, &value).unwrap();
5450 dst
5451 };
5452 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
5453 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
5454
5455
5456 loop {
5457 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
5458 let mut req_result = {
5459 let client = &self.hub.client;
5460 dlg.pre_request();
5461 let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string())
5462 .header(USER_AGENT, self.hub._user_agent.clone());
5463
5464
5465 let request = req_builder
5466 .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
5467 .header(CONTENT_LENGTH, request_size as u64)
5468 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
5469
5470 client.request(request.unwrap()).await
5471
5472 };
5473
5474 match req_result {
5475 Err(err) => {
5476 if let client::Retry::After(d) = dlg.http_error(&err) {
5477 sleep(d);
5478 continue;
5479 }
5480 dlg.finished(false);
5481 return Err(client::Error::HttpError(err))
5482 }
5483 Ok(mut res) => {
5484 if !res.status().is_success() {
5485 let res_body_string = client::get_body_as_string(res.body_mut()).await;
5486
5487 let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
5488 let server_error = json::from_str::<client::ServerError>(&res_body_string)
5489 .or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
5490 .ok();
5491
5492 if let client::Retry::After(d) = dlg.http_failure(&res,
5493 json_server_error,
5494 server_error) {
5495 sleep(d);
5496 continue;
5497 }
5498 dlg.finished(false);
5499 return match json::from_str::<client::ErrorResponse>(&res_body_string){
5500 Err(_) => Err(client::Error::Failure(res)),
5501 Ok(serr) => Err(client::Error::BadRequest(serr))
5502 }
5503 }
5504 let result_value = {
5505 let res_body_string = client::get_body_as_string(res.body_mut()).await;
5506
5507 match json::from_str(&res_body_string) {
5508 Ok(decoded) => (res, decoded),
5509 Err(err) => {
5510 dlg.response_json_decode_error(&res_body_string, &err);
5511 return Err(client::Error::JsonDecodeError(res_body_string, err));
5512 }
5513 }
5514 };
5515
5516 dlg.finished(true);
5517 return Ok(result_value)
5518 }
5519 }
5520 }
5521 }
5522
5523
5524 ///
5525 /// Sets the *request* property to the given value.
5526 ///
5527 /// Even though the property as already been set when instantiating this call,
5528 /// we provide this method for API completeness.
5529 pub fn request(mut self, new_value: Message) -> SpaceWebhookCall<'a> {
5530 self._request = new_value;
5531 self
5532 }
5533 /// Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY
5534 ///
5535 /// Sets the *parent* path property to the given value.
5536 ///
5537 /// Even though the property as already been set when instantiating this call,
5538 /// we provide this method for API completeness.
5539 pub fn parent(mut self, new_value: &str) -> SpaceWebhookCall<'a> {
5540 self._parent = new_value.to_string();
5541 self
5542 }
5543 /// Opaque thread identifier string that can be specified to group messages into a single thread. If this is the first message with a given thread identifier, a new thread is created. Subsequent messages with the same thread identifier will be posted into the same thread. This relieves bots and webhooks from having to store the Hangouts Chat thread ID of a thread (created earlier by them) to post further updates to it. Has no effect if thread field, corresponding to an existing thread, is set in message.
5544 ///
5545 /// Sets the *thread key* query property to the given value.
5546 pub fn thread_key(mut self, new_value: &str) -> SpaceWebhookCall<'a> {
5547 self._thread_key = Some(new_value.to_string());
5548 self
5549 }
5550 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5551 /// while executing the actual API request.
5552 ///
5553 /// It should be used to handle progress information, and to implement a certain level of resilience.
5554 ///
5555 /// Sets the *delegate* property to the given value.
5556 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> SpaceWebhookCall<'a> {
5557 self._delegate = Some(new_value);
5558 self
5559 }
5560
5561 /// Set any additional parameter of the query string used in the request.
5562 /// It should be used to set parameters which are not yet available through their own
5563 /// setters.
5564 ///
5565 /// Please note that this method must not be used to set any of the known parameters
5566 /// which have their own setter method. If done anyway, the request will fail.
5567 ///
5568 /// # Additional Parameters
5569 ///
5570 /// * *$.xgafv* (query-string) - V1 error format.
5571 /// * *access_token* (query-string) - OAuth access token.
5572 /// * *alt* (query-string) - Data format for response.
5573 /// * *callback* (query-string) - JSONP
5574 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5575 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5576 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5577 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5578 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5579 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5580 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5581 pub fn param<T>(mut self, name: T, value: T) -> SpaceWebhookCall<'a>
5582 where T: AsRef<str> {
5583 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
5584 self
5585 }
5586
5587}
5588
5589