diff --git a/docs/migrate-v0.12-to-v0.13.md b/docs/migrate-v0.12-to-v0.13.md index 2182194..84e4cf3 100644 --- a/docs/migrate-v0.12-to-v0.13.md +++ b/docs/migrate-v0.12-to-v0.13.md @@ -9,6 +9,7 @@ feel free to create an issue. - [EditMilestoneOption use StateType (#350)](#EditMilestoneOption-use-StateType) - [RepoSearch Options Struct was rewritten (#346)](#RepoSearch-Options-Struct-was-rewritten) +- [Variable Renames (#386)](#Variable-Renames) @@ -36,3 +37,13 @@ If there is a special edgecase you have you can pass a `RawQuery` to the API end Pulls: - [#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) diff --git a/gitea/admin_test.go b/gitea/admin_test.go index fa2244d..429dbf0 100644 --- a/gitea/admin_test.go +++ b/gitea/admin_test.go @@ -19,7 +19,7 @@ func TestAdminOrg(t *testing.T) { orgName := "NewTestOrg" newOrg, err := c.AdminCreateOrg(user.UserName, CreateOrgOption{ - UserName: orgName, + Name: orgName, FullName: orgName + " FullName", Description: "test adminCreateOrg", Visibility: VisibleTypePublic, diff --git a/gitea/org.go b/gitea/org.go index 48ea9da..750953e 100644 --- a/gitea/org.go +++ b/gitea/org.go @@ -64,7 +64,7 @@ func (c *Client) GetOrg(orgname string) (*Organization, error) { // CreateOrgOption options for creating an organization type CreateOrgOption struct { - UserName string `json:"username"` + Name string `json:"username"` FullName string `json:"full_name"` Description string `json:"description"` Website string `json:"website"` @@ -79,7 +79,7 @@ func checkVisibilityOpt(v VisibleType) bool { // Validate the CreateOrgOption struct func (opt CreateOrgOption) Validate() error { - if len(opt.UserName) == 0 { + if len(opt.Name) == 0 { return fmt.Errorf("empty org name") } if len(opt.Visibility) != 0 && !checkVisibilityOpt(opt.Visibility) { diff --git a/gitea/org_member_test.go b/gitea/org_member_test.go index a148ff4..533796e 100644 --- a/gitea/org_member_test.go +++ b/gitea/org_member_test.go @@ -23,7 +23,7 @@ func TestOrgMembership(t *testing.T) { user := createTestUser(t, "org_mem_user", c) c.SetSudo(user.UserName) - newOrg, err := c.CreateOrg(CreateOrgOption{UserName: "MemberOrg"}) + newOrg, err := c.CreateOrg(CreateOrgOption{Name: "MemberOrg"}) assert.NoError(t, err) assert.NotNil(t, newOrg) diff --git a/gitea/pull_test.go b/gitea/pull_test.go index 76851c9..9780dfe 100644 --- a/gitea/pull_test.go +++ b/gitea/pull_test.go @@ -124,7 +124,7 @@ func preparePullTest(t *testing.T, c *Client, repoName, forkOrg string) bool { if !assert.NoError(t, err) { return false } - org, err := c.CreateOrg(CreateOrgOption{UserName: forkOrg}) + org, err := c.CreateOrg(CreateOrgOption{Name: forkOrg}) assert.NoError(t, err) forkRepo, err := c.CreateFork(origRepo.Owner.UserName, origRepo.Name, CreateForkOption{Organization: &org.UserName}) assert.NoError(t, err) diff --git a/gitea/repo_transfer_test.go b/gitea/repo_transfer_test.go index 9998659..93b5104 100644 --- a/gitea/repo_transfer_test.go +++ b/gitea/repo_transfer_test.go @@ -15,7 +15,7 @@ func TestRepoTransfer(t *testing.T) { log.Printf("== TestRepoTransfer ==") c := newTestClient() - org, err := c.AdminCreateOrg(c.username, CreateOrgOption{UserName: "TransferOrg"}) + org, err := c.AdminCreateOrg(c.username, CreateOrgOption{Name: "TransferOrg"}) assert.NoError(t, err) repo, err := createTestRepo(t, "ToMove", c) assert.NoError(t, err)