go get github.com/trifonovmixail/jira-hooks
import (
hooks "github.com/trifonovmixail/jira-hooks"
"net/http"
)
func manyHooks(request *http.Request) int {
hook, err := hooks.Parse(
request,
hooks.IssueCreatedEvent,
hooks.StatusTransitionEvent,
)
if err != nil {
return http.StatusBadRequest
}
switch hook.(type) {
case hooks.IssueCreatedPayload:
payload := hook.(hooks.IssueCreatedPayload)
case hooks.TransitionIssueStatusPayload:
payload := hook.(hooks.TransitionIssueStatusPayload)
}
return http.StatusBadRequest
}
func oneHook(request *http.Request) int {
hook, err := hooks.Parse(request, hooks.StatusTransitionEvent)
if err != nil {
return http.StatusBadRequest
}
payload, ok := hook.(hooks.TransitionIssueStatusPayload)
if !ok {
return http.StatusBadRequest
}
return http.StatusOK
}
Payloads:
- TransitionIssueStatusPayload
Payloads:
- IssueCreatedPayload
Payloads:
- IssueGenericPayload
- IssueUpdatedPayload
- IssueCommentCreatedPayload
- IssueCommentUpdatedPayload
- IssueCommentDeletedPayload
- IssueAssignedPayload
- IssueMovedPayload
Payloads:
- IssueDeletedPayload
Payloads:
- IssueWorkLogCreatedPayload
- IssueWorkLogUpdatedPayload
- IssueWorkLogDeletedPayload
Payloads:
- CommentCreatedPayload
Payloads:
- CommentUpdatedPayload
Payloads:
- CommentDeletedPayload
Payloads:
- WorkLogCreatedPayload
Payloads:
- WorkLogUpdatedPayload
Payloads:
- WorkLogDeletedPayload
Payloads:
- LinkCreatedPayload
Payloads:
- LinkDeletedPayload
Payloads:
- UserCreatedPayload
Payloads:
- UserUpdatedPayload
Payloads:
- UserDeletedPayload
Payloads:
- ProjectCreatedPayload
Payloads:
- ProjectUpdatedPayload
Payloads:
- ProjectDeletedPayload
Payloads:
- ProjectArchivedPayload
Payloads:
- ProjectRestoredPayload
Payloads:
- BoardCreatedPayload
Payloads:
- BoardUpdatedPayload
Payloads:
- BoardDeletedPayload
Payloads:
- BoardConfigurationChangedPayload
Payloads:
- SprintCreatedPayload
Payloads:
- SprintUpdatedPayload
Payloads:
- SprintDeletedPayload
Payloads:
- SprintStartedPayload
Payloads:
- SprintClosedPayload
Payloads:
- VersionCreatedPayload
Payloads:
- VersionUpdatedPayload
Payloads:
- VersionDeletedPayload
Payloads:
- VersionReleasedPayload
Payloads:
- VersionUnreleasedPayload
Payloads:
- OptionTimeTrackingChangedPayload
Payloads:
- OptionIssueLinksChangedPayload
Payloads:
- OptionSubTasksChangedPayload
Payloads:
- OptionAttachmentsChangedPayload
Payloads:
- OptionWatchingChangedPayload
Payloads:
- OptionVotingChangedPayload
Payloads:
- OptionUnassignedIssuesChangedPayload
You can debug request from jira, use hooks.DebugRequest = true
for this.