Skip to content

Add support to list custom roles for organizations #2336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Updated typos in github/org_custom_roles.go
  • Loading branch information
tamboliasir1 committed Apr 24, 2022
commit b01926cb2078e9b9a36275c9380c76b06c0cb6e4
16 changes: 8 additions & 8 deletions github/github-accessors.go

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

20 changes: 10 additions & 10 deletions github/github-accessors_test.go

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

8 changes: 4 additions & 4 deletions github/org_custom_roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"fmt"
)

// OrgainizationCustomRepoRoles represents custom repository roles available in specified organization.
type OrgainizationCustomRepoRoles struct {
// OrganizationCustomRepoRoles represents custom repository roles available in specified organization.
type OrganizationCustomRepoRoles struct {
TotalCount *int `json:"total_count,omitempty"`
CustomRepoRoles []*CustomRepoRoles `json:"custom_roles,omitempty"`
}
Expand All @@ -28,15 +28,15 @@ type CustomRepoRoles struct {
// In order to see custom repository roles in an organization, the authenticated user must be an organization owner.
//
// GitHub API docs: https://docs.github.com/en/rest/orgs/custom-roles
func (s *OrganizationsService) ListCustomRepoRoles(ctx context.Context, org string) (*OrgainizationCustomRepoRoles, *Response, error) {
func (s *OrganizationsService) ListCustomRepoRoles(ctx context.Context, org string) (*OrganizationCustomRepoRoles, *Response, error) {
u := fmt.Sprintf("organizations/%v/custom_roles", org)

req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}

customRepoRoles := new(OrgainizationCustomRepoRoles)
customRepoRoles := new(OrganizationCustomRepoRoles)
resp, err := s.client.Do(ctx, req, customRepoRoles)
if err != nil {
return nil, resp, err
Expand Down
2 changes: 1 addition & 1 deletion github/org_custom_roles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestOrganizationsService_ListCustomRepoRoles(t *testing.T) {
t.Errorf("Organizations.ListCustomRepoRoles returned error: %v", err)
}

want := &OrgainizationCustomRepoRoles{TotalCount: Int(1), CustomRepoRoles: []*CustomRepoRoles{{ID: Int64(1), Name: String("Developer")}}}
want := &OrganizationCustomRepoRoles{TotalCount: Int(1), CustomRepoRoles: []*CustomRepoRoles{{ID: Int64(1), Name: String("Developer")}}}
if !cmp.Equal(apps, want) {
t.Errorf("Organizations.ListCustomRepoRoles returned %+v, want %+v", apps, want)
}
Expand Down