Created
December 2, 2020 12:47
-
-
Save zupzup/f6fa5d86f339f6602739a5b6e8de6973 to your computer and use it in GitHub Desktop.
Timeular Webhooks List Subscriptions
This file contains hidden or 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(Deserialize, Debug)] | |
struct SubscriptionsResponse { | |
subscriptions: Vec<Subscription>, | |
} | |
#[derive(Deserialize, Debug)] | |
struct Subscription { | |
id: String, | |
event: String, | |
target_url: String, | |
} | |
async fn list_subscriptions(token: &str) -> Result<Vec<Subscription>, Error> { | |
let resp = CLIENT | |
.get(&url("/webhooks/subscription")) | |
.header("Authorization", auth(token)) | |
.send() | |
.await? | |
.json::<SubscriptionsResponse>() | |
.await?; | |
Ok(resp.subscriptions) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment