rippling_base_api/
application_management.rs

1use anyhow::Result;
2
3use crate::Client;
4#[derive(Clone, Debug)]
5pub struct ApplicationManagement {
6    pub client: Client,
7}
8
9impl ApplicationManagement {
10    #[doc(hidden)]
11    pub fn new(client: Client) -> Self {
12        Self { client }
13    }
14
15    #[doc = "GET Matching App Users\n\nReturns matching users and their app IDs based on the app handles.\n\nNote:There could be multiple instances of the same app. In this case, the API will return all instances in the format app_handle_app_owner_id.\n\n\n**Parameters:**\n\n- `app_handles: Option<String>`: CSV of app handles. See GET /app_detail/app_handles\n\n\n```rust,no_run\nasync fn example_application_management_get_app_app_matching_users() -> anyhow::Result<()> {\n    let client = rippling_base_api::Client::new_from_env();\n    let result: rippling_base_api::types::GetAppAppMatchingUsersResponse = client\n        .application_management()\n        .get_app_app_matching_users(Some(\"some-string\".to_string()))\n        .await?;\n    println!(\"{:?}\", result);\n    Ok(())\n}\n```"]
16    #[tracing::instrument]
17    pub async fn get_app_app_matching_users<'a>(
18        &'a self,
19        app_handles: Option<String>,
20    ) -> Result<crate::types::GetAppAppMatchingUsersResponse, crate::types::error::Error> {
21        let mut req = self.client.client.request(
22            http::Method::GET,
23            &format!(
24                "{}/{}",
25                self.client.base_url, "platform/api/app_detail/app_matching_users"
26            ),
27        );
28        req = req.bearer_auth(&self.client.token);
29        let mut query_params = vec![];
30        if let Some(p) = app_handles {
31            query_params.push(("app_handles", p));
32        }
33
34        req = req.query(&query_params);
35        let resp = req.send().await?;
36        let status = resp.status();
37        if status.is_success() {
38            let text = resp.text().await.unwrap_or_default();
39            serde_json::from_str(&text).map_err(|err| {
40                crate::types::error::Error::from_serde_error(
41                    format_serde_error::SerdeError::new(text.to_string(), err),
42                    status,
43                )
44            })
45        } else {
46            let text = resp.text().await.unwrap_or_default();
47            return Err(crate::types::error::Error::Server {
48                body: text.to_string(),
49                status,
50            });
51        }
52    }
53
54    #[doc = "Mark App Installed\n\nThis endpoint can be hit to mark your app as installed in \
55             Rippling, if you aren't hitting Rippling's other endpoints on installation. The \
56             endpoint does not require any scopes.\n\nPlease note, hitting any other endpoint \
57             should mark your app as installed as well.\n\n```rust,no_run\nasync fn \
58             example_application_management_post_mark_app_installed() -> anyhow::Result<()> {\n    \
59             let client = rippling_base_api::Client::new_from_env();\n    let result: \
60             rippling_base_api::types::PostMarkAppInstalledResponse = client\n        \
61             .application_management()\n        .post_mark_app_installed()\n        .await?;\n    \
62             println!(\"{:?}\", result);\n    Ok(())\n}\n```"]
63    #[tracing::instrument]
64    pub async fn post_mark_app_installed<'a>(
65        &'a self,
66    ) -> Result<crate::types::PostMarkAppInstalledResponse, crate::types::error::Error> {
67        let mut req = self.client.client.request(
68            http::Method::POST,
69            &format!(
70                "{}/{}",
71                self.client.base_url, "platform/api/mark_app_installed"
72            ),
73        );
74        req = req.bearer_auth(&self.client.token);
75        let resp = req.send().await?;
76        let status = resp.status();
77        if status.is_success() {
78            let text = resp.text().await.unwrap_or_default();
79            serde_json::from_str(&text).map_err(|err| {
80                crate::types::error::Error::from_serde_error(
81                    format_serde_error::SerdeError::new(text.to_string(), err),
82                    status,
83                )
84            })
85        } else {
86            let text = resp.text().await.unwrap_or_default();
87            return Err(crate::types::error::Error::Server {
88                body: text.to_string(),
89                status,
90            });
91        }
92    }
93}