Created
December 2, 2020 11:59
-
-
Save zupzup/184e348d130fc9f237b5b585fb2c80e6 to your computer and use it in GitHub Desktop.
Timeular Webhooks SignIn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Serialize, Debug)] | |
#[serde(rename_all = "camelCase")] | |
struct SignInRequest { | |
api_key: String, | |
api_secret: String, | |
} | |
#[derive(Deserialize, Debug)] | |
struct SignInResponse { | |
token: String, | |
} | |
async fn sign_in(api_key: String, api_secret: String) -> Result<String, Error> { | |
let body = SignInRequest { | |
api_key, | |
api_secret, | |
}; | |
let resp = CLIENT | |
.post(&url("/developer/sign-in")) | |
.json(&body) | |
.send() | |
.await? | |
.json::<SignInResponse>() | |
.await?; | |
Ok(resp.token) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment