using System;
using System.Diagnostics;
using System.Globalization;
namespace Octokit
{
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class NewCheckRunAnnotation
{
///
/// Constructs a CheckRunCreateAnnotation request object
///
/// Required. The path of the file to add an annotation to. For example, assets/css/main.css
/// Required. The start line of the annotation
/// Required. The end line of the annotation
/// Required. The level of the annotation. Can be one of notice, warning, or failure
/// Required. A short description of the feedback for these lines of code. The maximum size is 64 KB
public NewCheckRunAnnotation(string path, int startLine, int endLine, CheckAnnotationLevel annotationLevel, string message)
{
Path = path;
StartLine = startLine;
EndLine = endLine;
AnnotationLevel = annotationLevel;
Message = message;
// Ensure legacy properties are explicitly null
#pragma warning disable CS0618 // Type or member is obsolete
Filename = null;
BlobHref = null;
WarningLevel = null;
#pragma warning restore CS0618 // Type or member is obsolete
}
///
/// Constructs a CheckRunCreateAnnotation request object (using Filename, BlobHref and WarningLevel)
///
/// Required. The path of the file to add an annotation to. For example, assets/css/main.css
/// Required. The file's full blob URL. You can find the blob_href in the response of the Get a single commit endpoint, by reading the blob_url from an element of the files array. You can also construct the blob URL from the head_sha, the repository, and the filename: https://github.com/:owner/:repo/blob/:head_sha/:filename
/// Required. The start line of the annotation
/// Required. The end line of the annotation
/// Required. The warning level of the annotation. Can be one of notice, warning, or failure
/// Required. A short description of the feedback for these lines of code. The maximum size is 64 KB
[Obsolete("This ctor taking Filename, BlobHref and WarningLevel is deprecated but may still be required on GitHub Enterprise 2.14")]
public NewCheckRunAnnotation(string filename, string blobHref, int startLine, int endLine, CheckWarningLevel warningLevel, string message)
{
Filename = filename;
BlobHref = blobHref;
StartLine = startLine;
EndLine = endLine;
WarningLevel = warningLevel;
Message = message;
// Ensure new properties are explicitly null
Path = null;
AnnotationLevel = null;
}
///
/// Required. The path of the file to add an annotation to. For example, assets/css/main.css
///
[Obsolete("This property is replaced with Path but may still be required on GitHub Enterprise 2.14")]
public string Filename { get; protected set; }
///
/// Required. The path of the file to add an annotation to. For example, assets/css/main.css
///
public string Path { get; protected set; }
///
/// Required. The file's full blob URL. You can find the blob_href in the response of the Get a single commit endpoint, by reading the blob_url from an element of the files array. You can also construct the blob URL from the head_sha, the repository, and the filename: https://github.com/:owner/:repo/blob/:head_sha/:filename
///
[Obsolete("This property is deprecated but may still be required on GitHub Enterprise 2.14")]
public string BlobHref { get; protected set; }
///
/// Required. The start line of the annotation
///
public int StartLine { get; protected set; }
///
/// Required. The end line of the annotation
///
public int EndLine { get; protected set; }
///
/// Required. The start line of the annotation
///
public int? StartColumn { get; set; }
///
/// Required. The end line of the annotation
///
public int? EndColumn { get; set; }
///
/// Required. The warning level of the annotation. Can be one of notice, warning, or failure
///
[Obsolete("This property is replaced with AnnotationLevel but may still be required on GitHub Enterprise 2.14")]
public StringEnum? WarningLevel { get; protected set; }
///
/// Required. The level of the annotation. Can be one of notice, warning, or failure
///
public StringEnum? AnnotationLevel { get; protected set; }
///
/// Required. A short description of the feedback for these lines of code. The maximum size is 64 KB
///
public string Message { get; protected set; }
///
/// The title that represents the annotation. The maximum size is 255 characters
///
public string Title { get; set; }
///
/// Details about this annotation. The maximum size is 64 KB
///
public string RawDetails { get; set; }
#pragma warning disable CS0618 // Type or member is obsolete
internal string DebuggerDisplay => string.Format(CultureInfo.InvariantCulture, "Path: {0}, StartLine: {1}, AnnotationLevel: {2}", Path ?? Filename, StartLine, AnnotationLevel?.DebuggerDisplay ?? WarningLevel?.DebuggerDisplay);
#pragma warning restore CS0618 // Type or member is obsolete
}
}