Skip to content

Commit 0e8dfae

Browse files
authored
Remove ListServiceHooks (#2917)
Fixes: #2916.
1 parent b24403c commit 0e8dfae

6 files changed

Lines changed: 0 additions & 142 deletions

File tree

github/github-accessors.go

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-stringify_test.go

Lines changed: 0 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/misc.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -245,35 +245,3 @@ func (c *Client) Zen(ctx context.Context) (string, *Response, error) {
245245

246246
return buf.String(), resp, nil
247247
}
248-
249-
// ServiceHook represents a hook that has configuration settings, a list of
250-
// available events, and default events.
251-
type ServiceHook struct {
252-
Name *string `json:"name,omitempty"`
253-
Events []string `json:"events,omitempty"`
254-
SupportedEvents []string `json:"supported_events,omitempty"`
255-
Schema [][]string `json:"schema,omitempty"`
256-
}
257-
258-
func (s *ServiceHook) String() string {
259-
return Stringify(s)
260-
}
261-
262-
// ListServiceHooks lists all of the available service hooks.
263-
//
264-
// GitHub API docs: https://developer.github.com/webhooks/#services
265-
func (c *Client) ListServiceHooks(ctx context.Context) ([]*ServiceHook, *Response, error) {
266-
u := "hooks"
267-
req, err := c.NewRequest("GET", u, nil)
268-
if err != nil {
269-
return nil, nil, err
270-
}
271-
272-
var hooks []*ServiceHook
273-
resp, err := c.Do(ctx, req, &hooks)
274-
if err != nil {
275-
return nil, resp, err
276-
}
277-
278-
return hooks, resp, nil
279-
}

github/misc_test.go

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -317,48 +317,6 @@ func TestZen(t *testing.T) {
317317
})
318318
}
319319

320-
func TestListServiceHooks(t *testing.T) {
321-
client, mux, _, teardown := setup()
322-
defer teardown()
323-
324-
mux.HandleFunc("/hooks", func(w http.ResponseWriter, r *http.Request) {
325-
testMethod(t, r, "GET")
326-
fmt.Fprint(w, `[{
327-
"name":"n",
328-
"events":["e"],
329-
"supported_events":["s"],
330-
"schema":[
331-
["a", "b"]
332-
]
333-
}]`)
334-
})
335-
336-
ctx := context.Background()
337-
hooks, _, err := client.ListServiceHooks(ctx)
338-
if err != nil {
339-
t.Errorf("ListServiceHooks returned error: %v", err)
340-
}
341-
342-
want := []*ServiceHook{{
343-
Name: String("n"),
344-
Events: []string{"e"},
345-
SupportedEvents: []string{"s"},
346-
Schema: [][]string{{"a", "b"}},
347-
}}
348-
if !cmp.Equal(hooks, want) {
349-
t.Errorf("ListServiceHooks returned %+v, want %+v", hooks, want)
350-
}
351-
352-
const methodName = "ListServiceHooks"
353-
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
354-
got, resp, err := client.ListServiceHooks(ctx)
355-
if got != nil {
356-
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
357-
}
358-
return resp, err
359-
})
360-
}
361-
362320
func TestMarkdownRequest_Marshal(t *testing.T) {
363321
testJSONMarshal(t, &markdownRequest{}, "{}")
364322

@@ -396,30 +354,3 @@ func TestCodeOfConduct_Marshal(t *testing.T) {
396354

397355
testJSONMarshal(t, a, want)
398356
}
399-
400-
func TestServiceHook_Marshal(t *testing.T) {
401-
testJSONMarshal(t, &ServiceHook{}, "{}")
402-
403-
a := &ServiceHook{
404-
Name: String("name"),
405-
Events: []string{"e"},
406-
SupportedEvents: []string{"se"},
407-
Schema: [][]string{{"g"}},
408-
}
409-
want := `{
410-
"name": "name",
411-
"events": [
412-
"e"
413-
],
414-
"supported_events": [
415-
"se"
416-
],
417-
"schema": [
418-
[
419-
"g"
420-
]
421-
]
422-
}`
423-
424-
testJSONMarshal(t, a, want)
425-
}

test/integration/misc_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,3 @@ func TestRateLimits(t *testing.T) {
6767
t.Errorf("Core.Reset is more than 1 minute in the past; that doesn't seem right.")
6868
}
6969
}
70-
71-
func TestListServiceHooks(t *testing.T) {
72-
hooks, _, err := client.ListServiceHooks(context.Background())
73-
if err != nil {
74-
t.Fatalf("ListServiceHooks returned error: %v", err)
75-
}
76-
77-
if len(hooks) == 0 {
78-
t.Fatalf("ListServiceHooks returned no hooks")
79-
}
80-
}

0 commit comments

Comments
 (0)