google_groups_settings/groups.rs
1use crate::Client;
2use crate::ClientResult;
3
4pub struct Groups {
5 pub client: Client,
6}
7
8impl Groups {
9 #[doc(hidden)]
10 pub fn new(client: Client) -> Self {
11 Groups { client }
12 }
13
14 /**
15 * This function performs a `GET` to the `/{groupUniqueId}` endpoint.
16 *
17 * Gets one resource by id.
18 *
19 * **Parameters:**
20 *
21 * * `group_unique_id: &str` -- Identifies whether members external to your organization can join the group. Possible values are:
22 * - true: G Suite users external to your organization can become members of this group.
23 * - false: Users not belonging to the organization are not allowed to become members of this group.
24 */
25 pub async fn get(
26 &self,
27 alt: crate::types::Alt,
28 group_unique_id: &str,
29 ) -> ClientResult<crate::Response<crate::types::Groups>> {
30 let mut query_args: Vec<(String, String)> = Default::default();
31 if !alt.to_string().is_empty() {
32 query_args.push(("alt".to_string(), alt.to_string()));
33 }
34 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
35 let url = self.client.url(
36 &format!(
37 "/{}?{}",
38 crate::progenitor_support::encode_path(group_unique_id),
39 query_
40 ),
41 None,
42 );
43 self.client
44 .get(
45 &url,
46 crate::Message {
47 body: None,
48 content_type: None,
49 },
50 )
51 .await
52 }
53 /**
54 * This function performs a `PUT` to the `/{groupUniqueId}` endpoint.
55 *
56 * Updates an existing resource.
57 *
58 * **Parameters:**
59 *
60 * * `group_unique_id: &str` -- Identifies whether members external to your organization can join the group. Possible values are:
61 * - true: G Suite users external to your organization can become members of this group.
62 * - false: Users not belonging to the organization are not allowed to become members of this group.
63 */
64 pub async fn update(
65 &self,
66 alt: crate::types::Alt,
67 group_unique_id: &str,
68 body: &crate::types::Groups,
69 ) -> ClientResult<crate::Response<crate::types::Groups>> {
70 let mut query_args: Vec<(String, String)> = Default::default();
71 if !alt.to_string().is_empty() {
72 query_args.push(("alt".to_string(), alt.to_string()));
73 }
74 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
75 let url = self.client.url(
76 &format!(
77 "/{}?{}",
78 crate::progenitor_support::encode_path(group_unique_id),
79 query_
80 ),
81 None,
82 );
83 self.client
84 .put(
85 &url,
86 crate::Message {
87 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
88 content_type: Some("application/json".to_string()),
89 },
90 )
91 .await
92 }
93 /**
94 * This function performs a `PATCH` to the `/{groupUniqueId}` endpoint.
95 *
96 * Updates an existing resource. This method supports patch semantics.
97 *
98 * **Parameters:**
99 *
100 * * `group_unique_id: &str` -- Identifies whether members external to your organization can join the group. Possible values are:
101 * - true: G Suite users external to your organization can become members of this group.
102 * - false: Users not belonging to the organization are not allowed to become members of this group.
103 */
104 pub async fn patch(
105 &self,
106 alt: crate::types::Alt,
107 group_unique_id: &str,
108 body: &crate::types::Groups,
109 ) -> ClientResult<crate::Response<crate::types::Groups>> {
110 let mut query_args: Vec<(String, String)> = Default::default();
111 if !alt.to_string().is_empty() {
112 query_args.push(("alt".to_string(), alt.to_string()));
113 }
114 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
115 let url = self.client.url(
116 &format!(
117 "/{}?{}",
118 crate::progenitor_support::encode_path(group_unique_id),
119 query_
120 ),
121 None,
122 );
123 self.client
124 .patch(
125 &url,
126 crate::Message {
127 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
128 content_type: Some("application/json".to_string()),
129 },
130 )
131 .await
132 }
133}