#21 code cleanup

This commit is contained in:
Unknwon 2016-08-05 20:56:36 -07:00
parent 3a3b83760f
commit 58af7d8521
2 changed files with 5 additions and 6 deletions

View file

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

View file

@ -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
// license that can be found in the LICENSE file.
@ -12,15 +12,14 @@ import (
)
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)
if err != nil {
return err
}
_, err = c.getResponse("PUT", fmt.Sprintf("/orgs/%s/membership/%s", orgname, username),
http.Header{"content-type": []string{"application/json"}}, bytes.NewReader(body))
_, err = c.getResponse("PUT", fmt.Sprintf("/orgs/%s/membership/%s", org, user), jsonHeader, bytes.NewReader(body))
return err
}