3 files changed
+29
crates/smbcloud-networking-account/src/oauth/get_account_status.rs
new
+27
@@ -0,0 +1,27 @@
1
+use {
2
+ reqwest::Client,
3
+ smbcloud_model::{error_codes::ErrorResponse, login::AccountStatus},
4
+ smbcloud_network::{environment::Environment, network::request_login},
5
+ smbcloud_networking::{
6
+ constants::PATH_ACCOUNT_STATUS, smb_base_url_builder, smb_client::SmbClient,
7
+ },
8
+};
9
+
10
+pub async fn get_account_status(
11
+ env: Environment,
12
+ client: SmbClient,
13
+ email: &str,
14
+) -> Result<AccountStatus, ErrorResponse> {
15
+ let builder = Client::new()
16
+ .get(build_url(env, &client, email))
17
+ .header("Accept", "application/json")
18
+ .header("Content-Type", "application/x-www-form-urlencoded");
19
+ request_login(builder).await
20
+}
21
+
22
+fn build_url(env: Environment, client: &SmbClient, email: &str) -> String {
23
+ let mut url_builder = smb_base_url_builder(env, client);
24
+ url_builder.add_route(PATH_ACCOUNT_STATUS);
25
+ url_builder.add_param("email", email);
26
+ url_builder.build()
27
+}
crates/smbcloud-networking-account/src/oauth/mod.rs
+1
@@ -1,3 +1,4 @@
1
+pub mod get_account_status;
2
pub mod get_consent_url;
3
pub mod get_profile;
4
pub mod get_token;
crates/smbcloud-networking/src/constants.rs
+1
@@ -12,6 +12,7 @@ pub const SMB_USER_AGENT: &str = "smbcloud-cli";
12
13
// Paths
14
pub const PATH_USERS_CHECK_EMAIL: &str = "v1/check_email";
15
+pub const PATH_ACCOUNT_STATUS: &str = "v1/account_status";
16
pub const PATH_USERS_ME: &str = "v1/me";
17
pub const PATH_USERS: &str = "v1/users";
18
pub const PATH_USERS_PASSWORD: &str = "v1/users/password";