[Feat] Add Repository Autolinks Client (#2868)

This commit is contained in:
Slyck Lizzie
2024-02-01 14:56:26 -05:00
committed by GitHub
parent c9ddf3edc3
commit 2a87dd0802
13 changed files with 649 additions and 11 deletions
+48
View File
@@ -0,0 +1,48 @@
using Octokit.Internal;
using System.Diagnostics;
namespace Octokit
{
/// <summary>
/// Represents a repository Autolink object.
/// </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class AutolinkRequest
{
public AutolinkRequest()
{ }
public AutolinkRequest(string keyPrefix, string urlTemplate, bool isAlphanumeric)
{
this.KeyPrefix = keyPrefix;
this.UrlTemplate = urlTemplate;
this.IsAlphanumeric = isAlphanumeric;
}
/// <summary>
/// This prefix appended by certain characters will generate a link any time it is found in an issue, pull request, or commit.
/// </summary>
public string KeyPrefix { get; set; }
/// <summary>
/// The URL must contain &lt;num&gt; for the reference number. &lt;num&gt; matches different characters depending on the value of is_alphanumeric.
/// </summary>
public string UrlTemplate { get; set; }
/// <summary>
/// Whether this autolink reference matches alphanumeric characters. If true, the &lt;num&gt; parameter of the url_template matches alphanumeric characters A-Z (case insensitive), 0-9, and -. If false, this autolink reference only matches numeric characters.
/// </summary>
public bool IsAlphanumeric { get; set; }
internal string DebuggerDisplay
{
get
{
return new SimpleJsonSerializer().Serialize(this);
}
}
}
}
+54
View File
@@ -0,0 +1,54 @@
using Octokit.Internal;
using System.Diagnostics;
namespace Octokit
{
/// <summary>
/// Represents a repository Autolink object.
/// </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class Autolink
{
public Autolink()
{ }
public Autolink(int id, string keyPrefix, string urlTemplate, bool isAlphanumeric)
{
this.Id = id;
this.KeyPrefix = keyPrefix;
this.UrlTemplate = urlTemplate;
this.IsAlphanumeric = isAlphanumeric;
}
/// <summary>
/// The unique identifier of the autolink.
/// </summary>
public int Id { get; protected set; }
/// <summary>
/// This prefix appended by certain characters will generate a link any time it is found in an issue, pull request, or commit.
/// </summary>
public string KeyPrefix { get; protected set; }
/// <summary>
/// The URL must contain &lt;num&gt; for the reference number. &lt;num&gt; matches different characters depending on the value of is_alphanumeric.
/// </summary>
public string UrlTemplate { get; protected set; }
/// <summary>
/// Whether this autolink reference matches alphanumeric characters. If true, the &lt;num&gt; parameter of the url_template matches alphanumeric characters A-Z (case insensitive), 0-9, and -. If false, this autolink reference only matches numeric characters.
/// </summary>
public bool IsAlphanumeric { get; protected set; }
internal string DebuggerDisplay
{
get
{
return new SimpleJsonSerializer().Serialize(this);
}
}
}
}