gsuite_api/asps.rs
1use crate::Client;
2use crate::ClientResult;
3
4pub struct Asps {
5 pub client: Client,
6}
7
8impl Asps {
9 #[doc(hidden)]
10 pub fn new(client: Client) -> Self {
11 Asps { client }
12 }
13
14 /**
15 * This function performs a `GET` to the `/admin/directory/v1/users/{userKey}/asps` endpoint.
16 *
17 * Lists the ASPs issued by a user.
18 *
19 * **Parameters:**
20 *
21 * * `user_key: &str` -- Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.
22 */
23 pub async fn list(&self, user_key: &str) -> ClientResult<crate::Response<crate::types::Asps>> {
24 let url = self.client.url(
25 &format!(
26 "/admin/directory/v1/users/{}/asps",
27 crate::progenitor_support::encode_path(user_key),
28 ),
29 None,
30 );
31 self.client
32 .get(
33 &url,
34 crate::Message {
35 body: None,
36 content_type: None,
37 },
38 )
39 .await
40 }
41 /**
42 * This function performs a `GET` to the `/admin/directory/v1/users/{userKey}/asps/{codeId}` endpoint.
43 *
44 * Gets information about an ASP issued by a user.
45 *
46 * **Parameters:**
47 *
48 * * `user_key: &str` -- Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.
49 * * `code_id: i64` -- The unique ID of the ASP.
50 */
51 pub async fn get(
52 &self,
53 user_key: &str,
54 code_id: i64,
55 ) -> ClientResult<crate::Response<crate::types::Asp>> {
56 let url = self.client.url(
57 &format!(
58 "/admin/directory/v1/users/{}/asps/{}",
59 crate::progenitor_support::encode_path(user_key),
60 crate::progenitor_support::encode_path(&code_id.to_string()),
61 ),
62 None,
63 );
64 self.client
65 .get(
66 &url,
67 crate::Message {
68 body: None,
69 content_type: None,
70 },
71 )
72 .await
73 }
74 /**
75 * This function performs a `DELETE` to the `/admin/directory/v1/users/{userKey}/asps/{codeId}` endpoint.
76 *
77 * Deletes an ASP issued by a user.
78 *
79 * **Parameters:**
80 *
81 * * `user_key: &str` -- Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.
82 * * `code_id: i64` -- The unique ID of the ASP to be deleted.
83 */
84 pub async fn delete(&self, user_key: &str, code_id: i64) -> ClientResult<crate::Response<()>> {
85 let url = self.client.url(
86 &format!(
87 "/admin/directory/v1/users/{}/asps/{}",
88 crate::progenitor_support::encode_path(user_key),
89 crate::progenitor_support::encode_path(&code_id.to_string()),
90 ),
91 None,
92 );
93 self.client
94 .delete(
95 &url,
96 crate::Message {
97 body: None,
98 content_type: None,
99 },
100 )
101 .await
102 }
103}