forgejo-sdk/org_member.go

25 lines
592 B
Go
Raw Normal View History

2016-08-06 04:56:36 +01:00
// 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 gitea
import (
"bytes"
"encoding/json"
"fmt"
)
type AddOrgMembershipOption struct {
2016-08-06 05:25:42 +01:00
Role string `json:"role" binding:"Required"`
}
2016-08-06 04:56:36 +01:00
func (c *Client) AddOrgMembership(org, user string, opt AddOrgMembershipOption) error {
body, err := json.Marshal(&opt)
if err != nil {
return err
}
2016-08-06 04:56:36 +01:00
_, err = c.getResponse("PUT", fmt.Sprintf("/orgs/%s/membership/%s", org, user), jsonHeader, bytes.NewReader(body))
return err
}