[APIV4] POST /hooks/outgoing/{hook_id}/regen_token - regentoken endpoint for apiV4 (#5783)

Этот коммит содержится в:
Carlos Tadeu Panato Junior
2017-03-20 13:56:23 +01:00
коммит произвёл George Goldberg
родитель 4efefa0ff6
Коммит 3d14573b8c
3 изменённых файлов: 89 добавлений и 0 удалений

Просмотреть файл

@@ -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.