mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-08-06 22:13:02 +02:00
✨ Add: Organization Webhook API [HX-822] (#11)
✨ Add: Organization Webhook API
This commit is contained in:
@ -55,6 +55,16 @@ type PropertyKeys struct {
|
||||
Keys []PropertyKey `json:"keys,omitempty" structs:"keys,omitempty"`
|
||||
}
|
||||
|
||||
type Webhook struct {
|
||||
Name string `json:"name,omitempty" structs:"name,omitempty"`
|
||||
WebhookUrl string `json:"url,omitempty" structs:"url,omitempty"`
|
||||
SelfUrl string `json:"self,omitempty" structs:"self,omitempty"`
|
||||
Events []string `json:"events,omitempty" structs:"events,omitempty"`
|
||||
Enabled bool `json:"enabled" structs:"enabled"`
|
||||
LastUpdatedUserName string `json:"lastUpdatedDisplayName,omitempty" structs:"lastUpdatedDisplayName,omitempty"`
|
||||
LastUpdatedUserId string `json:"lastUpdatedUser,omitempty" structs:"lastUpdatedUser,omitempty"`
|
||||
}
|
||||
|
||||
// GetAllOrganizationsWithContext returns a list of organizations in
|
||||
// the Jira Service Management instance.
|
||||
// Use this method when you want to present a list
|
||||
@ -385,3 +395,25 @@ func (s *OrganizationService) RemoveUsersWithContext(ctx context.Context, organi
|
||||
func (s *OrganizationService) RemoveUsers(organizationID int, users OrganizationUsersDTO) (*Response, error) {
|
||||
return s.RemoveUsersWithContext(context.Background(), organizationID, users)
|
||||
}
|
||||
|
||||
func (s *OrganizationService) GetWebhookList(ctx context.Context) ([]*Webhook, *Response, error) {
|
||||
apiEndPoint := "rest/webhooks/1.0/webhook"
|
||||
|
||||
req, err := s.client.NewRequestWithContext(ctx, "GET", apiEndPoint, nil)
|
||||
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", "application/json")
|
||||
|
||||
webhooks := []*Webhook{}
|
||||
|
||||
resp, err := s.client.Do(req, &webhooks)
|
||||
if err != nil {
|
||||
jerr := NewJiraError(resp, err)
|
||||
return nil, resp, jerr
|
||||
}
|
||||
|
||||
return webhooks, resp, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user