woodpecker/vendor/github.com/gogits/go-gogs-client/admin_repos.go
2016-01-21 09:41:34 -07:00

22 lines
598 B
Go

// Copyright 2015 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package gogs
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func (c *Client) AdminCreateRepo(user string, opt CreateRepoOption) (*Repository, error) {
body, err := json.Marshal(&opt)
if err != nil {
return nil, err
}
repo := new(Repository)
return repo, c.getParsedResponse("POST", fmt.Sprintf("/admin/users/%s/repos", user),
http.Header{"content-type": []string{"application/json"}}, bytes.NewReader(body), repo)
}