@@ -245,6 +245,28 @@ def check_runs(self):
245
245
)
246
246
247
247
248
+ class CheckRunAnnotation (models .GitHubCore ):
249
+
250
+ class_name = "CheckRunAnnotation"
251
+ CUSTOM_HEADERS = {"Accept" : "application/vnd.github.antiope-preview+json" }
252
+
253
+ def _repr (self ):
254
+ return "<{s.class_name} [{s.path}:{s.start_line}-{s.end_line}]>" .format (
255
+ s = self
256
+ )
257
+
258
+ def _update_attributes (self , note ):
259
+ self .path = note ["path" ]
260
+ self .start_line = note ["start_line" ]
261
+ self .end_line = note ["end_line" ]
262
+ self .start_column = note ["start_column" ]
263
+ self .end_column = note ["end_column" ]
264
+ self .annotation_level = note ["annotation_level" ]
265
+ self .title = note ["title" ]
266
+ self .message = note ["message" ]
267
+ self .raw_details = note ["raw_details" ]
268
+
269
+
248
270
class CheckRunOutput (models .GitHubCore ):
249
271
250
272
class_name = "CheckRunOutput"
@@ -260,6 +282,23 @@ def _update_attributes(self, output):
260
282
def _repr (self ):
261
283
return "<{s.class_name} [{s.title}]>" .format (s = self )
262
284
285
+ @decorators .requires_app_installation_auth
286
+ def annotations (self ):
287
+ """Retrieve the annotations for a check run.
288
+
289
+ :returns:
290
+ the annotations for this check run
291
+ :rtype:
292
+ :class:`~github3.checks.CheckRunAnnotations`
293
+ """
294
+ url = self ._build_url (base_url = self .annotations_url )
295
+ return self ._iter (
296
+ - 1 ,
297
+ url ,
298
+ CheckRunAnnotation ,
299
+ headers = CheckRunAnnotation .CUSTOM_HEADERS ,
300
+ )
301
+
263
302
264
303
class CheckRun (models .GitHubCore ):
265
304
"""The :class:`CheckRun <CheckRun>` object.
0 commit comments