Skip to content

Instantly share code, notes, and snippets.

@zupzup
Created December 2, 2020 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zupzup/f6fa5d86f339f6602739a5b6e8de6973 to your computer and use it in GitHub Desktop.
Save zupzup/f6fa5d86f339f6602739a5b6e8de6973 to your computer and use it in GitHub Desktop.
Timeular Webhooks List Subscriptions
#[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