diff --git a/Octokit/GitHubModels.cs b/Octokit/GitHubModels.cs deleted file mode 100644 index 230e2d5f..00000000 --- a/Octokit/GitHubModels.cs +++ /dev/null @@ -1,590 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.IO; -using System.Text; -using System.Threading.Tasks; -using Octokit.Http; - -namespace Octokit -{ - /// - /// Represents an oauth application. - /// - public class Application - { - /// - /// Name. - /// - public string Name { get; set; } - - /// - /// The Url of this . - /// - public string Url { get; set; } - } - - public class AuthorizationUpdate - { - /// - /// Replace scopes with this list. - /// - [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Special type of model object that only updates none-null fields.")] - public string[] Scopes { get; set; } - - /// - /// Notes about this particular . - /// - public string Note { get; set; } - - /// - /// A url for more information about notes. - /// - public string NoteUrl { get; set; } - } - - /// - /// Represents an oauth access given to a particular application. - /// - public class Authorization - { - /// - /// The Id of this . - /// - public int Id { get; set; } - - /// - /// The API URL for this . - /// - public string Url { get; set; } - - /// - /// The that created this . - /// - public Application Application { get; set; } - - /// - /// The oauth token (be careful with these, they are like passwords!). - /// - public string Token { get; set; } - - /// - /// Notes about this particular . - /// - public string Note { get; set; } - - /// - /// A url for more information about notes. - /// - public string NoteUrl { get; set; } - - /// - /// When this was created. - /// - public DateTimeOffset CreatedAt { get; set; } - - /// - /// When this was last updated. - /// - public DateTimeOffset UpdateAt { get; set; } - - /// - /// The scopes that this has. This is the kind of access that the token allows. - /// - [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Special type of model object that only updates none-null fields.")] - public string[] Scopes { get; set; } - - public string ScopesDelimited - { - get { return string.Join(",", Scopes); } - } - } - - /// - /// Represents updatable fields on a user. Values that are null will not be sent in the request. - /// Use string.empty if you want to clear clear a value. - /// - public class UserUpdate - { - /// - /// This user's bio. - /// - public string Bio { get; set; } - - /// - /// URL for this user's blog. - /// - public string Blog { get; set; } - - /// - /// The company this user's works for. - /// - public string Company { get; set; } - - /// - /// This user's email. - /// - public string Email { get; set; } - - /// - /// The geographic location of this user. - /// - public string Location { get; set; } - - /// - /// This user's full name. - /// - public string Name { get; set; } - - /// - /// Tells if this user is currently hireable. - /// - public bool? Hireable { get; set; } - } - - /// - /// Represents a user on GitHub. - /// - public class User : Account - { - /// - /// Hex Gravatar identifier - /// - public string GravatarId { get; set; } - - /// - /// Whether or not the user is an administrator of the site - /// - public bool SiteAdmin { get; set; } - } - - public class Organization : Account - { - /// - /// The billing address for an organization. This is only returned when updating - /// an organization. - /// - public string BillingAddress { get; set; } - } - - public abstract class Account - { - /// - /// URL for this user's avatar. - /// - public string AvatarUrl { get; set; } - - /// - /// This user's bio. - /// - public string Bio { get; set; } - - /// - /// URL for this user's blog. - /// - public string Blog { get; set; } - - /// - /// Number of collaborators this user has on their account. - /// - public int Collaborators { get; set; } - - /// - /// The company this user's works for. - /// - public string Company { get; set; } - - /// - /// The date this user account was create. - /// - public DateTimeOffset CreatedAt { get; set; } - - /// - /// The amout of disk space this user is currently using. - /// - public int DiskUsage { get; set; } - - /// - /// This user's email. - /// - public string Email { get; set; } - - /// - /// Number of follwers this user has. - /// - public int Followers { get; set; } - - /// - /// Number of other users this user is following. - /// - public int Following { get; set; } - - /// - /// Tells if this user is currently hireable. - /// - public bool Hireable { get; set; } - - /// - /// The HTML URL for this user on github.com. - /// - public string HtmlUrl { get; set; } - - /// - /// The system-wide unique Id for this user. - /// - public int Id { get; set; } - - /// - /// The geographic location of this user. - /// - public string Location { get; set; } - - /// - /// This user's login. - /// - public string Login { get; set; } - - /// - /// This user's full name. - /// - public string Name { get; set; } - - /// - /// Number of private repos owned by this user. - /// - public int OwnedPrivateRepos { get; set; } - - /// - /// The plan this user pays for. - /// - public Plan Plan { get; set; } - - /// - /// The number of private gists this user has created. - /// - public int PrivateGists { get; set; } - - /// - /// The number of public gists this user has created. - /// - public int PublicGists { get; set; } - - /// - /// The number of public repos owned by this user. - /// - public int PublicRepos { get; set; } - - /// - /// The total number of private repos this user owns. - /// - public int TotalPrivateRepos { get; set; } - - /// - /// The api URL for this user. - /// - public string Url { get; set; } - } - - internal class ReadmeResponse - { - public string Content { get; set; } - public string Name { get; set; } - public string HtmlUrl { get; set; } - public string Url { get; set; } - public string Encoding { get; set; } - } - - public class Readme - { - readonly Lazy> htmlContent; - - internal Readme(ReadmeResponse response, IApiConnection client) - { - Ensure.ArgumentNotNull(response, "response"); - Ensure.ArgumentNotNull(client, "client"); - - Name = response.Name; - Url = new Uri(response.Url); - HtmlUrl = new Uri(response.HtmlUrl); - if (response.Encoding.Equals("base64", StringComparison.OrdinalIgnoreCase)) - { - var contentAsBytes = Convert.FromBase64String(response.Content); - Content = Encoding.UTF8.GetString(contentAsBytes, 0, contentAsBytes.Length); - } - htmlContent = new Lazy>(async () => await client.GetHtml(HtmlUrl)); - } - - public string Content { get; private set; } - public string Name { get; private set; } - public Uri HtmlUrl { get; private set; } - public Uri Url { get; private set; } - - [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", - Justification = "Makse a network request")] - public async Task GetHtmlContent() - { - return await htmlContent.Value; - } - } - - public class SshKey - { - /// - /// The system-wide unique Id for this user. - /// - public int Id { get; set; } - - /// - /// The SSH Key - /// - public string Key { get; set; } - - /// - /// The title of the SSH key - /// - public string Title { get; set; } - - /// - /// The api URL for this organization. - /// - public string Url { get; set; } - } - - /// - /// Represents the data and name parsed from the Ssh key. - /// - public class SshKeyInfo - { - public SshKeyInfo(string data, string name) - { - Ensure.ArgumentNotNull(data, "data"); - Ensure.ArgumentNotNull(name, "name"); - - Data = data; - Name = name; - } - - public string Data { get; private set; } - public string Name { get; private set; } - } - - public class SshKeyUpdate - { - /// - /// The SSH Key - /// - public string Key { get; set; } - - /// - /// The title of the SSH key - /// - public string Title { get; set; } - } - - /// - /// A plan (either paid or free) for a particular user - /// - public class Plan - { - /// - /// The number of collaborators allowed with this plan. - /// - public int Collaborators { get; set; } - - /// - /// The name of the plan. - /// - public string Name { get; set; } - - /// - /// The number of private repositories allowed with this plan. - /// - public int PrivateRepos { get; set; } - - /// - /// The amount of disk space allowed with this plan. - /// - public int Space { get; set; } - - /// - /// The billing email for the organization. Only has a value in response to editing an organization. - /// - public string BillingEmail { get; set; } - } - - public class Repository - { - public string Url { get; set; } - public string HtmlUrl { get; set; } - public string CloneUrl { get; set; } - public string GitUrl { get; set; } - public string SshUrl { get; set; } - public string SvnUrl { get; set; } - public string MirrorUrl { get; set; } - public int Id { get; set; } - public User Owner { get; set; } - public string Name { get; set; } - public string FullName { get; set; } - public string Description { get; set; } - public string Homepage { get; set; } - public string Language { get; set; } - public bool Private { get; set; } - public bool Fork { get; set; } - public int ForksCount { get; set; } - public int WatchersCount { get; set; } - public string MasterBranch { get; set; } - public int OpenIssuesCount { get; set; } - public DateTimeOffset? PushedAt { get; set; } - public DateTimeOffset CreatedAt { get; set; } - public DateTimeOffset UpdatedAt { get; set; } - - public User Organization { get; set; } - public Repository Parent { get; set; } - public Repository Source { get; set; } - public bool HasIssues { get; set; } - public bool HasWiki { get; set; } - public bool HasDownloads { get; set; } - } - - public class EmailAddress - { - public string Email { get; set; } - - public bool Verified { get; set; } - - public bool Primary { get; set; } - } - - public class Release - { - public string Url { get; set; } - public string HtmlUrl { get; set; } - public string AssetsUrl { get; set; } - public string UploadUrl { get; set; } - public int Id { get; set; } - public string TagName { get; set; } - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Commitish")] - public string TargetCommitish { get; set; } - public string Name { get; set; } - public string Body { get; set; } - public bool Draft { get; set; } - public bool Prerelease { get; set; } - public DateTimeOffset CreatedAt { get; set; } - public DateTimeOffset PublishedAt { get; set; } - } - - public class ReleaseUpdate - { - public ReleaseUpdate(string tagName) - { - Ensure.ArgumentNotNullOrEmptyString(tagName, "tagName"); - TagName = tagName; - } - - public string TagName { get; private set; } - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Commitish")] - public string TargetCommitish { get; set; } - public string Name { get; set; } - public string Description { get; set; } - public bool Draft { get; set; } - public bool Prerelease { get; set; } - } - - public class ReleaseAsset - { - public string Url { get; set; } - public int Id { get; set; } - public string Name { get; set; } - public string Label { get; set; } - public string State { get; set; } - public string ContentType { get; set; } - public int Size { get; set; } - public int DownloadCount { get; set; } - public DateTimeOffset CreatedAt { get; set; } - public DateTimeOffset UpdatedAt { get; set; } - } - - public class ReleaseAssetUpload - { - public string FileName { get; set; } - public string ContentType { get; set; } - public Stream RawData { get; set; } - } - - public class ApiError - { - public string Message { get; set; } - - // TODO: This ought to be an IReadOnlyList but we need to add support to SimpleJson for that. - [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public IList Errors { get; set; } - } - - public class ApiErrorDetail - { - public string Message { get; set; } - - public string Code { get; set; } - - public string Field { get; set; } - - public string Resource { get; set; } - } - - /// - /// Describes a new repository to create via the method. - /// - public class NewRepository - { - /// - /// Optional. Gets or sets whether to create an initial commit with empty README. The default is false. - /// - public bool? AutoInit { get; set; } - - /// - /// Required. Gets or sets the new repository's description - /// - public string Description { get; set; } - - /// s - /// Optional. Gets or sets whether to the enable downloads for the new repository. The default is true. - /// - public bool? HasDownloads { get; set; } - - /// s - /// Optional. Gets or sets whether to the enable issues for the new repository. The default is true. - /// - public bool? HasIssues { get; set; } - - /// s - /// Optional. Gets or sets whether to the enable the wiki for the new repository. The default is true. - /// - public bool? HasWiki { get; set; } - - /// - /// Optional. Gets or sets the new repository's optional website. - /// - public string Homepage { get; set; } - - /// - /// Optional. Gets or sets the desired language's or platform's .gitignore template to apply. Use the name of the template without the extension; "Haskell", for example. Ignored if is null or false. - /// - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gitignore", Justification = "It needs to be this way for proper serialization.")] - public string GitignoreTemplate { get; set; } - - /// - /// Required. Gets or sets the new repository's name. - /// - public string Name { get; set; } - - /// - /// Optional. Gets or sets whether the new repository is private; the default is false. - /// - public bool? Private { get; set; } - - /// - /// Optional. Gets or sets the ID of the team to grant access to this repository. This is only valid when creating a repository for an organization. - /// - public int? TeamId { get; set; } - } -} diff --git a/Octokit/Models/Account.cs b/Octokit/Models/Account.cs new file mode 100644 index 00000000..f26652dd --- /dev/null +++ b/Octokit/Models/Account.cs @@ -0,0 +1,122 @@ +using System; + +namespace Octokit +{ + public abstract class Account + { + /// + /// URL for this user's avatar. + /// + public string AvatarUrl { get; set; } + + /// + /// This user's bio. + /// + public string Bio { get; set; } + + /// + /// URL for this user's blog. + /// + public string Blog { get; set; } + + /// + /// Number of collaborators this user has on their account. + /// + public int Collaborators { get; set; } + + /// + /// The company this user's works for. + /// + public string Company { get; set; } + + /// + /// The date this user account was create. + /// + public DateTimeOffset CreatedAt { get; set; } + + /// + /// The amout of disk space this user is currently using. + /// + public int DiskUsage { get; set; } + + /// + /// This user's email. + /// + public string Email { get; set; } + + /// + /// Number of follwers this user has. + /// + public int Followers { get; set; } + + /// + /// Number of other users this user is following. + /// + public int Following { get; set; } + + /// + /// Tells if this user is currently hireable. + /// + public bool Hireable { get; set; } + + /// + /// The HTML URL for this user on github.com. + /// + public string HtmlUrl { get; set; } + + /// + /// The system-wide unique Id for this user. + /// + public int Id { get; set; } + + /// + /// The geographic location of this user. + /// + public string Location { get; set; } + + /// + /// This user's login. + /// + public string Login { get; set; } + + /// + /// This user's full name. + /// + public string Name { get; set; } + + /// + /// Number of private repos owned by this user. + /// + public int OwnedPrivateRepos { get; set; } + + /// + /// The plan this user pays for. + /// + public Plan Plan { get; set; } + + /// + /// The number of private gists this user has created. + /// + public int PrivateGists { get; set; } + + /// + /// The number of public gists this user has created. + /// + public int PublicGists { get; set; } + + /// + /// The number of public repos owned by this user. + /// + public int PublicRepos { get; set; } + + /// + /// The total number of private repos this user owns. + /// + public int TotalPrivateRepos { get; set; } + + /// + /// The api URL for this user. + /// + public string Url { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/ApiError.cs b/Octokit/Models/ApiError.cs new file mode 100644 index 00000000..67ad59f2 --- /dev/null +++ b/Octokit/Models/ApiError.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; + +namespace Octokit +{ + public class ApiError + { + public string Message { get; set; } + + // TODO: This ought to be an IReadOnlyList but we need to add support to SimpleJson for that. + [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public IList Errors { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/ApiErrorDetail.cs b/Octokit/Models/ApiErrorDetail.cs new file mode 100644 index 00000000..10d222cc --- /dev/null +++ b/Octokit/Models/ApiErrorDetail.cs @@ -0,0 +1,13 @@ +namespace Octokit +{ + public class ApiErrorDetail + { + public string Message { get; set; } + + public string Code { get; set; } + + public string Field { get; set; } + + public string Resource { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/Application.cs b/Octokit/Models/Application.cs new file mode 100644 index 00000000..7d71f07e --- /dev/null +++ b/Octokit/Models/Application.cs @@ -0,0 +1,18 @@ +namespace Octokit +{ + /// + /// Represents an oauth application. + /// + public class Application + { + /// + /// Name. + /// + public string Name { get; set; } + + /// + /// The Url of this . + /// + public string Url { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/Authorization.cs b/Octokit/Models/Authorization.cs new file mode 100644 index 00000000..304dbb3b --- /dev/null +++ b/Octokit/Models/Authorization.cs @@ -0,0 +1,62 @@ +using System; +using System.Diagnostics.CodeAnalysis; + +namespace Octokit +{ + /// + /// Represents an oauth access given to a particular application. + /// + public class Authorization + { + /// + /// The Id of this . + /// + public int Id { get; set; } + + /// + /// The API URL for this . + /// + public string Url { get; set; } + + /// + /// The that created this . + /// + public Application Application { get; set; } + + /// + /// The oauth token (be careful with these, they are like passwords!). + /// + public string Token { get; set; } + + /// + /// Notes about this particular . + /// + public string Note { get; set; } + + /// + /// A url for more information about notes. + /// + public string NoteUrl { get; set; } + + /// + /// When this was created. + /// + public DateTimeOffset CreatedAt { get; set; } + + /// + /// When this was last updated. + /// + public DateTimeOffset UpdateAt { get; set; } + + /// + /// The scopes that this has. This is the kind of access that the token allows. + /// + [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Special type of model object that only updates none-null fields.")] + public string[] Scopes { get; set; } + + public string ScopesDelimited + { + get { return string.Join(",", Scopes); } + } + } +} \ No newline at end of file diff --git a/Octokit/Models/AuthorizationUpdate.cs b/Octokit/Models/AuthorizationUpdate.cs new file mode 100644 index 00000000..1c0732fc --- /dev/null +++ b/Octokit/Models/AuthorizationUpdate.cs @@ -0,0 +1,23 @@ +using System.Diagnostics.CodeAnalysis; + +namespace Octokit +{ + public class AuthorizationUpdate + { + /// + /// Replace scopes with this list. + /// + [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Special type of model object that only updates none-null fields.")] + public string[] Scopes { get; set; } + + /// + /// Notes about this particular . + /// + public string Note { get; set; } + + /// + /// A url for more information about notes. + /// + public string NoteUrl { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/EmailAddress.cs b/Octokit/Models/EmailAddress.cs new file mode 100644 index 00000000..50e88d9d --- /dev/null +++ b/Octokit/Models/EmailAddress.cs @@ -0,0 +1,11 @@ +namespace Octokit +{ + public class EmailAddress + { + public string Email { get; set; } + + public bool Verified { get; set; } + + public bool Primary { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/NewRepository.cs b/Octokit/Models/NewRepository.cs new file mode 100644 index 00000000..194fcb6e --- /dev/null +++ b/Octokit/Models/NewRepository.cs @@ -0,0 +1,61 @@ +using System.Diagnostics.CodeAnalysis; + +namespace Octokit +{ + /// + /// Describes a new repository to create via the method. + /// + public class NewRepository + { + /// + /// Optional. Gets or sets whether to create an initial commit with empty README. The default is false. + /// + public bool? AutoInit { get; set; } + + /// + /// Required. Gets or sets the new repository's description + /// + public string Description { get; set; } + + /// s + /// Optional. Gets or sets whether to the enable downloads for the new repository. The default is true. + /// + public bool? HasDownloads { get; set; } + + /// s + /// Optional. Gets or sets whether to the enable issues for the new repository. The default is true. + /// + public bool? HasIssues { get; set; } + + /// s + /// Optional. Gets or sets whether to the enable the wiki for the new repository. The default is true. + /// + public bool? HasWiki { get; set; } + + /// + /// Optional. Gets or sets the new repository's optional website. + /// + public string Homepage { get; set; } + + /// + /// Optional. Gets or sets the desired language's or platform's .gitignore template to apply. Use the name of the template without the extension; "Haskell", for example. Ignored if is null or false. + /// + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gitignore", Justification = "It needs to be this way for proper serialization.")] + public string GitignoreTemplate { get; set; } + + /// + /// Required. Gets or sets the new repository's name. + /// + public string Name { get; set; } + + /// + /// Optional. Gets or sets whether the new repository is private; the default is false. + /// + public bool? Private { get; set; } + + /// + /// Optional. Gets or sets the ID of the team to grant access to this repository. This is only valid when creating a repository for an organization. + /// + public int? TeamId { get; set; } + } +} diff --git a/Octokit/Models/Organization.cs b/Octokit/Models/Organization.cs new file mode 100644 index 00000000..d17edff6 --- /dev/null +++ b/Octokit/Models/Organization.cs @@ -0,0 +1,11 @@ +namespace Octokit +{ + public class Organization : Account + { + /// + /// The billing address for an organization. This is only returned when updating + /// an organization. + /// + public string BillingAddress { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/Plan.cs b/Octokit/Models/Plan.cs new file mode 100644 index 00000000..10d2f6bf --- /dev/null +++ b/Octokit/Models/Plan.cs @@ -0,0 +1,33 @@ +namespace Octokit +{ + /// + /// A plan (either paid or free) for a particular user + /// + public class Plan + { + /// + /// The number of collaborators allowed with this plan. + /// + public int Collaborators { get; set; } + + /// + /// The name of the plan. + /// + public string Name { get; set; } + + /// + /// The number of private repositories allowed with this plan. + /// + public int PrivateRepos { get; set; } + + /// + /// The amount of disk space allowed with this plan. + /// + public int Space { get; set; } + + /// + /// The billing email for the organization. Only has a value in response to editing an organization. + /// + public string BillingEmail { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/Readme.cs b/Octokit/Models/Readme.cs new file mode 100644 index 00000000..910db0d9 --- /dev/null +++ b/Octokit/Models/Readme.cs @@ -0,0 +1,41 @@ +using System; +using System.Diagnostics.CodeAnalysis; +using System.Text; +using System.Threading.Tasks; +using Octokit.Http; + +namespace Octokit +{ + public class Readme + { + readonly Lazy> htmlContent; + + internal Readme(ReadmeResponse response, IApiConnection client) + { + Ensure.ArgumentNotNull(response, "response"); + Ensure.ArgumentNotNull(client, "client"); + + Name = response.Name; + Url = new Uri(response.Url); + HtmlUrl = new Uri(response.HtmlUrl); + if (response.Encoding.Equals("base64", StringComparison.OrdinalIgnoreCase)) + { + var contentAsBytes = Convert.FromBase64String(response.Content); + Content = Encoding.UTF8.GetString(contentAsBytes, 0, contentAsBytes.Length); + } + htmlContent = new Lazy>(async () => await client.GetHtml(HtmlUrl)); + } + + public string Content { get; private set; } + public string Name { get; private set; } + public Uri HtmlUrl { get; private set; } + public Uri Url { get; private set; } + + [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", + Justification = "Makse a network request")] + public async Task GetHtmlContent() + { + return await htmlContent.Value; + } + } +} \ No newline at end of file diff --git a/Octokit/Models/ReadmeResponse.cs b/Octokit/Models/ReadmeResponse.cs new file mode 100644 index 00000000..931a5f7b --- /dev/null +++ b/Octokit/Models/ReadmeResponse.cs @@ -0,0 +1,11 @@ +namespace Octokit +{ + internal class ReadmeResponse + { + public string Content { get; set; } + public string Name { get; set; } + public string HtmlUrl { get; set; } + public string Url { get; set; } + public string Encoding { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/Release.cs b/Octokit/Models/Release.cs new file mode 100644 index 00000000..475b3a1a --- /dev/null +++ b/Octokit/Models/Release.cs @@ -0,0 +1,23 @@ +using System; +using System.Diagnostics.CodeAnalysis; + +namespace Octokit +{ + public class Release + { + public string Url { get; set; } + public string HtmlUrl { get; set; } + public string AssetsUrl { get; set; } + public string UploadUrl { get; set; } + public int Id { get; set; } + public string TagName { get; set; } + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Commitish")] + public string TargetCommitish { get; set; } + public string Name { get; set; } + public string Body { get; set; } + public bool Draft { get; set; } + public bool Prerelease { get; set; } + public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset PublishedAt { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/ReleaseAsset.cs b/Octokit/Models/ReleaseAsset.cs new file mode 100644 index 00000000..24d1f696 --- /dev/null +++ b/Octokit/Models/ReleaseAsset.cs @@ -0,0 +1,18 @@ +using System; + +namespace Octokit +{ + public class ReleaseAsset + { + public string Url { get; set; } + public int Id { get; set; } + public string Name { get; set; } + public string Label { get; set; } + public string State { get; set; } + public string ContentType { get; set; } + public int Size { get; set; } + public int DownloadCount { get; set; } + public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset UpdatedAt { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/ReleaseAssetUpload.cs b/Octokit/Models/ReleaseAssetUpload.cs new file mode 100644 index 00000000..88181713 --- /dev/null +++ b/Octokit/Models/ReleaseAssetUpload.cs @@ -0,0 +1,11 @@ +using System.IO; + +namespace Octokit +{ + public class ReleaseAssetUpload + { + public string FileName { get; set; } + public string ContentType { get; set; } + public Stream RawData { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/ReleaseUpdate.cs b/Octokit/Models/ReleaseUpdate.cs new file mode 100644 index 00000000..2db9b029 --- /dev/null +++ b/Octokit/Models/ReleaseUpdate.cs @@ -0,0 +1,21 @@ +using System.Diagnostics.CodeAnalysis; + +namespace Octokit +{ + public class ReleaseUpdate + { + public ReleaseUpdate(string tagName) + { + Ensure.ArgumentNotNullOrEmptyString(tagName, "tagName"); + TagName = tagName; + } + + public string TagName { get; private set; } + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Commitish")] + public string TargetCommitish { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public bool Draft { get; set; } + public bool Prerelease { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/Repository.cs b/Octokit/Models/Repository.cs new file mode 100644 index 00000000..393e1178 --- /dev/null +++ b/Octokit/Models/Repository.cs @@ -0,0 +1,38 @@ +using System; + +namespace Octokit +{ + public class Repository + { + public string Url { get; set; } + public string HtmlUrl { get; set; } + public string CloneUrl { get; set; } + public string GitUrl { get; set; } + public string SshUrl { get; set; } + public string SvnUrl { get; set; } + public string MirrorUrl { get; set; } + public int Id { get; set; } + public User Owner { get; set; } + public string Name { get; set; } + public string FullName { get; set; } + public string Description { get; set; } + public string Homepage { get; set; } + public string Language { get; set; } + public bool Private { get; set; } + public bool Fork { get; set; } + public int ForksCount { get; set; } + public int WatchersCount { get; set; } + public string MasterBranch { get; set; } + public int OpenIssuesCount { get; set; } + public DateTimeOffset? PushedAt { get; set; } + public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset UpdatedAt { get; set; } + + public User Organization { get; set; } + public Repository Parent { get; set; } + public Repository Source { get; set; } + public bool HasIssues { get; set; } + public bool HasWiki { get; set; } + public bool HasDownloads { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/SshKey.cs b/Octokit/Models/SshKey.cs new file mode 100644 index 00000000..38825c35 --- /dev/null +++ b/Octokit/Models/SshKey.cs @@ -0,0 +1,25 @@ +namespace Octokit +{ + public class SshKey + { + /// + /// The system-wide unique Id for this user. + /// + public int Id { get; set; } + + /// + /// The SSH Key + /// + public string Key { get; set; } + + /// + /// The title of the SSH key + /// + public string Title { get; set; } + + /// + /// The api URL for this organization. + /// + public string Url { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/SshKeyInfo.cs b/Octokit/Models/SshKeyInfo.cs new file mode 100644 index 00000000..d66d6819 --- /dev/null +++ b/Octokit/Models/SshKeyInfo.cs @@ -0,0 +1,20 @@ +namespace Octokit +{ + /// + /// Represents the data and name parsed from the Ssh key. + /// + public class SshKeyInfo + { + public SshKeyInfo(string data, string name) + { + Ensure.ArgumentNotNull(data, "data"); + Ensure.ArgumentNotNull(name, "name"); + + Data = data; + Name = name; + } + + public string Data { get; private set; } + public string Name { get; private set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/SshKeyUpdate.cs b/Octokit/Models/SshKeyUpdate.cs new file mode 100644 index 00000000..f45dd245 --- /dev/null +++ b/Octokit/Models/SshKeyUpdate.cs @@ -0,0 +1,15 @@ +namespace Octokit +{ + public class SshKeyUpdate + { + /// + /// The SSH Key + /// + public string Key { get; set; } + + /// + /// The title of the SSH key + /// + public string Title { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/User.cs b/Octokit/Models/User.cs new file mode 100644 index 00000000..e79fcb00 --- /dev/null +++ b/Octokit/Models/User.cs @@ -0,0 +1,18 @@ +namespace Octokit +{ + /// + /// Represents a user on GitHub. + /// + public class User : Account + { + /// + /// Hex Gravatar identifier + /// + public string GravatarId { get; set; } + + /// + /// Whether or not the user is an administrator of the site + /// + public bool SiteAdmin { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/UserUpdate.cs b/Octokit/Models/UserUpdate.cs new file mode 100644 index 00000000..efa39305 --- /dev/null +++ b/Octokit/Models/UserUpdate.cs @@ -0,0 +1,44 @@ +namespace Octokit +{ + /// + /// Represents updatable fields on a user. Values that are null will not be sent in the request. + /// Use string.empty if you want to clear clear a value. + /// + public class UserUpdate + { + /// + /// This user's bio. + /// + public string Bio { get; set; } + + /// + /// URL for this user's blog. + /// + public string Blog { get; set; } + + /// + /// The company this user's works for. + /// + public string Company { get; set; } + + /// + /// This user's email. + /// + public string Email { get; set; } + + /// + /// The geographic location of this user. + /// + public string Location { get; set; } + + /// + /// This user's full name. + /// + public string Name { get; set; } + + /// + /// Tells if this user is currently hireable. + /// + public bool? Hireable { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index 258ac06c..8ff61081 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -78,6 +78,10 @@ + + + + @@ -141,11 +145,28 @@ + + + + + + + + + + + + + + + + + - + diff --git a/Octokit/Octokit.csproj.DotSettings b/Octokit/Octokit.csproj.DotSettings new file mode 100644 index 00000000..58b4dfd1 --- /dev/null +++ b/Octokit/Octokit.csproj.DotSettings @@ -0,0 +1,2 @@ + + True \ No newline at end of file diff --git a/Octokit/OctokitRT.csproj b/Octokit/OctokitRT.csproj index 04512f3a..87301df8 100644 --- a/Octokit/OctokitRT.csproj +++ b/Octokit/OctokitRT.csproj @@ -159,10 +159,31 @@ + + + + + + + + + + + + + + + + + + + + + + -