diff --git a/CustomDictionary.xml b/CustomDictionary.xml
index f8179146..c5fa9377 100644
--- a/CustomDictionary.xml
+++ b/CustomDictionary.xml
@@ -15,6 +15,8 @@
EmojiEmojisSha
+ Color
+ Prerelease
diff --git a/Octokit.Reactive.nuspec b/Octokit.Reactive.nuspec
index 22e4db7e..ba8fdc70 100644
--- a/Octokit.Reactive.nuspec
+++ b/Octokit.Reactive.nuspec
@@ -8,7 +8,7 @@
@summary@https://github.com/octokit/octokit.net/blob/master/LICENSE.txthttps://github.com/octokit/octokit.net
- https://f.cloud.github.com/assets/19977/1441274/160fba8c-41a9-11e3-831d-61d88fa886f4.png
+ https://f.cloud.github.com/assets/19977/1510987/64af2b26-4a9d-11e3-89fc-96a185171c75.pngfalse@description@@releaseNotes@
diff --git a/Octokit.Reactive/Clients/IObservableAuthorizationsClient.cs b/Octokit.Reactive/Clients/IObservableAuthorizationsClient.cs
index 54d27ad1..2283f454 100644
--- a/Octokit.Reactive/Clients/IObservableAuthorizationsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableAuthorizationsClient.cs
@@ -65,7 +65,7 @@ namespace Octokit.Reactive
/// Client ID for the OAuth application that is requesting the token
/// The client secret
/// Defines the scopes and metadata for the token
- ///
+ /// The two-factor authentication code provided by the user
/// Thrown when the user does not have permission to make
/// this request. Check
/// Thrown when the two-factor code is not
diff --git a/Octokit.Reactive/Clients/IObservableCommitStatusClient.cs b/Octokit.Reactive/Clients/IObservableCommitStatusClient.cs
index 0ff8beb2..e952d6aa 100644
--- a/Octokit.Reactive/Clients/IObservableCommitStatusClient.cs
+++ b/Octokit.Reactive/Clients/IObservableCommitStatusClient.cs
@@ -11,7 +11,7 @@ namespace Octokit.Reactive
/// Only users with pull access can see this.
/// The owner of the repository
/// The name of the repository
- /// The reference (SHA, branch name, or tag name) to list commits for.
+ /// The reference (SHA, branch name, or tag name) to list commits for
///
IObservable GetAll(string owner, string name, string reference);
@@ -20,8 +20,8 @@ namespace Octokit.Reactive
///
/// The owner of the repository
/// The name of the repository
- /// The reference (SHA, branch name, or tag name) to list commits for.
- /// The commit status to create.
+ /// The reference (SHA, branch name, or tag name) to list commits for
+ /// The commit status to create
///
IObservable Create(string owner, string name, string reference, NewCommitStatus commitStatus);
}
diff --git a/Octokit.Reactive/Clients/IObservableCommitsClient.cs b/Octokit.Reactive/Clients/IObservableCommitsClient.cs
new file mode 100644
index 00000000..22d9b003
--- /dev/null
+++ b/Octokit.Reactive/Clients/IObservableCommitsClient.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Diagnostics.CodeAnalysis;
+
+namespace Octokit.Reactive
+{
+ public interface IObservableCommitsClient
+ {
+ ///
+ /// Gets a commit for a given repository by sha reference
+ ///
+ ///
+ /// http://developer.github.com/v3/git/commits/#get-a-commit
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Tha sha reference of the commit
+ ///
+ [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
+ Justification = "Method makes a network request")]
+ IObservable Get(string owner, string name, string reference);
+
+ ///
+ /// Create a commit for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/git/commits/#create-a-commit
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The commit to create
+ ///
+ IObservable Create(string owner, string name, NewCommit commit);
+ }
+}
\ No newline at end of file
diff --git a/Octokit.Reactive/Clients/IObservableEventsClient.cs b/Octokit.Reactive/Clients/IObservableEventsClient.cs
index 5dbf588f..ced8b7ff 100644
--- a/Octokit.Reactive/Clients/IObservableEventsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableEventsClient.cs
@@ -52,7 +52,7 @@ namespace Octokit.Reactive
///
/// http://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
///
- /// The name of the user
+ /// The login of the user
/// All the s that a particular user has received.
IObservable GetUserReceived(string user);
@@ -62,7 +62,7 @@ namespace Octokit.Reactive
///
/// http://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received
///
- /// The name of the user
+ /// The login of the user
/// All the s that a particular user has received.
IObservable GetUserReceivedPublic(string user);
@@ -72,7 +72,7 @@ namespace Octokit.Reactive
///
/// http://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
///
- /// The name of the user
+ /// The login of the user
/// All the s that a particular user has performed.
IObservable GetUserPerformed(string user);
@@ -82,7 +82,7 @@ namespace Octokit.Reactive
///
/// http://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user
///
- /// The name of the user
+ /// The login of the user
/// All the public s that a particular user has performed.
IObservable GetUserPerformedPublic(string user);
@@ -92,7 +92,7 @@ namespace Octokit.Reactive
///
/// http://developer.github.com/v3/activity/events/#list-events-for-an-organization
///
- /// The name of the user
+ /// The login of the user
/// The name of the organization
/// All the public s that are associated with an organization.
IObservable GetForAnOrganization(string user, string organization);
diff --git a/Octokit.Reactive/Clients/IObservableGitDatabaseClient.cs b/Octokit.Reactive/Clients/IObservableGitDatabaseClient.cs
index 8c984fb6..d071c78a 100644
--- a/Octokit.Reactive/Clients/IObservableGitDatabaseClient.cs
+++ b/Octokit.Reactive/Clients/IObservableGitDatabaseClient.cs
@@ -6,5 +6,6 @@
public interface IObservableGitDatabaseClient
{
IObservableTagsClient Tag { get; set; }
+ IObservableCommitsClient Commit { get; set; }
}
}
\ No newline at end of file
diff --git a/Octokit.Reactive/Clients/IObservableOrganizationMembersClient.cs b/Octokit.Reactive/Clients/IObservableOrganizationMembersClient.cs
new file mode 100644
index 00000000..514872ca
--- /dev/null
+++ b/Octokit.Reactive/Clients/IObservableOrganizationMembersClient.cs
@@ -0,0 +1,102 @@
+using System;
+using System.Reactive;
+
+namespace Octokit.Reactive
+{
+ public interface IObservableOrganizationMembersClient
+ {
+ ///
+ ///
+ /// List all users who are members of an organization. A member is a user that
+ /// belongs to at least 1 team in the organization.
+ ///
+ ///
+ /// If the authenticated user is also an owner of this organization then both
+ /// concealed and public member will be returned.
+ ///
+ ///
+ /// If the requester is not an owner of the organization the query will be redirected
+ /// to the public members list.
+ ///
+ ///
+ ///
+ /// See the API documentation
+ /// for more information.
+ ///
+ /// The login for the organization
+ ///
+ IObservable GetAll(string org);
+
+ ///
+ /// List all users who have publicized their membership of the organization.
+ ///
+ /// http://developer.github.com/v3/orgs/members/#public-members-list
+ /// The login for the organization
+ ///
+ IObservable GetPublic(string org);
+
+ ///
+ /// Check if a user is, publicly or privately, a member of the organization.
+ ///
+ ///
+ /// See the API documentation
+ /// for more information.
+ ///
+ /// The login for the organization
+ /// The login for the user
+ ///
+ IObservable CheckMember(string org, string user);
+
+ ///
+ /// Check is a user is publicly a member of the organization.
+ ///
+ ///
+ /// See the API documentation
+ /// for more information.
+ ///
+ /// The login for the organization
+ /// The login for the user
+ ///
+ IObservable CheckMemberPublic(string org, string user);
+
+ ///
+ /// Removes a user from the organization, this will also remove them from all teams
+ /// within the organization and they will no longer have any access to the organization's
+ /// repositories.
+ ///
+ ///
+ /// See the API documentation
+ /// for more information.
+ ///
+ /// The login for the organization
+ /// The login for the user
+ ///
+ IObservable Delete(string org, string user);
+
+ ///
+ /// Make the authenticated user's organization membership public.
+ ///
+ ///
+ /// This method requires authentication.
+ /// See the API documentation
+ /// for more information.
+ ///
+ /// The login for the organization
+ /// The login for the user
+ ///
+ IObservable Publicize(string org, string user);
+
+ ///
+ /// Make the authenticated user's organization membership private.
+ ///
+ ///
+ /// This method requries authentication.
+ /// See the API documentation
+ /// for more information.
+ ///
+ /// The login for the organization
+ /// The login for the user
+ ///
+ IObservable Conceal(string org, string user);
+ }
+}
diff --git a/Octokit.Reactive/Clients/IObservableOrganizationTeamsClient.cs b/Octokit.Reactive/Clients/IObservableOrganizationTeamsClient.cs
new file mode 100644
index 00000000..a7911838
--- /dev/null
+++ b/Octokit.Reactive/Clients/IObservableOrganizationTeamsClient.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Reactive;
+
+namespace Octokit.Reactive
+{
+ ///
+ /// A client for GitHub's Org Teams API.
+ ///
+ ///
+ /// See the Orgs API documentation for more information.
+ ///
+ public interface IObservableOrganizationTeamsClient
+ {
+ ///
+ /// Returns all s for the current org.
+ ///
+ /// Thrown when a general API error occurs.
+ /// A list of the orgs's teams s.
+ IObservable GetAllTeams(string org);
+
+ ///
+ /// Returns newly created for the current org.
+ ///
+ /// Thrown when a general API error occurs.
+ /// Newly created
+ IObservable CreateTeam(string org, NewTeam team);
+
+ ///
+ /// Returns updated for the current org.
+ ///
+ /// Thrown when a general API error occurs.
+ /// Updated
+ IObservable UpdateTeam(int id, UpdateTeam team);
+
+ ///
+ /// Delete a team - must have owner permissions to this
+ ///
+ /// Thrown when a general API error occurs.
+ ///
+ IObservable DeleteTeam(int id);
+ }
+}
diff --git a/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs b/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs
index 7fb43aa4..fbe82a25 100644
--- a/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs
@@ -5,6 +5,16 @@ namespace Octokit.Reactive
{
public interface IObservableOrganizationsClient
{
+ ///
+ /// Returns a client to manage members of an organization.
+ ///
+ IObservableOrganizationMembersClient Member { get; }
+
+ ///
+ /// Returns a client to manage teams for an organization.
+ ///
+ IObservableOrganizationTeamsClient Teams { get; }
+
///
/// Returns the specified organization.
///
@@ -25,7 +35,7 @@ namespace Octokit.Reactive
///
/// Returns all the organizations for the specified user
///
- ///
+ /// The login for the user
///
IObservable GetAll(string user);
}
diff --git a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs
index 75a084fd..ac6fc2b2 100644
--- a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs
+++ b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs
@@ -33,8 +33,8 @@ namespace Octokit.Reactive
///
/// Retrieves the for the specified owner and name.
///
- /// The owner of the repository.
- /// The name of the repository.
+ /// The owner of the repository
+ /// The name of the repository
/// A
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
IObservable Get(string owner, string name);
@@ -76,16 +76,16 @@ namespace Octokit.Reactive
///
/// Returns the HTML rendered README.
///
- /// The owner of the repository.
- /// The name of the repository.
+ /// The owner of the repository
+ /// The name of the repository
///
IObservable GetReadme(string owner, string name);
///
/// Returns just the HTML portion of the README without the surrounding HTML document.
///
- /// The owner of the repository.
- /// The name of the repository.
+ /// The owner of the repository
+ /// The name of the repository
///
IObservable GetReadmeHtml(string owner, string name);
diff --git a/Octokit.Reactive/Clients/IObservableSshKeysClient.cs b/Octokit.Reactive/Clients/IObservableSshKeysClient.cs
index c12e4616..72b89ec2 100644
--- a/Octokit.Reactive/Clients/IObservableSshKeysClient.cs
+++ b/Octokit.Reactive/Clients/IObservableSshKeysClient.cs
@@ -9,7 +9,7 @@ namespace Octokit.Reactive
///
/// Retrieves the for the specified id.
///
- /// The ID of the SSH key.
+ /// The ID of the SSH key
/// A
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
IObservable Get(int id);
@@ -17,7 +17,7 @@ namespace Octokit.Reactive
///
/// Retrieves the for the specified id.
///
- /// The login of the user.
+ /// The login of the user
/// A of .
IObservable GetAll(string user);
@@ -33,7 +33,7 @@ namespace Octokit.Reactive
///
/// Update the specified .
///
- ///
+ /// The SSH Key contents
/// Thrown if the client is not authenticated.
/// A
IObservable Create(SshKeyUpdate key);
@@ -41,8 +41,8 @@ namespace Octokit.Reactive
///
/// Update the specified .
///
- ///
- ///
+ /// The ID of the SSH key
+ /// The SSH Key contents
/// Thrown if the client is not authenticated.
/// A
IObservable Update(int id, SshKeyUpdate key);
diff --git a/Octokit.Reactive/Clients/IObservableUsersClient.cs b/Octokit.Reactive/Clients/IObservableUsersClient.cs
index a671df61..ef319da0 100644
--- a/Octokit.Reactive/Clients/IObservableUsersClient.cs
+++ b/Octokit.Reactive/Clients/IObservableUsersClient.cs
@@ -23,7 +23,7 @@ namespace Octokit.Reactive
///
/// Update the specified .
///
- ///
+ /// The login for the user
/// Thrown if the client is not authenticated.
/// A
IObservable Update(UserUpdate user);
diff --git a/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs b/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs
index 253f80d9..9459be6e 100644
--- a/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs
@@ -87,7 +87,7 @@ namespace Octokit.Reactive
/// Client ID for the OAuth application that is requesting the token
/// The client secret
/// Defines the scopes and metadata for the token
- ///
+ /// The two-factor authentication code provided by the user
/// Thrown when the user does not have permission to make
/// this request. Check
/// Thrown when the two-factor code is not
diff --git a/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs b/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs
index a1d35f14..f2e669e3 100644
--- a/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs
+++ b/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs
@@ -24,7 +24,7 @@ namespace Octokit.Reactive
/// Only users with pull access can see this.
/// The owner of the repository
/// The name of the repository
- /// The reference (SHA, branch name, or tag name) to list commits for.
+ /// The reference (SHA, branch name, or tag name) to list commits for
///
public IObservable GetAll(string owner, string name, string reference)
{
@@ -36,8 +36,8 @@ namespace Octokit.Reactive
///
/// The owner of the repository
/// The name of the repository
- /// The reference (SHA, branch name, or tag name) to list commits for.
- /// The commit status to create.
+ /// The reference (SHA, branch name, or tag name) to list commits for
+ /// The commit status to create
///
public IObservable Create(string owner, string name, string reference, NewCommitStatus commitStatus)
{
diff --git a/Octokit.Reactive/Clients/ObservableCommitsClient.cs b/Octokit.Reactive/Clients/ObservableCommitsClient.cs
new file mode 100644
index 00000000..0030f83c
--- /dev/null
+++ b/Octokit.Reactive/Clients/ObservableCommitsClient.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Reactive.Threading.Tasks;
+
+namespace Octokit.Reactive
+{
+ public class ObservableCommitsClient : IObservableCommitsClient
+ {
+ readonly ICommitsClient _client;
+
+ public ObservableCommitsClient(IGitHubClient client)
+ {
+ Ensure.ArgumentNotNull(client, "client");
+ _client = client.GitDatabase.Commit;
+ }
+
+ ///
+ /// Gets a commit for a given repository by sha reference
+ ///
+ ///
+ /// http://developer.github.com/v3/git/commits/#get-a-commit
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Tha sha reference of the commit
+ ///
+ public IObservable Get(string owner, string name, string reference)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
+
+ return _client.Get(owner, name, reference).ToObservable();
+ }
+
+ ///
+ /// Create a commit for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/git/commits/#create-a-commit
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The commit to create
+ ///
+ public IObservable Create(string owner, string name, NewCommit commit)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(commit, "commit");
+
+ return _client.Create(owner, name, commit).ToObservable();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Octokit.Reactive/Clients/ObservableEventsClient.cs b/Octokit.Reactive/Clients/ObservableEventsClient.cs
index df5d8fdc..ccfb6ebb 100644
--- a/Octokit.Reactive/Clients/ObservableEventsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableEventsClient.cs
@@ -81,7 +81,7 @@ namespace Octokit.Reactive
///
/// http://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
///
- /// The name of the user
+ /// The login of the user
/// All the s that a particular user has received.
public IObservable GetUserReceived(string user)
{
@@ -96,7 +96,7 @@ namespace Octokit.Reactive
///
/// http://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received
///
- /// The name of the user
+ /// The login of the user
/// All the s that a particular user has received.
public IObservable GetUserReceivedPublic(string user)
{
@@ -111,7 +111,7 @@ namespace Octokit.Reactive
///
/// http://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
///
- /// The name of the user
+ /// The login of the user
/// All the s that a particular user has performed.
public IObservable GetUserPerformed(string user)
{
@@ -126,7 +126,7 @@ namespace Octokit.Reactive
///
/// http://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user
///
- /// The name of the user
+ /// The login of the user
/// All the public s that a particular user has performed.
public IObservable GetUserPerformedPublic(string user)
{
@@ -141,7 +141,7 @@ namespace Octokit.Reactive
///
/// http://developer.github.com/v3/activity/events/#list-events-for-an-organization
///
- /// The name of the user
+ /// The login of the user
/// The name of the organization
/// All the public s that are associated with an organization.
public IObservable GetForAnOrganization(string user, string organization)
diff --git a/Octokit.Reactive/Clients/ObservableGitDatabaseClient.cs b/Octokit.Reactive/Clients/ObservableGitDatabaseClient.cs
index 9207a75a..48a65d0a 100644
--- a/Octokit.Reactive/Clients/ObservableGitDatabaseClient.cs
+++ b/Octokit.Reactive/Clients/ObservableGitDatabaseClient.cs
@@ -5,8 +5,10 @@
public ObservableGitDatabaseClient(IGitHubClient client)
{
Tag = new ObservableTagsClient(client);
+ Commit = new ObservableCommitsClient(client);
}
public IObservableTagsClient Tag { get; set; }
+ public IObservableCommitsClient Commit { get; set; }
}
}
\ No newline at end of file
diff --git a/Octokit.Reactive/Clients/ObservableOrganizationMembersClient.cs b/Octokit.Reactive/Clients/ObservableOrganizationMembersClient.cs
new file mode 100644
index 00000000..8fc09701
--- /dev/null
+++ b/Octokit.Reactive/Clients/ObservableOrganizationMembersClient.cs
@@ -0,0 +1,159 @@
+using System;
+using System.Reactive;
+using System.Reactive.Threading.Tasks;
+using Octokit.Reactive.Internal;
+
+namespace Octokit.Reactive
+{
+ public class ObservableOrganizationMembersClient : IObservableOrganizationMembersClient
+ {
+ readonly IOrganizationMembersClient _client;
+ readonly IConnection _connection;
+
+ ///
+ /// Initializes a new Organization Members API client.
+ ///
+ /// An used to make the requests
+ public ObservableOrganizationMembersClient(IGitHubClient client)
+ {
+ Ensure.ArgumentNotNull(client, "client");
+
+ _client = client.Organization.Member;
+ _connection = client.Connection;
+ }
+
+ ///
+ ///
+ /// List all users who are members of an organization. A member is a user that
+ /// belongs to at least 1 team in the organization.
+ ///
+ ///
+ /// If the authenticated user is also an owner of this organization then both
+ /// concealed and public member will be returned.
+ ///
+ ///
+ /// If the requester is not an owner of the organization the query will be redirected
+ /// to the public members list.
+ ///
+ ///
+ ///
+ /// See the API documentation
+ /// for more information.
+ ///
+ /// The login for the organization
+ ///
+ public IObservable GetAll(string org)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(org, "org");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Members(org));
+ }
+
+ ///
+ /// List all users who have publicized their membership of the organization.
+ ///
+ /// http://developer.github.com/v3/orgs/members/#public-members-list
+ /// The login for the organization
+ ///
+ public IObservable GetPublic(string org)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(org, "org");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.PublicMembers(org));
+ }
+
+ ///
+ /// Check if a user is, publicly or privately, a member of the organization.
+ ///
+ ///
+ /// See the API documentation
+ /// for more information.
+ ///
+ /// The login for the organization
+ /// The login for the user
+ ///
+ public IObservable CheckMember(string org, string user)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(org, "org");
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+
+ return _client.CheckMember(org, user).ToObservable();
+ }
+
+ ///
+ /// Check is a user is publicly a member of the organization.
+ ///
+ ///
+ /// See the API documentation
+ /// for more information.
+ ///
+ /// The login for the organization
+ /// The login for the user
+ ///
+ public IObservable CheckMemberPublic(string org, string user)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(org, "org");
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+
+ return _client.CheckMemberPublic(org, user).ToObservable();
+ }
+
+ ///
+ /// Removes a user from the organization, this will also remove them from all teams
+ /// within the organization and they will no longer have any access to the organization's
+ /// repositories.
+ ///
+ ///
+ /// See the API documentation
+ /// for more information.
+ ///
+ /// The login for the organization
+ /// The login for the user
+ ///
+ public IObservable Delete(string org, string user)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(org, "org");
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+
+ return _client.Delete(org, user).ToObservable();
+ }
+
+ ///
+ /// Make the authenticated user's organization membership public.
+ ///
+ ///
+ /// This method requires authentication.
+ /// See the API documentation
+ /// for more information.
+ ///
+ /// The login for the organization
+ /// The login for the user
+ ///
+ public IObservable Publicize(string org, string user)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(org, "org");
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+
+ return _client.Publicize(org, user).ToObservable();
+ }
+
+ ///
+ /// Make the authenticated user's organization membership private.
+ ///
+ ///
+ /// This method requries authentication.
+ /// See the API documentation
+ /// for more information.
+ ///
+ /// The login for the organization
+ /// The login for the user
+ ///
+ public IObservable Conceal(string org, string user)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(org, "org");
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+
+ return _client.Conceal(org, user).ToObservable();
+ }
+ }
+}
diff --git a/Octokit.Reactive/Clients/ObservableOrganizationTeamsClient.cs b/Octokit.Reactive/Clients/ObservableOrganizationTeamsClient.cs
new file mode 100644
index 00000000..609375cc
--- /dev/null
+++ b/Octokit.Reactive/Clients/ObservableOrganizationTeamsClient.cs
@@ -0,0 +1,65 @@
+using System;
+using System.Reactive;
+using System.Reactive.Threading.Tasks;
+using Octokit.Reactive.Internal;
+
+namespace Octokit.Reactive
+{
+ public class ObservableOrganizationTeamsClient : IObservableOrganizationTeamsClient
+ {
+ readonly IConnection _connection;
+ readonly ITeamsClient _client;
+
+ ///
+ /// Initializes a new Organization Teams API client.
+ ///
+ /// An used to make the requests
+ public ObservableOrganizationTeamsClient(IGitHubClient client)
+ {
+ Ensure.ArgumentNotNull(client, "client");
+ _connection = client.Connection;
+ _client = client.Organization.Team;
+ }
+
+ ///
+ /// Returns all s for the current org.
+ ///
+ /// Thrown when a general API error occurs.
+ /// A list of the orgs's teams s.
+ public IObservable GetAllTeams(string org)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(org, "org");
+ return _connection.GetAndFlattenAllPages(ApiUrls.OrganizationTeams(org));
+ }
+
+ ///
+ /// Returns newly created for the current org.
+ ///
+ /// Thrown when a general API error occurs.
+ /// Newly created
+ public IObservable CreateTeam(string org, NewTeam team)
+ {
+ return _client.CreateTeam(org, team).ToObservable();
+ }
+
+ ///
+ /// Returns updated for the current org.
+ ///
+ /// Thrown when a general API error occurs.
+ /// Updated
+ public IObservable UpdateTeam(int id, UpdateTeam team)
+ {
+ return _client.UpdateTeam(id, team).ToObservable();
+ }
+
+ ///
+ /// Delete a team - must have owner permissions to this
+ ///
+ /// Thrown when a general API error occurs.
+ ///
+ public IObservable DeleteTeam(int id)
+ {
+ return _client.DeleteTeam(id).ToObservable();
+ }
+ }
+}
diff --git a/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs b/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs
index 1db9f492..1b8618f9 100644
--- a/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs
@@ -9,14 +9,36 @@ namespace Octokit.Reactive
readonly IOrganizationsClient _client;
readonly IConnection _connection;
+ ///
+ /// Initializes a new Organization API client.
+ ///
+ /// An used to make the requests
public ObservableOrganizationsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
+ Member = new ObservableOrganizationMembersClient(client);
+ Teams = new ObservableOrganizationTeamsClient(client);
+
_client = client.Organization;
_connection = client.Connection;
}
+ ///
+ /// Returns a client to manage members of an organization.
+ ///
+ public IObservableOrganizationMembersClient Member { get; private set; }
+
+ ///
+ /// Returns a client to manage teams for an organization.
+ ///
+ public IObservableOrganizationTeamsClient Teams { get; private set; }
+
+ ///
+ /// Returns the specified organization.
+ ///
+ /// The login of the specified organization,
+ ///
public IObservable Get(string org)
{
Ensure.ArgumentNotNullOrEmptyString(org, "org");
@@ -24,11 +46,20 @@ namespace Octokit.Reactive
return _client.Get(org).ToObservable();
}
+ ///
+ /// Returns all the organizations for the current user.
+ ///
+ ///
public IObservable GetAllForCurrent()
{
return _connection.GetAndFlattenAllPages(ApiUrls.Organizations());
}
+ ///
+ /// Returns all the organizations for the specified user
+ ///
+ /// The login for the user
+ ///
public IObservable GetAll(string user)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
diff --git a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs
index 05d60706..efe5bd81 100644
--- a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs
+++ b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs
@@ -64,6 +64,12 @@ namespace Octokit.Reactive
return _client.Delete(owner, name).ToObservable();
}
+ ///
+ /// Retrieves the for the specified owner and name.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// A
public IObservable Get(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -72,11 +78,26 @@ namespace Octokit.Reactive
return _client.Get(owner, name).ToObservable();
}
+ ///
+ /// Retrieves every that belongs to the current user.
+ ///
+ ///
+ /// The default page size on GitHub.com is 30.
+ ///
+ /// Thrown if the client is not authenticated.
+ /// A of .
public IObservable GetAllForCurrent()
{
return _connection.GetAndFlattenAllPages(ApiUrls.Repositories());
}
+ ///
+ /// Retrieves every that belongs to the specified user.
+ ///
+ ///
+ /// The default page size on GitHub.com is 30.
+ ///
+ /// A of .
public IObservable GetAllForUser(string login)
{
Ensure.ArgumentNotNullOrEmptyString(login, "login");
@@ -84,6 +105,13 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages(ApiUrls.Repositories(login));
}
+ ///
+ /// Retrieves every that belongs to the specified organization.
+ ///
+ ///
+ /// The default page size on GitHub.com is 30.
+ ///
+ /// A of .
public IObservable GetAllForOrg(string organization)
{
Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
@@ -91,6 +119,12 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages(ApiUrls.OrganizationRepositories(organization));
}
+ ///
+ /// Returns the HTML rendered README.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ ///
public IObservable GetReadme(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -99,6 +133,12 @@ namespace Octokit.Reactive
return _client.GetReadme(owner, name).ToObservable();
}
+ ///
+ /// Returns just the HTML portion of the README without the surrounding HTML document.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ ///
public IObservable GetReadmeHtml(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -107,6 +147,14 @@ namespace Octokit.Reactive
return _client.GetReadmeHtml(owner, name).ToObservable();
}
+ ///
+ /// A client for GitHub's Commit Status API.
+ ///
+ ///
+ /// See the Commit Status API documentation for more
+ /// details. Also check out the blog post
+ /// that announced this feature.
+ ///
public IObservableCommitStatusClient CommitStatus { get; private set; }
}
}
diff --git a/Octokit.Reactive/Clients/ObservableSshKeysClient.cs b/Octokit.Reactive/Clients/ObservableSshKeysClient.cs
index f94c6612..2d09d92c 100644
--- a/Octokit.Reactive/Clients/ObservableSshKeysClient.cs
+++ b/Octokit.Reactive/Clients/ObservableSshKeysClient.cs
@@ -8,8 +8,12 @@ namespace Octokit.Reactive
public class ObservableSshKeysClient : IObservableSshKeysClient
{
readonly ISshKeysClient _client;
- readonly IConnection _connection;
+ readonly IConnection _connection;
+ ///
+ /// Initializes a new SSH Key API client.
+ ///
+ /// An used to make the requests
public ObservableSshKeysClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
@@ -18,11 +22,21 @@ namespace Octokit.Reactive
_connection = client.Connection;
}
+ ///
+ /// Retrieves the for the specified id.
+ ///
+ /// The ID of the SSH key
+ /// A
public IObservable Get(int id)
{
return _client.Get(id).ToObservable();
}
+ ///
+ /// Retrieves the for the specified id.
+ ///
+ /// The login of the user
+ /// A of .
public IObservable GetAll(string user)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
@@ -30,11 +44,22 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages(ApiUrls.SshKeys(user));
}
+ ///
+ /// Retrieves the for the specified id.
+ ///
+ /// Thrown if the client is not authenticated.
+ /// A of .
public IObservable GetAllForCurrent()
{
return _connection.GetAndFlattenAllPages(ApiUrls.SshKeys());
}
+ ///
+ /// Update the specified .
+ ///
+ /// The SSH Key contents
+ /// Thrown if the client is not authenticated.
+ /// A
public IObservable Create(SshKeyUpdate key)
{
Ensure.ArgumentNotNull(key, "key");
@@ -42,6 +67,13 @@ namespace Octokit.Reactive
return _client.Create(key).ToObservable();
}
+ ///
+ /// Update the specified .
+ ///
+ /// The ID of the SSH key
+ /// The SSH Key contents
+ /// Thrown if the client is not authenticated.
+ /// A
public IObservable Update(int id, SshKeyUpdate key)
{
Ensure.ArgumentNotNull(key, "key");
@@ -49,6 +81,12 @@ namespace Octokit.Reactive
return _client.Update(id, key).ToObservable();
}
+ ///
+ /// Update the specified .
+ ///
+ /// The id of the SSH key
+ /// Thrown if the client is not authenticated.
+ /// A
public IObservable Delete(int id)
{
return _client.Delete(id).ToObservable();
diff --git a/Octokit.Reactive/Clients/ObservableTagsClient.cs b/Octokit.Reactive/Clients/ObservableTagsClient.cs
index d54897c6..29cede9f 100644
--- a/Octokit.Reactive/Clients/ObservableTagsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableTagsClient.cs
@@ -14,6 +14,16 @@ namespace Octokit.Reactive
_client = client.GitDatabase.Tag;
}
+ ///
+ /// Gets a tag for a given repository by sha reference
+ ///
+ ///
+ /// http://developer.github.com/v3/git/tags/#get-a-tag
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Tha sha reference of the tag
+ ///
public IObservable Get(string owner, string name, string reference)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -23,6 +33,16 @@ namespace Octokit.Reactive
return _client.Get(owner, name, reference).ToObservable();
}
+ ///
+ /// Create a tag for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/git/tags/#create-a-tag-object
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The tag to create
+ ///
public IObservable Create(string owner, string name, NewTag tag)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
diff --git a/Octokit.Reactive/Clients/ObservableUsersClient.cs b/Octokit.Reactive/Clients/ObservableUsersClient.cs
index 81521992..5588e737 100644
--- a/Octokit.Reactive/Clients/ObservableUsersClient.cs
+++ b/Octokit.Reactive/Clients/ObservableUsersClient.cs
@@ -17,6 +17,10 @@ namespace Octokit.Reactive
_connection = client.Connection;
}
+ ///
+ /// Returns the user specified by the login.
+ ///
+ /// The login name for the user
public IObservable Get(string login)
{
Ensure.ArgumentNotNull(login, "login");
@@ -24,11 +28,22 @@ namespace Octokit.Reactive
return _client.Get(login).ToObservable();
}
+ ///
+ /// Returns a for the current authenticated user.
+ ///
+ /// Thrown if the client is not authenticated.
+ /// A
public IObservable Current()
{
return _client.Current().ToObservable();
}
+ ///
+ /// Update the specified .
+ ///
+ /// The login for the user
+ /// Thrown if the client is not authenticated.
+ /// A
public IObservable Update(UserUpdate user)
{
Ensure.ArgumentNotNull(user, "user");
@@ -36,6 +51,10 @@ namespace Octokit.Reactive
return _client.Update(user).ToObservable();
}
+ ///
+ /// Returns emails for the current user.
+ ///
+ ///
public IObservable GetEmails()
{
return _connection.GetAndFlattenAllPages(ApiUrls.Emails());
diff --git a/Octokit.Reactive/Octokit.Reactive.csproj b/Octokit.Reactive/Octokit.Reactive.csproj
index 51c48ab7..6b828e91 100644
--- a/Octokit.Reactive/Octokit.Reactive.csproj
+++ b/Octokit.Reactive/Octokit.Reactive.csproj
@@ -74,9 +74,14 @@
Properties\SolutionInfo.cs
+
+
+
+
+
@@ -94,6 +99,7 @@
+
diff --git a/Octokit.Tests.Integration/CommitsClientTests.cs b/Octokit.Tests.Integration/CommitsClientTests.cs
new file mode 100644
index 00000000..9e89a608
--- /dev/null
+++ b/Octokit.Tests.Integration/CommitsClientTests.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Linq;
+using System.Net.Http.Headers;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Octokit.Tests.Integration
+{
+ public class CommitsClientTests : IDisposable
+ {
+ readonly IGitHubClient _gitHubClient;
+ readonly Repository _repository;
+ readonly ICommitsClient _commitsClient;
+
+ public CommitsClientTests()
+ {
+ this._gitHubClient = new GitHubClient(new ProductHeaderValue("OctokitTests"))
+ {
+ Credentials = Helper.Credentials
+ };
+
+ var repoName = Helper.MakeNameWithTimestamp("public-repo");
+ this._commitsClient = this._gitHubClient.GitDatabase.Commit;
+ this._repository = this._gitHubClient.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
+ }
+
+ [IntegrationTest(Skip = "Requires Tree Api implementation to create a commit")]
+ public async Task CanCreateAndRetrieveCommit()
+ {
+ string owner = this._repository.Owner.Login;
+
+ var author = new Signature { Name = "author", Email = "test-author@example.com", Date = DateTime.UtcNow };
+ var commiter = new Signature { Name = "commiter", Email = "test-commiter@example.com", Date = DateTime.Today };
+
+ var newCommit = new NewCommit("test-commit", "[Change this to tree sha]", Enumerable.Empty())
+ {
+ Author = author,
+ Committer = commiter
+ };
+
+ var commit = await this._commitsClient.Create(owner, this._repository.Name, newCommit);
+
+ Assert.NotNull(commit);
+ var retrieved = await this._commitsClient.Get(owner, this._repository.Name, commit.Sha);
+ Assert.NotNull(retrieved);
+ }
+
+
+ public void Dispose()
+ {
+ Helper.DeleteRepo(this._repository);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
index 4f11acc3..205f8a4e 100644
--- a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
+++ b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
@@ -58,6 +58,7 @@
+
diff --git a/Octokit.Tests.Integration/ReleasesClientTests.cs b/Octokit.Tests.Integration/ReleasesClientTests.cs
index d0a0b38b..ebe9c8a8 100644
--- a/Octokit.Tests.Integration/ReleasesClientTests.cs
+++ b/Octokit.Tests.Integration/ReleasesClientTests.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System;
+using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Xunit;
@@ -7,21 +8,54 @@ namespace Octokit.Tests.Integration
{
public class ReleasesClientTests
{
- public class TheGetReleasesMethod
+ public class TheGetReleasesMethod : IDisposable
{
- [IntegrationTest]
- public async Task ReturnsReleases()
+ readonly IReleasesClient _releaseClient;
+ readonly Repository _repository;
+ readonly string _repositoryOwner;
+ readonly string _repositoryName;
+ readonly GitHubClient _github;
+
+ public TheGetReleasesMethod()
{
- var github = new GitHubClient(new ProductHeaderValue("OctokitTests"))
+ _github = new GitHubClient(new ProductHeaderValue("OctokitTests"))
{
Credentials = Helper.Credentials
};
+ _releaseClient = _github.Release;
- var releases = await github.Release.GetAll("git-tfs", "git-tfs");
+ var repoName = Helper.MakeNameWithTimestamp("public-repo");
+ _repository = _github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
+ _repositoryOwner = _repository.Owner.Login;
+ _repositoryName = _repository.Name;
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsReleases()
+ {
+ var releases = await _releaseClient.GetAll("git-tfs", "git-tfs");
Assert.True(releases.Count > 5);
Assert.True(releases.Any(release => release.TagName == "v0.18.0"));
}
+
+ [IntegrationTest]
+ public async Task ReturnsReleasesWithNullPublishDate()
+ {
+ // create a release without a publish date
+ var releaseWithNoUpdate = new ReleaseUpdate("0.1") { Draft = true };
+ var release = _releaseClient.CreateRelease(_repositoryOwner, _repositoryName, releaseWithNoUpdate).Result;
+
+ var releases = await _releaseClient.GetAll(_repositoryOwner, _repositoryName);
+
+ Assert.True(releases.Count == 1);
+ Assert.False(releases.First().PublishedAt.HasValue);
+ }
+
+ public void Dispose()
+ {
+ Helper.DeleteRepo(_repository);
+ }
}
}
}
diff --git a/Octokit.Tests/Clients/CommitsClientTests.cs b/Octokit.Tests/Clients/CommitsClientTests.cs
new file mode 100644
index 00000000..c36cb9a4
--- /dev/null
+++ b/Octokit.Tests/Clients/CommitsClientTests.cs
@@ -0,0 +1,78 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using NSubstitute;
+using Octokit;
+using Octokit.Tests.Helpers;
+using Xunit;
+
+public class CommitsClientTests
+{
+ public class TheGetMethod
+ {
+ [Fact]
+ public async void EnsuresNonNullArguments()
+ {
+ var client = new CommitsClient(Substitute.For());
+
+ await AssertEx.Throws(async () => await client.Get(null, "name", "reference"));
+ await AssertEx.Throws(async () => await client.Get("owner", null, "reference"));
+ await AssertEx.Throws(async () => await client.Get("owner", "name", null));
+ await AssertEx.Throws(async () => await client.Get("", "name", "reference"));
+ await AssertEx.Throws(async () => await client.Get("owner", "", "reference"));
+ await AssertEx.Throws(async () => await client.Get("owner", "name", ""));
+ }
+
+ [Fact]
+ public void RequestsCorrectUrl()
+ {
+ var connection = Substitute.For();
+ var client = new CommitsClient(connection);
+
+ client.Get("owner", "repo", "reference");
+
+ connection.Received().Get(Arg.Is(u => u.ToString() == "repos/owner/repo/git/commits/reference"), null);
+ }
+ }
+
+ public class TheCreateMethod
+ {
+ [Fact]
+ public void PostsToTheCorrectUrl()
+ {
+ var connection = Substitute.For();
+ var client = new CommitsClient(connection);
+
+ var parents = new List { "sha-reference1", "sha-reference2" };
+ var newCommit = new NewCommit("message", "tree", parents);
+ client.Create("owner", "repo", newCommit);
+
+ connection.Received().Post(Arg.Is(u => u.ToString() == "repos/owner/repo/git/commits"),
+ Arg.Is(nc => nc.Message == "message"
+ && nc.Tree == "tree"
+ && nc.Parents.Count() == 2));
+ }
+
+ [Fact]
+ public async void EnsuresNonNullArguments()
+ {
+ var client = new CommitsClient(Substitute.For());
+
+ var newCommit = new NewCommit("message", "tree", new[]{"parent1", "parent2"});
+ await AssertEx.Throws(async () => await client.Create(null, "name", newCommit));
+ await AssertEx.Throws(async () => await client.Create("owner", null, newCommit));
+ await AssertEx.Throws(async () => await client.Create("owner", "name", null));
+ await AssertEx.Throws(async () => await client.Create("", "name", newCommit));
+ await AssertEx.Throws(async () => await client.Create("owner", "", newCommit));
+ }
+ }
+
+ public class TheCtor
+ {
+ [Fact]
+ public void EnsuresArgument()
+ {
+ Assert.Throws(() => new CommitsClient(null));
+ }
+ }
+}
\ No newline at end of file
diff --git a/Octokit.Tests/Clients/GitDatabaseClientTests.cs b/Octokit.Tests/Clients/GitDatabaseClientTests.cs
index e43362f3..93ee03bb 100644
--- a/Octokit.Tests/Clients/GitDatabaseClientTests.cs
+++ b/Octokit.Tests/Clients/GitDatabaseClientTests.cs
@@ -14,11 +14,19 @@ public class GitDatabaseClientTests
}
[Fact]
- public void SetChildsClients()
+ public void SetTagsClient()
{
var apiConnection = Substitute.For();
var gitDatabaseClient = new GitDatabaseClient(apiConnection);
Assert.NotNull(gitDatabaseClient.Tag);
}
+
+ [Fact]
+ public void SetCommitsClient()
+ {
+ var apiConnection = Substitute.For();
+ var gitDatabaseClient = new GitDatabaseClient(apiConnection);
+ Assert.NotNull(gitDatabaseClient.Commit);
+ }
}
}
\ No newline at end of file
diff --git a/Octokit.Tests/Clients/IssuesClientTests.cs b/Octokit.Tests/Clients/IssuesClientTests.cs
index e79bde95..da402574 100644
--- a/Octokit.Tests/Clients/IssuesClientTests.cs
+++ b/Octokit.Tests/Clients/IssuesClientTests.cs
@@ -191,15 +191,15 @@ namespace Octokit.Tests.Clients
var client = new IssuesClient(connection);
AssertEx.Throws(async () => await
- client.Create(null, "name", new NewIssue("title")));
- AssertEx.Throws(async () => await
- client.Create("", "name", new NewIssue("x")));
+ client.Update(null, "name", 1, new IssueUpdate()));
AssertEx.Throws(async () => await
- client.Create("owner", null, new NewIssue("x")));
- AssertEx.Throws(async () => await
- client.Create("owner", "", new NewIssue("x")));
+ client.Update("", "name", 1, new IssueUpdate()));
AssertEx.Throws(async () => await
- client.Create("owner", "name", null));
+ client.Update("owner", null, 1, new IssueUpdate()));
+ AssertEx.Throws(async () => await
+ client.Update("owner", "", 1, new IssueUpdate()));
+ AssertEx.Throws(async () => await
+ client.Update("owner", "name", 1, null));
}
}
diff --git a/Octokit.Tests/Clients/StarredClientTests.cs b/Octokit.Tests/Clients/StarredClientTests.cs
new file mode 100644
index 00000000..7203f2fc
--- /dev/null
+++ b/Octokit.Tests/Clients/StarredClientTests.cs
@@ -0,0 +1,129 @@
+using Octokit.Internal;
+using System;
+using System.Net;
+using System.Threading.Tasks;
+using NSubstitute;
+using Xunit;
+using Xunit.Extensions;
+
+namespace Octokit.Tests.Clients
+{
+ public class StarredClientTests
+ {
+ public class TheGetAllForCurrentMethod
+ {
+ [Fact]
+ public void RequestsCorrectUrl()
+ {
+ var endpoint = new Uri("user/starred", UriKind.Relative);
+ var connection = Substitute.For();
+ var client = new StarredClient(connection);
+
+ client.GetAllForCurrent();
+
+ connection.Received().GetAll(endpoint);
+ }
+ }
+
+ public class TheGetAllForUserMethod
+ {
+ [Fact]
+ public void RequestsCorrectUrl()
+ {
+ var endpoint = new Uri("users/banana/starred", UriKind.Relative);
+ var connection = Substitute.For();
+ var client = new StarredClient(connection);
+
+ client.GetAllForUser("banana");
+
+ connection.Received().GetAll(endpoint);
+ }
+ }
+
+ public class TheGetAllStargazersForRepoMethod
+ {
+ [Fact]
+ public void RequestsCorrectUrl()
+ {
+ var endpoint = new Uri("repos/fight/club/stargazers", UriKind.Relative);
+ var connection = Substitute.For();
+ var client = new StarredClient(connection);
+
+ client.GetAllStargazers("fight", "club");
+
+ connection.Received().GetAll(endpoint);
+ }
+ }
+
+ public class TheCheckStarredMethod
+ {
+ [Theory]
+ [InlineData(HttpStatusCode.NoContent, true)]
+ [InlineData(HttpStatusCode.NotFound, false)]
+ public async Task ReturnsCorrectResultBasedOnStatus(HttpStatusCode status, bool expected)
+ {
+ var response = Task.Factory.StartNew>(() =>
+ new ApiResponse
diff --git a/Octokit.Tests/Octokit.Tests.csproj b/Octokit.Tests/Octokit.Tests.csproj
index 6e640003..a0c528aa 100644
--- a/Octokit.Tests/Octokit.Tests.csproj
+++ b/Octokit.Tests/Octokit.Tests.csproj
@@ -65,7 +65,9 @@
+
+
@@ -73,6 +75,7 @@
+
@@ -104,6 +107,7 @@
+
@@ -114,10 +118,12 @@
+
+
diff --git a/Octokit.Tests/Reactive/ObservableCommitsClientTests.cs b/Octokit.Tests/Reactive/ObservableCommitsClientTests.cs
new file mode 100644
index 00000000..f247ef31
--- /dev/null
+++ b/Octokit.Tests/Reactive/ObservableCommitsClientTests.cs
@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.Reactive.Linq;
+using System.Threading.Tasks;
+using NSubstitute;
+using Octokit.Reactive;
+using Octokit.Tests.Helpers;
+using Xunit;
+
+namespace Octokit.Tests.Reactive
+{
+ public class ObservableCommitsClientTests
+ {
+ public class TheCtorMethod
+ {
+ [Fact]
+ public void EnsuresArgumentIsNotNulll()
+ {
+ Assert.Throws(() => new ObservableCommitsClient(null));
+ }
+ }
+
+ public class TheGetMethod
+ {
+ [Fact]
+ public async Task EnsureNonNullArguments()
+ {
+ var client = new ObservableCommitsClient(Substitute.For());
+
+ await AssertEx.Throws(async () => await client.Get(null, "name", ""));
+ await AssertEx.Throws(async () => await client.Get("owner", null, ""));
+ await AssertEx.Throws(async () => await client.Get("owner", "name", null));
+ await AssertEx.Throws(async () => await client.Get("", "name", "reference"));
+ await AssertEx.Throws(async () => await client.Get("owner", "", "reference"));
+ await AssertEx.Throws(async () => await client.Get("owner", "name", ""));
+ }
+
+ [Fact]
+ public async Task RequestsCorrectUrl()
+ {
+ var gitHubClient = Substitute.For();
+ var client = new ObservableCommitsClient(gitHubClient);
+
+ client.Get("owner", "name", "reference");
+
+ gitHubClient.Connection.GetAsync>(
+ new Uri("repos/owner/name/commits/reference", UriKind.Relative), null, null);
+ }
+ }
+
+ public class TheCreateMethod
+ {
+ [Fact]
+ public async Task EnsureNonNullArguments()
+ {
+ var client = new ObservableCommitsClient(Substitute.For());
+ var newCommit = new NewCommit("message", "tree", new[] { "parent1", "parent2" });
+
+ await AssertEx.Throws(async () => await client.Create(null, "name", newCommit));
+ await AssertEx.Throws(async () => await client.Create("owner", null, newCommit));
+ await AssertEx.Throws(async () => await client.Create("owner", "name", null));
+ await AssertEx.Throws(async () => await client.Create("", "name", newCommit));
+ await AssertEx.Throws(async () => await client.Create("owner", "", newCommit));
+ }
+
+ [Fact]
+ public async Task RequestsCorrectUrl()
+ {
+ var gitHubClient = Substitute.For();
+ var client = new ObservableCommitsClient(gitHubClient);
+ var newCommit = new NewCommit("message", "tree", new[] { "parent1", "parent2" });
+
+ client.Create("owner", "name", newCommit);
+
+ gitHubClient.GitDatabase.Commit.Received().Create("owner", "name", newCommit);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Octokit.Tests/Reactive/ObservableOrganizationMembersClientTests.cs b/Octokit.Tests/Reactive/ObservableOrganizationMembersClientTests.cs
new file mode 100644
index 00000000..9b27ea7f
--- /dev/null
+++ b/Octokit.Tests/Reactive/ObservableOrganizationMembersClientTests.cs
@@ -0,0 +1,189 @@
+using NSubstitute;
+using Octokit;
+using Octokit.Internal;
+using Octokit.Reactive;
+using Octokit.Tests.Helpers;
+using System;
+using System.Collections.Generic;
+using System.Reactive.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Octokit.Tests.Reactive
+{
+ public class ObservableOrganizationMembersClientTests
+ {
+ public class TheGetAllMethod
+ {
+ [Fact]
+ public void RequestsCorrectUrl()
+ {
+ var gitHubClient = Substitute.For();
+ var client = new ObservableOrganizationMembersClient(gitHubClient);
+
+ client.GetAll("org");
+
+ gitHubClient.Connection.GetAsync>(
+ new Uri("orgs/org/members", UriKind.Relative), null, null);
+ }
+
+ [Fact]
+ public async Task EnsuresNonNullArguments()
+ {
+ var client = new ObservableOrganizationMembersClient(Substitute.For());
+
+ await AssertEx.Throws(async () => await client.GetAll(null));
+ await AssertEx.Throws(async () => await client.GetAll(""));
+ }
+ }
+
+ public class TheGetPublicMethod
+ {
+ [Fact]
+ public void RequestsTheCorrectUrl()
+ {
+ var gitHubClient = Substitute.For();
+ var client = new ObservableOrganizationMembersClient(gitHubClient);
+
+ client.GetPublic("org");
+
+ gitHubClient.Connection.GetAsync>(
+ new Uri("orgs/org/public_members", UriKind.Relative), null, null);
+ }
+
+ [Fact]
+ public async Task EnsuresNonNullArguments()
+ {
+ var client = new ObservableOrganizationMembersClient(Substitute.For());
+
+ await AssertEx.Throws(async () => await client.GetPublic(null));
+ await AssertEx.Throws(async () => await client.GetPublic(""));
+ }
+ }
+
+ public class TheCheckMemberMethod
+ {
+ [Fact]
+ public void ChecksMemberFromClientOrganizationMember()
+ {
+ var gitHubClient = Substitute.For();
+ var client = new ObservableOrganizationMembersClient(gitHubClient);
+
+ client.CheckMember("org", "user");
+
+ gitHubClient.Organization.Member.Received().CheckMember("org", "user");
+ }
+
+ [Fact]
+ public async Task EnsuresNonNullArguments()
+ {
+ var client = new ObservableOrganizationMembersClient(Substitute.For());
+
+ await AssertEx.Throws(async () => await client.CheckMember(null, "username"));
+ await AssertEx.Throws(async () => await client.CheckMember("", "username"));
+ await AssertEx.Throws(async () => await client.CheckMember("org", null));
+ await AssertEx.Throws(async () => await client.CheckMember("org", ""));
+ }
+ }
+
+ public class TheCheckMemberPublicMethod
+ {
+ [Fact]
+ public void ChecksMemberPublicFromClientOrganizationMember()
+ {
+ var gitHubClient = Substitute.For();
+ var client = new ObservableOrganizationMembersClient(gitHubClient);
+
+ client.CheckMemberPublic("org", "user");
+
+ gitHubClient.Organization.Member.Received().CheckMemberPublic("org", "user");
+ }
+
+ [Fact]
+ public async Task EnsuresNonNullArguments()
+ {
+ var client = new ObservableOrganizationMembersClient(Substitute.For());
+
+ await AssertEx.Throws(async () => await client.CheckMemberPublic(null, "username"));
+ await AssertEx.Throws(async () => await client.CheckMemberPublic("", "username"));
+ await AssertEx.Throws(async () => await client.CheckMemberPublic("org", null));
+ await AssertEx.Throws(async () => await client.CheckMemberPublic("org", ""));
+ }
+ }
+
+ public class TheDeleteMethod
+ {
+ [Fact]
+ public void DeletesFromClientOrganizationMember()
+ {
+ var gitHubClient = Substitute.For();
+ var client = new ObservableOrganizationMembersClient(gitHubClient);
+
+ client.Delete("org", "user");
+
+ gitHubClient.Organization.Member.Received().Delete("org", "user");
+ }
+
+ [Fact]
+ public async Task EnsuresNonNullArguments()
+ {
+ var client = new ObservableOrganizationMembersClient(Substitute.For());
+
+ await AssertEx.Throws(async () => await client.Delete(null, "username"));
+ await AssertEx.Throws(async () => await client.Delete("", "username"));
+ await AssertEx.Throws(async () => await client.Delete("org", null));
+ await AssertEx.Throws(async () => await client.Delete("org", ""));
+ }
+ }
+
+ public class ThePublicizeMethod
+ {
+ [Fact]
+ public void PublicizeFromClientOrganizationMember()
+ {
+ var gitHubClient = Substitute.For();
+ var client = new ObservableOrganizationMembersClient(gitHubClient);
+
+ client.Publicize("org", "user");
+
+ gitHubClient.Organization.Member.Received().Publicize("org", "user");
+ }
+
+ [Fact]
+ public async Task EnsuresNonNullArguments()
+ {
+ var client = new ObservableOrganizationMembersClient(Substitute.For());
+
+ await AssertEx.Throws(async () => await client.Publicize(null, "username"));
+ await AssertEx.Throws(async () => await client.Publicize("", "username"));
+ await AssertEx.Throws(async () => await client.Publicize("org", null));
+ await AssertEx.Throws(async () => await client.Publicize("org", ""));
+ }
+ }
+
+ public class TheConcealMethod
+ {
+ [Fact]
+ public void ConcealFromClientOrganizationMember()
+ {
+ var gitHubClient = Substitute.For();
+ var client = new ObservableOrganizationMembersClient(gitHubClient);
+
+ client.Conceal("org", "user");
+
+ gitHubClient.Organization.Member.Received().Conceal("org", "user");
+ }
+
+ [Fact]
+ public async Task EnsuresNonNullArguments()
+ {
+ var client = new ObservableOrganizationMembersClient(Substitute.For());
+
+ await AssertEx.Throws(async () => await client.Conceal(null, "username"));
+ await AssertEx.Throws(async () => await client.Conceal("", "username"));
+ await AssertEx.Throws(async () => await client.Conceal("org", null));
+ await AssertEx.Throws(async () => await client.Conceal("org", ""));
+ }
+ }
+ }
+}
diff --git a/Octokit.Tests/SimpleJsonSerializerTests.cs b/Octokit.Tests/SimpleJsonSerializerTests.cs
index e8aa392d..0a69254c 100644
--- a/Octokit.Tests/SimpleJsonSerializerTests.cs
+++ b/Octokit.Tests/SimpleJsonSerializerTests.cs
@@ -79,6 +79,18 @@ namespace Octokit.Tests
Assert.True(sample.IsSomething);
Assert.True(sample.Private);
}
+
+ [Fact]
+ public void DeserializesInheritedProperties()
+ {
+ const string json = "{\"sha\":\"commit-sha\",\"url\":\"commit-url\",\"message\":\"commit-message\"}";
+
+ var result = new SimpleJsonSerializer().Deserialize(json);
+
+ Assert.Equal("commit-sha", result.Sha);
+ Assert.Equal("commit-url", result.Url);
+ Assert.Equal("commit-message", result.Message);
+ }
}
public class Sample
diff --git a/Octokit/Clients/ActivitiesClient.cs b/Octokit/Clients/ActivitiesClient.cs
index ade4ac5d..bf07a291 100644
--- a/Octokit/Clients/ActivitiesClient.cs
+++ b/Octokit/Clients/ActivitiesClient.cs
@@ -6,8 +6,10 @@
: base(apiConnection)
{
Events = new EventsClient(apiConnection);
+ Starring = new StarredClient(apiConnection);
}
public IEventsClient Events { get; private set; }
+ public IStarredClient Starring { get; private set; }
}
}
diff --git a/Octokit/Clients/ApiClient.cs b/Octokit/Clients/ApiClient.cs
index 49a5d417..1358c10f 100644
--- a/Octokit/Clients/ApiClient.cs
+++ b/Octokit/Clients/ApiClient.cs
@@ -8,7 +8,7 @@
///
/// Initializes a new API client.
///
- /// The client's connection.
+ /// The client's connection
protected ApiClient(IApiConnection apiConnection)
{
Ensure.ArgumentNotNull(apiConnection, "apiConnection");
diff --git a/Octokit/Clients/AuthorizationsClient.cs b/Octokit/Clients/AuthorizationsClient.cs
index eb80c64d..a991f253 100644
--- a/Octokit/Clients/AuthorizationsClient.cs
+++ b/Octokit/Clients/AuthorizationsClient.cs
@@ -17,7 +17,7 @@ namespace Octokit
///
/// Initializes a new GitHub OAuth API client.
///
- /// An API connection.
+ /// An API connection
public AuthorizationsClient(IApiConnection apiConnection) : base(apiConnection)
{
}
@@ -46,7 +46,7 @@ namespace Octokit
/// This method requires authentication.
/// See the API documentation for more information.
///
- /// The ID of the to get.
+ /// The ID of the to get
///
/// Thrown when the current user does not have permission to make this request.
///
@@ -66,9 +66,9 @@ namespace Octokit
/// This method requires authentication.
/// See the API documentation for more information.
///
- /// Client ID of the OAuth application for the token.
- /// The client secret.
- /// Describes the new authorization to create.
+ /// Client ID of the OAuth application for the token
+ /// The client secret
+ /// Describes the new authorization to create
///
/// Thrown when the current user does not have permission to make this request.
///
@@ -106,10 +106,10 @@ namespace Octokit
/// This method requires authentication.
/// See the API documentation for more information.
///
- /// Client ID of the OAuth application for the token.
- /// The client secret.
- /// Describes the new authorization to create.
- /// The two-factor authentication code in response to the current user's previous challenge.
+ /// Client ID of the OAuth application for the token
+ /// The client secret
+ /// Describes the new authorization to create
+ /// The two-factor authentication code in response to the current user's previous challenge
///
/// Thrown when the current user does not have permission to make this request.
///
@@ -159,8 +159,8 @@ namespace Octokit
/// See the API
/// documentation for more details.
///
- /// ID of the to update.
- /// Describes the changes to make to the authorization.
+ /// ID of the to update
+ /// Describes the changes to make to the authorization
///
/// Thrown when the current user does not have permission to make the request.
///
@@ -202,7 +202,7 @@ namespace Octokit
/// See the API
/// documentation for more details.
///
- /// The system-wide ID of the authorization to delete.
+ /// The system-wide ID of the authorization to delete
///
/// Thrown when the current user does not have permission to make the request.
///
diff --git a/Octokit/Clients/CommitStatusClient.cs b/Octokit/Clients/CommitStatusClient.cs
index d743c237..322139a9 100644
--- a/Octokit/Clients/CommitStatusClient.cs
+++ b/Octokit/Clients/CommitStatusClient.cs
@@ -16,7 +16,7 @@ namespace Octokit
///
/// Initializes a new Commit Status API client.
///
- /// An API connection.
+ /// An API connection
public CommitStatusClient(IApiConnection apiConnection) : base(apiConnection)
{
}
@@ -28,7 +28,7 @@ namespace Octokit
/// Only users with pull access can see this.
/// The owner of the repository
/// The name of the repository
- /// The reference (SHA, branch name, or tag name) to list commits for.
+ /// The reference (SHA, branch name, or tag name) to list commits for
///
public Task> GetAll(string owner, string name, string reference)
{
@@ -44,8 +44,8 @@ namespace Octokit
///
/// The owner of the repository
/// The name of the repository
- /// The reference (SHA, branch name, or tag name) to list commits for.
- /// The commit status to create.
+ /// The reference (SHA, branch name, or tag name) to list commits for
+ /// The commit status to create
///
public Task Create(string owner, string name, string reference, NewCommitStatus commitStatus)
{
diff --git a/Octokit/Clients/CommitsClient.cs b/Octokit/Clients/CommitsClient.cs
new file mode 100644
index 00000000..095b4bc6
--- /dev/null
+++ b/Octokit/Clients/CommitsClient.cs
@@ -0,0 +1,50 @@
+using System.Threading.Tasks;
+
+namespace Octokit
+{
+ public class CommitsClient : ApiClient, ICommitsClient
+ {
+ public CommitsClient(IApiConnection apiConnection) :
+ base(apiConnection)
+ {
+ }
+
+ ///
+ /// Gets a commit for a given repository by sha reference
+ ///
+ ///
+ /// http://developer.github.com/v3/git/commits/#get-a-commit
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Tha sha reference of the commit
+ ///
+ public Task Get(string owner, string name, string reference)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
+
+ return ApiConnection.Get(ApiUrls.Commit(owner, name, reference));
+ }
+
+ ///
+ /// Create a commit for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/git/commits/#create-a-commit
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The commit to create
+ ///
+ public Task Create(string owner, string name, NewCommit commit)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(commit, "commit");
+
+ return ApiConnection.Post(ApiUrls.CreateCommit(owner, name), commit);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Octokit/Clients/EventsClient.cs b/Octokit/Clients/EventsClient.cs
index 45a21471..f21ed214 100644
--- a/Octokit/Clients/EventsClient.cs
+++ b/Octokit/Clients/EventsClient.cs
@@ -77,7 +77,7 @@ namespace Octokit
///
/// http://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
///
- /// The name of the user
+ /// The login of the user
/// All the s that a particular user has received.
public Task> GetUserReceived(string user)
{
@@ -92,7 +92,7 @@ namespace Octokit
///
/// http://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received
///
- /// The name of the user
+ /// The login of the user
/// All the s that a particular user has received.
public Task> GetUserReceivedPublic(string user)
{
@@ -107,7 +107,7 @@ namespace Octokit
///
/// http://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
///
- /// The name of the user
+ /// The login of the user
/// All the s that a particular user has performed.
public Task> GetUserPerformed(string user)
{
@@ -122,7 +122,7 @@ namespace Octokit
///
/// http://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user
///
- /// The name of the user
+ /// The login of the user
/// All the public s that a particular user has performed.
public Task> GetUserPerformedPublic(string user)
{
@@ -137,7 +137,7 @@ namespace Octokit
///
/// http://developer.github.com/v3/activity/events/#list-events-for-an-organization
///
- /// The name of the user
+ /// The login of the user
/// The name of the organization
/// All the public s that are associated with an organization.
public Task> GetForAnOrganization(string user, string organization)
diff --git a/Octokit/Clients/GitDatabaseClient.cs b/Octokit/Clients/GitDatabaseClient.cs
index 0e97a0de..908f1ca0 100644
--- a/Octokit/Clients/GitDatabaseClient.cs
+++ b/Octokit/Clients/GitDatabaseClient.cs
@@ -6,8 +6,10 @@
: base(apiConnection)
{
Tag = new TagsClient(apiConnection);
+ Commit = new CommitsClient(apiConnection);
}
public ITagsClient Tag { get; set; }
+ public ICommitsClient Commit { get; set; }
}
}
\ No newline at end of file
diff --git a/Octokit/Clients/IActivitiesClient.cs b/Octokit/Clients/IActivitiesClient.cs
index 81c4f294..ad1e4fcc 100644
--- a/Octokit/Clients/IActivitiesClient.cs
+++ b/Octokit/Clients/IActivitiesClient.cs
@@ -3,5 +3,6 @@
public interface IActivitiesClient
{
IEventsClient Events { get; }
+ IStarredClient Starring { get; }
}
}
\ No newline at end of file
diff --git a/Octokit/Clients/IAuthorizationsClient.cs b/Octokit/Clients/IAuthorizationsClient.cs
index 3bc5b39e..9195aa44 100644
--- a/Octokit/Clients/IAuthorizationsClient.cs
+++ b/Octokit/Clients/IAuthorizationsClient.cs
@@ -37,7 +37,7 @@ namespace Octokit
/// This method requires authentication.
/// See the API documentation for more information.
///
- /// The ID of the to get.
+ /// The ID of the to get
///
/// Thrown when the current user does not have permission to make this request.
///
@@ -55,9 +55,9 @@ namespace Octokit
/// This method requires authentication.
/// See the API documentation for more information.
///
- /// Client ID of the OAuth application for the token.
- /// The client secret.
- /// Describes the new authorization to create.
+ /// Client ID of the OAuth application for the token
+ /// The client secret
+ /// Describes the new authorization to create
///
/// Thrown when the current user does not have permission to make this request.
///
@@ -79,10 +79,10 @@ namespace Octokit
/// This method requires authentication.
/// See the API documentation for more information.
///
- /// Client ID of the OAuth application for the token.
- /// The client secret.
- /// Describes the new authorization to create.
- /// The two-factor authentication code in response to the current user's previous challenge.
+ /// Client ID of the OAuth application for the token
+ /// The client secret
+ /// Describes the new authorization to create
+ /// The two-factor authentication code in response to the current user's previous challenge
///
/// Thrown when the current user does not have permission to make this request.
///
@@ -120,8 +120,8 @@ namespace Octokit
/// See the API
/// documentation for more details.
///
- /// ID of the to update.
- /// Describes the changes to make to the authorization.
+ /// ID of the to update
+ /// Describes the changes to make to the authorization
///
/// Thrown when the current user does not have permission to make the request.
///
@@ -137,7 +137,7 @@ namespace Octokit
/// See the API
/// documentation for more details.
///
- /// The system-wide ID of the authorization to delete.
+ /// The system-wide ID of the authorization to delete
///
/// Thrown when the current user does not have permission to make the request.
///
diff --git a/Octokit/Clients/ICommitStatusClient.cs b/Octokit/Clients/ICommitStatusClient.cs
index 30f15d13..81daf573 100644
--- a/Octokit/Clients/ICommitStatusClient.cs
+++ b/Octokit/Clients/ICommitStatusClient.cs
@@ -12,7 +12,7 @@ namespace Octokit
/// Only users with pull access can see this.
/// The owner of the repository
/// The name of the repository
- /// The reference (SHA, branch name, or tag name) to list commits for.
+ /// The reference (SHA, branch name, or tag name) to list commits for
///
Task> GetAll(string owner, string name, string reference);
@@ -21,8 +21,8 @@ namespace Octokit
///
/// The owner of the repository
/// The name of the repository
- /// The reference (SHA, branch name, or tag name) to list commits for.
- /// The commit status to create.
+ /// The reference (SHA, branch name, or tag name) to list commits for
+ /// The commit status to create
///
Task Create(string owner, string name, string reference, NewCommitStatus commitStatus);
}
diff --git a/Octokit/Clients/ICommitsClient.cs b/Octokit/Clients/ICommitsClient.cs
new file mode 100644
index 00000000..6f187fd3
--- /dev/null
+++ b/Octokit/Clients/ICommitsClient.cs
@@ -0,0 +1,34 @@
+using System.Diagnostics.CodeAnalysis;
+using System.Threading.Tasks;
+
+namespace Octokit
+{
+ public interface ICommitsClient
+ {
+ ///
+ /// Gets a commit for a given repository by sha reference
+ ///
+ ///
+ /// http://developer.github.com/v3/git/commits/#get-a-commit
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Tha sha reference of the commit
+ ///
+ [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
+ Justification = "Method makes a network request")]
+ Task Get(string owner, string name, string reference);
+
+ ///
+ /// Create a commit for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/git/commits/#create-a-commit
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The commit to create
+ ///
+ Task Create(string owner, string name, NewCommit commit);
+ }
+}
\ No newline at end of file
diff --git a/Octokit/Clients/IEventsClient.cs b/Octokit/Clients/IEventsClient.cs
index 9f436818..378cc91a 100644
--- a/Octokit/Clients/IEventsClient.cs
+++ b/Octokit/Clients/IEventsClient.cs
@@ -53,7 +53,7 @@ namespace Octokit
///
/// http://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
///
- /// The name of the user
+ /// The login of the user
/// All the s that a particular user has received.
Task> GetUserReceived(string user);
@@ -63,7 +63,7 @@ namespace Octokit
///
/// http://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received
///
- /// The name of the user
+ /// The login of the user
/// All the s that a particular user has received.
Task> GetUserReceivedPublic(string user);
@@ -73,7 +73,7 @@ namespace Octokit
///
/// http://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
///
- /// The name of the user
+ /// The login of the user
/// All the s that a particular user has performed.
Task> GetUserPerformed(string user);
@@ -83,7 +83,7 @@ namespace Octokit
///
/// http://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user
///
- /// The name of the user
+ /// The login of the user
/// All the public s that a particular user has performed.
Task> GetUserPerformedPublic(string user);
@@ -93,7 +93,7 @@ namespace Octokit
///
/// http://developer.github.com/v3/activity/events/#list-events-for-an-organization
///
- /// The name of the user
+ /// The login of the user
/// The name of the organization
/// All the public s that are associated with an organization.
Task> GetForAnOrganization(string user, string organization);
diff --git a/Octokit/Clients/IGitDatabaseClient.cs b/Octokit/Clients/IGitDatabaseClient.cs
index 6bd46eb4..8c36b6bb 100644
--- a/Octokit/Clients/IGitDatabaseClient.cs
+++ b/Octokit/Clients/IGitDatabaseClient.cs
@@ -6,5 +6,6 @@
public interface IGitDatabaseClient
{
ITagsClient Tag { get; set; }
+ ICommitsClient Commit { get; set; }
}
}
\ No newline at end of file
diff --git a/Octokit/Clients/IMiscellaneousClient.cs b/Octokit/Clients/IMiscellaneousClient.cs
index 98cdfa4b..7c08bf4d 100644
--- a/Octokit/Clients/IMiscellaneousClient.cs
+++ b/Octokit/Clients/IMiscellaneousClient.cs
@@ -26,7 +26,7 @@ namespace Octokit
///
/// Gets the rendered Markdown for the specified plain-text Markdown document.
///
- /// A plain-text Markdown document.
+ /// A plain-text Markdown document
/// Thrown when a general API error occurs.
/// The rendered Markdown.
Task RenderRawMarkdown(string markdown);
diff --git a/Octokit/Clients/IOrganizationMembersClient.cs b/Octokit/Clients/IOrganizationMembersClient.cs
index a4cbdace..f763a908 100644
--- a/Octokit/Clients/IOrganizationMembersClient.cs
+++ b/Octokit/Clients/IOrganizationMembersClient.cs
@@ -23,7 +23,7 @@ namespace Octokit
/// See the API documentation
/// for more information.
///
- ///
+ /// The login for the organization
///
Task> GetAll(string org);
@@ -31,7 +31,7 @@ namespace Octokit
/// List all users who have publicized their membership of the organization.
///
/// http://developer.github.com/v3/orgs/members/#public-members-list
- ///
+ /// The login for the organization
///
Task> GetPublic(string org);
@@ -42,8 +42,8 @@ namespace Octokit
/// See the API documentation
/// for more information.
///
- ///
- ///
+ /// The login for the organization
+ /// The login for the user
///
Task CheckMember(string org, string user);
@@ -54,8 +54,8 @@ namespace Octokit
/// See the API documentation
/// for more information.
///
- ///
- ///
+ /// The login for the organization
+ /// The login for the user
///
Task CheckMemberPublic(string org, string user);
@@ -68,8 +68,8 @@ namespace Octokit
/// See the API documentation
/// for more information.
///
- ///
- ///
+ /// The login for the organization
+ /// The login for the user
///
Task Delete(string org, string user);
@@ -81,8 +81,8 @@ namespace Octokit
/// See the API documentation
/// for more information.
///
- ///
- ///
+ /// The login for the organization
+ /// The login for the user
///
Task Publicize(string org, string user);
@@ -94,8 +94,8 @@ namespace Octokit
/// See the API documentation
/// for more information.
///
- ///
- ///
+ /// The login for the organization
+ /// The login for the user
///
Task Conceal(string org, string user);
}
diff --git a/Octokit/Clients/IOrganizationsClient.cs b/Octokit/Clients/IOrganizationsClient.cs
index 01d8c94b..546e5cd2 100644
--- a/Octokit/Clients/IOrganizationsClient.cs
+++ b/Octokit/Clients/IOrganizationsClient.cs
@@ -14,12 +14,20 @@ namespace Octokit
///
public interface IOrganizationsClient
{
+ ///
+ /// Returns a client to manage members of an organization.
+ ///
IOrganizationMembersClient Member { get; }
+ ///
+ /// Returns a client to manage teams of an organization.
+ ///
+ ITeamsClient Team { get; }
+
///
/// Returns the specified .
///
- /// login of the organization to get.
+ /// login of the organization to get
/// Thrown when a general API error occurs.
/// The specified .
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get"
diff --git a/Octokit/Clients/IReleasesClient.cs b/Octokit/Clients/IReleasesClient.cs
index 8e000eec..f3480134 100644
--- a/Octokit/Clients/IReleasesClient.cs
+++ b/Octokit/Clients/IReleasesClient.cs
@@ -19,8 +19,8 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// The repository's owner.
- /// The repository's name.
+ /// The repository's owner
+ /// The repository's name
/// Thrown when a general API error occurs.
/// The list of s for the specified repository.
Task> GetAll(string owner, string name);
@@ -31,9 +31,9 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// The repository's owner.
- /// The repository's name.
- /// A description of the release to create.
+ /// The repository's owner
+ /// The repository's name
+ /// A description of the release to create
/// Thrown when a general API error occurs.
/// The created .
Task CreateRelease(string owner, string name, ReleaseUpdate data);
@@ -44,8 +44,8 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// The to attach the uploaded asset to.
- /// Description of the asset with its data.
+ /// The to attach the uploaded asset to
+ /// Description of the asset with its data
/// Thrown when a general API error occurs.
/// The created .
Task UploadAsset(Release release, ReleaseAssetUpload data);
diff --git a/Octokit/Clients/IRepositoriesClient.cs b/Octokit/Clients/IRepositoriesClient.cs
index 0e08da1c..c2fd2910 100644
--- a/Octokit/Clients/IRepositoriesClient.cs
+++ b/Octokit/Clients/IRepositoriesClient.cs
@@ -20,7 +20,7 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// A instance describing the new repository to create.
+ /// A instance describing the new repository to create
/// Thrown when a general API error occurs.
/// A instance for the created repository.
Task Create(NewRepository newRepository);
@@ -31,8 +31,8 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// Login of the organization in which to create the repostiory.
- /// A instance describing the new repository to create.
+ /// Login of the organization in which to create the repostiory
+ /// A instance describing the new repository to create
/// Thrown when a general API error occurs.
/// A instance for the created repository
Task Create(string organizationLogin, NewRepository newRepository);
@@ -44,8 +44,8 @@ namespace Octokit
/// See the API documentation for more information.
/// Deleting a repository requires admin access. If OAuth is used, the `delete_repo` scope is required.
///
- /// The owner of the repository.
- /// The name of the repository.
+ /// The owner of the repository
+ /// The name of the repository
/// Thrown when a general API error occurs.
Task Delete(string owner, string name);
@@ -55,8 +55,8 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// The owner of the repository.
- /// The name of the repository.
+ /// The owner of the repository
+ /// The name of the repository
/// Thrown when a general API error occurs.
/// A
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
@@ -108,8 +108,8 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// The owner of the repository.
- /// The name of the repository.
+ /// The owner of the repository
+ /// The name of the repository
/// Thrown when a general API error occurs.
///
Task GetReadme(string owner, string name);
@@ -120,8 +120,8 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// The owner of the repository.
- /// The name of the repository.
+ /// The owner of the repository
+ /// The name of the repository
/// Thrown when a general API error occurs.
///
Task GetReadmeHtml(string owner, string name);
diff --git a/Octokit/Clients/ISshKeysClient.cs b/Octokit/Clients/ISshKeysClient.cs
index 23026124..a66586f3 100644
--- a/Octokit/Clients/ISshKeysClient.cs
+++ b/Octokit/Clients/ISshKeysClient.cs
@@ -9,7 +9,7 @@ namespace Octokit
///
/// Retrieves the for the specified id.
///
- /// The ID of the SSH key.
+ /// The ID of the SSH key
/// A
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
Task Get(int id);
@@ -17,7 +17,7 @@ namespace Octokit
///
/// Retrieves the for the specified id.
///
- /// The login of the user.
+ /// The login of the user
/// A of .
Task> GetAll(string user);
@@ -33,7 +33,7 @@ namespace Octokit
///
/// Update the specified .
///
- ///
+ /// The SSH Key contents
/// Thrown if the client is not authenticated.
/// A
Task Create(SshKeyUpdate key);
@@ -41,8 +41,8 @@ namespace Octokit
///
/// Update the specified .
///
- ///
- ///
+ /// The ID of the SSH key
+ /// The SSH Key contents
/// Thrown if the client is not authenticated.
/// A
Task Update(int id, SshKeyUpdate key);
diff --git a/Octokit/Clients/IStarredClient.cs b/Octokit/Clients/IStarredClient.cs
new file mode 100644
index 00000000..ffb8695c
--- /dev/null
+++ b/Octokit/Clients/IStarredClient.cs
@@ -0,0 +1,74 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Octokit
+{
+ public interface IStarredClient
+ {
+ ///
+ /// Retrieves all of the stargazers for the passed repository.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Thrown if the client is not authenticated.
+ /// A of .
+ Task> GetAllStargazers(string owner, string name);
+
+ ///
+ /// Retrieves all of the starred (ies) for the current user.
+ ///
+ /// Thrown if the client is not authenticated.
+ /// A of .
+ Task> GetAllForCurrent();
+
+ ///
+ /// Retrieves all of the starred (ies) for the current user.
+ ///
+ /// Star-specific request parameters that sort the results
+ /// Thrown if the client is not authenticated.
+ /// A of .
+ Task> GetAllForCurrent(StarredRequest request);
+
+ ///
+ /// Retrieves all of the (ies) starred by the specified user.
+ ///
+ /// The login of the user
+ /// Thrown if the client is not authenticated.
+ /// A starred by the specified user.
+ Task> GetAllForUser(string user);
+
+ ///
+ /// Retrieves all of the (ies) starred by the specified user.
+ ///
+ /// The login of the user
+ /// Star-specific request parameters that sort the results
+ /// Thrown if the client is not authenticated.
+ /// A starred by the specified user.
+ Task> GetAllForUser(string user, StarredRequest request);
+
+ ///
+ /// Check if a repository is starred by the current authenticated user.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Thrown if the client is not authenticated.
+ /// A bool representing the success of the operation
+ Task CheckStarred(string owner, string name);
+
+ ///
+ /// Stars a repository for the authenticated user.
+ ///
+ /// The owner of the repository to star
+ /// The name of the repository to star
+ /// A bool representing the success of starring
+ Task StarRepo(string owner, string name);
+
+ ///
+ /// Unstars a repository for the authenticated user.
+ ///
+ /// The owner of the repository to unstar
+ /// The name of the repository to unstar
+ /// A bool representing the success of the operation
+ Task RemoveStarFromRepo(string owner, string name);
+ }
+}
diff --git a/Octokit/Clients/ITeamsClient.cs b/Octokit/Clients/ITeamsClient.cs
new file mode 100644
index 00000000..06554128
--- /dev/null
+++ b/Octokit/Clients/ITeamsClient.cs
@@ -0,0 +1,46 @@
+#if NET_45
+using System.Collections.Generic;
+#endif
+using System.Diagnostics.CodeAnalysis;
+using System.Threading.Tasks;
+
+namespace Octokit
+{
+ ///
+ /// A client for GitHub's Org Teams API.
+ ///
+ ///
+ /// See the Orgs API documentation for more information.
+ ///
+ public interface ITeamsClient
+ {
+ ///
+ /// Returns all s for the current org.
+ ///
+ /// Thrown when a general API error occurs.
+ /// A list of the orgs's teams s.
+ Task> GetAllTeams(string org);
+
+ ///
+ /// Returns newly created for the current org.
+ ///
+ /// Thrown when a general API error occurs.
+ /// Newly created
+ Task CreateTeam(string org, NewTeam team);
+
+ ///
+ /// Returns updated for the current org.
+ ///
+ /// Thrown when a general API error occurs.
+ /// Updated
+ Task UpdateTeam(int id, UpdateTeam team);
+
+ ///
+ /// Delte a team - must have owner permissions to this
+ ///
+ /// Thrown when a general API error occurs.
+ ///
+ Task DeleteTeam(int id);
+
+ }
+}
diff --git a/Octokit/Clients/IUsersClient.cs b/Octokit/Clients/IUsersClient.cs
index 6e96c525..a42dc2ae 100644
--- a/Octokit/Clients/IUsersClient.cs
+++ b/Octokit/Clients/IUsersClient.cs
@@ -24,7 +24,7 @@ namespace Octokit
///
/// Update the specified .
///
- ///
+ /// The login for the user
/// Thrown if the client is not authenticated.
/// A
Task Update(UserUpdate user);
diff --git a/Octokit/Clients/MiscellaneousClient.cs b/Octokit/Clients/MiscellaneousClient.cs
index c4c4277b..22dece5a 100644
--- a/Octokit/Clients/MiscellaneousClient.cs
+++ b/Octokit/Clients/MiscellaneousClient.cs
@@ -21,7 +21,7 @@ namespace Octokit
///
/// Initializes a new GitHub miscellaneous API client.
///
- /// An API connection.
+ /// An API connection
public MiscellaneousClient(IConnection connection)
{
Ensure.ArgumentNotNull(connection, "connection");
@@ -46,7 +46,7 @@ namespace Octokit
///
/// Gets the rendered Markdown for the specified plain-text Markdown document.
///
- /// A plain-text Markdown document.
+ /// A plain-text Markdown document
/// Thrown when a general API error occurs.
/// The rendered Markdown.
public async Task RenderRawMarkdown(string markdown)
diff --git a/Octokit/Clients/OrganizationMembersClient.cs b/Octokit/Clients/OrganizationMembersClient.cs
index a018008f..1a0df2e5 100644
--- a/Octokit/Clients/OrganizationMembersClient.cs
+++ b/Octokit/Clients/OrganizationMembersClient.cs
@@ -9,7 +9,7 @@ namespace Octokit
///
/// Initializes a new Organization Members API client.
///
- /// An API connection.
+ /// An API connection
public OrganizationMembersClient(IApiConnection apiConnection) : base(apiConnection)
{
}
@@ -32,26 +32,26 @@ namespace Octokit
/// See the API documentation
/// for more information.
///
- ///
+ /// The login for the organization
///
public Task> GetAll(string org)
{
Ensure.ArgumentNotNullOrEmptyString(org, "org");
- return ApiConnection.GetAll("orgs/{0}/members".FormatUri(org));
+ return ApiConnection.GetAll(ApiUrls.Members(org));
}
///
/// List all users who have publicized their membership of the organization.
///
/// http://developer.github.com/v3/orgs/members/#public-members-list
- ///
+ /// The login for the organization
///
public Task> GetPublic(string org)
{
Ensure.ArgumentNotNullOrEmptyString(org, "org");
- return ApiConnection.GetAll("orgs/{0}/public_members".FormatUri(org));
+ return ApiConnection.GetAll(ApiUrls.PublicMembers(org));
}
///
@@ -61,8 +61,8 @@ namespace Octokit
/// See the API documentation
/// for more information.
///
- ///
- ///
+ /// The login for the organization
+ /// The login for the user
///
public async Task CheckMember(string org, string user)
{
@@ -94,8 +94,8 @@ namespace Octokit
/// See the API documentation
/// for more information.
///
- ///
- ///
+ /// The login for the organization
+ /// The login for the user
///
public async Task CheckMemberPublic(string org, string user)
{
@@ -128,8 +128,8 @@ namespace Octokit
/// See the API documentation
/// for more information.
///
- ///
- ///
+ /// The login for the organization
+ /// The login for the user
///
public Task Delete(string org, string user)
{
@@ -147,8 +147,8 @@ namespace Octokit
/// See the API documentation
/// for more information.
///
- ///
- ///
+ /// The login for the organization
+ /// The login for the user
///
public async Task Publicize(string org, string user)
{
@@ -180,8 +180,8 @@ namespace Octokit
/// See the API documentation
/// for more information.
///
- ///
- ///
+ /// The login for the organization
+ /// The login for the user
///
public Task Conceal(string org, string user)
{
diff --git a/Octokit/Clients/OrganizationsClient.cs b/Octokit/Clients/OrganizationsClient.cs
index 243e115f..ba7f7c5f 100644
--- a/Octokit/Clients/OrganizationsClient.cs
+++ b/Octokit/Clients/OrganizationsClient.cs
@@ -17,18 +17,24 @@ namespace Octokit
///
/// Initializes a new GitHub Orgs API client.
///
- /// An API connection.
+ /// An API connection
public OrganizationsClient(IApiConnection apiConnection) : base(apiConnection)
{
Member = new OrganizationMembersClient(apiConnection);
+ Team = new TeamsClient(apiConnection);
}
public IOrganizationMembersClient Member { get; private set; }
+ ///
+ /// Returns a client to manage teams of an organization.
+ ///
+ public ITeamsClient Team { get; private set; }
+
///
/// Returns the specified .
///
- /// login of the organization to get.
+ /// login of the organization to get
/// Thrown when a general API error occurs.
/// The specified .
public Task Get(string org)
diff --git a/Octokit/Clients/ReleasesClient.cs b/Octokit/Clients/ReleasesClient.cs
index 7f4bda68..7ae5994c 100644
--- a/Octokit/Clients/ReleasesClient.cs
+++ b/Octokit/Clients/ReleasesClient.cs
@@ -16,7 +16,7 @@ namespace Octokit
///
/// Initializes a new GitHub Releases API client.
///
- /// An API connection.
+ /// An API connection
public ReleasesClient(IApiConnection apiConnection) : base(apiConnection)
{
}
@@ -27,8 +27,8 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// The repository's owner.
- /// The repository's name.
+ /// The repository's owner
+ /// The repository's name
/// Thrown when a general API error occurs.
/// The list of s for the specified repository.
public Task> GetAll(string owner, string name)
@@ -46,9 +46,9 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// The repository's owner.
- /// The repository's name.
- /// A description of the release to create.
+ /// The repository's owner
+ /// The repository's name
+ /// A description of the release to create
/// Thrown when a general API error occurs.
/// The created .
public Task CreateRelease(string owner, string name, ReleaseUpdate data)
@@ -67,8 +67,8 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// The to attach the uploaded asset to.
- /// Description of the asset with its data.
+ /// The to attach the uploaded asset to
+ /// Description of the asset with its data
/// Thrown when a general API error occurs.
/// The created .
public Task UploadAsset(Release release, ReleaseAssetUpload data)
diff --git a/Octokit/Clients/RepositoriesClient.cs b/Octokit/Clients/RepositoriesClient.cs
index 023651ca..d115e5d3 100644
--- a/Octokit/Clients/RepositoriesClient.cs
+++ b/Octokit/Clients/RepositoriesClient.cs
@@ -17,7 +17,7 @@ namespace Octokit
///
/// Initializes a new GitHub Repos API client.
///
- /// An API connection.
+ /// An API connection
public RepositoriesClient(IApiConnection apiConnection) : base(apiConnection)
{
CommitStatus = new CommitStatusClient(apiConnection);
@@ -29,7 +29,7 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// A instance describing the new repository to create.
+ /// A instance describing the new repository to create
/// Thrown when a general API error occurs.
/// A instance for the created repository.
public Task Create(NewRepository newRepository)
@@ -47,8 +47,8 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// Login of the organization in which to create the repostiory.
- /// A instance describing the new repository to create.
+ /// Login of the organization in which to create the repostiory
+ /// A instance describing the new repository to create
/// Thrown when a general API error occurs.
/// A instance for the created repository
public Task Create(string organizationLogin, NewRepository newRepository)
@@ -68,8 +68,8 @@ namespace Octokit
/// See the API documentation for more information.
/// Deleting a repository requires admin access. If OAuth is used, the `delete_repo` scope is required.
///
- /// The owner of the repository.
- /// The name of the repository.
+ /// The owner of the repository
+ /// The name of the repository
/// Thrown when a general API error occurs.
public Task Delete(string owner, string name)
{
@@ -86,8 +86,8 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// The owner of the repository.
- /// The name of the repository.
+ /// The owner of the repository
+ /// The name of the repository
/// Thrown when a general API error occurs.
/// A
public Task Get(string owner, string name)
@@ -152,8 +152,8 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// The owner of the repository.
- /// The name of the repository.
+ /// The owner of the repository
+ /// The name of the repository
/// Thrown when a general API error occurs.
///
public async Task GetReadme(string owner, string name)
@@ -172,8 +172,8 @@ namespace Octokit
///
/// See the API documentation for more information.
///
- /// The owner of the repository.
- /// The name of the repository.
+ /// The owner of the repository
+ /// The name of the repository
/// Thrown when a general API error occurs.
///
public Task GetReadmeHtml(string owner, string name)
diff --git a/Octokit/Clients/SshKeysClient.cs b/Octokit/Clients/SshKeysClient.cs
index 4b3c8f89..a89b78b9 100644
--- a/Octokit/Clients/SshKeysClient.cs
+++ b/Octokit/Clients/SshKeysClient.cs
@@ -8,10 +8,19 @@ namespace Octokit
{
public class SshKeysClient : ApiClient, ISshKeysClient
{
+ ///
+ /// Instantiates a new SSH Key Client.
+ ///
+ /// The connection used to make requests
public SshKeysClient(IApiConnection apiConnection) : base(apiConnection)
{
}
+ ///
+ /// Retrieves the for the specified id.
+ ///
+ /// The ID of the SSH key
+ /// A
public Task Get(int id)
{
var endpoint = "user/keys/{0}".FormatUri(id);
@@ -19,6 +28,11 @@ namespace Octokit
return ApiConnection.Get(endpoint);
}
+ ///
+ /// Retrieves the for the specified id.
+ ///
+ /// The login of the user
+ /// A of .
public Task> GetAll(string user)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
@@ -26,11 +40,22 @@ namespace Octokit
return ApiConnection.GetAll(ApiUrls.SshKeys(user));
}
+ ///
+ /// Retrieves the for the specified id.
+ ///
+ /// Thrown if the client is not authenticated.
+ /// A of .
public Task> GetAllForCurrent()
{
return ApiConnection.GetAll(ApiUrls.SshKeys());
}
+ ///
+ /// Update the specified .
+ ///
+ /// The SSH Key contents
+ /// Thrown if the client is not authenticated.
+ /// A
public Task Create(SshKeyUpdate key)
{
Ensure.ArgumentNotNull(key, "key");
@@ -38,6 +63,13 @@ namespace Octokit
return ApiConnection.Post(ApiUrls.SshKeys(), key);
}
+ ///
+ /// Update the specified .
+ ///
+ /// The ID of the SSH key
+ /// The SSH Key contents
+ /// Thrown if the client is not authenticated.
+ /// A
public Task Update(int id, SshKeyUpdate key)
{
Ensure.ArgumentNotNull(key, "key");
@@ -46,6 +78,12 @@ namespace Octokit
return ApiConnection.Patch(endpoint, key);
}
+ ///
+ /// Update the specified .
+ ///
+ /// The id of the SSH key
+ /// Thrown if the client is not authenticated.
+ /// A
public Task Delete(int id)
{
var endpoint = "user/keys/{0}".FormatUri(id);
diff --git a/Octokit/Clients/StarredClient.cs b/Octokit/Clients/StarredClient.cs
new file mode 100644
index 00000000..06e46c53
--- /dev/null
+++ b/Octokit/Clients/StarredClient.cs
@@ -0,0 +1,156 @@
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Threading.Tasks;
+
+namespace Octokit
+{
+ public class StarredClient : ApiClient, IStarredClient
+ {
+ public StarredClient(IApiConnection apiConnection) : base(apiConnection)
+ {
+ }
+
+ ///
+ /// Retrieves all of the stargazers for the passed repository.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Thrown if the client is not authenticated.
+ /// A of .
+ public Task> GetAllStargazers(string owner, string name)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
+ return ApiConnection.GetAll(ApiUrls.Stargazers(owner, name));
+ }
+
+ ///
+ /// Retrieves all of the starred (ies) for the current user.
+ ///
+ /// Thrown if the client is not authenticated.
+ /// A of .
+ public Task> GetAllForCurrent()
+ {
+ return ApiConnection.GetAll(ApiUrls.Starred());
+ }
+
+ ///
+ /// Retrieves all of the starred (ies) for the current user.
+ ///
+ /// Star-specific request parameters that sort the results
+ /// Thrown if the client is not authenticated.
+ /// A of .
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters",
+ Justification = "But i think i do need star-specific request parameters")]
+ public Task> GetAllForCurrent(StarredRequest request)
+ {
+ Ensure.ArgumentNotNull(request, "request");
+
+ return ApiConnection.GetAll(ApiUrls.Starred(), request.ToParametersDictionary());
+ }
+
+ ///
+ /// Retrieves all of the (ies) starred by the specified user.
+ ///
+ /// The login of the user
+ /// Thrown if the client is not authenticated.
+ /// A starred by the specified user.
+ public Task> GetAllForUser(string user)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+
+ return ApiConnection.GetAll(ApiUrls.StarredByUser(user));
+ }
+
+ ///
+ /// Retrieves all of the (ies) starred by the specified user.
+ ///
+ /// The login of the user
+ /// Star-specific request parameters that sort the results
+ /// Thrown if the client is not authenticated.
+ /// A starred by the specified user.
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ public Task> GetAllForUser(string user, StarredRequest request)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+ Ensure.ArgumentNotNull(request, "request");
+
+ return ApiConnection.GetAll(ApiUrls.StarredByUser(user), request.ToParametersDictionary());
+ }
+
+ ///
+ /// Check if a repository is starred by the current authenticated user.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Thrown if the client is not authenticated.
+ /// A bool representing the success of the operation
+ public async Task CheckStarred(string owner, string name)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
+ try
+ {
+ var response = await Connection.GetAsync(ApiUrls.Starred(owner, name), null, null)
+ .ConfigureAwait(false);
+
+ return response.StatusCode == HttpStatusCode.NoContent;
+ }
+ catch (NotFoundException)
+ {
+ return false;
+ }
+ }
+
+ ///
+ /// Stars a repository for the authenticated user.
+ ///
+ /// The owner of the repository to star
+ /// The name of the repository to star
+ /// A bool representing the success of starring the repository.
+ public async Task StarRepo(string owner, string name)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
+ try
+ {
+ var response = await Connection.PutAsync(ApiUrls.Starred(owner, name), null, null)
+ .ConfigureAwait(false);
+
+ return response.StatusCode == HttpStatusCode.NoContent;
+ }
+ catch (NotFoundException)
+ {
+ return false;
+ }
+ }
+
+ ///
+ /// Unstars a repository for the authenticated user.
+ ///
+ /// The owner of the repository to unstar
+ /// The name of the repository to unstar
+ /// A bool representing the success of unstarring the repository.
+ public async Task RemoveStarFromRepo(string owner, string name)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
+ try
+ {
+ var statusCode = await Connection.DeleteAsync(ApiUrls.Starred(owner, name))
+ .ConfigureAwait(false);
+
+ return statusCode == HttpStatusCode.NoContent;
+ }
+ catch (NotFoundException)
+ {
+ return false;
+ }
+ }
+ }
+}
diff --git a/Octokit/Clients/TagsClient.cs b/Octokit/Clients/TagsClient.cs
index 56d30cf7..099f1d5e 100644
--- a/Octokit/Clients/TagsClient.cs
+++ b/Octokit/Clients/TagsClient.cs
@@ -9,6 +9,16 @@ namespace Octokit
{
}
+ ///
+ /// Gets a tag for a given repository by sha reference
+ ///
+ ///
+ /// http://developer.github.com/v3/git/tags/#get-a-tag
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Tha sha reference of the tag
+ ///
public Task Get(string owner, string name, string reference)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -18,6 +28,16 @@ namespace Octokit
return ApiConnection.Get(ApiUrls.Tag(owner, name, reference));
}
+ ///
+ /// Create a tag for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/git/tags/#create-a-tag-object
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The tag to create
+ ///
public Task Create(string owner, string name, NewTag tag)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
diff --git a/Octokit/Clients/TeamsClient.cs b/Octokit/Clients/TeamsClient.cs
new file mode 100644
index 00000000..47e1dab0
--- /dev/null
+++ b/Octokit/Clients/TeamsClient.cs
@@ -0,0 +1,79 @@
+#if NET_45
+using System.Collections.Generic;
+#endif
+using System.Diagnostics.CodeAnalysis;
+using System.Threading.Tasks;
+
+namespace Octokit
+{
+
+ ///
+ /// A client for GitHub's Org Teams API.
+ ///
+ ///
+ /// See the Orgs API documentation for more information.
+ ///
+ public class TeamsClient : ApiClient, ITeamsClient
+ {
+ ///
+ /// Initializes a new GitHub Orgs Team API client.
+ ///
+ /// An API connection.
+ public TeamsClient(IApiConnection apiConnection)
+ : base(apiConnection)
+ {
+ }
+
+ ///
+ /// Returns all s for the current org.
+ ///
+ /// Thrown when a general API error occurs.
+ /// A list of the orgs's teams s.
+ public Task> GetAllTeams(string org)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(org, "org");
+
+ var endpoint = ApiUrls.OrganizationTeams(org);
+ return ApiConnection.GetAll(endpoint);
+ }
+
+
+ ///
+ /// Returns newly created for the current org.
+ ///
+ /// Thrown when a general API error occurs.
+ /// Newly created
+ public Task CreateTeam(string org, NewTeam team)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(org, "org");
+ Ensure.ArgumentNotNull(team, "team");
+
+ var endpoint = ApiUrls.OrganizationTeams(org);
+ return ApiConnection.Post(endpoint, team);
+ }
+
+ ///
+ /// Returns updated for the current org.
+ ///
+ /// Thrown when a general API error occurs.
+ /// Updated
+ public Task UpdateTeam(int id, UpdateTeam team)
+ {
+ Ensure.ArgumentNotNull(team, "team");
+
+ var endpoint = ApiUrls.TeamsUpdateOrDelete(id);
+ return ApiConnection.Patch(endpoint, team);
+ }
+
+ ///
+ /// Delte a team - must have owner permissions to this
+ ///
+ /// Thrown when a general API error occurs.
+ ///
+ public Task DeleteTeam(int id)
+ {
+ var endpoint = ApiUrls.TeamsUpdateOrDelete(id);
+ return ApiConnection.Delete(endpoint);
+ }
+ }
+}
diff --git a/Octokit/Clients/UsersClient.cs b/Octokit/Clients/UsersClient.cs
index cb53c7d5..b61870d3 100644
--- a/Octokit/Clients/UsersClient.cs
+++ b/Octokit/Clients/UsersClient.cs
@@ -46,7 +46,7 @@ namespace Octokit
///
/// Update the specified .
///
- ///
+ /// The login for the user
/// Thrown if the client is not authenticated.
/// A
public Task Update(UserUpdate user)
diff --git a/Octokit/GitHubClient.cs b/Octokit/GitHubClient.cs
index fc8816a7..eeede2e7 100644
--- a/Octokit/GitHubClient.cs
+++ b/Octokit/GitHubClient.cs
@@ -32,7 +32,7 @@ namespace Octokit
/// The name (and optionally version) of the product using this library. This is sent to the server as part of
/// the user agent for analytics purposes.
///
- /// Provides credentials to the client when making requests.
+ /// Provides credentials to the client when making requests
public GitHubClient(ProductHeaderValue productInformation, ICredentialStore credentialStore)
: this(new Connection(productInformation, credentialStore))
{
@@ -60,7 +60,7 @@ namespace Octokit
/// The name (and optionally version) of the product using this library. This is sent to the server as part of
/// the user agent for analytics purposes.
///
- /// Provides credentials to the client when making requests.
+ /// Provides credentials to the client when making requests
///
/// The address to point this client to. Typically used for GitHub Enterprise
/// instances
@@ -72,7 +72,7 @@ namespace Octokit
///
/// Create a new instance of the GitHub API v3 client using the specified connection.
///
- /// The underlying used to make requests.
+ /// The underlying used to make requests
public GitHubClient(IConnection connection)
{
Ensure.ArgumentNotNull(connection, "connection");
diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs
index 94f6265a..fcaf02e3 100644
--- a/Octokit/Helpers/ApiUrls.cs
+++ b/Octokit/Helpers/ApiUrls.cs
@@ -10,6 +10,7 @@ namespace Octokit
static readonly Uri _currentUserRepositoriesUrl = new Uri("user/repos", UriKind.Relative);
static readonly Uri _currentUserOrganizationsUrl = new Uri("user/orgs", UriKind.Relative);
static readonly Uri _currentUserSshKeys = new Uri("user/keys", UriKind.Relative);
+ static readonly Uri _currentUserStars = new Uri("user/starred", UriKind.Relative);
static readonly Uri _currentUserEmailsEndpoint = new Uri("user/emails", UriKind.Relative);
static readonly Uri _currentUserAuthorizationsEndpoint = new Uri("authorizations", UriKind.Relative);
static readonly Uri _currentUserNotificationsEndpoint = new Uri("notifications", UriKind.Relative);
@@ -97,8 +98,8 @@ namespace Octokit
///
/// Returns the that returns all of the releases for the specified repository.
///
- /// The owner of the repository.
- /// The name of the repository.
+ /// The owner of the repository
+ /// The name of the repository
///
public static Uri Releases(string owner, string name)
{
@@ -247,6 +248,26 @@ namespace Octokit
return "repos/{0}/{1}/assignees/{2}".FormatUri(owner, name, login);
}
+ ///
+ /// Returns the that returns all of the members of the organization
+ ///
+ /// The organization
+ ///
+ public static Uri Members(string org)
+ {
+ return "orgs/{0}/members".FormatUri(org);
+ }
+
+ ///
+ /// Returns the that returns all of the public members of the organization
+ ///
+ /// Organization
+ ///
+ public static Uri PublicMembers(string org)
+ {
+ return "orgs/{0}/public_members".FormatUri(org);
+ }
+
///
/// Returns the that returns a 204 if requester is an organization member and
/// the user is, publicly or privately a member of the organization.
@@ -350,13 +371,49 @@ namespace Octokit
///
/// The owner of the repository
/// The name of the repository
- /// The reference (SHA, branch name, or tag name) to list commits for.
+ /// The reference (SHA, branch name, or tag name) to list commits for
///
public static Uri CommitStatus(string owner, string name, string reference)
{
return "repos/{0}/{1}/statuses/{2}".FormatUri(owner, name, reference);
}
+ ///
+ /// Returns the that lists the starred repositories for the authenticated user.
+ ///
+ public static Uri Stargazers(string owner, string repo)
+ {
+ return "repos/{0}/{1}/stargazers".FormatUri(owner, repo);
+ }
+
+ ///
+ /// Returns the that lists the starred repositories for the authenticated user.
+ ///
+ public static Uri Starred()
+ {
+ return _currentUserStars;
+ }
+
+ ///
+ /// Returns the that lists the starred repositories for the specified user.
+ ///
+ /// The user that has the stars
+ public static Uri StarredByUser(string user)
+ {
+ return "users/{0}/starred".FormatUri(user);
+ }
+
+ ///
+ /// Returns the that shows whether the repo is starred by the current user.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ ///
+ public static Uri Starred(string owner, string repo)
+ {
+ return "user/starred/{0}/{1}".FormatUri(owner, repo);
+ }
+
///
/// Returns the for the specified tag.
///
@@ -390,11 +447,31 @@ namespace Octokit
}
///
- /// Returns the for the network of repositories.
+ /// Returns the for the specified commit.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The commit reference (SHA)
+ ///
+ public static Uri Commit(string owner, string name, string reference)
+ {
+ return "repos/{0}/{1}/git/commits/{2}".FormatUri(owner, name, reference);
+ }
+
+ ///
+ /// Returns the for creating a commit object.
///
/// The owner of the repository
/// The name of the repository
///
+ public static Uri CreateCommit(string owner, string name)
+ {
+ return "repos/{0}/{1}/git/commits".FormatUri(owner, name);
+ }
+
+ ///
+ /// Returns the for the network of repositories.
+ ///
public static Uri NetworkEvents(string owner, string name)
{
return "networks/{0}/{1}/events".FormatUri(owner, name);
@@ -413,7 +490,7 @@ namespace Octokit
///
/// Returns the for the received events for a user.
///
- /// The name of the user
+ /// The login of the user
///
public static Uri ReceivedEvents(string user)
{
@@ -423,7 +500,7 @@ namespace Octokit
///
/// Returns the for the received events for a user.
///
- /// The name of the user
+ /// The login of the user
/// Whether to return public events or not
///
public static Uri ReceivedEvents(string user, bool isPublic)
@@ -439,7 +516,7 @@ namespace Octokit
///
/// Returns the for events performed by a user.
///
- /// The name of the user
+ /// The login of the user
///
public static Uri PerformedEvents(string user)
{
@@ -449,7 +526,7 @@ namespace Octokit
///
/// Returns the for events performed by a user.
///
- /// The name of the user
+ /// The login of the user
/// Whether to return public events or not
///
public static Uri PerformedEvents(string user, bool isPublic)
@@ -465,7 +542,7 @@ namespace Octokit
///
/// Returns the for events associated with an organization.
///
- /// The name of the user
+ /// The login of the user
/// The name of the organization
///
public static Uri OrganizationEvents(string user, string organization)
@@ -500,5 +577,27 @@ namespace Octokit
}
return blob.FormatUri(owner, name, reference);
}
+
+ ///
+ /// returns the for org teams
+ /// use for both Get and Create methods
+ ///
+ ///
+ ///
+ public static Uri OrganizationTeams(string organization)
+ {
+ return "orgs/{0}/teams".FormatUri(organization);
+ }
+
+ ///
+ /// returns the for teams
+ /// use for update or deleting a team
+ ///
+ ///
+ ///
+ public static Uri TeamsUpdateOrDelete(int id)
+ {
+ return "teams/{0}".FormatUri(id);
+ }
}
}
diff --git a/Octokit/Helpers/Ensure.cs b/Octokit/Helpers/Ensure.cs
index b43ffb3f..c817dd94 100644
--- a/Octokit/Helpers/Ensure.cs
+++ b/Octokit/Helpers/Ensure.cs
@@ -10,8 +10,8 @@ namespace Octokit
///
/// Checks an argument to ensure it isn't null.
///
- /// The argument value to check.
- /// The name of the argument.
+ /// The argument value to check
+ /// The name of the argument
public static void ArgumentNotNull([ValidatedNotNull]object value, string name)
{
if (value != null) return;
@@ -22,8 +22,8 @@ namespace Octokit
///
/// Checks a string argument to ensure it isn't null or empty.
///
- /// The argument value to check.
- /// The name of the argument.
+ /// The argument value to check
+ /// The name of the argument
public static void ArgumentNotNullOrEmptyString([ValidatedNotNull]string value, string name)
{
ArgumentNotNull(value, name);
diff --git a/Octokit/Helpers/UriExtensions.cs b/Octokit/Helpers/UriExtensions.cs
index 53acbc82..d3d3c102 100644
--- a/Octokit/Helpers/UriExtensions.cs
+++ b/Octokit/Helpers/UriExtensions.cs
@@ -12,6 +12,10 @@ namespace Octokit
if (parameters == null || !parameters.Any()) return uri;
+ // to prevent values being persisted across requests
+ // use a temporary dictionary which combines new and existing parameters
+ IDictionary p = new Dictionary(parameters);
+
string queryString;
if (uri.IsAbsoluteUri)
{
@@ -34,13 +38,13 @@ namespace Octokit
foreach (var existing in existingParameters)
{
- if (!parameters.ContainsKey(existing.Key))
+ if (!p.ContainsKey(existing.Key))
{
- parameters.Add(existing);
+ p.Add(existing);
}
}
- string query = String.Join("&", parameters.Select(kvp => kvp.Key + "=" + kvp.Value));
+ string query = String.Join("&", p.Select(kvp => kvp.Key + "=" + kvp.Value));
if (uri.IsAbsoluteUri)
{
var uriBuilder = new UriBuilder(uri)
diff --git a/Octokit/Http/ApiConnection.cs b/Octokit/Http/ApiConnection.cs
index 9f5f0a8f..1703f253 100644
--- a/Octokit/Http/ApiConnection.cs
+++ b/Octokit/Http/ApiConnection.cs
@@ -16,7 +16,7 @@ namespace Octokit
///
/// Initializes a new instance of the class.
///
- /// A connection for making HTTP requests.
+ /// A connection for making HTTP requests
public ApiConnection(IConnection connection) : this(connection, new ApiPagination())
{
}
@@ -24,8 +24,8 @@ namespace Octokit
///
/// Initializes a new instance of the class.
///
- /// A connection for making HTTP requests.
- /// A paginator for paging API responses.
+ /// A connection for making HTTP requests
+ /// A paginator for paging API responses
protected ApiConnection(IConnection connection, IApiPagination pagination)
{
Ensure.ArgumentNotNull(connection, "connection");
@@ -44,8 +44,8 @@ namespace Octokit
/// Gets the API resource at the specified URI.
///
/// Type of the API resource to get.
- /// URI of the API resource to get.
- /// Parameters to add to the API request.
+ /// URI of the API resource to get
+ /// Parameters to add to the API request
/// The API resource.
/// Thrown when an API error occurs.
public async Task Get(Uri uri, IDictionary parameters)
@@ -59,8 +59,8 @@ namespace Octokit
///
/// Gets the HTML content of the API resource at the specified URI.
///
- /// URI of the API resource to get.
- /// Parameters to add to the API request.
+ /// URI of the API resource to get
+ /// Parameters to add to the API request
/// The API resource's HTML content.
/// Thrown when an API error occurs.
public async Task GetHtml(Uri uri, IDictionary parameters)
@@ -75,7 +75,7 @@ namespace Octokit
/// Gets all API resources in the list at the specified URI.
///
/// Type of the API resource in the list.
- /// URI of the API resource to get.
+ /// URI of the API resource to get
/// of the The API resources in the list.
/// Thrown when an API error occurs.
public Task> GetAll(Uri uri)
@@ -87,8 +87,8 @@ namespace Octokit
/// Gets all API resources in the list at the specified URI.
///
/// Type of the API resource in the list.
- /// URI of the API resource to get.
- /// Parameters to add to the API request.
+ /// URI of the API resource to get
+ /// Parameters to add to the API request
/// of the The API resources in the list.
/// Thrown when an API error occurs.
public Task> GetAll(Uri uri, IDictionary parameters)
@@ -100,9 +100,9 @@ namespace Octokit
/// Gets all API resources in the list at the specified URI.
///
/// Type of the API resource in the list.
- /// URI of the API resource to get.
- /// Parameters to add to the API request.
- /// Accept header to use for the API request.
+ /// URI of the API resource to get
+ /// Parameters to add to the API request
+ /// Accept header to use for the API request
/// of the The API resources in the list.
/// Thrown when an API error occurs.
public Task> GetAll(Uri uri, IDictionary parameters, string accepts)
@@ -117,8 +117,8 @@ namespace Octokit
/// Creates a new API resource in the list at the specified URI.
///
/// The API resource's type.
- /// URI of the API resource to get.
- /// Object that describes the new API resource; this will be serialized and used as the request's body.
+ /// URI of the API resource to get
+ /// Object that describes the new API resource; this will be serialized and used as the request's body
/// The created API resource.
/// Thrown when an API error occurs.
public Task Post(Uri uri, object data)
@@ -133,9 +133,9 @@ namespace Octokit
/// Creates a new API resource in the list at the specified URI.
///
/// The API resource's type.
- /// URI of the API resource to get.
- /// Object that describes the new API resource; this will be serialized and used as the request's body.
- /// Accept header to use for the API request.
+ /// URI of the API resource to get
+ /// Object that describes the new API resource; this will be serialized and used as the request's body
+ /// Accept header to use for the API request
/// The created API resource.
/// Thrown when an API error occurs.
public Task Post(Uri uri, object data, string accepts)
@@ -147,10 +147,10 @@ namespace Octokit
/// Creates a new API resource in the list at the specified URI.
///
/// The API resource's type.
- /// URI of the API resource to get.
- /// Object that describes the new API resource; this will be serialized and used as the request's body.
- /// Accept header to use for the API request.
- /// Content type of the API request.
+ /// URI of the API resource to get
+ /// Object that describes the new API resource; this will be serialized and used as the request's body
+ /// Accept header to use for the API request
+ /// Content type of the API request
/// The created API resource.
/// Thrown when an API error occurs.
public async Task Post(Uri uri, object data, string accepts, string contentType)
@@ -170,8 +170,8 @@ namespace Octokit
/// Creates or replaces the API resource at the specified URI.
///
/// The API resource's type.
- /// URI of the API resource to create or replace.
- /// Object that describes the API resource; this will be serialized and used as the request's body.
+ /// URI of the API resource to create or replace
+ /// Object that describes the API resource; this will be serialized and used as the request's body
/// The created API resource.
/// Thrown when an API error occurs.
public async Task Put(Uri uri, object data)
@@ -188,9 +188,9 @@ namespace Octokit
/// Creates or replaces the API resource at the specified URI.
///
/// The API resource's type.
- /// URI of the API resource to create or replace.
- /// Object that describes the API resource; this will be serialized and used as the request's body.
- /// The two-factor authentication code in response to the current user's previous challenge.
+ /// URI of the API resource to create or replace
+ /// Object that describes the API resource; this will be serialized and used as the request's body
+ /// The two-factor authentication code in response to the current user's previous challenge
/// The created API resource.
/// Thrown when an API error occurs.
public async Task Put(Uri uri, object data, string twoFactorAuthenticationCode)
@@ -208,8 +208,8 @@ namespace Octokit
/// Updates the API resource at the specified URI.
///
/// The API resource's type.
- /// URI of the API resource to update.
- /// /// Object that describes the API resource; this will be serialized and used as the request's body.
+ /// URI of the API resource to update
+ /// /// Object that describes the API resource; this will be serialized and used as the request's body
/// The updated API resource.
/// Thrown when an API error occurs.
public async Task Patch(Uri uri, object data)
@@ -225,7 +225,7 @@ namespace Octokit
///
/// Deletes the API object at the specified URI.
///
- /// URI of the API resource to delete.
+ /// URI of the API resource to delete
/// A for the request's execution.
public Task Delete(Uri uri)
{
diff --git a/Octokit/Http/Connection.cs b/Octokit/Http/Connection.cs
index 36fcb14a..e41b77e4 100644
--- a/Octokit/Http/Connection.cs
+++ b/Octokit/Http/Connection.cs
@@ -42,7 +42,7 @@ namespace Octokit
///
///
/// The address to point this client to such as https://api.github.com or the URL to a GitHub Enterprise
- /// instance.
+ /// instance
public Connection(ProductHeaderValue productInformation, Uri baseAddress)
: this(productInformation, baseAddress, _anonymousCredentials)
{
@@ -55,7 +55,7 @@ namespace Octokit
/// The name (and optionally version) of the product using this library. This is sent to the server as part of
/// the user agent for analytics purposes.
///
- /// Provides credentials to the client when making requests.
+ /// Provides credentials to the client when making requests
public Connection(ProductHeaderValue productInformation, ICredentialStore credentialStore)
: this(productInformation, _defaultGitHubApiUrl, credentialStore)
{
@@ -70,8 +70,8 @@ namespace Octokit
///
///
/// The address to point this client to such as https://api.github.com or the URL to a GitHub Enterprise
- /// instance.
- /// Provides credentials to the client when making requests.
+ /// instance
+ /// Provides credentials to the client when making requests
public Connection(ProductHeaderValue productInformation, Uri baseAddress, ICredentialStore credentialStore)
: this(productInformation, baseAddress, credentialStore, new HttpClientAdapter(), new SimpleJsonSerializer())
{
@@ -86,10 +86,10 @@ namespace Octokit
///
///
/// The address to point this client to such as https://api.github.com or the URL to a GitHub Enterprise
- /// instance.
- /// Provides credentials to the client when making requests.
- /// A raw used to make requests.
- /// Class used to serialize and deserialize JSON requests.
+ /// instance
+ /// Provides credentials to the client when making requests
+ /// A raw used to make requests
+ /// Class used to serialize and deserialize JSON requests
public Connection(
ProductHeaderValue productInformation,
Uri baseAddress,
@@ -205,16 +205,17 @@ namespace Octokit
return Run(request);
}
- public Task DeleteAsync(Uri uri)
+ public async Task DeleteAsync(Uri uri)
{
Ensure.ArgumentNotNull(uri, "uri");
- return Run(new Request
+ var response = await Run(new Request
{
Method = HttpMethod.Delete,
BaseAddress = BaseAddress,
Endpoint = uri
});
+ return response.StatusCode;
}
public Uri BaseAddress { get; private set; }
diff --git a/Octokit/Http/IApiConnection.cs b/Octokit/Http/IApiConnection.cs
index 3c6ef682..1c73d21d 100644
--- a/Octokit/Http/IApiConnection.cs
+++ b/Octokit/Http/IApiConnection.cs
@@ -20,8 +20,8 @@ namespace Octokit
/// Gets the API resource at the specified URI.
///
/// Type of the API resource to get.
- /// URI of the API resource to get.
- /// Parameters to add to the API request.
+ /// URI of the API resource to get
+ /// Parameters to add to the API request
/// The API resource.
/// Thrown when an API error occurs.
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
@@ -31,8 +31,8 @@ namespace Octokit
///
/// Gets the HTML content of the API resource at the specified URI.
///
- /// URI of the API resource to get.
- /// Parameters to add to the API request.
+ /// URI of the API resource to get
+ /// Parameters to add to the API request
/// The API resource's HTML content.
/// Thrown when an API error occurs.
Task GetHtml(Uri uri, IDictionary parameters);
@@ -41,7 +41,7 @@ namespace Octokit
/// Gets all API resources in the list at the specified URI.
///
/// Type of the API resource in the list.
- /// URI of the API resource to get.
+ /// URI of the API resource to get
/// of the The API resources in the list.
/// Thrown when an API error occurs.
Task> GetAll(Uri uri);
@@ -50,8 +50,8 @@ namespace Octokit
/// Gets all API resources in the list at the specified URI.
///
/// Type of the API resource in the list.
- /// URI of the API resource to get.
- /// Parameters to add to the API request.
+ /// URI of the API resource to get
+ /// Parameters to add to the API request
/// of the The API resources in the list.
/// Thrown when an API error occurs.
Task> GetAll(Uri uri, IDictionary parameters);
@@ -60,9 +60,9 @@ namespace Octokit
/// Gets all API resources in the list at the specified URI.
///
/// Type of the API resource in the list.
- /// URI of the API resource to get.
- /// Parameters to add to the API request.
- /// Accept header to use for the API request.
+ /// URI of the API resource to get
+ /// Parameters to add to the API request
+ /// Accept header to use for the API request
/// of the The API resources in the list.
/// Thrown when an API error occurs.
Task> GetAll(Uri uri, IDictionary parameters, string accepts);
@@ -71,8 +71,8 @@ namespace Octokit
/// Creates a new API resource in the list at the specified URI.
///
/// The API resource's type.
- /// URI of the API resource to get.
- /// Object that describes the new API resource; this will be serialized and used as the request's body.
+ /// URI of the API resource to get
+ /// Object that describes the new API resource; this will be serialized and used as the request's body
/// The created API resource.
/// Thrown when an API error occurs.
Task Post(Uri uri, object data);
@@ -81,9 +81,9 @@ namespace Octokit
/// Creates a new API resource in the list at the specified URI.
///
/// The API resource's type.
- /// URI of the API resource to get.
- /// Object that describes the new API resource; this will be serialized and used as the request's body.
- /// Accept header to use for the API request.
+ /// URI of the API resource to get
+ /// Object that describes the new API resource; this will be serialized and used as the request's body
+ /// Accept header to use for the API request
/// The created API resource.
/// Thrown when an API error occurs.
Task Post(Uri uri, object data, string accepts);
@@ -92,10 +92,10 @@ namespace Octokit
/// Creates a new API resource in the list at the specified URI.
///
/// The API resource's type.
- /// URI of the API resource to get.
- /// Object that describes the new API resource; this will be serialized and used as the request's body.
- /// Accept header to use for the API request.
- /// Content type of the API request.
+ /// URI of the API resource to get
+ /// Object that describes the new API resource; this will be serialized and used as the request's body
+ /// Accept header to use for the API request
+ /// Content type of the API request
/// The created API resource.
/// Thrown when an API error occurs.
Task Post(Uri uri, object data, string accepts, string contentType);
@@ -104,8 +104,8 @@ namespace Octokit
/// Creates or replaces the API resource at the specified URI.
///
/// The API resource's type.
- /// URI of the API resource to create or replace.
- /// Object that describes the API resource; this will be serialized and used as the request's body.
+ /// URI of the API resource to create or replace
+ /// Object that describes the API resource; this will be serialized and used as the request's body
/// The created API resource.
/// Thrown when an API error occurs.
Task Put(Uri uri, object data);
@@ -114,9 +114,9 @@ namespace Octokit
/// Creates or replaces the API resource at the specified URI.
///
/// The API resource's type.
- /// URI of the API resource to create or replace.
- /// Object that describes the API resource; this will be serialized and used as the request's body.
- /// The two-factor authentication code in response to the current user's previous challenge.
+ /// URI of the API resource to create or replace
+ /// Object that describes the API resource; this will be serialized and used as the request's body
+ /// The two-factor authentication code in response to the current user's previous challenge
/// The created API resource.
/// Thrown when an API error occurs.
Task Put(Uri uri, object data, string twoFactorAuthenticationCode);
@@ -125,8 +125,8 @@ namespace Octokit
/// Updates the API resource at the specified URI.
///
/// The API resource's type.
- /// URI of the API resource to update.
- /// /// Object that describes the API resource; this will be serialized and used as the request's body.
+ /// URI of the API resource to update
+ /// /// Object that describes the API resource; this will be serialized and used as the request's body
/// The updated API resource.
/// Thrown when an API error occurs.
Task Patch(Uri uri, object data);
@@ -134,7 +134,7 @@ namespace Octokit
///
/// Deletes the API object at the specified URI.
///
- /// URI of the API resource to delete.
+ /// URI of the API resource to delete
/// A for the request's execution.
Task Delete(Uri uri);
}
diff --git a/Octokit/Http/IConnection.cs b/Octokit/Http/IConnection.cs
index 548da217..6d513ba8 100644
--- a/Octokit/Http/IConnection.cs
+++ b/Octokit/Http/IConnection.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Net;
using System.Threading.Tasks;
namespace Octokit
@@ -13,7 +14,7 @@ namespace Octokit
Task> PutAsync(Uri uri, object body);
Task> PutAsync(Uri uri, object body, string twoFactorAuthenticationCode);
- Task DeleteAsync(Uri uri);
+ Task