mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 11:05:56 +00:00
tidying up some docs in the Extensions namespace
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -29,7 +30,7 @@ namespace Octokit
|
||||
|
||||
public static string UriEncode(this string input)
|
||||
{
|
||||
return System.Net.WebUtility.UrlEncode(input);
|
||||
return WebUtility.UrlEncode(input);
|
||||
}
|
||||
|
||||
public static string ToBase64String(this string input)
|
||||
|
||||
@@ -2,12 +2,22 @@
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the response to a 2FA challenge from the API
|
||||
/// </summary>
|
||||
public class TwoFactorChallengeResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper action for resending the 2FA code
|
||||
/// </summary>
|
||||
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes",
|
||||
Justification = "It really is immutable yo!")]
|
||||
public static readonly TwoFactorChallengeResult RequestResendCode = new TwoFactorChallengeResult(null, true);
|
||||
|
||||
/// <summary>
|
||||
/// Construct an instance of TwoFactorChallengeResult
|
||||
/// </summary>
|
||||
/// <param name="authenticationCode"></param>
|
||||
public TwoFactorChallengeResult(string authenticationCode)
|
||||
: this(authenticationCode, false)
|
||||
{
|
||||
@@ -20,8 +30,14 @@ namespace Octokit
|
||||
ResendCodeRequested = resendCodeRequested;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if this request should resent an authentication code
|
||||
/// </summary>
|
||||
public bool ResendCodeRequested { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The user-specified authentication code
|
||||
/// </summary>
|
||||
public string AuthenticationCode { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,21 @@
|
||||
|
||||
namespace Octokit.Helpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Extensions for converting between different time representations
|
||||
/// </summary>
|
||||
public static class UnixTimestampExtensions
|
||||
{
|
||||
const long _unixEpochTicks = 621355968000000000; // Unix Epoch is January 1, 1970 00:00 -0:00
|
||||
|
||||
{
|
||||
// Unix Epoch is January 1, 1970 00:00 -0:00
|
||||
const long unixEpochTicks = 621355968000000000;
|
||||
|
||||
/// <summary>
|
||||
/// Convert a Unix tick to a <see cref="DateTimeOffset"/> with UTC offset
|
||||
/// </summary>
|
||||
/// <param name="unixTime">UTC tick</param>
|
||||
public static DateTimeOffset FromUnixTime(this long unixTime)
|
||||
{
|
||||
return new DateTimeOffset(unixTime * TimeSpan.TicksPerSecond + _unixEpochTicks, TimeSpan.Zero);
|
||||
return new DateTimeOffset(unixTime * TimeSpan.TicksPerSecond + unixEpochTicks, TimeSpan.Zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,17 @@ using System.Linq;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
/// <summary>
|
||||
/// Extensions for working with Uris
|
||||
/// </summary>
|
||||
public static class UriExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Merge a dictionary of valeus with an existing <see cref="Uri"/>
|
||||
/// </summary>
|
||||
/// <param name="uri">Original request Uri</param>
|
||||
/// <param name="parameters">Collection of key-value pairs</param>
|
||||
/// <returns>Updated request Uri</returns>
|
||||
public static Uri ApplyParameters(this Uri uri, IDictionary<string, string> parameters)
|
||||
{
|
||||
Ensure.ArgumentNotNull(uri, "uri");
|
||||
|
||||
@@ -6,9 +6,17 @@ using Octokit.Helpers;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents lines added and deleted at a given point in time
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class AdditionsAndDeletions
|
||||
{
|
||||
/// <summary>
|
||||
/// Construct an instance of AdditionsAndDeletions
|
||||
/// </summary>
|
||||
/// <param name="additionsAndDeletions"></param>
|
||||
/// <exception cref="ArgumentException">If the list of data points is not 3 elements</exception>
|
||||
public AdditionsAndDeletions(IList<long> additionsAndDeletions)
|
||||
{
|
||||
Ensure.ArgumentNotNull(additionsAndDeletions, "additionsAndDeletions");
|
||||
@@ -21,10 +29,19 @@ namespace Octokit
|
||||
Deletions = Convert.ToInt32(additionsAndDeletions[2]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Date of the recorded activity
|
||||
/// </summary>
|
||||
public DateTimeOffset Timestamp { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Lines added for the given day
|
||||
/// </summary>
|
||||
public int Additions { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Lines deleted for the given day
|
||||
/// </summary>
|
||||
public int Deletions { get; private set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
|
||||
@@ -6,9 +6,16 @@ using System.Linq;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the summary of lines added and deleted
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class CodeFrequency
|
||||
{
|
||||
/// <summary>
|
||||
/// Construct an instance of CodeFrequency
|
||||
/// </summary>
|
||||
/// <param name="rawFrequencies">Raw data </param>
|
||||
public CodeFrequency(IEnumerable<IList<long>> rawFrequencies)
|
||||
{
|
||||
Ensure.ArgumentNotNull(rawFrequencies, "rawFrequencies");
|
||||
|
||||
Reference in New Issue
Block a user