diff options
| author | Zeyla Hellyer <[email protected]> | 2017-10-09 15:54:48 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-10-09 15:54:48 -0700 |
| commit | 1735e57ea57bcd4d75b73ac9398e13bee5198c5b (patch) | |
| tree | 9c01b9615da98a863a8a13d2495c47cefdca9c53 /src/http | |
| parent | Reset shard heartbeat state on resume (diff) | |
| download | serenity-1735e57ea57bcd4d75b73ac9398e13bee5198c5b.tar.xz serenity-1735e57ea57bcd4d75b73ac9398e13bee5198c5b.zip | |
Make webhook_id a majour parameter in ratelimiting
This change is made due to this change in documentation:
<https://github.com/discordapp/discord-api-docs/commit/32d06c360867cead6aa785ff10c437fdb2743bd6?short_path=5f625d6#diff-5f625d6c4303e22c3d6af4c8d6df28fe>
Diffstat (limited to 'src/http')
| -rw-r--r-- | src/http/mod.rs | 21 | ||||
| -rw-r--r-- | src/http/ratelimiting.rs | 2 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/http/mod.rs b/src/http/mod.rs index 1828bd7..2348794 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -625,7 +625,12 @@ pub fn delete_role(guild_id: u64, role_id: u64) -> Result<()> { pub fn delete_webhook(webhook_id: u64) -> Result<()> { verify( 204, - request!(Route::WebhooksId, delete, "/webhooks/{}", webhook_id), + request!( + Route::WebhooksId(webhook_id), + delete, + "/webhooks/{}", + webhook_id, + ), ) } @@ -855,7 +860,12 @@ pub fn edit_role(guild_id: u64, role_id: u64, map: &JsonMap) -> Result<Role> { // external crates being incredibly messy and misleading in the end user's view. pub fn edit_webhook(webhook_id: u64, map: &Value) -> Result<Webhook> { let body = map.to_string(); - let response = request!(Route::WebhooksId, patch(body), "/webhooks/{}", webhook_id); + let response = request!( + Route::WebhooksId(webhook_id), + patch(body), + "/webhooks/{}", + webhook_id, + ); serde_json::from_reader::<HyperResponse, Webhook>(response) .map_err(From::from) @@ -1518,7 +1528,12 @@ pub fn get_voice_regions() -> Result<Vec<VoiceRegion>> { /// /// [`get_webhook_with_token`]: fn.get_webhook_with_token.html pub fn get_webhook(webhook_id: u64) -> Result<Webhook> { - let response = request!(Route::WebhooksId, get, "/webhooks/{}", webhook_id); + let response = request!( + Route::WebhooksId(webhook_id), + get, + "/webhooks/{}", + webhook_id, + ); serde_json::from_reader::<HyperResponse, Webhook>(response) .map_err(From::from) diff --git a/src/http/ratelimiting.rs b/src/http/ratelimiting.rs index ed3eb71..93ca4f6 100644 --- a/src/http/ratelimiting.rs +++ b/src/http/ratelimiting.rs @@ -338,7 +338,7 @@ pub enum Route { /// Route for the `/voice/regions` path. VoiceRegions, /// Route for the `/webhooks/:webhook_id` path. - WebhooksId, + WebhooksId(u64), /// Route where no ratelimit headers are in place (i.e. user account-only /// routes). /// |