You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

repo_collaborator.go 613B

123456789101112131415161718192021222324
  1. // Copyright 2016 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package gitea
  5. import (
  6. "bytes"
  7. "encoding/json"
  8. "fmt"
  9. )
  10. type AddCollaboratorOption struct {
  11. Permission *string `json:"permission"`
  12. }
  13. func (c *Client) AddCollaborator(user, repo, collaborator string, opt AddCollaboratorOption) error {
  14. body, err := json.Marshal(&opt)
  15. if err != nil {
  16. return err
  17. }
  18. _, err = c.getResponse("PUT", fmt.Sprintf("/repos/%s/%s/collaborators/%s", user, repo, collaborator), nil, bytes.NewReader(body))
  19. return err
  20. }