Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5898069

Browse files
syndbgunknwon
authored andcommitted
Add org.CreateOrg (#84)
* Fix typo * Add `org.CreateOrg` Exposes endpoint provided by gogs/gogs#4835
1 parent bbae6af commit 5898069

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

‎gogs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type Client struct {
2424
client *http.Client
2525
}
2626

27-
// NewClient initializes and returns a API client.
27+
// NewClient initializes and returns an API client.
2828
func NewClient(url, token string) *Client {
2929
return &Client{
3030
url: strings.TrimSuffix(url, "/"),

‎org.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ type EditOrgOption struct {
5050
Location string `json:"location"`
5151
}
5252

53+
func (c *Client) CreateOrg(opt CreateOrgOption) (*Organization, error) {
54+
body, err := json.Marshal(&opt)
55+
if err != nil {
56+
return nil, err
57+
}
58+
org := new(Organization)
59+
return org, c.getParsedResponse("POST", "/user/orgs", jsonHeader, bytes.NewReader(body), org)
60+
}
61+
5362
func (c *Client) EditOrg(orgname string, opt EditOrgOption) error {
5463
body, err := json.Marshal(&opt)
5564
if err != nil {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /