gsuite_api/customer.rs
1use crate::Client;
2use crate::ClientResult;
3
4pub struct Customer {
5 pub client: Client,
6}
7
8impl Customer {
9 #[doc(hidden)]
10 pub fn new(client: Client) -> Self {
11 Customer { client }
12 }
13
14 /**
15 * This function performs a `GET` to the `/admin/directory/v1/customer/{customerId}/devices/chromeos/{deviceId}/commands/{commandId}` endpoint.
16 *
17 * Gets command data a specific command issued to the device.
18 *
19 * **Parameters:**
20 *
21 * * `customer_id: &str` -- Immutable. Immutable ID of the Google Workspace account.
22 * * `device_id: &str` -- Immutable. Immutable ID of Chrome OS Device.
23 * * `command_id: &str` -- Immutable. Immutable ID of Chrome OS Device Command.
24 */
25 pub async fn admin_devices_chromeos_commands_get(
26 &self,
27 customer_id: &str,
28 device_id: &str,
29 command_id: &str,
30 ) -> ClientResult<crate::Response<crate::types::DirectoryChromeosdevicesCommand>> {
31 let url = self.client.url(
32 &format!(
33 "/admin/directory/v1/customer/{}/devices/chromeos/{}/commands/{}",
34 crate::progenitor_support::encode_path(customer_id),
35 crate::progenitor_support::encode_path(device_id),
36 crate::progenitor_support::encode_path(command_id),
37 ),
38 None,
39 );
40 self.client
41 .get(
42 &url,
43 crate::Message {
44 body: None,
45 content_type: None,
46 },
47 )
48 .await
49 }
50 /**
51 * This function performs a `POST` to the `/admin/directory/v1/customer/{customerId}/devices/chromeos/{deviceId}:issueCommand` endpoint.
52 *
53 * Issues a command for the device to execute.
54 *
55 * **Parameters:**
56 *
57 * * `customer_id: &str` -- Immutable. Immutable ID of the Google Workspace account.
58 * * `device_id: &str` -- Immutable. Immutable ID of Chrome OS Device.
59 */
60 pub async fn admin_devices_chromeos_issue_command(
61 &self,
62 customer_id: &str,
63 device_id: &str,
64 body: &crate::types::DirectoryChromeosdevicesIssueCommandRequest,
65 ) -> ClientResult<crate::Response<crate::types::DirectoryChromeosdevicesIssueCommandResponse>>
66 {
67 let url = self.client.url(
68 &format!(
69 "/admin/directory/v1/customer/{}/devices/chromeos/{}:issueCommand",
70 crate::progenitor_support::encode_path(customer_id),
71 crate::progenitor_support::encode_path(device_id),
72 ),
73 None,
74 );
75 self.client
76 .post(
77 &url,
78 crate::Message {
79 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
80 content_type: Some("application/json".to_string()),
81 },
82 )
83 .await
84 }
85}