1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package gitlab
18
19 import (
20 "fmt"
21 "net/http"
22 "time"
23 )
24
25
26
27
28
29 type ResourceIterationEventsService struct {
30 client *Client
31 }
32
33
34
35
36 type IterationEvent struct {
37 ID int `json:"id"`
38 User *BasicUser `json:"user"`
39 CreatedAt *time.Time `json:"created_at"`
40 ResourceType string `json:"resource_type"`
41 ResourceID int `json:"resource_id"`
42 Iteration *Iteration `json:"iteration"`
43 Action string `json:"action"`
44 }
45
46
47
48
49 type Iteration struct {
50 ID int `json:"id"`
51 IID int `json:"iid"`
52 Sequence int `json:"sequence"`
53 GroupId int `json:"group_id"`
54 Title string `json:"title"`
55 Description string `json:"description"`
56 State int `json:"state"`
57 CreatedAt *time.Time `json:"created_at"`
58 UpdatedAt *time.Time `json:"updated_at"`
59 DueDate *ISOTime `json:"due_date"`
60 StartDate *ISOTime `json:"start_date"`
61 WebURL string `json:"web_url"`
62 }
63
64
65
66
67
68
69 type ListIterationEventsOptions struct {
70 ListOptions
71 }
72
73
74
75
76
77
78 func (s *ResourceIterationEventsService) ListIssueIterationEvents(pid interface{}, issue int, opt *ListIterationEventsOptions, options ...RequestOptionFunc) ([]*IterationEvent, *Response, error) {
79 project, err := parseID(pid)
80 if err != nil {
81 return nil, nil, err
82 }
83 u := fmt.Sprintf("projects/%s/issues/%d/resource_iteration_events", PathEscape(project), issue)
84
85 req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
86 if err != nil {
87 return nil, nil, err
88 }
89
90 var ies []*IterationEvent
91 resp, err := s.client.Do(req, &ies)
92 if err != nil {
93 return nil, resp, err
94 }
95
96 return ies, resp, nil
97 }
98
99
100
101
102
103 func (s *ResourceIterationEventsService) GetIssueIterationEvent(pid interface{}, issue int, event int, options ...RequestOptionFunc) (*IterationEvent, *Response, error) {
104 project, err := parseID(pid)
105 if err != nil {
106 return nil, nil, err
107 }
108 u := fmt.Sprintf("projects/%s/issues/%d/resource_iteration_events/%d", PathEscape(project), issue, event)
109
110 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
111 if err != nil {
112 return nil, nil, err
113 }
114
115 ie := new(IterationEvent)
116 resp, err := s.client.Do(req, ie)
117 if err != nil {
118 return nil, resp, err
119 }
120
121 return ie, resp, nil
122 }
123
View as plain text