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)
|
||||
- [RepoSearch Options Struct was rewritten (#346)](#RepoSearch-Options-Struct-was-rewritten)
|
||||
- [Variable Renames (#386)](#Variable-Renames)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue