package gitlab import ( "fmt" "io" "time" "github.com/xlgmokha/x/pkg/serde" ) type IssueState string type IssueType string const ( IssueClosed IssueState = "closed" IssueOpened IssueState = "opened" ) const ( IssueTypeIncident IssueType = "incident" IssueTypeIssue IssueType = "issue" IssueTypeTask IssueType = "task" IssueTypeTestCase IssueType = "test_case" ) type Issue struct { ID int `json:"id" yaml:"id"` IID int `json:"iid" yaml:"iid"` ProjectID int `json:"project_id" yaml:"project_id"` Title string `json:"title" yaml:"title"` Description string `json:"description" yaml:"description"` State IssueState `json:"state" yaml:"state"` CreatedAt time.Time `json:"created_at" yaml:"created_at"` UpdatedAt time.Time `json:"updated_at" yaml:"updated_at"` ClosedAt time.Time `json:"closed_at" yaml:"closed_at"` ClosedBy User `json:"closed_by" yaml:"closed_by"` Labels []string `json:"labels" yaml:"labels"` Milestone *Milestone `json:"milestone" yaml:"milestone"` Assignees []User `json:"assignees" yaml:"assignees"` Author User `json:"author" yaml:"author"` Type IssueType `json:"issue_type" yaml:"issue_type"` Assignee *User `json:"assignee" yaml:"assignee"` UserNotesCount int `json:"user_notes_count" yaml:"user_notes_count"` MergeRequestsCount int `json:"merge_requests_count" yaml:"merge_requests_count"` Upvotes int `json:"upvotes" yaml:"upvotes"` Downvotes int `json:"downvotes" yaml:"downvotes"` DueDate *string `json:"due_date" yaml:"due_date"` Confidential bool `json:"confidential" yaml:"confidential"` DiscussionLocked *bool `json:"discussion_locked" yaml:"discussion_locked"` WebUrl string `json:"web_url" yaml:"web_url"` BlockingIssuesCount int `json:"blocking_issues_count" yaml:"blocking_issues_count"` HasTasks bool `json:"has_tasks" yaml:"has_tasks"` TaskStatus string `json:"task_status" yaml:"task_status"` } func (issue *Issue) Identifier() string { return fmt.Sprintf("%v", issue.ID) } func FromIssues(r io.Reader) ([]Issue, error) { return serde.From[[]Issue](r, serde.JSON) }