blob: a3e94b986aec90e86881cbf436a718e06c322897 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
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"
)
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) ToParam() string {
return fmt.Sprintf("%v", issue.ID)
}
func FromIssues(r io.Reader) ([]Issue, error) {
return serde.From[[]Issue](r, serde.JSON)
}
|