add webhooks v8 (#759)

* add webhook structure and getChannelWebhooks as well as getServerWebhooks

* add sendMessage

* add the ability to edit create and delete hooks

* remove server wide cache and add getter.
This commit is contained in:
Jacob
2016-10-01 06:53:14 -04:00
committed by Amish Shah
parent d22ca969db
commit c00d209014
15 changed files with 548 additions and 45 deletions

View File

@@ -64,6 +64,9 @@ var Endpoints = Constants.Endpoints = {
SERVER_CHANNELS: function SERVER_CHANNELS(serverID) {
return Endpoints.SERVER(serverID) + "/channels";
},
SERVER_WEBHOOKS: function SERVER_WEBHOOKS(serverID) {
return Endpoints.SERVER(serverID) + "/webhooks";
},
// channels
CHANNELS: API + "/channels",
@@ -91,6 +94,24 @@ var Endpoints = Constants.Endpoints = {
CHANNEL_PIN: function CHANNEL_PIN(channelID, messageID) {
return Endpoints.CHANNEL_PINS(channelID) + "/" + messageID;
},
CHANNEL_WEBHOOKS: function CHANNEL_WEBHOOKS(channelID) {
return Endpoints.CHANNEL(channelID) + "/webhooks";
},
// webhooks
WEBHOOKS: API + "/webhooks",
WEBHOOK: function WEBHOOK(webhookID) {
return Endpoints.WEBHOOKS + "/" + webhookID;
},
WEBHOOK_WITH_TOKEN: function WEBHOOK_WITH_TOKEN(webhookID, webhookToken) {
return Endpoints.WEBHOOKS + "/" + webhookToken;
},
WEBHOOK_MESSAGE: function WEBHOOK_MESSAGE(webhookID, webhookToken) {
return Endpoints.WEBHOOK(webhookID) + "/" + webhookToken;
},
WEBHOOK_MESSAGE_SLACK: function WEBHOOK_MESSAGE_SLACK(webhookID, webhookToken) {
return Endpoints.WEBHOOK_MESSAGE(webhookID, webhookToken) + "/slack";
},
// friends
FRIENDS: API + "/users/@me/relationships"