You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
537 B

  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package gogs
  5. import (
  6. "bytes"
  7. "encoding/json"
  8. "fmt"
  9. )
  10. func (c *Client) AdminCreateOrg(user string, opt CreateOrgOption) (*Organization, error) {
  11. body, err := json.Marshal(&opt)
  12. if err != nil {
  13. return nil, err
  14. }
  15. org := new(Organization)
  16. return org, c.getParsedResponse("POST", fmt.Sprintf("/admin/users/%s/orgs", user),
  17. jsonHeader, bytes.NewReader(body), org)
  18. }