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.

admin_repo.go 540B

123456789101112131415161718192021
  1. // Copyright 2015 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. func (c *Client) AdminCreateRepo(user string, opt CreateRepoOption) (*Repository, error) {
  11. body, err := json.Marshal(&opt)
  12. if err != nil {
  13. return nil, err
  14. }
  15. repo := new(Repository)
  16. return repo, c.getParsedResponse("POST", fmt.Sprintf("/admin/users/%s/repos", user),
  17. jsonHeader, bytes.NewReader(body), repo)
  18. }