summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-03-20 13:56:23 +0100
committerGeorge Goldberg <george@gberg.me>2017-03-20 12:56:23 +0000
commit3d14573b8c4df6f293fdac9933aa270b541234ec (patch)
tree306853083ead0bbdc1419c46dcd9e83bfab2c9bf /model
parent4efefa0ff6a49491ea33ca7fd5c9efd2422b0fe1 (diff)
downloadchat-3d14573b8c4df6f293fdac9933aa270b541234ec.tar.gz
chat-3d14573b8c4df6f293fdac9933aa270b541234ec.tar.bz2
chat-3d14573b8c4df6f293fdac9933aa270b541234ec.zip
[APIV4] POST /hooks/outgoing/{hook_id}/regen_token - regentoken endpoint for apiV4 (#5783)
Diffstat (limited to 'model')
-rw-r--r--model/client4.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index bcefe90a4..d6d804c7b 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -182,6 +182,10 @@ func (c *Client4) GetOutgoingWebhooksRoute() string {
return fmt.Sprintf("/hooks/outgoing")
}
+func (c *Client4) GetOutgoingWebhookRoute(hookID string) string {
+ return fmt.Sprintf(c.GetOutgoingWebhooksRoute()+"/%v", hookID)
+}
+
func (c *Client4) GetPreferencesRoute(userId string) string {
return fmt.Sprintf(c.GetUserRoute(userId) + "/preferences")
}
@@ -1329,6 +1333,16 @@ func (c *Client4) GetOutgoingWebhooksForTeam(teamId string, page int, perPage in
}
}
+// RegenOutgoingHookToken regenerate the outgoing webhook token.
+func (c *Client4) RegenOutgoingHookToken(hookId string) (*OutgoingWebhook, *Response) {
+ if r, err := c.DoApiPost(c.GetOutgoingWebhookRoute(hookId)+"/regen_token", ""); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return OutgoingWebhookFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// Preferences Section
// GetPreferences returns the user's preferences.