|
|
@ -175,3 +175,35 @@ func (s *RepositoriesService) TestHook(owner, repo string, id int) (*Response, e |
|
|
} |
|
|
} |
|
|
return s.client.Do(req, nil) |
|
|
return s.client.Do(req, nil) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ServiceHook represents a hook that has configuration settings, a list of
|
|
|
|
|
|
// available events, and default events.
|
|
|
|
|
|
type ServiceHook struct { |
|
|
|
|
|
Name *string `json:"name,omitempty"` |
|
|
|
|
|
Events []string `json:"events,omitempty"` |
|
|
|
|
|
SupportedEvents []string `json:"supported_events,omitempty"` |
|
|
|
|
|
Schema [][]string `json:"schema,omitempty"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (s *ServiceHook) String() string { |
|
|
|
|
|
return Stringify(s) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ListServiceHooks lists all of the available service hooks.
|
|
|
|
|
|
//
|
|
|
|
|
|
// GitHub API docs: https://developer.github.com/webhooks/#services
|
|
|
|
|
|
func (s *RepositoriesService) ListServiceHooks() ([]ServiceHook, *Response, error) { |
|
|
|
|
|
u := "hooks" |
|
|
|
|
|
req, err := s.client.NewRequest("GET", u, nil) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return nil, nil, err |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hooks := new([]ServiceHook) |
|
|
|
|
|
resp, err := s.client.Do(req, hooks) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return nil, resp, err |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return *hooks, resp, err |
|
|
|
|
|
} |