Implement Check Runs API (#1847)

* Add CheckRunEventPayload

* add CheckRunEventPayload into all the right places

* forgot integration tests for RepositoryId methods (+1 squashed commits)

Squashed commits:

[b2445bf3] Implement Create CheckRun methods for normal and observable clients including unit and integration tests and xmldoc comments

* Implement Update CheckRun method
Refactored NewCheckRun to inherit CheckRunUpdate since they share all fields except HeadSha

* Implement GetAllForReference method

* Implement GetAllForCheckSuite method

* tweak XmlDoc to match github documentation

* Implement Get method

* Implement GetAllAnnotations
Moved CheckRunAnnotation model from Request to Common and added a parameterless ctor, since it is now a response model as well as a request model

* Split common CheckRunAnnotation model into separate response and request models due to different field and ctor requirements
Rename other CheckRun request sub classes to be consistent with NewCheckRunAnnotation (eg NewCheckRunOutput, NewCheckRunImage, etc)

* add title field back into CheckRunAnnotation

* fix up XmlDocs

* fix mutable response property - hooray for convention tests!
This commit is contained in:
Ryan Gribble
2018-07-19 08:29:12 +10:00
committed by GitHub
parent 8407369485
commit c5d5df5b08
33 changed files with 4566 additions and 17 deletions
@@ -0,0 +1,67 @@
using System.Diagnostics;
using System.Globalization;
namespace Octokit
{
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class CheckRunAnnotation
{
public CheckRunAnnotation()
{
}
public CheckRunAnnotation(string filename, string blobHref, int startLine, int endLine, CheckWarningLevel warningLevel, string message, string title, string rawDetails)
{
Filename = filename;
BlobHref = blobHref;
StartLine = startLine;
EndLine = endLine;
WarningLevel = warningLevel;
Message = message;
Title = title;
RawDetails = rawDetails;
}
/// <summary>
/// The path of the file the annotation refers to
/// </summary>
public string Filename { get; protected set; }
/// <summary>
/// The file's full blob URL
/// </summary>
public string BlobHref { get; protected set; }
/// <summary>
/// The start line of the annotation
/// </summary>
public int StartLine { get; protected set; }
/// <summary>
/// The end line of the annotation
/// </summary>
public int EndLine { get; protected set; }
/// <summary>
/// The warning level of the annotation. Can be one of notice, warning, or failure
/// </summary>
public StringEnum<CheckWarningLevel> WarningLevel { get; protected set; }
/// <summary>
/// A short description of the feedback for these lines of code
/// </summary>
public string Message { get; protected set; }
/// <summary>
/// The title that represents the annotation
/// </summary>
public string Title { get; protected set; }
/// <summary>
/// Details about this annotation
/// </summary>
public string RawDetails { get; protected set; }
internal string DebuggerDisplay => string.Format(CultureInfo.InvariantCulture, "Filename: {0}, StartLine: {1}, WarningLevel: {2}", Filename, StartLine, WarningLevel.DebuggerDisplay);
}
}