Skip to content

Commit

Permalink
Change ListPendingOrgInvitations method to take string org name. (goo…
Browse files Browse the repository at this point in the history
…gle#731)

The /orgs/:org GitHub API endpoint expects the string name of the
organization, not its integer ID (that would be /organizations/:id
endpoint, which we're generally not using).

Change the org parameter type from int to string to make it possible to
specify the organization via its name.

This method wasn't functional before.

Fixes google#730.
  • Loading branch information
dmitshur authored and gmlewis committed Oct 3, 2017
1 parent 19edc5e commit f6bc16c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

const (
libraryVersion = "11"
libraryVersion = "12"
defaultBaseURL = "https://api.github.com/"
uploadBaseURL = "https://uploads.github.com/"
userAgent = "go-github/" + libraryVersion
Expand Down
2 changes: 1 addition & 1 deletion github/orgs_members.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func (s *OrganizationsService) RemoveOrgMembership(ctx context.Context, user, or
// ListPendingOrgInvitations returns a list of pending invitations.
//
// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-pending-organization-invitations
func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, org int, opt *ListOptions) ([]*Invitation, *Response, error) {
func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, org string, opt *ListOptions) ([]*Invitation, *Response, error) {
u := fmt.Sprintf("orgs/%v/invitations", org)
u, err := addOptions(u, opt)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions github/orgs_members_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ func TestOrganizationsService_ListPendingOrgInvitations(t *testing.T) {
setup()
defer teardown()

mux.HandleFunc("/orgs/1/invitations", func(w http.ResponseWriter, r *http.Request) {
mux.HandleFunc("/orgs/o/invitations", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testFormValues(t, r, values{"page": "1"})
fmt.Fprint(w, `[
Expand Down Expand Up @@ -394,7 +394,7 @@ func TestOrganizationsService_ListPendingOrgInvitations(t *testing.T) {
})

opt := &ListOptions{Page: 1}
invitations, _, err := client.Organizations.ListPendingOrgInvitations(context.Background(), 1, opt)
invitations, _, err := client.Organizations.ListPendingOrgInvitations(context.Background(), "o", opt)
if err != nil {
t.Errorf("Organizations.ListPendingOrgInvitations returned error: %v", err)
}
Expand Down

0 comments on commit f6bc16c

Please sign in to comment.