// Copyright 2022 The go-github AUTHORS. All rights reserved.//// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package githubimport ()// OrganizationCustomRoles represents custom organization roles available in specified organization.typeOrganizationCustomRolesstruct { TotalCount *int`json:"total_count,omitempty"` CustomRepoRoles []*CustomOrgRoles`json:"roles,omitempty"`}// CustomOrgRoles represents custom organization role available in specified organization.typeCustomOrgRolesstruct { ID *int64`json:"id,omitempty"` Name *string`json:"name,omitempty"` Description *string`json:"description,omitempty"` Permissions []string`json:"permissions,omitempty"` Org *Organization`json:"organization,omitempty"` CreatedAt *Timestamp`json:"created_at,omitempty"` UpdatedAt *Timestamp`json:"updated_at,omitempty"` Source *string`json:"source,omitempty"` BaseRole *string`json:"base_role,omitempty"`}// CreateOrUpdateOrgRoleOptions represents options required to create or update a custom organization role.typeCreateOrUpdateOrgRoleOptionsstruct { Name *string`json:"name,omitempty"` Description *string`json:"description,omitempty"` Permissions []string`json:"permissions"` BaseRole *string`json:"base_role,omitempty"`}// ListRoles lists the custom roles available in this organization.// In order to see custom roles in an organization, the authenticated user must be an organization owner.//// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#get-all-organization-roles-for-an-organization////meta:operation GET /orgs/{org}/organization-rolesfunc ( *OrganizationsService) ( context.Context, string) (*OrganizationCustomRoles, *Response, error) { := fmt.Sprintf("orgs/%v/organization-roles", ) , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, } := new(OrganizationCustomRoles) , := .client.Do(, , )if != nil {returnnil, , }return , , nil}// GetOrgRole gets an organization role in this organization.// In order to get organization roles in an organization, the authenticated user must be an organization owner, or have access via an organization role.//// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#get-an-organization-role////meta:operation GET /orgs/{org}/organization-roles/{role_id}func ( *OrganizationsService) ( context.Context, string, int64) (*CustomOrgRoles, *Response, error) { := fmt.Sprintf("orgs/%v/organization-roles/%v", , ) , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, } := new(CustomOrgRoles) , := .client.Do(, , )if != nil {returnnil, , }return , , }// CreateCustomOrgRole creates a custom role in this organization.// In order to create custom roles in an organization, the authenticated user must be an organization owner.//// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#create-a-custom-organization-role////meta:operation POST /orgs/{org}/organization-rolesfunc ( *OrganizationsService) ( context.Context, string, *CreateOrUpdateOrgRoleOptions) (*CustomOrgRoles, *Response, error) { := fmt.Sprintf("orgs/%v/organization-roles", ) , := .client.NewRequest("POST", , )if != nil {returnnil, nil, } := new(CustomOrgRoles) , := .client.Do(, , )if != nil {returnnil, , }return , , }// UpdateCustomOrgRole updates a custom role in this organization.// In order to update custom roles in an organization, the authenticated user must be an organization owner.//// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#update-a-custom-organization-role////meta:operation PATCH /orgs/{org}/organization-roles/{role_id}func ( *OrganizationsService) ( context.Context, string, int64, *CreateOrUpdateOrgRoleOptions) (*CustomOrgRoles, *Response, error) { := fmt.Sprintf("orgs/%v/organization-roles/%v", , ) , := .client.NewRequest("PATCH", , )if != nil {returnnil, nil, } := new(CustomOrgRoles) , := .client.Do(, , )if != nil {returnnil, , }return , , }// DeleteCustomOrgRole deletes an existing custom role in this organization.// In order to delete custom roles in an organization, the authenticated user must be an organization owner.//// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#delete-a-custom-organization-role////meta:operation DELETE /orgs/{org}/organization-roles/{role_id}func ( *OrganizationsService) ( context.Context, string, int64) (*Response, error) { := fmt.Sprintf("orgs/%v/organization-roles/%v", , ) , := .client.NewRequest("DELETE", , nil)if != nil {returnnil, } := new(CustomOrgRoles) , := .client.Do(, , )if != nil {return , }return , nil}// AssignOrgRoleToTeam assigns an existing organization role to a team in this organization.// In order to assign organization roles in an organization, the authenticated user must be an organization owner.//// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#assign-an-organization-role-to-a-team////meta:operation PUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}func ( *OrganizationsService) ( context.Context, , string, int64) (*Response, error) { := fmt.Sprintf("orgs/%v/organization-roles/teams/%v/%v", , , ) , := .client.NewRequest("PUT", , nil)if != nil {returnnil, } , := .client.Do(, , nil)if != nil {return , }return , nil}// RemoveOrgRoleFromTeam removes an existing organization role assignment from a team in this organization.// In order to remove organization role assignments in an organization, the authenticated user must be an organization owner.//// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#remove-an-organization-role-from-a-team////meta:operation DELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}func ( *OrganizationsService) ( context.Context, , string, int64) (*Response, error) { := fmt.Sprintf("orgs/%v/organization-roles/teams/%v/%v", , , ) , := .client.NewRequest("DELETE", , nil)if != nil {returnnil, } , := .client.Do(, , nil)if != nil {return , }return , nil}// AssignOrgRoleToUser assigns an existing organization role to a user in this organization.// In order to assign organization roles in an organization, the authenticated user must be an organization owner.//// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#assign-an-organization-role-to-a-user////meta:operation PUT /orgs/{org}/organization-roles/users/{username}/{role_id}func ( *OrganizationsService) ( context.Context, , string, int64) (*Response, error) { := fmt.Sprintf("orgs/%v/organization-roles/users/%v/%v", , , ) , := .client.NewRequest("PUT", , nil)if != nil {returnnil, } , := .client.Do(, , nil)if != nil {return , }return , nil}// RemoveOrgRoleFromUser removes an existing organization role assignment from a user in this organization.// In order to remove organization role assignments in an organization, the authenticated user must be an organization owner.//// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#remove-an-organization-role-from-a-user////meta:operation DELETE /orgs/{org}/organization-roles/users/{username}/{role_id}func ( *OrganizationsService) ( context.Context, , string, int64) (*Response, error) { := fmt.Sprintf("orgs/%v/organization-roles/users/%v/%v", , , ) , := .client.NewRequest("DELETE", , nil)if != nil {returnnil, } , := .client.Do(, , nil)if != nil {return , }return , nil}// ListTeamsAssignedToOrgRole returns all teams assigned to a specific organization role.// In order to list teams assigned to an organization role, the authenticated user must be an organization owner.//// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#list-teams-that-are-assigned-to-an-organization-role////meta:operation GET /orgs/{org}/organization-roles/{role_id}/teamsfunc ( *OrganizationsService) ( context.Context, string, int64, *ListOptions) ([]*Team, *Response, error) { := fmt.Sprintf("orgs/%v/organization-roles/%v/teams", , ) , := addOptions(, )if != nil {returnnil, nil, } , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var []*Team , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// ListUsersAssignedToOrgRole returns all users assigned to a specific organization role.// In order to list users assigned to an organization role, the authenticated user must be an organization owner.//// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#list-users-that-are-assigned-to-an-organization-role////meta:operation GET /orgs/{org}/organization-roles/{role_id}/usersfunc ( *OrganizationsService) ( context.Context, string, int64, *ListOptions) ([]*User, *Response, error) { := fmt.Sprintf("orgs/%v/organization-roles/%v/users", , ) , := addOptions(, )if != nil {returnnil, nil, } , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var []*User , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.