Skip to content

Commit

Permalink
refactor!: Rename token fetch methods
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb-leinz committed Aug 23, 2024
1 parent 3a4e681 commit 55fe717
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/fetch_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use freedom_config::Config;
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::from_env()?;
let client = Client::from_config(config);
let tkn = client.get_token_by_satellite(2017, 1016).await?;
let tkn = client.new_token_by_satellite_id(2017, 1016).await?;

println!("{:?}", tkn);
Ok(())
Expand Down
14 changes: 7 additions & 7 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1141,9 +1141,9 @@ pub trait FreedomApi: Send + Sync {
///
/// # Warning
///
/// Do not use this method, directly. Instead prefer [`FreedomApi::get_token_by_satellite`] or
/// [`FreedomApi::get_token_by_site_configuration`]
async fn get_token<S: std::fmt::Debug + Serialize + Sync + Send>(
/// Do not use this method, directly. Instead prefer [`FreedomApi::new_token_by_satellite_id`] or
/// [`FreedomApi::new_token_by_site_configuration_id`]
async fn new_token<S: std::fmt::Debug + Serialize + Sync + Send>(
&self,
post_val: S,
) -> Result<String, Error> {
Expand All @@ -1163,7 +1163,7 @@ pub trait FreedomApi: Send + Sync {
}

/// Fetch an FPS token for the provided band ID and site configuration ID
async fn get_token_by_site_configuration(
async fn new_token_by_site_configuration_id(
&self,
band_id: u32,
site_configuration_id: u32,
Expand All @@ -1173,11 +1173,11 @@ pub trait FreedomApi: Send + Sync {
"configuration": format!("/api/configurations/{}", site_configuration_id),
});

self.get_token(&payload).await
self.new_token(&payload).await
}

/// Fetch an FPS token for the provided band ID and satellite ID
async fn get_token_by_satellite(
async fn new_token_by_satellite_id(
&self,
band_id: u32,
satellite_id: u32,
Expand All @@ -1187,7 +1187,7 @@ pub trait FreedomApi: Send + Sync {
"satellite": format!("/api/satellites/{}", satellite_id),
});

self.get_token(&payload).await
self.new_token(&payload).await
}

/// Produces a paginated stream of [`User`] objects.
Expand Down

0 comments on commit 55fe717

Please sign in to comment.