@@ -245,6 +245,28 @@ def check_runs(self):
245245 )
246246
247247
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+
248270class CheckRunOutput (models .GitHubCore ):
249271
250272 class_name = "CheckRunOutput"
@@ -260,6 +282,23 @@ def _update_attributes(self, output):
260282 def _repr (self ):
261283 return "<{s.class_name} [{s.title}]>" .format (s = self )
262284
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+
263302
264303class CheckRun (models .GitHubCore ):
265304 """The :class:`CheckRun <CheckRun>` object.
0 commit comments