Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProjectOptions (public to private) & Project struct (org related fields) fixes #2111

Merged
merged 2 commits into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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