#21 code cleanup
This commit is contained in:
parent
3a3b83760f
commit
58af7d8521
2 changed files with 5 additions and 6 deletions
2
gogs.go
2
gogs.go
|
@ -14,7 +14,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func Version() string {
|
func Version() string {
|
||||||
return "0.10.1"
|
return "0.10.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client represents a Gogs API client.
|
// Client represents a Gogs API client.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2015 The Gogs Authors. All rights reserved.
|
// Copyright 2016 The Gogs Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -12,15 +12,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type AddOrgMembershipOption struct {
|
type AddOrgMembershipOption struct {
|
||||||
Role string `json:"role"`
|
Role string `json:"role"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) AddOrgMembership(orgname string, username string, opt AddOrgMembershipOption) error {
|
func (c *Client) AddOrgMembership(org, user string, opt AddOrgMembershipOption) error {
|
||||||
body, err := json.Marshal(&opt)
|
body, err := json.Marshal(&opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
_, err = c.getResponse("PUT", fmt.Sprintf("/orgs/%s/membership/%s", orgname, username),
|
_, err = c.getResponse("PUT", fmt.Sprintf("/orgs/%s/membership/%s", org, user), jsonHeader, bytes.NewReader(body))
|
||||||
http.Header{"content-type": []string{"application/json"}}, bytes.NewReader(body))
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
Loading…
Reference in a new issue