// Copyright 2017 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 github

import (
	
	
)

// ListOutsideCollaboratorsOptions specifies optional parameters to the
// OrganizationsService.ListOutsideCollaborators method.
type ListOutsideCollaboratorsOptions struct {
	// Filter outside collaborators returned in the list. Possible values are:
	// 2fa_disabled, all.  Default is "all".
	Filter string `url:"filter,omitempty"`

	ListOptions
}

// ListOutsideCollaborators lists outside collaborators of organization's repositories.
// This will only work if the authenticated
// user is an owner of the organization.
//
// Warning: The API may change without advance notice during the preview period.
// Preview features are not supported for production use.
//
// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators#list-outside-collaborators-for-an-organization
//
//meta:operation GET /orgs/{org}/outside_collaborators
func ( *OrganizationsService) ( context.Context,  string,  *ListOutsideCollaboratorsOptions) ([]*User, *Response, error) {
	 := fmt.Sprintf("orgs/%v/outside_collaborators", )
	,  := addOptions(, )
	if  != nil {
		return nil, nil, 
	}

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

	var  []*User
	,  := .client.Do(, , &)
	if  != nil {
		return nil, , 
	}

	return , , nil
}

// RemoveOutsideCollaborator removes a user from the list of outside collaborators;
// consequently, removing them from all the organization's repositories.
//
// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators#remove-outside-collaborator-from-an-organization
//
//meta:operation DELETE /orgs/{org}/outside_collaborators/{username}
func ( *OrganizationsService) ( context.Context,  string,  string) (*Response, error) {
	 := fmt.Sprintf("orgs/%v/outside_collaborators/%v", , )
	,  := .client.NewRequest("DELETE", , nil)
	if  != nil {
		return nil, 
	}

	return .client.Do(, , nil)
}

// ConvertMemberToOutsideCollaborator reduces the permission level of a member of the
// organization to that of an outside collaborator. Therefore, they will only
// have access to the repositories that their current team membership allows.
// Responses for converting a non-member or the last owner to an outside collaborator
// are listed in GitHub API docs.
//
// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators#convert-an-organization-member-to-outside-collaborator
//
//meta:operation PUT /orgs/{org}/outside_collaborators/{username}
func ( *OrganizationsService) ( context.Context,  string,  string) (*Response, error) {
	 := fmt.Sprintf("orgs/%v/outside_collaborators/%v", , )
	,  := .client.NewRequest("PUT", , nil)
	if  != nil {
		return nil, 
	}

	return .client.Do(, , nil)
}