imgurian/commands/
generate_access_token.rs1use crate::opt::GenerateAccessTokenInput;
2use crate::result::Result;
3use imgur_openapi::apis::auth_api;
4use imgur_openapi::apis::configuration::Configuration;
5
6pub async fn generate_access_token(input: GenerateAccessTokenInput) -> Result<()> {
7 let configuration = Configuration::new();
8 let model = auth_api::generate_access_token(
9 &configuration,
10 &input.client_id,
11 &input.client_secret,
12 "refresh_token",
13 &input.refresh_token,
14 )
15 .await?;
16 let json = serde_json::to_string(&model)?;
17 println!("{}", json);
18 Ok(())
19}