From 1da1834d366c2c0b0b4495d34089082f4e38aed5 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Mon, 21 Mar 2016 12:45:51 -0400 Subject: [PATCH] Add CreateTeamOption --- admin_orgs.go => admin_org.go | 8 -------- admin_repos.go => admin_repo.go | 0 admin_users.go => admin_user.go | 0 gogs.go | 2 +- org.go | 8 ++++++++ org_team.go | 18 ++++++++++++++++++ repo_hooks.go => repo_hook.go | 0 repo_keys.go => repo_key.go | 0 user_keys.go => user_key.go | 0 9 files changed, 27 insertions(+), 9 deletions(-) rename admin_orgs.go => admin_org.go (70%) rename admin_repos.go => admin_repo.go (100%) rename admin_users.go => admin_user.go (100%) create mode 100644 org_team.go rename repo_hooks.go => repo_hook.go (100%) rename repo_keys.go => repo_key.go (100%) rename user_keys.go => user_key.go (100%) diff --git a/admin_orgs.go b/admin_org.go similarity index 70% rename from admin_orgs.go rename to admin_org.go index ee29464..92f2cd9 100644 --- a/admin_orgs.go +++ b/admin_org.go @@ -11,14 +11,6 @@ import ( "net/http" ) -type CreateOrgOption struct { - UserName string `json:"username" binding:"Required"` - FullName string `json:"full_name"` - Description string `json:"description"` - Website string `json:"website"` - Location string `json:"location"` -} - func (c *Client) AdminCreateOrg(user string, opt CreateOrgOption) (*Organization, error) { body, err := json.Marshal(&opt) if err != nil { diff --git a/admin_repos.go b/admin_repo.go similarity index 100% rename from admin_repos.go rename to admin_repo.go diff --git a/admin_users.go b/admin_user.go similarity index 100% rename from admin_users.go rename to admin_user.go diff --git a/gogs.go b/gogs.go index 8e4596b..ce9e0a2 100644 --- a/gogs.go +++ b/gogs.go @@ -14,7 +14,7 @@ import ( ) func Version() string { - return "0.8.0" + return "0.8.1" } // Client represents a Gogs API client. diff --git a/org.go b/org.go index 4d31461..a68462d 100644 --- a/org.go +++ b/org.go @@ -36,6 +36,14 @@ func (c *Client) GetOrg(orgname string) (*Organization, error) { return org, c.getParsedResponse("GET", fmt.Sprintf("/orgs/%s", orgname), nil, nil, org) } +type CreateOrgOption struct { + UserName string `json:"username" binding:"Required"` + FullName string `json:"full_name"` + Description string `json:"description"` + Website string `json:"website"` + Location string `json:"location"` +} + type EditOrgOption struct { FullName string `json:"full_name"` Description string `json:"description"` diff --git a/org_team.go b/org_team.go new file mode 100644 index 0000000..89f09e3 --- /dev/null +++ b/org_team.go @@ -0,0 +1,18 @@ +// 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 gogs + +type Team struct { + ID int64 `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + Permission string `json:"permission"` +} + +type CreateTeamOption struct { + Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"` + Description string `json:"description" binding:"MaxSize(255)"` + Permission string `json:"permission"` +} diff --git a/repo_hooks.go b/repo_hook.go similarity index 100% rename from repo_hooks.go rename to repo_hook.go diff --git a/repo_keys.go b/repo_key.go similarity index 100% rename from repo_keys.go rename to repo_key.go diff --git a/user_keys.go b/user_key.go similarity index 100% rename from user_keys.go rename to user_key.go