REST API speed improvement (#1577)

This commit is contained in:
Gus Caplan
2017-07-01 04:14:17 -05:00
committed by Amish Shah
parent 6bc7b3e068
commit 5ecd5f7d69
25 changed files with 114 additions and 109 deletions

View File

@@ -150,7 +150,7 @@ class Webhook {
file.file = buffer;
return file;
})
)).then(files => this.client.api.webhooks(this.id, this.token).post({
)).then(files => this.client.api.webhooks.opts(this.id, this.token).post({
data: options,
query: { wait: true },
files,
@@ -158,7 +158,7 @@ class Webhook {
}));
}
return this.client.api.webhooks(this.id, this.token).post({
return this.client.api.webhooks.opts(this.id, this.token).post({
data: options,
query: { wait: true },
auth: false,
@@ -187,7 +187,7 @@ class Webhook {
* }).catch(console.error);
*/
sendSlackMessage(body) {
return this.client.api.webhooks(this.id, this.token).slack.post({
return this.client.api.webhooks.opts(this.id, this.token).slack.post({
query: { wait: true },
auth: false,
data: body,
@@ -213,7 +213,7 @@ class Webhook {
return this.edit({ name, avatar: dataURI }, reason);
});
}
return this.client.api.webhooks(this.id, this.token).patch({
return this.client.api.webhooks.opts(this.id, this.token).patch({
data: { name, avatar },
reason,
}).then(data => {
@@ -229,7 +229,7 @@ class Webhook {
* @returns {Promise}
*/
delete(reason) {
return this.client.api.webhooks(this.id, this.token).delete({ reason });
return this.client.api.webhooks.opts(this.id, this.token).delete({ reason });
}
}