admin creare repo
This commit is contained in:
parent
ce7aab692f
commit
78460e9b86
3 changed files with 27 additions and 5 deletions
|
@ -19,7 +19,7 @@ type CreateOrgOption struct {
|
||||||
Location string `json:"location"`
|
Location string `json:"location"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) CreateOrg(user string, opt CreateOrgOption) (*Organization, error) {
|
func (c *Client) AdminCreateOrg(user string, opt CreateOrgOption) (*Organization, error) {
|
||||||
body, err := json.Marshal(&opt)
|
body, err := json.Marshal(&opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
22
admin_repos.go
Normal file
22
admin_repos.go
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
// 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)
|
||||||
|
}
|
|
@ -20,7 +20,7 @@ type CreateUserOption struct {
|
||||||
SendNotify bool `json:"send_notify"`
|
SendNotify bool `json:"send_notify"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) CreateUser(opt CreateUserOption) (*User, error) {
|
func (c *Client) AdminCreateUser(opt CreateUserOption) (*User, error) {
|
||||||
body, err := json.Marshal(&opt)
|
body, err := json.Marshal(&opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -44,7 +44,7 @@ type EditUserOption struct {
|
||||||
AllowImportLocal *bool `json:"allow_import_local"`
|
AllowImportLocal *bool `json:"allow_import_local"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) EditUser(user string, opt EditUserOption) error {
|
func (c *Client) AdminEditUser(user string, opt EditUserOption) error {
|
||||||
body, err := json.Marshal(&opt)
|
body, err := json.Marshal(&opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -54,12 +54,12 @@ func (c *Client) EditUser(user string, opt EditUserOption) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) DeleteUser(user string) error {
|
func (c *Client) AdminDeleteUser(user string) error {
|
||||||
_, err := c.getResponse("DELETE", fmt.Sprintf("/admin/users/%s", user), nil, nil)
|
_, err := c.getResponse("DELETE", fmt.Sprintf("/admin/users/%s", user), nil, nil)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) CreateUserPublicKey(user string, opt CreateKeyOption) (*PublicKey, error) {
|
func (c *Client) AdminCreateUserPublicKey(user string, opt CreateKeyOption) (*PublicKey, error) {
|
||||||
body, err := json.Marshal(&opt)
|
body, err := json.Marshal(&opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in a new issue