fix user mapping and add doco

This commit is contained in:
Simon Cropp
2013-11-14 17:58:34 +11:00
parent 0b0661aa1e
commit cc779283ea
9 changed files with 198 additions and 35 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ namespace Octokit
/// <remarks>
/// http://developer.github.com/v3/gists/#get-a-single-gist
/// </remarks>
/// <param name="id">The id of the gidt</param>
/// <param name="id">The id of the gist</param>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
Task<Gist> Get(int id);
+64 -34
View File
@@ -4,57 +4,87 @@ using System.Diagnostics.CodeAnalysis;
namespace Octokit
{
public class Gist
public class Gist
{
/// <summary>
/// The API URL for this <see cref="Gist"/>.
/// </summary>
public string Url { get; set; }
/// <summary>
/// The Id of this <see cref="Gist"/>.
/// </summary>
/// <remarks>
/// Given a gist url of https://gist.github.com/UserName/1234 the Id would be '1234'.
/// </remarks>
public string Id { get; set; }
/// <summary>
/// A description of the <see cref="Gist"/>.
/// </summary>
public string Description { get; set; }
/// <summary>
/// Indicates if the <see cref="Gist"/> is private or public.
/// </summary>
public bool Public { get; set; }
public User User { get; set; }
/// <summary>
/// The <see cref="User"/> who owns this <see cref="Gist"/>.
/// </summary>
/// <remarks>
/// Given a gist url of https://gist.github.com/UserName/1234 the Owner would be 'UserName'.
/// </remarks>
public User Owner { get; set; }
/// <summary>
/// A <see cref="IDictionary{TKey,TValue}"/> containing all <see cref="GistFile"/>s in this <see cref="Gist"/>.
/// </summary>
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public IDictionary<string, GistFile> Files { get; set; }
/// <summary>
/// The number of comments on this <see cref="Gist"/>.
/// </summary>
public int Comments { get; set; }
/// <summary>
/// A url to retrieve the comments for this <see cref="Gist"/>.
/// </summary>
public string CommentsUrl { get; set; }
public string HtmlUrl { get; set; }
/// <summary>
/// The git url to pull from to retrieve the contents for this <see cref="Gist"/>.
/// </summary>
public string GitPullUrl { get; set; }
/// <summary>
/// The git url to push to when changing this <see cref="Gist"/>.
/// </summary>
public string GitPushUrl { get; set; }
/// <summary>
/// The <see cref="DateTimeOffset"/> for when this <see cref="Gist"/> was created.
/// </summary>
public DateTimeOffset CreatedAt { get; set; }
/// <summary>
/// The <see cref="DateTimeOffset"/> for when this <see cref="Gist"/> was last updated.
/// </summary>
public DateTimeOffset UpdatedAt { get; set; }
/// <summary>
/// A <see cref="IList{T}"/> of all <see cref="GistFork"/> that exist for this <see cref="Gist"/>.
/// </summary>
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public IList<GistFork> Forks { get; set; }
/// <summary>
/// A <see cref="IList{T}"/> of all <see cref="GistHistory"/> containing the full history for this <see cref="Gist"/>.
/// </summary>
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public IList<GistHistory> History { get; set; }
}
public class GistFork
{
public User User { get; set; }
public string Url { get; set; }
public string CreatedAt { get; set; }
}
public class GistFile
{
public int Size { get; set; }
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
public string Filename { get; set; }
[SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")]
public string Type { get; set; }
public string Language { get; set; }
public string Content { get; set; }
public string RawUrl { get; set; }
}
public class GistHistory
{
public string Url { get; set; }
public string Version { get; set; }
public User User { get; set; }
public GistChangeStatus ChangeStatus { get; set; }
public string CommittedAt { get; set; }
}
public class GistChangeStatus
{
public int Deletions { get; set; }
public int Additions { get; set; }
public int Total { get; set; }
}
}
@@ -0,0 +1,23 @@
namespace Octokit
{
/// <summary>
/// User by <see cref="GistHistory"/> to indicate the level of change.
/// </summary>
public class GistChangeStatus
{
/// <summary>
/// The number of deletions that occurred as part of this change.
/// </summary>
public int Deletions { get; set; }
/// <summary>
/// The number of additions that occurred as part of this change.
/// </summary>
public int Additions { get; set; }
/// <summary>
/// The total number of changes.
/// </summary>
public int Total { get; set; }
}
}
+40
View File
@@ -0,0 +1,40 @@
using System.Diagnostics.CodeAnalysis;
namespace Octokit
{
public class GistFile
{
/// <summary>
/// The size in bytes of the file.
/// </summary>
public int Size { get; set; }
/// <summary>
/// The name of the file
/// </summary>
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
public string Filename { get; set; }
/// <summary>
/// The mime type of the file
/// </summary>
[SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")]
public string Type { get; set; }
/// <summary>
/// The programming language of the file, if any.
/// </summary>
public string Language { get; set; }
/// <summary>
/// The text content of the file.
/// </summary>
public string Content { get; set; }
/// <summary>
/// The url to download the file.
/// </summary>
public string RawUrl { get; set; }
}
}
+23
View File
@@ -0,0 +1,23 @@
using System;
namespace Octokit
{
public class GistFork
{
/// <summary>
/// The <see cref="User"/> that created this <see cref="GistFork"/>
/// </summary>
public User User { get; set; }
/// <summary>
/// The API URL for this <see cref="GistFork"/>.
/// </summary>
public string Url { get; set; }
/// <summary>
/// The <see cref="DateTimeOffset"/> for when this <see cref="Gist"/> was created.
/// </summary>
public DateTimeOffset CreatedAt { get; set; }
}
}
+35
View File
@@ -0,0 +1,35 @@
using System;
namespace Octokit
{
/// <summary>
/// A historical version of a <see cref="Gist"/>
/// </summary>
public class GistHistory
{
/// <summary>
/// The url that can be used by the API to retrieve this version of the <see cref="Gist"/>.
/// </summary>
public string Url { get; set; }
/// <summary>
/// A git sha representing the version.
/// </summary>
public string Version { get; set; }
/// <summary>
/// The <see cref="User"/> who create this version.
/// </summary>
public User User { get; set; }
/// <summary>
/// A <see cref="GistHistory"/> that represents the level of change for this <see cref="GistHistory"/>.
/// </summary>
public GistChangeStatus ChangeStatus { get; set; }
/// <summary>
/// The <see cref="DateTimeOffset"/> the version was created.
/// </summary>
public DateTimeOffset CommittedAt { get; set; }
}
}
+4
View File
@@ -88,6 +88,10 @@
<Compile Include="Models\Response\CommitStatus.cs" />
<Compile Include="Models\Response\EventInfo.cs" />
<Compile Include="Models\Response\Gist.cs" />
<Compile Include="Models\Response\GistChangeStatus.cs" />
<Compile Include="Models\Response\GistFile.cs" />
<Compile Include="Models\Response\GistFork.cs" />
<Compile Include="Models\Response\GistHistory.cs" />
<Compile Include="Models\Response\GitReference.cs" />
<Compile Include="Models\Response\GitTag.cs" />
<Compile Include="Models\Response\Issue.cs" />
+4
View File
@@ -177,6 +177,10 @@
<Compile Include="Models\Response\CommitStatus.cs" />
<Compile Include="Models\Response\EmailAddress.cs" />
<Compile Include="Models\Response\Gist.cs" />
<Compile Include="Models\Response\GistChangeStatus.cs" />
<Compile Include="Models\Response\GistFile.cs" />
<Compile Include="Models\Response\GistFork.cs" />
<Compile Include="Models\Response\GistHistory.cs" />
<Compile Include="Models\Response\GitReference.cs" />
<Compile Include="Models\Response\GitTag.cs" />
<Compile Include="Models\Response\EventInfo.cs" />
+4
View File
@@ -98,6 +98,10 @@
<Compile Include="Models\Response\CommitStatus.cs" />
<Compile Include="Models\Request\Permission.cs" />
<Compile Include="Models\Response\Gist.cs" />
<Compile Include="Models\Response\GistChangeStatus.cs" />
<Compile Include="Models\Response\GistFile.cs" />
<Compile Include="Models\Response\GistFork.cs" />
<Compile Include="Models\Response\GistHistory.cs" />
<Compile Include="Models\Response\TeamItem.cs" />
<Compile Include="Models\Response\Team.cs" />
<Compile Include="Models\Response\EventInfo.cs" />