mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-19 10:12:54 +02:00
Migrate gitea-sdk to v0.12.0 (#133)
Migrate Update code.gitea.io/sdk/gitea to v0.12.0. Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/133 Reviewed-by: Andrew Thornton <art27@cantab.net> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
22
vendor/code.gitea.io/sdk/gitea/repo_collaborator.go
generated
vendored
22
vendor/code.gitea.io/sdk/gitea/repo_collaborator.go
generated
vendored
@ -10,20 +10,23 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// ListCollaboratorsOptions options for listing a repository's collaborators
|
||||
type ListCollaboratorsOptions struct {
|
||||
ListOptions
|
||||
}
|
||||
|
||||
// ListCollaborators list a repository's collaborators
|
||||
func (c *Client) ListCollaborators(user, repo string) ([]*User, error) {
|
||||
collaborators := make([]*User, 0, 10)
|
||||
err := c.getParsedResponse("GET",
|
||||
fmt.Sprintf("/repos/%s/%s/collaborators", user, repo),
|
||||
func (c *Client) ListCollaborators(user, repo string, opt ListCollaboratorsOptions) ([]*User, error) {
|
||||
opt.setDefaults()
|
||||
collaborators := make([]*User, 0, opt.PageSize)
|
||||
return collaborators, c.getParsedResponse("GET",
|
||||
fmt.Sprintf("/repos/%s/%s/collaborators?%s", user, repo, opt.getURLQuery().Encode()),
|
||||
nil, nil, &collaborators)
|
||||
return collaborators, err
|
||||
}
|
||||
|
||||
// IsCollaborator check if a user is a collaborator of a repository
|
||||
func (c *Client) IsCollaborator(user, repo, collaborator string) (bool, error) {
|
||||
status, err := c.getStatusCode("GET",
|
||||
fmt.Sprintf("/repos/%s/%s/collaborators/%s", user, repo, collaborator),
|
||||
nil, nil)
|
||||
status, err := c.getStatusCode("GET", fmt.Sprintf("/repos/%s/%s/collaborators/%s", user, repo, collaborator), nil, nil)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@ -51,7 +54,6 @@ func (c *Client) AddCollaborator(user, repo, collaborator string, opt AddCollabo
|
||||
// DeleteCollaborator remove a collaborator from a repository
|
||||
func (c *Client) DeleteCollaborator(user, repo, collaborator string) error {
|
||||
_, err := c.getResponse("DELETE",
|
||||
fmt.Sprintf("/repos/%s/%s/collaborators/%s", user, repo, collaborator),
|
||||
nil, nil)
|
||||
fmt.Sprintf("/repos/%s/%s/collaborators/%s", user, repo, collaborator), nil, nil)
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user