1
1
package dto
2
2
3
+ import "encoding/json"
4
+
3
5
// PullRequest represents a pull request in the system
4
6
type PullRequest struct {
5
7
Author PullRequestAuthor `json:"author,omitempty"`
@@ -112,18 +114,18 @@ type PullRequestCheckReporter struct {
112
114
113
115
// PullRequestCheck represents a status check for a pull request
114
116
type PullRequestCheck struct {
115
- Created int64 `json:"created,omitempty"`
116
- Ended int64 `json:"ended,omitempty"`
117
- ID int `json:"id,omitempty"`
118
- Identifier string `json:"identifier,omitempty"`
119
- Link string `json:"link,omitempty"`
120
- Metadata interface {} `json:"metadata"`
121
- Payload PullRequestCheckPayload `json:"payload,omitempty"`
117
+ Created int64 `json:"created,omitempty"`
118
+ Ended int64 `json:"ended,omitempty"`
119
+ ID int `json:"id,omitempty"`
120
+ Identifier string `json:"identifier,omitempty"`
121
+ Link string `json:"link,omitempty"`
122
+ Metadata interface {} `json:"metadata"`
123
+ Payload PullRequestCheckPayload `json:"payload,omitempty"`
122
124
ReportedBy PullRequestCheckReporter `json:"reported_by,omitempty"`
123
- Started int64 `json:"started,omitempty"`
124
- Status string `json:"status,omitempty"`
125
- Summary string `json:"summary,omitempty"`
126
- Updated int64 `json:"updated,omitempty"`
125
+ Started int64 `json:"started,omitempty"`
126
+ Status string `json:"status,omitempty"`
127
+ Summary string `json:"summary,omitempty"`
128
+ Updated int64 `json:"updated,omitempty"`
127
129
}
128
130
129
131
// PullRequestCheckInfo represents a check with additional information
@@ -136,7 +138,7 @@ type PullRequestCheckInfo struct {
136
138
// PullRequestChecksResponse represents the response from the checks API
137
139
type PullRequestChecksResponse struct {
138
140
Checks []PullRequestCheckInfo `json:"checks,omitempty"`
139
- CommitSha string `json:"commit_sha,omitempty"`
141
+ CommitSha string `json:"commit_sha,omitempty"`
140
142
}
141
143
142
144
// PullRequestOptions represents the options for listing pull requests
@@ -158,3 +160,49 @@ type PullRequestOptions struct {
158
160
AuthorID int `json:"author_id,omitempty"`
159
161
IncludeChecks bool `json:"include_checks,omitempty"`
160
162
}
163
+
164
+ // PullRequestActivity represents an activity on a pull request
165
+ type PullRequestActivity struct {
166
+ ID int `json:"id,omitempty"`
167
+ Type string `json:"type,omitempty"`
168
+ Created int64 `json:"created,omitempty"`
169
+ Updated int64 `json:"updated,omitempty"`
170
+ Edited int64 `json:"edited,omitempty"`
171
+ ParentID int `json:"parent_id,omitempty"`
172
+ RepoID int64 `json:"repo_id"`
173
+ PullReqID int64 `json:"pullreq_id"`
174
+ Kind string `json:"kind,omitempty"`
175
+ Text string `json:"text,omitempty"`
176
+ CodeComment CodeComment `json:"code_comment,omitempty"`
177
+ Metadata interface {} `json:"metadata,omitempty"`
178
+ Resolved int64 `json:"resolved,omitempty"`
179
+ PayloadRaw json.RawMessage `json:"payload"`
180
+ }
181
+
182
+ // PullRequestActivitiesResponse represents the response from the activities API
183
+ // It's a direct slice of activities as the API returns an array
184
+ type PullRequestActivitiesResponse []PullRequestActivity
185
+
186
+ type CodeComment struct {
187
+ Outdated bool `json:"outdated,omitempty"`
188
+ MergeBaseSHA string `json:"merge_base_sha,omitempty"`
189
+ SourceSHA string `json:"source_sha,omitempty"`
190
+ Path string `json:"path,omitempty"`
191
+ LineNew int `json:"line_new,omitempty"`
192
+ SpanNew int `json:"span_new,omitempty"`
193
+ LineOld int `json:"line_old,omitempty"`
194
+ SpanOld int `json:"span_old,omitempty"`
195
+ }
196
+
197
+ // PullRequestActivityOptions defines options for listing PR activities
198
+ type PullRequestActivityOptions struct {
199
+ AccountIdentifier string `json:"accountIdentifier,omitempty"`
200
+ OrgIdentifier string `json:"orgIdentifier,omitempty"`
201
+ ProjectIdentifier string `json:"projectIdentifier,omitempty"`
202
+ Kind []string `json:"kind,omitempty"`
203
+ Type []string `json:"type,omitempty"`
204
+ After int64 `json:"after,omitempty"`
205
+ Before int64 `json:"before,omitempty"`
206
+ Limit int `json:"limit,omitempty"`
207
+ Page int `json:"page,omitempty"`
208
+ }
0 commit comments