Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions github/github-accessors.go

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

104 changes: 104 additions & 0 deletions github/github-accessors_test.go

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

80 changes: 52 additions & 28 deletions github/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,31 @@ type Issue struct {
// Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025.
// Use the Issues REST API endpoint to retrieve this information.
// See: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#get-an-issue
AuthorAssociation *string `json:"author_association,omitempty"`
User *User `json:"user,omitempty"`
Labels []*Label `json:"labels,omitempty"`
Assignee *User `json:"assignee,omitempty"`
Comments *int `json:"comments,omitempty"`
ClosedAt *Timestamp `json:"closed_at,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
ClosedBy *User `json:"closed_by,omitempty"`
URL *string `json:"url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
CommentsURL *string `json:"comments_url,omitempty"`
EventsURL *string `json:"events_url,omitempty"`
LabelsURL *string `json:"labels_url,omitempty"`
RepositoryURL *string `json:"repository_url,omitempty"`
ParentIssueURL *string `json:"parent_issue_url,omitempty"`
Milestone *Milestone `json:"milestone,omitempty"`
PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"`
Repository *Repository `json:"repository,omitempty"`
Reactions *Reactions `json:"reactions,omitempty"`
Assignees []*User `json:"assignees,omitempty"`
NodeID *string `json:"node_id,omitempty"`
Draft *bool `json:"draft,omitempty"`
Type *IssueType `json:"type,omitempty"`
AuthorAssociation *string `json:"author_association,omitempty"`
User *User `json:"user,omitempty"`
Labels []*Label `json:"labels,omitempty"`
Assignee *User `json:"assignee,omitempty"`
Comments *int `json:"comments,omitempty"`
ClosedAt *Timestamp `json:"closed_at,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
ClosedBy *User `json:"closed_by,omitempty"`
URL *string `json:"url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
CommentsURL *string `json:"comments_url,omitempty"`
EventsURL *string `json:"events_url,omitempty"`
LabelsURL *string `json:"labels_url,omitempty"`
RepositoryURL *string `json:"repository_url,omitempty"`
ParentIssueURL *string `json:"parent_issue_url,omitempty"`
Milestone *Milestone `json:"milestone,omitempty"`
PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"`
Repository *Repository `json:"repository,omitempty"`
Reactions *Reactions `json:"reactions,omitempty"`
Assignees []*User `json:"assignees,omitempty"`
NodeID *string `json:"node_id,omitempty"`
Draft *bool `json:"draft,omitempty"`
Type *IssueType `json:"type,omitempty"`
IssueFieldValues []*IssueFieldValue `json:"issue_field_values,omitempty"`

// TextMatches is only populated from search results that request text matches
// See: search.go and https://docs.github.com/rest/search/#text-match-metadata
Expand Down Expand Up @@ -94,10 +95,11 @@ type IssueRequest struct {
Assignee *string `json:"assignee,omitempty"`
State *string `json:"state,omitempty"`
// StateReason can be 'completed' or 'not_planned'.
StateReason *string `json:"state_reason,omitempty"`
Milestone *int `json:"milestone,omitempty"`
Assignees *[]string `json:"assignees,omitempty"`
Type *string `json:"type,omitempty"`
StateReason *string `json:"state_reason,omitempty"`
Milestone *int `json:"milestone,omitempty"`
Assignees *[]string `json:"assignees,omitempty"`
Type *string `json:"type,omitempty"`
IssueFieldValues []*IssueFieldValue `json:"issue_field_values,omitempty"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can add []*IssueFieldValue to IssueRequest, We should create a new struct for it bcuz
IssueFieldValue have these field -

  • issue_field_id (required)
  • node_id (required)
  • data_type (required)
  • value (required)
  • single_select_option

Whereas issue_field_values only accepts the following fields in the array

  • field_id (required)
  • value (required)
Image

https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#update-an-issue

}

// PullRequestLinks object is added to the Issue object when it's an issue included
Expand All @@ -122,6 +124,28 @@ type IssueType struct {
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
}

// IssueFieldValueSingleSelectOption represents a single-select option for an issue field value.
//
// GitHub API docs: https://docs.github.com/rest/issues/issues#get-an-issue
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// GitHub API docs: https://docs.github.com/rest/issues/issues#get-an-issue
// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#get-an-issue

type IssueFieldValueSingleSelectOption struct {
ID *int64 `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Color *string `json:"color,omitempty"`
Comment on lines +131 to +133
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These fields are all required:

Suggested change
ID *int64 `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Color *string `json:"color,omitempty"`
ID int64 `json:"id"`
Name string `json:"name"`
Color string `json:"color"`

See

          "single_select_option": {
            "description": "Details about the selected option (only present for single_select fields)",
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "description": "Unique identifier for the option.",
                "type": "integer",
                "format": "int64"
              },
              "name": {
                "description": "The name of the option",
                "type": "string"
              },
              "color": {
                "description": "The color of the option",
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "color"
            ]
          }

}

// IssueFieldValue represents a custom field value attached to an issue.
// The Value field contains a string for text, single_select, and date fields,
// or a number for numeric fields.
//
// GitHub API docs: https://docs.github.com/rest/issues/issues#get-an-issue
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// GitHub API docs: https://docs.github.com/rest/issues/issues#get-an-issue
// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#get-an-issue

type IssueFieldValue struct {
IssueFieldID *int64 `json:"issue_field_id,omitempty"`
NodeID *string `json:"node_id,omitempty"`
DataType *string `json:"data_type,omitempty"`
Value any `json:"value,omitempty"`
Comment on lines +142 to +145
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these fields are required according to the schema:

Suggested change
IssueFieldID *int64 `json:"issue_field_id,omitempty"`
NodeID *string `json:"node_id,omitempty"`
DataType *string `json:"data_type,omitempty"`
Value any `json:"value,omitempty"`
IssueFieldID int64 `json:"issue_field_id"`
NodeID string `json:"node_id"`
DataType string `json:"data_type"`
Value any `json:"value"`

SingleSelectOption *IssueFieldValueSingleSelectOption `json:"single_select_option,omitempty"`
}

// ListAllIssuesOptions specifies the optional parameters to the
// IssuesService.ListAllIssues method.
type ListAllIssuesOptions struct {
Expand Down
Loading