...
1
2
3
4
5
6 package github
7
8 import (
9 "context"
10 "fmt"
11 )
12
13
14
15
16 func (s *OrganizationsService) GetHookConfiguration(ctx context.Context, org string, id int64) (*HookConfig, *Response, error) {
17 u := fmt.Sprintf("orgs/%v/hooks/%v/config", org, id)
18 req, err := s.client.NewRequest("GET", u, nil)
19 if err != nil {
20 return nil, nil, err
21 }
22
23 config := new(HookConfig)
24 resp, err := s.client.Do(ctx, req, config)
25 if err != nil {
26 return nil, resp, err
27 }
28
29 return config, resp, nil
30 }
31
32
33
34
35 func (s *OrganizationsService) EditHookConfiguration(ctx context.Context, org string, id int64, config *HookConfig) (*HookConfig, *Response, error) {
36 u := fmt.Sprintf("orgs/%v/hooks/%v/config", org, id)
37 req, err := s.client.NewRequest("PATCH", u, config)
38 if err != nil {
39 return nil, nil, err
40 }
41
42 c := new(HookConfig)
43 resp, err := s.client.Do(ctx, req, c)
44 if err != nil {
45 return nil, resp, err
46 }
47
48 return c, resp, nil
49 }
50
View as plain text