sendgrid_api/single_sign_on_teammates.rs
1use crate::Client;
2use crate::ClientResult;
3
4pub struct SingleSignOnTeammates {
5 pub client: Client,
6}
7
8impl SingleSignOnTeammates {
9 #[doc(hidden)]
10 pub fn new(client: Client) -> Self {
11 SingleSignOnTeammates { client }
12 }
13
14 /**
15 * Create SSO Teammate.
16 *
17 * This function performs a `POST` to the `/sso/teammates` endpoint.
18 *
19 * **This endpoint allows you to create an SSO Teammate.**
20 *
21 * The email provided for this user will also function as the Teammate’s username.
22 */
23 pub async fn post_sso_teammate(
24 &self,
25 body: &crate::types::SsoTeammateRequestAllOf,
26 ) -> ClientResult<crate::Response<crate::types::SsoTeammateResponseAllOf>> {
27 let url = self.client.url("/sso/teammates", None);
28 self.client
29 .post(
30 &url,
31 crate::Message {
32 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
33 content_type: Some("application/json".to_string()),
34 },
35 )
36 .await
37 }
38 /**
39 * Edit an SSO Teammate.
40 *
41 * This function performs a `PATCH` to the `/sso/teammates/{username}` endpoint.
42 *
43 * **This endpoint allows you to modify an existing SSO Teammate.**
44 *
45 * To turn a teammate into an admin, the request body should contain the `is_admin` field set to `true`. Otherwise, set `is_admin` to false and pass in all the scopes that a teammate should have.
46 *
47 * Only the parent user and Teammates with admin permissions can update another Teammate’s permissions. Admin users can only update permissions.
48 */
49 pub async fn patch_sso_teammates_username(
50 &self,
51 username: &str,
52 body: &crate::types::PatchSsoTeammatesUsernameRequest,
53 ) -> ClientResult<crate::Response<crate::types::SsoTeammatesPatchResponseAllOf>> {
54 let url = self.client.url(
55 &format!(
56 "/sso/teammates/{}",
57 crate::progenitor_support::encode_path(username),
58 ),
59 None,
60 );
61 self.client
62 .patch(
63 &url,
64 crate::Message {
65 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
66 content_type: Some("application/json".to_string()),
67 },
68 )
69 .await
70 }
71}