CreateOrgOption rename UserName to Name (#386)
add docu CreateOrgOption rename UserName to Name since it is the name of the new Organisation and not some User Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/386 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
df77e54d81
commit
9e280adb4d
6 changed files with 17 additions and 6 deletions
|
@ -9,6 +9,7 @@ feel free to create an issue.
|
||||||
|
|
||||||
- [EditMilestoneOption use StateType (#350)](#EditMilestoneOption-use-StateType)
|
- [EditMilestoneOption use StateType (#350)](#EditMilestoneOption-use-StateType)
|
||||||
- [RepoSearch Options Struct was rewritten (#346)](#RepoSearch-Options-Struct-was-rewritten)
|
- [RepoSearch Options Struct was rewritten (#346)](#RepoSearch-Options-Struct-was-rewritten)
|
||||||
|
- [Variable Renames (#386)](#Variable-Renames)
|
||||||
|
|
||||||
<!-- tocstop -->
|
<!-- tocstop -->
|
||||||
|
|
||||||
|
@ -36,3 +37,13 @@ If there is a special edgecase you have you can pass a `RawQuery` to the API end
|
||||||
Pulls:
|
Pulls:
|
||||||
|
|
||||||
- [#346 Refactor RepoSearch to be easy usable](https://gitea.com/gitea/go-sdk/pulls/346)
|
- [#346 Refactor RepoSearch to be easy usable](https://gitea.com/gitea/go-sdk/pulls/346)
|
||||||
|
|
||||||
|
|
||||||
|
## Variable Renames
|
||||||
|
|
||||||
|
Some names of strcut options have been renamed to describe there function/usecase more precisely.
|
||||||
|
if you use `CreateOrgOption` somewhere just rename `UserName` to `Name`.
|
||||||
|
|
||||||
|
Pulls:
|
||||||
|
|
||||||
|
- [#386 CreateOrgOption rename UserName to Name](https://gitea.com/gitea/go-sdk/pulls/386)
|
||||||
|
|
|
@ -19,7 +19,7 @@ func TestAdminOrg(t *testing.T) {
|
||||||
|
|
||||||
orgName := "NewTestOrg"
|
orgName := "NewTestOrg"
|
||||||
newOrg, err := c.AdminCreateOrg(user.UserName, CreateOrgOption{
|
newOrg, err := c.AdminCreateOrg(user.UserName, CreateOrgOption{
|
||||||
UserName: orgName,
|
Name: orgName,
|
||||||
FullName: orgName + " FullName",
|
FullName: orgName + " FullName",
|
||||||
Description: "test adminCreateOrg",
|
Description: "test adminCreateOrg",
|
||||||
Visibility: VisibleTypePublic,
|
Visibility: VisibleTypePublic,
|
||||||
|
|
|
@ -64,7 +64,7 @@ func (c *Client) GetOrg(orgname string) (*Organization, error) {
|
||||||
|
|
||||||
// CreateOrgOption options for creating an organization
|
// CreateOrgOption options for creating an organization
|
||||||
type CreateOrgOption struct {
|
type CreateOrgOption struct {
|
||||||
UserName string `json:"username"`
|
Name string `json:"username"`
|
||||||
FullName string `json:"full_name"`
|
FullName string `json:"full_name"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
Website string `json:"website"`
|
Website string `json:"website"`
|
||||||
|
@ -79,7 +79,7 @@ func checkVisibilityOpt(v VisibleType) bool {
|
||||||
|
|
||||||
// Validate the CreateOrgOption struct
|
// Validate the CreateOrgOption struct
|
||||||
func (opt CreateOrgOption) Validate() error {
|
func (opt CreateOrgOption) Validate() error {
|
||||||
if len(opt.UserName) == 0 {
|
if len(opt.Name) == 0 {
|
||||||
return fmt.Errorf("empty org name")
|
return fmt.Errorf("empty org name")
|
||||||
}
|
}
|
||||||
if len(opt.Visibility) != 0 && !checkVisibilityOpt(opt.Visibility) {
|
if len(opt.Visibility) != 0 && !checkVisibilityOpt(opt.Visibility) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ func TestOrgMembership(t *testing.T) {
|
||||||
|
|
||||||
user := createTestUser(t, "org_mem_user", c)
|
user := createTestUser(t, "org_mem_user", c)
|
||||||
c.SetSudo(user.UserName)
|
c.SetSudo(user.UserName)
|
||||||
newOrg, err := c.CreateOrg(CreateOrgOption{UserName: "MemberOrg"})
|
newOrg, err := c.CreateOrg(CreateOrgOption{Name: "MemberOrg"})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.NotNil(t, newOrg)
|
assert.NotNil(t, newOrg)
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ func preparePullTest(t *testing.T, c *Client, repoName, forkOrg string) bool {
|
||||||
if !assert.NoError(t, err) {
|
if !assert.NoError(t, err) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
org, err := c.CreateOrg(CreateOrgOption{UserName: forkOrg})
|
org, err := c.CreateOrg(CreateOrgOption{Name: forkOrg})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
forkRepo, err := c.CreateFork(origRepo.Owner.UserName, origRepo.Name, CreateForkOption{Organization: &org.UserName})
|
forkRepo, err := c.CreateFork(origRepo.Owner.UserName, origRepo.Name, CreateForkOption{Organization: &org.UserName})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
|
@ -15,7 +15,7 @@ func TestRepoTransfer(t *testing.T) {
|
||||||
log.Printf("== TestRepoTransfer ==")
|
log.Printf("== TestRepoTransfer ==")
|
||||||
c := newTestClient()
|
c := newTestClient()
|
||||||
|
|
||||||
org, err := c.AdminCreateOrg(c.username, CreateOrgOption{UserName: "TransferOrg"})
|
org, err := c.AdminCreateOrg(c.username, CreateOrgOption{Name: "TransferOrg"})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
repo, err := createTestRepo(t, "ToMove", c)
|
repo, err := createTestRepo(t, "ToMove", c)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
Loading…
Reference in a new issue