Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions github/github-iterators.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 0 additions & 72 deletions github/github-iterators_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions github/repos_autolinks.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,8 @@ type Autolink struct {
// GitHub API docs: https://docs.github.com/rest/repos/autolinks#get-all-autolinks-of-a-repository
//
//meta:operation GET /repos/{owner}/{repo}/autolinks
func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Autolink, *Response, error) {
func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo string) ([]*Autolink, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/autolinks", owner, repo)
u, err := addOptions(u, opts)
if err != nil {
return nil, nil, err
}

req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
Expand Down
10 changes: 3 additions & 7 deletions github/repos_autolinks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,11 @@ func TestRepositoriesService_ListAutolinks(t *testing.T) {

mux.HandleFunc("/repos/o/r/autolinks", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testFormValues(t, r, values{"page": "2"})
fmt.Fprint(w, `[{"id":1, "key_prefix": "TICKET-", "url_template": "https://example.com/TICKET?query=<num>"}, {"id":2, "key_prefix": "STORY-", "url_template": "https://example.com/STORY?query=<num>"}]`)
})

opt := &ListOptions{
Page: 2,
}
ctx := t.Context()
autolinks, _, err := client.Repositories.ListAutolinks(ctx, "o", "r", opt)
autolinks, _, err := client.Repositories.ListAutolinks(ctx, "o", "r")
if err != nil {
t.Errorf("Repositories.ListAutolinks returned error: %v", err)
}
Expand All @@ -44,12 +40,12 @@ func TestRepositoriesService_ListAutolinks(t *testing.T) {

const methodName = "ListAutolinks"
testBadOptions(t, methodName, func() (err error) {
_, _, err = client.Repositories.ListAutolinks(ctx, "\n", "\n", opt)
_, _, err = client.Repositories.ListAutolinks(ctx, "\n", "\n")
return err
})

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
got, resp, err := client.Repositories.ListAutolinks(ctx, "o", "r", opt)
got, resp, err := client.Repositories.ListAutolinks(ctx, "o", "r")
if got != nil {
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
}
Expand Down
Loading