gsuite_api/resources.rs
1use crate::Client;
2use crate::ClientResult;
3
4pub struct Resources {
5 pub client: Client,
6}
7
8impl Resources {
9 #[doc(hidden)]
10 pub fn new(client: Client) -> Self {
11 Resources { client }
12 }
13
14 /**
15 * This function performs a `GET` to the `/admin/directory/v1/customer/{customer}/resources/buildings` endpoint.
16 *
17 * Retrieves a list of buildings for an account.
18 *
19 * **Parameters:**
20 *
21 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
22 * * `max_results: i64` -- Maximum number of results to return.
23 * * `page_token: &str` -- Token to specify the next page in the list.
24 */
25 pub async fn buildings_list(
26 &self,
27 customer: &str,
28 max_results: i64,
29 page_token: &str,
30 ) -> ClientResult<crate::Response<Vec<crate::types::Building>>> {
31 let mut query_args: Vec<(String, String)> = Default::default();
32 if max_results > 0 {
33 query_args.push(("maxResults".to_string(), max_results.to_string()));
34 }
35 if !page_token.is_empty() {
36 query_args.push(("pageToken".to_string(), page_token.to_string()));
37 }
38 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
39 let url = self.client.url(
40 &format!(
41 "/admin/directory/v1/customer/{}/resources/buildings?{}",
42 crate::progenitor_support::encode_path(customer),
43 query_
44 ),
45 None,
46 );
47 let resp: crate::Response<crate::types::Buildings> = self
48 .client
49 .get(
50 &url,
51 crate::Message {
52 body: None,
53 content_type: None,
54 },
55 )
56 .await?;
57
58 // Return our response data.
59 Ok(crate::Response::new(
60 resp.status,
61 resp.headers,
62 resp.body.buildings.to_vec(),
63 ))
64 }
65 /**
66 * This function performs a `GET` to the `/admin/directory/v1/customer/{customer}/resources/buildings` endpoint.
67 *
68 * As opposed to `buildings_list`, this function returns all the pages of the request at once.
69 *
70 * Retrieves a list of buildings for an account.
71 */
72 pub async fn buildings_list_all(
73 &self,
74 customer: &str,
75 ) -> ClientResult<crate::Response<Vec<crate::types::Building>>> {
76 let url = self.client.url(
77 &format!(
78 "/admin/directory/v1/customer/{}/resources/buildings",
79 crate::progenitor_support::encode_path(customer),
80 ),
81 None,
82 );
83 let crate::Response::<crate::types::Buildings> {
84 mut status,
85 mut headers,
86 mut body,
87 } = self
88 .client
89 .get(
90 &url,
91 crate::Message {
92 body: None,
93 content_type: None,
94 },
95 )
96 .await?;
97
98 let mut buildings = body.buildings;
99 let mut page = body.next_page_token;
100
101 // Paginate if we should.
102 while !page.is_empty() {
103 if !url.contains('?') {
104 crate::Response::<crate::types::Buildings> {
105 status,
106 headers,
107 body,
108 } = self
109 .client
110 .get(
111 &format!("{}?pageToken={}", url, page),
112 crate::Message {
113 body: None,
114 content_type: None,
115 },
116 )
117 .await?;
118 } else {
119 crate::Response::<crate::types::Buildings> {
120 status,
121 headers,
122 body,
123 } = self
124 .client
125 .get(
126 &format!("{}&pageToken={}", url, page),
127 crate::Message {
128 body: None,
129 content_type: None,
130 },
131 )
132 .await?;
133 }
134
135 buildings.append(&mut body.buildings);
136
137 if !body.next_page_token.is_empty() && body.next_page_token != page {
138 page = body.next_page_token.to_string();
139 } else {
140 page = "".to_string();
141 }
142 }
143
144 // Return our response data.
145 Ok(crate::Response::new(status, headers, buildings))
146 }
147 /**
148 * This function performs a `POST` to the `/admin/directory/v1/customer/{customer}/resources/buildings` endpoint.
149 *
150 * Inserts a building.
151 *
152 * **Parameters:**
153 *
154 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
155 * * `coordinates_source: crate::types::CoordinatesSource` -- Source from which Building.coordinates are derived.
156 */
157 pub async fn buildings_insert(
158 &self,
159 customer: &str,
160 coordinates_source: crate::types::CoordinatesSource,
161 body: &crate::types::Building,
162 ) -> ClientResult<crate::Response<crate::types::Building>> {
163 let mut query_args: Vec<(String, String)> = Default::default();
164 if !coordinates_source.to_string().is_empty() {
165 query_args.push((
166 "coordinatesSource".to_string(),
167 coordinates_source.to_string(),
168 ));
169 }
170 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
171 let url = self.client.url(
172 &format!(
173 "/admin/directory/v1/customer/{}/resources/buildings?{}",
174 crate::progenitor_support::encode_path(customer),
175 query_
176 ),
177 None,
178 );
179 self.client
180 .post(
181 &url,
182 crate::Message {
183 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
184 content_type: Some("application/json".to_string()),
185 },
186 )
187 .await
188 }
189 /**
190 * This function performs a `GET` to the `/admin/directory/v1/customer/{customer}/resources/buildings/{buildingId}` endpoint.
191 *
192 * Retrieves a building.
193 *
194 * **Parameters:**
195 *
196 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
197 * * `building_id: &str` -- The unique ID of the building to retrieve.
198 */
199 pub async fn buildings_get(
200 &self,
201 customer: &str,
202 building_id: &str,
203 ) -> ClientResult<crate::Response<crate::types::Building>> {
204 let url = self.client.url(
205 &format!(
206 "/admin/directory/v1/customer/{}/resources/buildings/{}",
207 crate::progenitor_support::encode_path(customer),
208 crate::progenitor_support::encode_path(building_id),
209 ),
210 None,
211 );
212 self.client
213 .get(
214 &url,
215 crate::Message {
216 body: None,
217 content_type: None,
218 },
219 )
220 .await
221 }
222 /**
223 * This function performs a `PUT` to the `/admin/directory/v1/customer/{customer}/resources/buildings/{buildingId}` endpoint.
224 *
225 * Updates a building.
226 *
227 * **Parameters:**
228 *
229 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
230 * * `building_id: &str` -- The id of the building to update.
231 * * `coordinates_source: crate::types::CoordinatesSource` -- Source from which Building.coordinates are derived.
232 */
233 pub async fn buildings_update(
234 &self,
235 customer: &str,
236 building_id: &str,
237 coordinates_source: crate::types::CoordinatesSource,
238 body: &crate::types::Building,
239 ) -> ClientResult<crate::Response<crate::types::Building>> {
240 let mut query_args: Vec<(String, String)> = Default::default();
241 if !coordinates_source.to_string().is_empty() {
242 query_args.push((
243 "coordinatesSource".to_string(),
244 coordinates_source.to_string(),
245 ));
246 }
247 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
248 let url = self.client.url(
249 &format!(
250 "/admin/directory/v1/customer/{}/resources/buildings/{}?{}",
251 crate::progenitor_support::encode_path(customer),
252 crate::progenitor_support::encode_path(building_id),
253 query_
254 ),
255 None,
256 );
257 self.client
258 .put(
259 &url,
260 crate::Message {
261 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
262 content_type: Some("application/json".to_string()),
263 },
264 )
265 .await
266 }
267 /**
268 * This function performs a `DELETE` to the `/admin/directory/v1/customer/{customer}/resources/buildings/{buildingId}` endpoint.
269 *
270 * Deletes a building.
271 *
272 * **Parameters:**
273 *
274 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
275 * * `building_id: &str` -- The id of the building to delete.
276 */
277 pub async fn buildings_delete(
278 &self,
279 customer: &str,
280 building_id: &str,
281 ) -> ClientResult<crate::Response<()>> {
282 let url = self.client.url(
283 &format!(
284 "/admin/directory/v1/customer/{}/resources/buildings/{}",
285 crate::progenitor_support::encode_path(customer),
286 crate::progenitor_support::encode_path(building_id),
287 ),
288 None,
289 );
290 self.client
291 .delete(
292 &url,
293 crate::Message {
294 body: None,
295 content_type: None,
296 },
297 )
298 .await
299 }
300 /**
301 * This function performs a `PATCH` to the `/admin/directory/v1/customer/{customer}/resources/buildings/{buildingId}` endpoint.
302 *
303 * Patches a building.
304 *
305 * **Parameters:**
306 *
307 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
308 * * `building_id: &str` -- The id of the building to update.
309 * * `coordinates_source: crate::types::CoordinatesSource` -- Source from which Building.coordinates are derived.
310 */
311 pub async fn buildings_patch(
312 &self,
313 customer: &str,
314 building_id: &str,
315 coordinates_source: crate::types::CoordinatesSource,
316 body: &crate::types::Building,
317 ) -> ClientResult<crate::Response<crate::types::Building>> {
318 let mut query_args: Vec<(String, String)> = Default::default();
319 if !coordinates_source.to_string().is_empty() {
320 query_args.push((
321 "coordinatesSource".to_string(),
322 coordinates_source.to_string(),
323 ));
324 }
325 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
326 let url = self.client.url(
327 &format!(
328 "/admin/directory/v1/customer/{}/resources/buildings/{}?{}",
329 crate::progenitor_support::encode_path(customer),
330 crate::progenitor_support::encode_path(building_id),
331 query_
332 ),
333 None,
334 );
335 self.client
336 .patch(
337 &url,
338 crate::Message {
339 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
340 content_type: Some("application/json".to_string()),
341 },
342 )
343 .await
344 }
345 /**
346 * This function performs a `GET` to the `/admin/directory/v1/customer/{customer}/resources/calendars` endpoint.
347 *
348 * Retrieves a list of calendar resources for an account.
349 *
350 * **Parameters:**
351 *
352 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
353 * * `max_results: i64` -- Maximum number of results to return.
354 * * `order_by: &str` -- Field(s) to sort results by in either ascending or descending order. Supported fields include `resourceId`, `resourceName`, `capacity`, `buildingId`, and `floorName`. If no order is specified, defaults to ascending. Should be of the form "field [asc|desc], field [asc|desc], ...". For example `buildingId, capacity desc` would return results sorted first by `buildingId` in ascending order then by `capacity` in descending order.
355 * * `page_token: &str` -- Token to specify the next page in the list.
356 * * `query: &str` -- String query used to filter results. Should be of the form "field operator value" where field can be any of supported fields and operators can be any of supported operations. Operators include '=' for exact match, '!=' for mismatch and ':' for prefix match or HAS match where applicable. For prefix match, the value should always be followed by a *. Logical operators NOT and AND are supported (in this order of precedence). Supported fields include `generatedResourceName`, `name`, `buildingId`, `floor_name`, `capacity`, `featureInstances.feature.name`, `resourceEmail`, `resourceCategory`. For example `buildingId=US-NYC-9TH AND featureInstances.feature.name:Phone`.
357 */
358 pub async fn calendars_list(
359 &self,
360 customer: &str,
361 max_results: i64,
362 order_by: &str,
363 page_token: &str,
364 query: &str,
365 ) -> ClientResult<crate::Response<Vec<crate::types::CalendarResource>>> {
366 let mut query_args: Vec<(String, String)> = Default::default();
367 if max_results > 0 {
368 query_args.push(("maxResults".to_string(), max_results.to_string()));
369 }
370 if !order_by.is_empty() {
371 query_args.push(("orderBy".to_string(), order_by.to_string()));
372 }
373 if !page_token.is_empty() {
374 query_args.push(("pageToken".to_string(), page_token.to_string()));
375 }
376 if !query.is_empty() {
377 query_args.push(("query".to_string(), query.to_string()));
378 }
379 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
380 let url = self.client.url(
381 &format!(
382 "/admin/directory/v1/customer/{}/resources/calendars?{}",
383 crate::progenitor_support::encode_path(customer),
384 query_
385 ),
386 None,
387 );
388 let resp: crate::Response<crate::types::CalendarResources> = self
389 .client
390 .get(
391 &url,
392 crate::Message {
393 body: None,
394 content_type: None,
395 },
396 )
397 .await?;
398
399 // Return our response data.
400 Ok(crate::Response::new(
401 resp.status,
402 resp.headers,
403 resp.body.items.to_vec(),
404 ))
405 }
406 /**
407 * This function performs a `GET` to the `/admin/directory/v1/customer/{customer}/resources/calendars` endpoint.
408 *
409 * As opposed to `calendars_list`, this function returns all the pages of the request at once.
410 *
411 * Retrieves a list of calendar resources for an account.
412 */
413 pub async fn calendars_list_all(
414 &self,
415 customer: &str,
416 order_by: &str,
417 query: &str,
418 ) -> ClientResult<crate::Response<Vec<crate::types::CalendarResource>>> {
419 let mut query_args: Vec<(String, String)> = Default::default();
420 if !order_by.is_empty() {
421 query_args.push(("orderBy".to_string(), order_by.to_string()));
422 }
423 if !query.is_empty() {
424 query_args.push(("query".to_string(), query.to_string()));
425 }
426 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
427 let url = self.client.url(
428 &format!(
429 "/admin/directory/v1/customer/{}/resources/calendars?{}",
430 crate::progenitor_support::encode_path(customer),
431 query_
432 ),
433 None,
434 );
435 let crate::Response::<crate::types::CalendarResources> {
436 mut status,
437 mut headers,
438 mut body,
439 } = self
440 .client
441 .get(
442 &url,
443 crate::Message {
444 body: None,
445 content_type: None,
446 },
447 )
448 .await?;
449
450 let mut items = body.items;
451 let mut page = body.next_page_token;
452
453 // Paginate if we should.
454 while !page.is_empty() {
455 if !url.contains('?') {
456 crate::Response::<crate::types::CalendarResources> {
457 status,
458 headers,
459 body,
460 } = self
461 .client
462 .get(
463 &format!("{}?pageToken={}", url, page),
464 crate::Message {
465 body: None,
466 content_type: None,
467 },
468 )
469 .await?;
470 } else {
471 crate::Response::<crate::types::CalendarResources> {
472 status,
473 headers,
474 body,
475 } = self
476 .client
477 .get(
478 &format!("{}&pageToken={}", url, page),
479 crate::Message {
480 body: None,
481 content_type: None,
482 },
483 )
484 .await?;
485 }
486
487 items.append(&mut body.items);
488
489 if !body.next_page_token.is_empty() && body.next_page_token != page {
490 page = body.next_page_token.to_string();
491 } else {
492 page = "".to_string();
493 }
494 }
495
496 // Return our response data.
497 Ok(crate::Response::new(status, headers, items))
498 }
499 /**
500 * This function performs a `POST` to the `/admin/directory/v1/customer/{customer}/resources/calendars` endpoint.
501 *
502 * Inserts a calendar resource.
503 *
504 * **Parameters:**
505 *
506 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
507 */
508 pub async fn calendars_insert(
509 &self,
510 customer: &str,
511 body: &crate::types::CalendarResource,
512 ) -> ClientResult<crate::Response<crate::types::CalendarResource>> {
513 let url = self.client.url(
514 &format!(
515 "/admin/directory/v1/customer/{}/resources/calendars",
516 crate::progenitor_support::encode_path(customer),
517 ),
518 None,
519 );
520 self.client
521 .post(
522 &url,
523 crate::Message {
524 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
525 content_type: Some("application/json".to_string()),
526 },
527 )
528 .await
529 }
530 /**
531 * This function performs a `GET` to the `/admin/directory/v1/customer/{customer}/resources/calendars/{calendarResourceId}` endpoint.
532 *
533 * Retrieves a calendar resource.
534 *
535 * **Parameters:**
536 *
537 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
538 * * `calendar_resource_id: &str` -- The unique ID of the calendar resource to retrieve.
539 */
540 pub async fn calendars_get(
541 &self,
542 customer: &str,
543 calendar_resource_id: &str,
544 ) -> ClientResult<crate::Response<crate::types::CalendarResource>> {
545 let url = self.client.url(
546 &format!(
547 "/admin/directory/v1/customer/{}/resources/calendars/{}",
548 crate::progenitor_support::encode_path(customer),
549 crate::progenitor_support::encode_path(calendar_resource_id),
550 ),
551 None,
552 );
553 self.client
554 .get(
555 &url,
556 crate::Message {
557 body: None,
558 content_type: None,
559 },
560 )
561 .await
562 }
563 /**
564 * This function performs a `PUT` to the `/admin/directory/v1/customer/{customer}/resources/calendars/{calendarResourceId}` endpoint.
565 *
566 * Updates a calendar resource. This method supports patch semantics, meaning you only need to include the fields you wish to update. Fields that are not present in the request will be preserved.
567 *
568 * **Parameters:**
569 *
570 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
571 * * `calendar_resource_id: &str` -- The unique ID of the calendar resource to update.
572 */
573 pub async fn calendars_update(
574 &self,
575 customer: &str,
576 calendar_resource_id: &str,
577 body: &crate::types::CalendarResource,
578 ) -> ClientResult<crate::Response<crate::types::CalendarResource>> {
579 let url = self.client.url(
580 &format!(
581 "/admin/directory/v1/customer/{}/resources/calendars/{}",
582 crate::progenitor_support::encode_path(customer),
583 crate::progenitor_support::encode_path(calendar_resource_id),
584 ),
585 None,
586 );
587 self.client
588 .put(
589 &url,
590 crate::Message {
591 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
592 content_type: Some("application/json".to_string()),
593 },
594 )
595 .await
596 }
597 /**
598 * This function performs a `DELETE` to the `/admin/directory/v1/customer/{customer}/resources/calendars/{calendarResourceId}` endpoint.
599 *
600 * Deletes a calendar resource.
601 *
602 * **Parameters:**
603 *
604 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
605 * * `calendar_resource_id: &str` -- The unique ID of the calendar resource to delete.
606 */
607 pub async fn calendars_delete(
608 &self,
609 customer: &str,
610 calendar_resource_id: &str,
611 ) -> ClientResult<crate::Response<()>> {
612 let url = self.client.url(
613 &format!(
614 "/admin/directory/v1/customer/{}/resources/calendars/{}",
615 crate::progenitor_support::encode_path(customer),
616 crate::progenitor_support::encode_path(calendar_resource_id),
617 ),
618 None,
619 );
620 self.client
621 .delete(
622 &url,
623 crate::Message {
624 body: None,
625 content_type: None,
626 },
627 )
628 .await
629 }
630 /**
631 * This function performs a `PATCH` to the `/admin/directory/v1/customer/{customer}/resources/calendars/{calendarResourceId}` endpoint.
632 *
633 * Patches a calendar resource.
634 *
635 * **Parameters:**
636 *
637 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
638 * * `calendar_resource_id: &str` -- The unique ID of the calendar resource to update.
639 */
640 pub async fn calendars_patch(
641 &self,
642 customer: &str,
643 calendar_resource_id: &str,
644 body: &crate::types::CalendarResource,
645 ) -> ClientResult<crate::Response<crate::types::CalendarResource>> {
646 let url = self.client.url(
647 &format!(
648 "/admin/directory/v1/customer/{}/resources/calendars/{}",
649 crate::progenitor_support::encode_path(customer),
650 crate::progenitor_support::encode_path(calendar_resource_id),
651 ),
652 None,
653 );
654 self.client
655 .patch(
656 &url,
657 crate::Message {
658 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
659 content_type: Some("application/json".to_string()),
660 },
661 )
662 .await
663 }
664 /**
665 * This function performs a `GET` to the `/admin/directory/v1/customer/{customer}/resources/features` endpoint.
666 *
667 * Retrieves a list of features for an account.
668 *
669 * **Parameters:**
670 *
671 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
672 * * `max_results: i64` -- Maximum number of results to return.
673 * * `page_token: &str` -- Token to specify the next page in the list.
674 */
675 pub async fn features_list(
676 &self,
677 customer: &str,
678 max_results: i64,
679 page_token: &str,
680 ) -> ClientResult<crate::Response<Vec<crate::types::Feature>>> {
681 let mut query_args: Vec<(String, String)> = Default::default();
682 if max_results > 0 {
683 query_args.push(("maxResults".to_string(), max_results.to_string()));
684 }
685 if !page_token.is_empty() {
686 query_args.push(("pageToken".to_string(), page_token.to_string()));
687 }
688 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
689 let url = self.client.url(
690 &format!(
691 "/admin/directory/v1/customer/{}/resources/features?{}",
692 crate::progenitor_support::encode_path(customer),
693 query_
694 ),
695 None,
696 );
697 let resp: crate::Response<crate::types::Features> = self
698 .client
699 .get(
700 &url,
701 crate::Message {
702 body: None,
703 content_type: None,
704 },
705 )
706 .await?;
707
708 // Return our response data.
709 Ok(crate::Response::new(
710 resp.status,
711 resp.headers,
712 resp.body.features.to_vec(),
713 ))
714 }
715 /**
716 * This function performs a `GET` to the `/admin/directory/v1/customer/{customer}/resources/features` endpoint.
717 *
718 * As opposed to `features_list`, this function returns all the pages of the request at once.
719 *
720 * Retrieves a list of features for an account.
721 */
722 pub async fn features_list_all(
723 &self,
724 customer: &str,
725 ) -> ClientResult<crate::Response<Vec<crate::types::Feature>>> {
726 let url = self.client.url(
727 &format!(
728 "/admin/directory/v1/customer/{}/resources/features",
729 crate::progenitor_support::encode_path(customer),
730 ),
731 None,
732 );
733 let crate::Response::<crate::types::Features> {
734 mut status,
735 mut headers,
736 mut body,
737 } = self
738 .client
739 .get(
740 &url,
741 crate::Message {
742 body: None,
743 content_type: None,
744 },
745 )
746 .await?;
747
748 let mut features = body.features;
749 let mut page = body.next_page_token;
750
751 // Paginate if we should.
752 while !page.is_empty() {
753 if !url.contains('?') {
754 crate::Response::<crate::types::Features> {
755 status,
756 headers,
757 body,
758 } = self
759 .client
760 .get(
761 &format!("{}?pageToken={}", url, page),
762 crate::Message {
763 body: None,
764 content_type: None,
765 },
766 )
767 .await?;
768 } else {
769 crate::Response::<crate::types::Features> {
770 status,
771 headers,
772 body,
773 } = self
774 .client
775 .get(
776 &format!("{}&pageToken={}", url, page),
777 crate::Message {
778 body: None,
779 content_type: None,
780 },
781 )
782 .await?;
783 }
784
785 features.append(&mut body.features);
786
787 if !body.next_page_token.is_empty() && body.next_page_token != page {
788 page = body.next_page_token.to_string();
789 } else {
790 page = "".to_string();
791 }
792 }
793
794 // Return our response data.
795 Ok(crate::Response::new(status, headers, features))
796 }
797 /**
798 * This function performs a `POST` to the `/admin/directory/v1/customer/{customer}/resources/features` endpoint.
799 *
800 * Inserts a feature.
801 *
802 * **Parameters:**
803 *
804 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
805 */
806 pub async fn features_insert(
807 &self,
808 customer: &str,
809 body: &crate::types::Feature,
810 ) -> ClientResult<crate::Response<crate::types::Feature>> {
811 let url = self.client.url(
812 &format!(
813 "/admin/directory/v1/customer/{}/resources/features",
814 crate::progenitor_support::encode_path(customer),
815 ),
816 None,
817 );
818 self.client
819 .post(
820 &url,
821 crate::Message {
822 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
823 content_type: Some("application/json".to_string()),
824 },
825 )
826 .await
827 }
828 /**
829 * This function performs a `GET` to the `/admin/directory/v1/customer/{customer}/resources/features/{featureKey}` endpoint.
830 *
831 * Retrieves a feature.
832 *
833 * **Parameters:**
834 *
835 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
836 * * `feature_key: &str` -- The unique ID of the feature to retrieve.
837 */
838 pub async fn features_get(
839 &self,
840 customer: &str,
841 feature_key: &str,
842 ) -> ClientResult<crate::Response<crate::types::Feature>> {
843 let url = self.client.url(
844 &format!(
845 "/admin/directory/v1/customer/{}/resources/features/{}",
846 crate::progenitor_support::encode_path(customer),
847 crate::progenitor_support::encode_path(feature_key),
848 ),
849 None,
850 );
851 self.client
852 .get(
853 &url,
854 crate::Message {
855 body: None,
856 content_type: None,
857 },
858 )
859 .await
860 }
861 /**
862 * This function performs a `PUT` to the `/admin/directory/v1/customer/{customer}/resources/features/{featureKey}` endpoint.
863 *
864 * Updates a feature.
865 *
866 * **Parameters:**
867 *
868 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
869 * * `feature_key: &str` -- The unique ID of the feature to update.
870 */
871 pub async fn features_update(
872 &self,
873 customer: &str,
874 feature_key: &str,
875 body: &crate::types::Feature,
876 ) -> ClientResult<crate::Response<crate::types::Feature>> {
877 let url = self.client.url(
878 &format!(
879 "/admin/directory/v1/customer/{}/resources/features/{}",
880 crate::progenitor_support::encode_path(customer),
881 crate::progenitor_support::encode_path(feature_key),
882 ),
883 None,
884 );
885 self.client
886 .put(
887 &url,
888 crate::Message {
889 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
890 content_type: Some("application/json".to_string()),
891 },
892 )
893 .await
894 }
895 /**
896 * This function performs a `DELETE` to the `/admin/directory/v1/customer/{customer}/resources/features/{featureKey}` endpoint.
897 *
898 * Deletes a feature.
899 *
900 * **Parameters:**
901 *
902 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
903 * * `feature_key: &str` -- The unique ID of the feature to delete.
904 */
905 pub async fn features_delete(
906 &self,
907 customer: &str,
908 feature_key: &str,
909 ) -> ClientResult<crate::Response<()>> {
910 let url = self.client.url(
911 &format!(
912 "/admin/directory/v1/customer/{}/resources/features/{}",
913 crate::progenitor_support::encode_path(customer),
914 crate::progenitor_support::encode_path(feature_key),
915 ),
916 None,
917 );
918 self.client
919 .delete(
920 &url,
921 crate::Message {
922 body: None,
923 content_type: None,
924 },
925 )
926 .await
927 }
928 /**
929 * This function performs a `PATCH` to the `/admin/directory/v1/customer/{customer}/resources/features/{featureKey}` endpoint.
930 *
931 * Patches a feature.
932 *
933 * **Parameters:**
934 *
935 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
936 * * `feature_key: &str` -- The unique ID of the feature to update.
937 */
938 pub async fn features_patch(
939 &self,
940 customer: &str,
941 feature_key: &str,
942 body: &crate::types::Feature,
943 ) -> ClientResult<crate::Response<crate::types::Feature>> {
944 let url = self.client.url(
945 &format!(
946 "/admin/directory/v1/customer/{}/resources/features/{}",
947 crate::progenitor_support::encode_path(customer),
948 crate::progenitor_support::encode_path(feature_key),
949 ),
950 None,
951 );
952 self.client
953 .patch(
954 &url,
955 crate::Message {
956 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
957 content_type: Some("application/json".to_string()),
958 },
959 )
960 .await
961 }
962 /**
963 * This function performs a `POST` to the `/admin/directory/v1/customer/{customer}/resources/features/{oldName}/rename` endpoint.
964 *
965 * Renames a feature.
966 *
967 * **Parameters:**
968 *
969 * * `customer: &str` -- The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the `my_customer` alias to represent your account's customer ID.
970 * * `old_name: &str` -- The unique ID of the feature to rename.
971 */
972 pub async fn features_rename(
973 &self,
974 customer: &str,
975 old_name: &str,
976 body: &crate::types::FeatureRename,
977 ) -> ClientResult<crate::Response<()>> {
978 let url = self.client.url(
979 &format!(
980 "/admin/directory/v1/customer/{}/resources/features/{}/rename",
981 crate::progenitor_support::encode_path(customer),
982 crate::progenitor_support::encode_path(old_name),
983 ),
984 None,
985 );
986 self.client
987 .post(
988 &url,
989 crate::Message {
990 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
991 content_type: Some("application/json".to_string()),
992 },
993 )
994 .await
995 }
996}