forked from google/go-github
/
org_custom_roles.go
38 lines (31 loc) · 1.03 KB
/
org_custom_roles.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package github
import (
"context"
"fmt"
)
// OrginizationCustomRoles represents custom repository roles available in specified organization
type OrginizationCustomRoles struct {
TotalCount *int `json:"total_count,omitempty"`
CustomRoles []*CustomRoles `json:"custom_roles,omitempty"`
}
// CustomRoles represents information of custom roles
type CustomRoles struct {
ID *int64 `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
}
// List Custome Roles in Org
//
// GitHub API docs: https://docs.github.com/en/rest/reference/orgs#custom-repository-roles
func (s *OrganizationsService) ListCustomRoles(ctx context.Context, organization_id string) (*OrginizationCustomRoles, *Response, error) {
u := fmt.Sprintf("organizations/%v/custom_roles", organization_id)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
custom_roles := new(OrginizationCustomRoles)
resp, err := s.client.Do(ctx, req, custom_roles)
if err != nil {
return nil, resp, err
}
return custom_roles, resp, nil
}