Skip to content

Commit

Permalink
Change ProjectOptions (Public to Private) and Project struct fields (#…
Browse files Browse the repository at this point in the history
…2111)

Fixes: #2110
  • Loading branch information
DariuszPorowski authored Dec 3, 2021
1 parent 392b7ea commit b913905
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 42 deletions.
24 changes: 20 additions & 4 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 25 additions & 5 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 16 additions & 14 deletions github/github-stringify_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 15 additions & 13 deletions github/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@ type ProjectsService service

// Project represents a GitHub Project.
type Project struct {
ID *int64 `json:"id,omitempty"`
URL *string `json:"url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
ColumnsURL *string `json:"columns_url,omitempty"`
OwnerURL *string `json:"owner_url,omitempty"`
Name *string `json:"name,omitempty"`
Body *string `json:"body,omitempty"`
Number *int `json:"number,omitempty"`
State *string `json:"state,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
NodeID *string `json:"node_id,omitempty"`
ID *int64 `json:"id,omitempty"`
URL *string `json:"url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
ColumnsURL *string `json:"columns_url,omitempty"`
OwnerURL *string `json:"owner_url,omitempty"`
Name *string `json:"name,omitempty"`
Body *string `json:"body,omitempty"`
Number *int `json:"number,omitempty"`
State *string `json:"state,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
NodeID *string `json:"node_id,omitempty"`
OrganizationPermission *string `json:"organization_permission,omitempty"`
Private *bool `json:"private,omitempty"`

// The User object that generated the project.
Creator *User `json:"creator,omitempty"`
Expand Down Expand Up @@ -83,7 +85,7 @@ type ProjectOptions struct {
// Sets visibility of the project within the organization.
// Setting visibility is only available
// for organization projects.(Optional.)
Public *bool `json:"public,omitempty"`
Private *bool `json:"private,omitempty"`
}

// UpdateProject updates a repository project.
Expand Down
12 changes: 6 additions & 6 deletions github/projects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ func TestProjectsService_UpdateProject(t *testing.T) {
defer teardown()

input := &ProjectOptions{
Name: String("Project Name"),
Body: String("Project body."),
State: String("open"),
Public: Bool(true),
Name: String("Project Name"),
Body: String("Project body."),
State: String("open"),
Private: Bool(false),

OrganizationPermission: String("read"),
}
Expand Down Expand Up @@ -857,15 +857,15 @@ func TestProjectOptions_Marshal(t *testing.T) {
Body: String("body"),
State: String("state"),
OrganizationPermission: String("op"),
Public: Bool(true),
Private: Bool(false),
}

want := `{
"name": "name",
"body": "body",
"state": "state",
"organization_permission": "op",
"public": true
"private": false
}`

testJSONMarshal(t, u, want)
Expand Down

0 comments on commit b913905

Please sign in to comment.