org.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. type Organization struct {
  11. ID int64 `json:"id"`
  12. UserName string `json:"username"`
  13. FullName string `json:"full_name"`
  14. AvatarUrl string `json:"avatar_url"`
  15. Description string `json:"description"`
  16. Website string `json:"website"`
  17. Location string `json:"location"`
  18. }
  19. func (c *Client) ListMyOrgs() ([]*Organization, error) {
  20. orgs := make([]*Organization, 0, 5)
  21. return orgs, c.getParsedResponse("GET", "/user/orgs", nil, nil, &orgs)
  22. }
  23. func (c *Client) ListUserOrgs(user string) ([]*Organization, error) {
  24. orgs := make([]*Organization, 0, 5)
  25. return orgs, c.getParsedResponse("GET", fmt.Sprintf("/users/%s/orgs", user), nil, nil, &orgs)
  26. }
  27. func (c *Client) GetOrg(orgname string) (*Organization, error) {
  28. org := new(Organization)
  29. return org, c.getParsedResponse("GET", fmt.Sprintf("/orgs/%s", orgname), nil, nil, org)
  30. }
  31. type CreateOrgOption struct {
  32. UserName string `json:"username" binding:"Required"`
  33. FullName string `json:"full_name"`
  34. Description string `json:"description"`
  35. Website string `json:"website"`
  36. Location string `json:"location"`
  37. }
  38. type EditOrgOption struct {
  39. FullName string `json:"full_name"`
  40. Description string `json:"description"`
  41. Website string `json:"website"`
  42. Location string `json:"location"`
  43. }
  44. func (c *Client) EditOrg(orgname string, opt EditOrgOption) error {
  45. body, err := json.Marshal(&opt)
  46. if err != nil {
  47. return err
  48. }
  49. _, err = c.getResponse("PATCH", fmt.Sprintf("/orgs/%s", orgname), jsonHeader, bytes.NewReader(body))
  50. return err
  51. }
PANIC: session(release): write data/sessions/6/e/6e6fa43b7fffb16c: no space left on device

PANIC

session(release): write data/sessions/6/e/6e6fa43b7fffb16c: no space left on device
github.com/go-macaron/session@v0.0.0-20190805070824-1a3cdc6f5659/session.go:199 (0x8b2934)
gopkg.in/macaron.v1@v1.3.9/context.go:79 (0x83d0a0)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/context.go:112 (0x84fdb5)
gopkg.in/macaron.v1@v1.3.9/recovery.go:161 (0x84fda8)
gopkg.in/macaron.v1@v1.3.9/logger.go:40 (0x840c73)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/router.go:187 (0x850fc6)
gopkg.in/macaron.v1@v1.3.9/router.go:303 (0x8493e5)
gopkg.in/macaron.v1@v1.3.9/macaron.go:220 (0x841fca)
net/http/server.go:2836 (0x7a79b2)
net/http/server.go:1924 (0x7a341b)
runtime/asm_amd64.s:1373 (0x46f9f0)