Add CreateTeamOption

This commit is contained in:
Unknwon 2016-03-21 12:45:51 -04:00
parent 788ec59749
commit 1da1834d36
9 changed files with 27 additions and 9 deletions

View file

@ -11,14 +11,6 @@ import (
"net/http" "net/http"
) )
type CreateOrgOption struct {
UserName string `json:"username" binding:"Required"`
FullName string `json:"full_name"`
Description string `json:"description"`
Website string `json:"website"`
Location string `json:"location"`
}
func (c *Client) AdminCreateOrg(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 {

View file

@ -14,7 +14,7 @@ import (
) )
func Version() string { func Version() string {
return "0.8.0" return "0.8.1"
} }
// Client represents a Gogs API client. // Client represents a Gogs API client.

8
org.go
View file

@ -36,6 +36,14 @@ func (c *Client) GetOrg(orgname string) (*Organization, error) {
return org, c.getParsedResponse("GET", fmt.Sprintf("/orgs/%s", orgname), nil, nil, org) return org, c.getParsedResponse("GET", fmt.Sprintf("/orgs/%s", orgname), nil, nil, org)
} }
type CreateOrgOption struct {
UserName string `json:"username" binding:"Required"`
FullName string `json:"full_name"`
Description string `json:"description"`
Website string `json:"website"`
Location string `json:"location"`
}
type EditOrgOption struct { type EditOrgOption struct {
FullName string `json:"full_name"` FullName string `json:"full_name"`
Description string `json:"description"` Description string `json:"description"`

18
org_team.go Normal file
View file

@ -0,0 +1,18 @@
// Copyright 2016 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
type Team struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Permission string `json:"permission"`
}
type CreateTeamOption struct {
Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"`
Description string `json:"description" binding:"MaxSize(255)"`
Permission string `json:"permission"`
}