diff --git a/Octokit.Reactive/Clients/IObservableIssuesClient.cs b/Octokit.Reactive/Clients/IObservableIssuesClient.cs
index d9ca53a3..26efd33d 100644
--- a/Octokit.Reactive/Clients/IObservableIssuesClient.cs
+++ b/Octokit.Reactive/Clients/IObservableIssuesClient.cs
@@ -42,7 +42,7 @@ namespace Octokit.Reactive
/// The owner of the repository
/// The name of the repository
/// The issue number
- ///
+ /// A signal containing the requested s.
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
IObservable Get(string owner, string name, int number);
@@ -55,9 +55,21 @@ namespace Octokit.Reactive
/// Issues are sorted by the create date descending.
/// http://developer.github.com/v3/issues/#list-issues
///
- ///
+ /// A signal containing one or more s.
IObservable GetAllForCurrent();
+ ///
+ /// Gets all open issues assigned to the authenticated user across all the authenticated user’s visible
+ /// repositories including owned repositories, member repositories, and organization repositories.
+ ///
+ /// Options for changing the API response
+ ///
+ /// Issues are sorted by the create date descending.
+ /// http://developer.github.com/v3/issues/#list-issues
+ ///
+ /// A signal containing one or more s.
+ IObservable GetAllForCurrent(ApiOptions options);
+
///
/// Gets all issues across all the authenticated user’s visible repositories including owned repositories,
/// member repositories, and organization repositories.
@@ -66,9 +78,21 @@ namespace Octokit.Reactive
/// http://developer.github.com/v3/issues/#list-issues
///
/// Used to filter and sort the list of issues returned
- ///
+ /// A signal containing one or more s.
IObservable GetAllForCurrent(IssueRequest request);
+ ///
+ /// Gets all issues across all the authenticated user’s visible repositories including owned repositories,
+ /// member repositories, and organization repositories.
+ ///
+ ///
+ /// http://developer.github.com/v3/issues/#list-issues
+ ///
+ /// Used to filter and sort the list of issues returned
+ /// Options for changing the API response
+ /// A signal containing one or more s.
+ IObservable GetAllForCurrent(IssueRequest request, ApiOptions options);
+
///
/// Gets all open issues assigned to the authenticated user across owned and member repositories for the
/// authenticated user.
@@ -77,9 +101,21 @@ namespace Octokit.Reactive
/// Issues are sorted by the create date descending.
/// http://developer.github.com/v3/issues/#list-issues
///
- ///
+ /// A signal containing one or more s.
IObservable GetAllForOwnedAndMemberRepositories();
+ ///
+ /// Gets all open issues assigned to the authenticated user across owned and member repositories for the
+ /// authenticated user.
+ ///
+ /// Options for changing the API response
+ ///
+ /// Issues are sorted by the create date descending.
+ /// http://developer.github.com/v3/issues/#list-issues
+ ///
+ /// A signal containing one or more s.
+ IObservable GetAllForOwnedAndMemberRepositories(ApiOptions options);
+
///
/// Gets all issues across owned and member repositories for the authenticated user.
///
@@ -87,9 +123,20 @@ namespace Octokit.Reactive
/// http://developer.github.com/v3/issues/#list-issues
///
/// Used to filter and sort the list of issues returned
- ///
+ /// A signal containing one or more s.
IObservable GetAllForOwnedAndMemberRepositories(IssueRequest request);
+ ///
+ /// Gets all issues across owned and member repositories for the authenticated user.
+ ///
+ ///
+ /// http://developer.github.com/v3/issues/#list-issues
+ ///
+ /// Used to filter and sort the list of issues returned
+ /// Options for changing the API response
+ /// A signal containing one or more s.
+ IObservable GetAllForOwnedAndMemberRepositories(IssueRequest request, ApiOptions options);
+
///
/// Gets all open issues assigned to the authenticated user for a given organization for the authenticated user.
///
@@ -97,9 +144,20 @@ namespace Octokit.Reactive
/// http://developer.github.com/v3/issues/#list-issues
///
/// The name of the organization
- ///
+ /// A signal containing one or more s.
IObservable GetAllForOrganization(string organization);
+ ///
+ /// Gets all open issues assigned to the authenticated user for a given organization for the authenticated user.
+ ///
+ ///
+ /// http://developer.github.com/v3/issues/#list-issues
+ ///
+ /// The name of the organization
+ /// Options for changing the API response
+ /// A signal containing one or more s.
+ IObservable GetAllForOrganization(string organization, ApiOptions options);
+
///
/// Gets all issues for a given organization for the authenticated user.
///
@@ -108,9 +166,21 @@ namespace Octokit.Reactive
///
/// The name of the organization
/// Used to filter and sort the list of issues returned
- ///
+ /// A signal containing one or more s.
IObservable GetAllForOrganization(string organization, IssueRequest request);
+ ///
+ /// Gets all issues for a given organization for the authenticated user.
+ ///
+ ///
+ /// http://developer.github.com/v3/issues/#list-issues
+ ///
+ /// The name of the organization
+ /// Used to filter and sort the list of issues returned
+ /// Options for changing the API response
+ /// A signal containing one or more s.
+ IObservable GetAllForOrganization(string organization, IssueRequest request, ApiOptions options);
+
///
/// Gets all open issues assigned to the authenticated user for the repository.
///
@@ -119,9 +189,21 @@ namespace Octokit.Reactive
///
/// The owner of the repository
/// The name of the repository
- ///
+ /// A signal containing one or more s.
IObservable GetAllForRepository(string owner, string name);
+ ///
+ /// Gets all open issues assigned to the authenticated user for the repository.
+ ///
+ ///
+ /// http://developer.github.com/v3/issues/#list-issues-for-a-repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Options for changing the API response
+ /// A signal containing one or more s.
+ IObservable GetAllForRepository(string owner, string name, ApiOptions options);
+
///
/// Gets issues for a repository.
///
@@ -131,9 +213,22 @@ namespace Octokit.Reactive
/// The owner of the repository
/// The name of the repository
/// Used to filter and sort the list of issues returned
- ///
+ /// A signal containing one or more s.
IObservable GetAllForRepository(string owner, string name, RepositoryIssueRequest request);
+ ///
+ /// Gets issues for a repository.
+ ///
+ ///
+ /// http://developer.github.com/v3/issues/#list-issues-for-a-repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Used to filter and sort the list of issues returned
+ /// Options for changing the API response
+ /// A signal containing one or more s.
+ IObservable GetAllForRepository(string owner, string name, RepositoryIssueRequest request, ApiOptions options);
+
///
/// Creates an issue for the specified repository. Any user with pull access to a repository can create an
/// issue.
@@ -142,7 +237,7 @@ namespace Octokit.Reactive
/// The owner of the repository
/// The name of the repository
/// A instance describing the new issue to create
- ///
+ /// A signal containing the new .
IObservable Create(string owner, string name, NewIssue newIssue);
///
@@ -155,18 +250,18 @@ namespace Octokit.Reactive
/// The issue number
/// An instance describing the changes to make to the issue
///
- ///
+ /// A signal containing the updated .
IObservable Update(string owner, string name, int number, IssueUpdate issueUpdate);
-
- ///
- /// Locks an issue for the specified repository. Issue owners and users with push access can lock an issue.
- ///
- /// https://developer.github.com/v3/issues/#lock-an-issue
- /// The owner of the repository
- /// The name of the repository
- /// The issue number
- ///
- IObservable Lock(string owner, string name, int number);
+
+ ///
+ /// Locks an issue for the specified repository. Issue owners and users with push access can lock an issue.
+ ///
+ /// https://developer.github.com/v3/issues/#lock-an-issue
+ /// The owner of the repository
+ /// The name of the repository
+ /// The issue number
+ /// A signal indicating completion.
+ IObservable Lock(string owner, string name, int number);
///
/// Unlocks an issue for the specified repository. Issue owners and users with push access can unlock an issue.
@@ -175,7 +270,7 @@ namespace Octokit.Reactive
/// The owner of the repository
/// The name of the repository
/// The issue number
- ///
+ /// A signal indicating completion.
IObservable Unlock(string owner, string name, int number);
}
}
\ No newline at end of file
diff --git a/Octokit.Reactive/Clients/IObservableNotificationsClient.cs b/Octokit.Reactive/Clients/IObservableNotificationsClient.cs
index aa2df53e..709f902e 100644
--- a/Octokit.Reactive/Clients/IObservableNotificationsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableNotificationsClient.cs
@@ -14,28 +14,74 @@ namespace Octokit.Reactive
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable GetAllForCurrent();
+ ///
+ /// Retrieves all of the s for the current user.
+ ///
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated.
+ /// A of .
+ [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
+ IObservable GetAllForCurrent(ApiOptions options);
+
///
/// Retrieves all of the s for the current user specific to the specified repository.
///
+ /// The owner of the repository.
+ /// The name of the repository.
/// Thrown if the client is not authenticated.
/// A of .
IObservable GetAllForRepository(string owner, string name);
+ ///
+ /// Retrieves all of the s for the current user specific to the specified repository.
+ ///
+ /// The owner of the repository.
+ /// The name of the repository.
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated.
+ /// A of .
+ IObservable GetAllForRepository(string owner, string name, ApiOptions options);
+
///
/// Retrieves all of the s for the current user.
///
+ /// Specifies the parameters to filter notifications by
/// Thrown if the client is not authenticated.
/// A of .
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable GetAllForCurrent(NotificationsRequest request);
+ ///
+ /// Retrieves all of the s for the current user.
+ ///
+ /// Specifies the parameters to filter notifications by
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated.
+ /// A of .
+ [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
+ IObservable GetAllForCurrent(NotificationsRequest request, ApiOptions options);
+
///
/// Retrieves all of the s for the current user specific to the specified repository.
///
+ /// The owner of the repository.
+ /// The name of the repository.
+ /// Specifies the parameters to filter notifications by
/// Thrown if the client is not authenticated.
/// A of .
IObservable GetAllForRepository(string owner, string name, NotificationsRequest request);
+ ///
+ /// Retrieves all of the s for the current user specific to the specified repository.
+ ///
+ /// The owner of the repository.
+ /// The name of the repository.
+ /// Specifies the parameters to filter notifications by
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated.
+ /// A of .
+ IObservable GetAllForRepository(string owner, string name, NotificationsRequest request, ApiOptions options);
+
///
/// Marks all notifications as read.
///
@@ -65,10 +111,10 @@ namespace Octokit.Reactive
///
/// The owner of the repository
/// The name of the repository
- /// The parameter which specifies which notifications to mark.
+ /// The parameter which specifies which notifications to mark.
/// http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository
///
- IObservable MarkAsReadForRepository(string owner, string name, MarkAsReadRequest markAsRead);
+ IObservable MarkAsReadForRepository(string owner, string name, MarkAsReadRequest markAsReadRequest);
///
/// Retrives a single by Id.
diff --git a/Octokit.Reactive/Clients/IObservableOrganizationMembersClient.cs b/Octokit.Reactive/Clients/IObservableOrganizationMembersClient.cs
index 5d15d246..8d77cad6 100644
--- a/Octokit.Reactive/Clients/IObservableOrganizationMembersClient.cs
+++ b/Octokit.Reactive/Clients/IObservableOrganizationMembersClient.cs
@@ -27,6 +27,29 @@ namespace Octokit.Reactive
///
IObservable GetAll(string org);
+ ///
+ ///
+ /// 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
+ /// Options for changing the API response
+ ///
+ IObservable GetAll(string org, ApiOptions options);
+
///
///
/// List all users who are members of an organization. A member is a user that
@@ -50,6 +73,30 @@ namespace Octokit.Reactive
///
IObservable GetAll(string org, OrganizationMembersFilter filter);
+ ///
+ ///
+ /// 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
+ /// The members filter,
+ /// Options for changing the API response
+ ///
+ IObservable GetAll(string org, OrganizationMembersFilter filter, ApiOptions options);
+
///
///
/// List all users who are members of an organization. A member is a user that
@@ -73,6 +120,30 @@ namespace Octokit.Reactive
///
IObservable GetAll(string org, OrganizationMembersRole role);
+ ///
+ ///
+ /// 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
+ /// The role filter to use when getting the users,
+ /// Options for changing the API response
+ ///
+ IObservable GetAll(string org, OrganizationMembersRole role, ApiOptions options);
+
///
///
/// List all users who are members of an organization. A member is a user that
@@ -97,6 +168,31 @@ namespace Octokit.Reactive
///
IObservable GetAll(string org, OrganizationMembersFilter filter, OrganizationMembersRole role);
+ ///
+ ///
+ /// 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
+ /// The members filter,
+ /// The role filter to use when getting the users,
+ /// Options for changing the API response
+ ///
+ IObservable GetAll(string org, OrganizationMembersFilter filter, OrganizationMembersRole role, ApiOptions options);
+
///
/// List all users who have publicized their membership of the organization.
///
@@ -105,6 +201,15 @@ namespace Octokit.Reactive
///
IObservable GetAllPublic(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
+ /// Options for changing the API response
+ ///
+ IObservable GetAllPublic(string org, ApiOptions options);
+
///
/// Check if a user is, publicly or privately, a member of the organization.
///
diff --git a/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs b/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs
index f36bb44a..fb9efd7f 100644
--- a/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs
@@ -32,6 +32,15 @@ namespace Octokit.Reactive
Justification = "Method makes a network request")]
IObservable GetAllForCurrent();
+ ///
+ /// Returns all the organizations for the current user.
+ ///
+ /// Options for changing the API response
+ ///
+ [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate",
+ Justification = "Method makes a network request")]
+ IObservable GetAllForCurrent(ApiOptions options);
+
///
/// Returns all the organizations for the specified user
///
@@ -39,6 +48,14 @@ namespace Octokit.Reactive
///
IObservable GetAll(string user);
+ ///
+ /// Returns all the organizations for the specified user
+ ///
+ /// The login for the user
+ /// Options for changing the API response
+ ///
+ IObservable GetAll(string user, ApiOptions options);
+
///
/// Update the specified organization with data from .
///
diff --git a/Octokit.Reactive/Clients/IObservableStarredClient.cs b/Octokit.Reactive/Clients/IObservableStarredClient.cs
index a1c5c9f6..8938e244 100644
--- a/Octokit.Reactive/Clients/IObservableStarredClient.cs
+++ b/Octokit.Reactive/Clients/IObservableStarredClient.cs
@@ -13,6 +13,16 @@ namespace Octokit.Reactive
/// A of s starring the passed repository
IObservable GetAllStargazers(string owner, string name);
+ ///
+ /// Retrieves all of the stargazers for the passed repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated
+ /// A of s starring the passed repository
+ IObservable GetAllStargazers(string owner, string name, ApiOptions options);
+
///
/// Retrieves all of the stargazers for the passed repository with star creation timestamps.
///
@@ -22,6 +32,16 @@ namespace Octokit.Reactive
/// A of s starring the passed repository with star creation timestamps.
IObservable GetAllStargazersWithTimestamps(string owner, string name);
+ ///
+ /// Retrieves all of the stargazers for the passed repository with star creation timestamps.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated.
+ /// A of s starring the passed repository with star creation timestamps.
+ IObservable GetAllStargazersWithTimestamps(string owner, string name, ApiOptions options);
+
///
/// Retrieves all of the starred (ies) for the current user
///
@@ -30,6 +50,15 @@ namespace Octokit.Reactive
/// A of (ies) starred by the current user
///
IObservable GetAllForCurrent();
+
+ ///
+ /// Retrieves all of the starred (ies) for the current user
+ ///
+ /// Thrown if the client is not authenticated
+ ///
+ /// A of (ies) starred by the current user
+ ///
+ IObservable GetAllForCurrent(ApiOptions options);
///
/// Retrieves all of the starred (ies) for the current user with star creation timestamps.
@@ -39,6 +68,15 @@ namespace Octokit.Reactive
/// A of (ies) starred by the current authenticated user with star creation timestamps.
///
IObservable GetAllForCurrentWithTimestamps();
+
+ ///
+ /// Retrieves all of the starred (ies) for the current user with star creation timestamps.
+ ///
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the current authenticated user with star creation timestamps.
+ ///
+ IObservable GetAllForCurrentWithTimestamps(ApiOptions options);
///
/// Retrieves all of the starred (ies) for the current user
@@ -51,6 +89,18 @@ namespace Octokit.Reactive
///
IObservable GetAllForCurrent(StarredRequest request);
+ ///
+ /// Retrieves all of the starred (ies) for the current user
+ ///
+ /// Star-specific request parameters that sort the results
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated
+ ///
+ /// A of (ies) starred by the current user,
+ /// sorted according to the passed request parameters
+ ///
+ IObservable GetAllForCurrent(StarredRequest request, ApiOptions options);
+
///
/// Retrieves all of the starred (ies) for the current user with star creation timestamps.
///
@@ -62,6 +112,18 @@ namespace Octokit.Reactive
///
IObservable GetAllForCurrentWithTimestamps(StarredRequest request);
+ ///
+ /// Retrieves all of the starred (ies) for the current user with star creation timestamps.
+ ///
+ /// Star-specific request parameters that sort the results
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the current user,
+ /// sorted according to the passed request parameters and with star creation timestamps.
+ ///
+ IObservable GetAllForCurrentWithTimestamps(StarredRequest request, ApiOptions options);
+
///
/// Retrieves all of the (ies) starred by the specified user
///
@@ -70,6 +132,15 @@ namespace Octokit.Reactive
/// A starred by the specified user
IObservable GetAllForUser(string user);
+ ///
+ /// Retrieves all of the (ies) starred by the specified user
+ ///
+ /// The login of the user
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated
+ /// A starred by the specified user
+ IObservable GetAllForUser(string user, ApiOptions options);
+
///
/// Retrieves all of the (ies) starred by the specified user with star creation timestamps.
///
@@ -80,6 +151,17 @@ namespace Octokit.Reactive
///
IObservable GetAllForUserWithTimestamps(string user);
+ ///
+ /// Retrieves all of the (ies) starred by the specified user with star creation timestamps.
+ ///
+ /// The login of the user
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A (ies) starred by the specified user with star creation timestamps.
+ ///
+ IObservable GetAllForUserWithTimestamps(string user, ApiOptions options);
+
///
/// Retrieves all of the (ies) starred by the specified user
///
@@ -89,6 +171,16 @@ namespace Octokit.Reactive
/// A starred by the specified user
IObservable GetAllForUser(string user, StarredRequest request);
+ ///
+ /// Retrieves all of the (ies) starred by the specified user
+ ///
+ /// The login of the user
+ /// Star-specific request parameters that sort the results
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated
+ /// A starred by the specified user
+ IObservable GetAllForUser(string user, StarredRequest request, ApiOptions options);
+
///
/// Retrieves all of the (ies) starred by the specified user with star creation timestamps.
///
@@ -101,6 +193,19 @@ namespace Octokit.Reactive
///
IObservable GetAllForUserWithTimestamps(string user, StarredRequest request);
+ ///
+ /// Retrieves all of the (ies) starred by the specified user with star creation timestamps.
+ ///
+ /// The login of the user
+ /// Star-specific request parameters that sort the results
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the specified user,
+ /// sorted according to the passed request parameters and with star creation timestamps.
+ ///
+ IObservable GetAllForUserWithTimestamps(string user, StarredRequest request, ApiOptions options);
+
///
/// Check if a repository is starred by the current authenticated user
///
diff --git a/Octokit.Reactive/Clients/ObservableIssuesClient.cs b/Octokit.Reactive/Clients/ObservableIssuesClient.cs
index 007b743d..343c057d 100644
--- a/Octokit.Reactive/Clients/ObservableIssuesClient.cs
+++ b/Octokit.Reactive/Clients/ObservableIssuesClient.cs
@@ -55,7 +55,7 @@ namespace Octokit.Reactive
/// The owner of the repository
/// The name of the repository
/// The issue number
- ///
+ /// A signal containing the requested s.
public IObservable Get(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -72,10 +72,27 @@ namespace Octokit.Reactive
/// Issues are sorted by the create date descending.
/// http://developer.github.com/v3/issues/#list-issues
///
- ///
+ /// A signal containing one or more s.
public IObservable GetAllForCurrent()
{
- return GetAllForCurrent(new IssueRequest());
+ return GetAllForCurrent(ApiOptions.None);
+ }
+
+ ///
+ /// Gets all open issues assigned to the authenticated user across all the authenticated user’s visible
+ /// repositories including owned repositories, member repositories, and organization repositories.
+ ///
+ /// Options for changing the API response
+ ///
+ /// Issues are sorted by the create date descending.
+ /// http://developer.github.com/v3/issues/#list-issues
+ ///
+ /// A signal containing one or more s.
+ public IObservable GetAllForCurrent(ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(options, "options");
+
+ return GetAllForCurrent(new IssueRequest(), options);
}
///
@@ -86,12 +103,30 @@ namespace Octokit.Reactive
/// http://developer.github.com/v3/issues/#list-issues
///
/// Used to filter and sort the list of issues returned
- ///
+ /// A signal containing one or more s.
public IObservable GetAllForCurrent(IssueRequest request)
{
Ensure.ArgumentNotNull(request, "request");
- return _connection.GetAndFlattenAllPages(ApiUrls.Issues(), request.ToParametersDictionary());
+ return GetAllForCurrent(request, ApiOptions.None);
+ }
+
+ ///
+ /// Gets all issues across all the authenticated user’s visible repositories including owned repositories,
+ /// member repositories, and organization repositories.
+ ///
+ ///
+ /// http://developer.github.com/v3/issues/#list-issues
+ ///
+ /// Used to filter and sort the list of issues returned
+ /// Options for changing the API response
+ /// A signal containing one or more s.
+ public IObservable GetAllForCurrent(IssueRequest request, ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(request, "request");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Issues(), request.ToParametersDictionary(), options);
}
///
@@ -102,12 +137,29 @@ namespace Octokit.Reactive
/// Issues are sorted by the create date descending.
/// http://developer.github.com/v3/issues/#list-issues
///
- ///
+ /// A signal containing one or more s.
public IObservable GetAllForOwnedAndMemberRepositories()
{
return GetAllForOwnedAndMemberRepositories(new IssueRequest());
}
+ ///
+ /// Gets all open issues assigned to the authenticated user across owned and member repositories for the
+ /// authenticated user.
+ ///
+ ///
+ /// Issues are sorted by the create date descending.
+ /// http://developer.github.com/v3/issues/#list-issues
+ ///
+ /// Options for changing the API response
+ /// A signal containing one or more s.
+ public IObservable GetAllForOwnedAndMemberRepositories(ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(options, "options");
+
+ return GetAllForOwnedAndMemberRepositories(new IssueRequest(), options);
+ }
+
///
/// Gets all issues across owned and member repositories for the authenticated user.
///
@@ -115,12 +167,29 @@ namespace Octokit.Reactive
/// http://developer.github.com/v3/issues/#list-issues
///
/// Used to filter and sort the list of issues returned
- ///
+ /// A signal containing one or more s.
public IObservable GetAllForOwnedAndMemberRepositories(IssueRequest request)
{
Ensure.ArgumentNotNull(request, "request");
- return _connection.GetAndFlattenAllPages(ApiUrls.IssuesForOwnedAndMember(), request.ToParametersDictionary());
+ return GetAllForOwnedAndMemberRepositories(request, ApiOptions.None);
+ }
+
+ ///
+ /// Gets all issues across owned and member repositories for the authenticated user.
+ ///
+ ///
+ /// http://developer.github.com/v3/issues/#list-issues
+ ///
+ /// Used to filter and sort the list of issues returned
+ /// Options for changing the API response
+ /// A signal containing one or more s.
+ public IObservable GetAllForOwnedAndMemberRepositories(IssueRequest request, ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(request, "request");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.IssuesForOwnedAndMember(), request.ToParametersDictionary(), options);
}
///
@@ -130,10 +199,29 @@ namespace Octokit.Reactive
/// http://developer.github.com/v3/issues/#list-issues
///
/// The name of the organization
- ///
+ /// A signal containing one or more s.
public IObservable GetAllForOrganization(string organization)
{
- return GetAllForOrganization(organization, new IssueRequest());
+ Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
+
+ return GetAllForOrganization(organization, ApiOptions.None);
+ }
+
+ ///
+ /// Gets all open issues assigned to the authenticated user for a given organization for the authenticated user.
+ ///
+ ///
+ /// http://developer.github.com/v3/issues/#list-issues
+ ///
+ /// The name of the organization
+ /// Options for changing the API response
+ /// A signal containing one or more s.
+ public IObservable GetAllForOrganization(string organization, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return GetAllForOrganization(organization, new IssueRequest(), options);
}
///
@@ -144,13 +232,32 @@ namespace Octokit.Reactive
///
/// The name of the organization
/// Used to filter and sort the list of issues returned
- ///
+ /// A signal containing one or more s.
public IObservable GetAllForOrganization(string organization, IssueRequest request)
{
Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
Ensure.ArgumentNotNull(request, "request");
- return _connection.GetAndFlattenAllPages(ApiUrls.Issues(organization), request.ToParametersDictionary());
+ return GetAllForOrganization(organization, request, ApiOptions.None);
+ }
+
+ ///
+ /// Gets all issues for a given organization for the authenticated user.
+ ///
+ ///
+ /// http://developer.github.com/v3/issues/#list-issues
+ ///
+ /// The name of the organization
+ /// Used to filter and sort the list of issues returned
+ /// Options for changing the API response
+ /// A signal containing one or more s.
+ public IObservable GetAllForOrganization(string organization, IssueRequest request, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
+ Ensure.ArgumentNotNull(request, "request");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Issues(organization), request.ToParametersDictionary(), options);
}
///
@@ -161,10 +268,32 @@ namespace Octokit.Reactive
///
/// The owner of the repository
/// The name of the repository
- ///
+ /// A signal containing one or more s.
public IObservable GetAllForRepository(string owner, string name)
{
- return GetAllForRepository(owner, name, new RepositoryIssueRequest());
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
+ return GetAllForRepository(owner, name, ApiOptions.None);
+ }
+
+ ///
+ /// Gets all open issues assigned to the authenticated user for the repository.
+ ///
+ ///
+ /// http://developer.github.com/v3/issues/#list-issues-for-a-repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Options for changing the API response
+ /// A signal containing one or more s.
+ public IObservable GetAllForRepository(string owner, string name, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return GetAllForRepository(owner, name, new RepositoryIssueRequest(), options);
}
///
@@ -176,14 +305,35 @@ namespace Octokit.Reactive
/// The owner of the repository
/// The name of the repository
/// Used to filter and sort the list of issues returned
- ///
+ /// A signal containing one or more s.
public IObservable GetAllForRepository(string owner, string name, RepositoryIssueRequest request)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(request, "request");
- return _connection.GetAndFlattenAllPages(ApiUrls.Issues(owner, name), request.ToParametersDictionary());
+ return GetAllForRepository(owner, name, request, ApiOptions.None);
+ }
+
+ ///
+ /// Gets issues for a repository.
+ ///
+ ///
+ /// http://developer.github.com/v3/issues/#list-issues-for-a-repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Used to filter and sort the list of issues returned
+ /// Options for changing the API response
+ /// A signal containing one or more s.
+ public IObservable GetAllForRepository(string owner, string name, RepositoryIssueRequest request, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(request, "request");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Issues(owner, name), request.ToParametersDictionary(), options);
}
///
@@ -194,7 +344,7 @@ namespace Octokit.Reactive
/// The owner of the repository
/// The name of the repository
/// A instance describing the new issue to create
- ///
+ /// A signal containing the new .
public IObservable Create(string owner, string name, NewIssue newIssue)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -214,7 +364,7 @@ namespace Octokit.Reactive
/// The issue number
/// An instance describing the changes to make to the issue
///
- ///
+ /// A signal containing the updated .
public IObservable Update(string owner, string name, int number, IssueUpdate issueUpdate)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -223,32 +373,32 @@ namespace Octokit.Reactive
return _client.Update(owner, name, number, issueUpdate).ToObservable();
}
-
- ///
- /// Locks an issue for the specified repository. Issue owners and users with push access can lock an issue.
- ///
- /// https://developer.github.com/v3/issues/#lock-an-issue
- /// The owner of the repository
- /// The name of the repository
- /// The issue number
- ///
- public IObservable Lock(string owner, string name, int number)
+
+ ///
+ /// Locks an issue for the specified repository. Issue owners and users with push access can lock an issue.
+ ///
+ /// https://developer.github.com/v3/issues/#lock-an-issue
+ /// The owner of the repository
+ /// The name of the repository
+ /// The issue number
+ /// A signal indicating completion.
+ public IObservable Lock(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return _client.Lock(owner, name, number).ToObservable();
}
-
- ///
- /// Unlocks an issue for the specified repository. Issue owners and users with push access can unlock an issue.
- ///
- /// https://developer.github.com/v3/issues/#unlock-an-issue
- /// The owner of the repository
- /// The name of the repository
- /// The issue number
- ///
- public IObservable Unlock(string owner, string name, int number)
+
+ ///
+ /// Unlocks an issue for the specified repository. Issue owners and users with push access can unlock an issue.
+ ///
+ /// https://developer.github.com/v3/issues/#unlock-an-issue
+ /// The owner of the repository
+ /// The name of the repository
+ /// The issue number
+ /// A signal indicating completion.
+ public IObservable Unlock(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
diff --git a/Octokit.Reactive/Clients/ObservableNotificationsClient.cs b/Octokit.Reactive/Clients/ObservableNotificationsClient.cs
index 1ba1bf72..775c636e 100644
--- a/Octokit.Reactive/Clients/ObservableNotificationsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableNotificationsClient.cs
@@ -25,35 +25,88 @@ namespace Octokit.Reactive
/// A of .
public IObservable GetAllForCurrent()
{
- return _connection.GetAndFlattenAllPages(ApiUrls.Notifications());
+ return GetAllForCurrent(ApiOptions.None);
}
-
///
/// Retrieves all of the s for the current user.
///
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated.
+ /// A of .
+ public IObservable GetAllForCurrent(ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Notifications(), options);
+ }
+
+ ///
+ /// Retrieves all of the s for the current user specific to the specified repository.
+ ///
+ /// The owner of the repository.
+ /// The name of the repository.
+ /// Thrown if the client is not authenticated.
+ /// A of .
+ public IObservable GetAllForRepository(string owner, string name)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
+ return GetAllForRepository(owner, name, ApiOptions.None);
+ }
+
+ ///
+ /// Retrieves all of the s for the current user specific to the specified repository.
+ ///
+ /// The owner of the repository.
+ /// The name of the repository.
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated.
+ /// A of .
+ public IObservable GetAllForRepository(string owner, string name, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Notifications(owner, name), options);
+ }
+
+ ///
+ /// Retrieves all of the s for the current user.
+ ///
+ /// Specifies the parameters to filter notifications by
/// Thrown if the client is not authenticated.
/// A of .
public IObservable GetAllForCurrent(NotificationsRequest request)
{
Ensure.ArgumentNotNull(request, "request");
- return _connection.GetAndFlattenAllPages(ApiUrls.Notifications(), request.ToParametersDictionary());
+ return GetAllForCurrent(request, ApiOptions.None);
}
///
- /// Retrieves all of the s for the current user specific to the specified repository.
+ /// Retrieves all of the s for the current user.
///
+ /// Specifies the parameters to filter notifications by
+ /// Options for changing the API response
/// Thrown if the client is not authenticated.
- /// A of .
- public IObservable GetAllForRepository(string owner, string name)
+ /// A of .
+ public IObservable GetAllForCurrent(NotificationsRequest request, ApiOptions options)
{
- return _connection.GetAndFlattenAllPages(ApiUrls.Notifications(owner, name));
+ Ensure.ArgumentNotNull(request, "request");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Notifications(), request.ToParametersDictionary(), options);
}
///
/// Retrieves all of the s for the current user specific to the specified repository.
///
+ /// The owner of the repository.
+ /// The name of the repository.
+ /// Specifies the parameters to filter notifications by
/// Thrown if the client is not authenticated.
/// A of .
public IObservable GetAllForRepository(string owner, string name, NotificationsRequest request)
@@ -62,7 +115,26 @@ namespace Octokit.Reactive
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(request, "request");
- return _connection.GetAndFlattenAllPages(ApiUrls.Notifications(owner, name), request.ToParametersDictionary());
+ return GetAllForRepository(owner, name, request, ApiOptions.None);
+ }
+
+ ///
+ /// Retrieves all of the s for the current user specific to the specified repository.
+ ///
+ /// The owner of the repository.
+ /// The name of the repository.
+ /// Specifies the parameters to filter notifications by
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated.
+ /// A of .
+ public IObservable GetAllForRepository(string owner, string name, NotificationsRequest request, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(request, "request");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Notifications(owner, name), request.ToParametersDictionary(), options);
}
///
@@ -83,6 +155,8 @@ namespace Octokit.Reactive
///
public IObservable MarkAsRead(MarkAsReadRequest markAsReadRequest)
{
+ Ensure.ArgumentNotNull(markAsReadRequest, "markAsReadRequest");
+
return _notificationsClient.MarkAsRead(markAsReadRequest).ToObservable();
}
@@ -95,6 +169,9 @@ namespace Octokit.Reactive
///
public IObservable MarkAsReadForRepository(string owner, string name)
{
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
return _notificationsClient.MarkAsReadForRepository(owner, name).ToObservable();
}
@@ -103,12 +180,16 @@ namespace Octokit.Reactive
///
/// The owner of the repository
/// The name of the repository
- /// The parameter which specifies which notifications to mark.
+ /// The parameter which specifies which notifications to mark.
/// http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository
///
- public IObservable MarkAsReadForRepository(string owner, string name, MarkAsReadRequest markAsRead)
+ public IObservable MarkAsReadForRepository(string owner, string name, MarkAsReadRequest markAsReadRequest)
{
- return _notificationsClient.MarkAsReadForRepository(owner, name, markAsRead).ToObservable();
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(markAsReadRequest, "markAsReadRequest");
+
+ return _notificationsClient.MarkAsReadForRepository(owner, name, markAsReadRequest).ToObservable();
}
///
@@ -153,6 +234,8 @@ namespace Octokit.Reactive
///
public IObservable SetThreadSubscription(int id, NewThreadSubscription threadSubscription)
{
+ Ensure.ArgumentNotNull(threadSubscription, "threadSubscription");
+
return _notificationsClient.SetThreadSubscription(id, threadSubscription).ToObservable();
}
diff --git a/Octokit.Reactive/Clients/ObservableOrganizationMembersClient.cs b/Octokit.Reactive/Clients/ObservableOrganizationMembersClient.cs
index 0bb84d35..56bde28b 100644
--- a/Octokit.Reactive/Clients/ObservableOrganizationMembersClient.cs
+++ b/Octokit.Reactive/Clients/ObservableOrganizationMembersClient.cs
@@ -46,7 +46,36 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNullOrEmptyString(org, "org");
- return _connection.GetAndFlattenAllPages(ApiUrls.Members(org));
+ return GetAll(org, ApiOptions.None);
+ }
+
+ ///
+ ///
+ /// 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
+ /// Options for changing the API response
+ ///
+ public IObservable GetAll(string org, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(org, "org");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Members(org), options);
}
///
@@ -74,7 +103,37 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNullOrEmptyString(org, "org");
- return _connection.GetAndFlattenAllPages(ApiUrls.Members(org, filter));
+ return GetAll(org, filter, ApiOptions.None);
+ }
+
+ ///
+ ///
+ /// 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
+ /// The members filter,
+ /// Options for changing the API response
+ ///
+ public IObservable GetAll(string org, OrganizationMembersFilter filter, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(org, "org");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Members(org, filter), options);
}
///
@@ -102,7 +161,37 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNullOrEmptyString(org, "org");
- return _connection.GetAndFlattenAllPages(ApiUrls.Members(org, role));
+ return GetAll(org, role, ApiOptions.None);
+ }
+
+ ///
+ ///
+ /// 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
+ /// The role filter to use when getting the users,
+ /// Options for changing the API response
+ ///
+ public IObservable GetAll(string org, OrganizationMembersRole role, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(org, "org");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Members(org, role), options);
}
///
@@ -131,7 +220,38 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNullOrEmptyString(org, "org");
- return _connection.GetAndFlattenAllPages(ApiUrls.Members(org, filter, role));
+ return GetAll(org, filter, role, ApiOptions.None);
+ }
+
+ ///
+ ///
+ /// 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
+ /// The members filter,
+ /// The role filter to use when getting the users,
+ /// Options for changing the API response
+ ///
+ public IObservable GetAll(string org, OrganizationMembersFilter filter, OrganizationMembersRole role, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(org, "org");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Members(org, filter, role), options);
}
///
@@ -144,7 +264,22 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNullOrEmptyString(org, "org");
- return _connection.GetAndFlattenAllPages(ApiUrls.PublicMembers(org));
+ return GetAllPublic(org, ApiOptions.None);
+ }
+
+ ///
+ /// 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
+ /// Options for changing the API response
+ ///
+ public IObservable GetAllPublic(string org, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(org, "org");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.PublicMembers(org), options);
}
///
diff --git a/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs b/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs
index 64afff9d..ff5b3101 100644
--- a/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs
@@ -52,6 +52,18 @@ namespace Octokit.Reactive
///
public IObservable GetAllForCurrent()
{
+ return GetAllForCurrent(ApiOptions.None);
+ }
+
+ ///
+ /// Returns all the organizations for the current user.
+ ///
+ /// Options for changing the API response
+ ///
+ public IObservable GetAllForCurrent(ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(options, "options");
+
return _connection.GetAndFlattenAllPages(ApiUrls.Organizations());
}
@@ -67,6 +79,20 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages(ApiUrls.Organizations(user));
}
+ ///
+ /// Returns all the organizations for the specified user
+ ///
+ /// The login for the user
+ /// Options for changing the API response
+ ///
+ public IObservable GetAll(string user, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Organizations(user), options);
+ }
+
///
/// Update the specified organization with data from .
///
@@ -76,6 +102,9 @@ namespace Octokit.Reactive
/// A
public IObservable Update(string organizationName, OrganizationUpdate updateRequest)
{
+ Ensure.ArgumentNotNullOrEmptyString(organizationName, "organizationName");
+ Ensure.ArgumentNotNull(updateRequest, "updateRequest");
+
return _client.Update(organizationName, updateRequest).ToObservable();
}
}
diff --git a/Octokit.Reactive/Clients/ObservableStarredClient.cs b/Octokit.Reactive/Clients/ObservableStarredClient.cs
index 9f09031f..58e59940 100644
--- a/Octokit.Reactive/Clients/ObservableStarredClient.cs
+++ b/Octokit.Reactive/Clients/ObservableStarredClient.cs
@@ -29,7 +29,24 @@ namespace Octokit.Reactive
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
- return _connection.GetAndFlattenAllPages(ApiUrls.Stargazers(owner, name));
+ return GetAllStargazers(owner, name, ApiOptions.None);
+ }
+
+ ///
+ /// Retrieves all of the stargazers for the passed repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated
+ /// A of s starring the passed repository
+ public IObservable GetAllStargazers(string owner, string name, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Stargazers(owner, name), options);
}
///
@@ -44,7 +61,24 @@ namespace Octokit.Reactive
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
- return _connection.GetAndFlattenAllPages(ApiUrls.Stargazers(owner, name), null, AcceptHeaders.StarCreationTimestamps);
+ return GetAllStargazersWithTimestamps(owner, name, ApiOptions.None);
+ }
+
+ ///
+ /// Retrieves all of the stargazers for the passed repository with star creation timestamps.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated.
+ /// A of s starring the passed repository with star creation timestamps.
+ public IObservable GetAllStargazersWithTimestamps(string owner, string name, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Stargazers(owner, name), null, AcceptHeaders.StarCreationTimestamps, options);
}
///
@@ -56,7 +90,21 @@ namespace Octokit.Reactive
///
public IObservable GetAllForCurrent()
{
- return _connection.GetAndFlattenAllPages(ApiUrls.Starred());
+ return GetAllForCurrent(ApiOptions.None);
+ }
+
+ ///
+ /// Retrieves all of the starred (ies) for the current user
+ ///
+ /// Thrown if the client is not authenticated
+ ///
+ /// A of (ies) starred by the current user
+ ///
+ public IObservable GetAllForCurrent(ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Starred(), options);
}
///
@@ -68,7 +116,21 @@ namespace Octokit.Reactive
///
public IObservable GetAllForCurrentWithTimestamps()
{
- return _connection.GetAndFlattenAllPages(ApiUrls.Starred(), null, AcceptHeaders.StarCreationTimestamps);
+ return GetAllForCurrentWithTimestamps(ApiOptions.None);
+ }
+
+ ///
+ /// Retrieves all of the starred (ies) for the current user with star creation timestamps.
+ ///
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the current authenticated user with star creation timestamps.
+ ///
+ public IObservable GetAllForCurrentWithTimestamps(ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Starred(), null, AcceptHeaders.StarCreationTimestamps, options);
}
///
@@ -85,7 +147,25 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNull(request, "request");
- return _connection.GetAndFlattenAllPages(ApiUrls.Starred(), request.ToParametersDictionary());
+ return GetAllForCurrent(request, ApiOptions.None);
+ }
+
+ ///
+ /// Retrieves all of the starred (ies) for the current user
+ ///
+ /// Star-specific request parameters that sort the results
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated
+ ///
+ /// A of (ies) starred by the current user,
+ /// sorted according to the passed request parameters
+ ///
+ public IObservable GetAllForCurrent(StarredRequest request, ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(request, "request");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Starred(), request.ToParametersDictionary(), options);
}
///
@@ -102,7 +182,25 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNull(request, "request");
- return _connection.GetAndFlattenAllPages(ApiUrls.Starred(), request.ToParametersDictionary(), AcceptHeaders.StarCreationTimestamps);
+ return GetAllForCurrentWithTimestamps(request, ApiOptions.None);
+ }
+
+ ///
+ /// Retrieves all of the starred (ies) for the current user with star creation timestamps.
+ ///
+ /// Star-specific request parameters that sort the results
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the current user,
+ /// sorted according to the passed request parameters and with star creation timestamps.
+ ///
+ public IObservable GetAllForCurrentWithTimestamps(StarredRequest request, ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(request, "request");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Starred(), request.ToParametersDictionary(), AcceptHeaders.StarCreationTimestamps, options);
}
///
@@ -115,7 +213,22 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
- return _connection.GetAndFlattenAllPages(ApiUrls.StarredByUser(user));
+ return GetAllForUser(user, ApiOptions.None);
+ }
+
+ ///
+ /// Retrieves all of the (ies) starred by the specified user
+ ///
+ /// The login of the user
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated
+ /// A starred by the specified user
+ public IObservable GetAllForUser(string user, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.StarredByUser(user), options);
}
///
@@ -130,7 +243,24 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
- return _connection.GetAndFlattenAllPages(ApiUrls.StarredByUser(user), null, AcceptHeaders.StarCreationTimestamps);
+ return GetAllForUserWithTimestamps(user, ApiOptions.None);
+ }
+
+ ///
+ /// Retrieves all of the (ies) starred by the specified user with star creation timestamps.
+ ///
+ /// The login of the user
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A (ies) starred by the specified user with star creation timestamps.
+ ///
+ public IObservable GetAllForUserWithTimestamps(string user, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.StarredByUser(user), null, AcceptHeaders.StarCreationTimestamps, options);
}
///
@@ -146,7 +276,24 @@ namespace Octokit.Reactive
Ensure.ArgumentNotNullOrEmptyString(user, "user");
Ensure.ArgumentNotNull(request, "request");
- return _connection.GetAndFlattenAllPages(ApiUrls.StarredByUser(user), request.ToParametersDictionary());
+ return GetAllForUser(user, request, ApiOptions.None);
+ }
+
+ ///
+ /// Retrieves all of the (ies) starred by the specified user
+ ///
+ /// The login of the user
+ /// Star-specific request parameters that sort the results
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated
+ /// A starred by the specified user
+ public IObservable GetAllForUser(string user, StarredRequest request, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+ Ensure.ArgumentNotNull(request, "request");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.StarredByUser(user), request.ToParametersDictionary(), options);
}
///
@@ -165,7 +312,27 @@ namespace Octokit.Reactive
Ensure.ArgumentNotNullOrEmptyString(user, "user");
Ensure.ArgumentNotNull(request, "request");
- return _connection.GetAndFlattenAllPages(ApiUrls.StarredByUser(user), request.ToParametersDictionary(), AcceptHeaders.StarCreationTimestamps);
+ return GetAllForUserWithTimestamps(user, request, ApiOptions.None);
+ }
+
+ ///
+ /// Retrieves all of the (ies) starred by the specified user with star creation timestamps.
+ ///
+ /// The login of the user
+ /// Star-specific request parameters that sort the results
+ /// Options for changing the API response
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the specified user,
+ /// sorted according to the passed request parameters and with star creation timestamps.
+ ///
+ public IObservable GetAllForUserWithTimestamps(string user, StarredRequest request, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+ Ensure.ArgumentNotNull(request, "request");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.StarredByUser(user), request.ToParametersDictionary(), AcceptHeaders.StarCreationTimestamps, options);
}
///
diff --git a/Octokit.Tests.Integration/Clients/IssuesClientTests.cs b/Octokit.Tests.Integration/Clients/IssuesClientTests.cs
index eb12698c..8d076448 100644
--- a/Octokit.Tests.Integration/Clients/IssuesClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/IssuesClientTests.cs
@@ -1,13 +1,11 @@
using System;
using System.Globalization;
using System.Linq;
-using System.Threading;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
-using Xunit;
using Octokit.Tests.Integration.Helpers;
-using System.Collections.Generic;
+using Xunit;
public class IssuesClientTests : IDisposable
{
@@ -29,15 +27,64 @@ public class IssuesClientTests : IDisposable
const string description = "A new unassigned issue";
var newIssue = new NewIssue(title) { Body = description };
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
+
+ Assert.True(issue.Id > 0);
+ Assert.False(issue.Locked);
+ Assert.Equal(title, issue.Title);
+ Assert.Equal(description, issue.Body);
+
var retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
- Assert.NotNull(retrieved);
- Assert.NotEqual(0, issue.Id);
- Assert.Equal(false, issue.Locked);
+ Assert.True(retrieved.Id > 0);
+ Assert.False(retrieved.Locked);
Assert.Equal(title, retrieved.Title);
Assert.Equal(description, retrieved.Body);
}
+ [IntegrationTest]
+ public async Task ReturnsPageOfIssuesForARepository()
+ {
+ var options = new ApiOptions
+ {
+ PageSize = 5,
+ PageCount = 1
+ };
+
+ var issues = await _issuesClient.GetAllForRepository("libgit2", "libgit2sharp", options);
+
+ Assert.Equal(5, issues.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsPageOfIssuesFromStartForARepository()
+ {
+ var first = new ApiOptions
+ {
+ PageSize = 5,
+ PageCount = 1
+ };
+
+ var firstPage = await _issuesClient.GetAllForRepository("libgit2", "libgit2sharp", first);
+
+ var second = new ApiOptions
+ {
+ PageSize = 5,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await _issuesClient.GetAllForRepository("libgit2", "libgit2sharp", second);
+
+ Assert.Equal(5, firstPage.Count);
+ Assert.Equal(5, secondPage.Count);
+
+ Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
+ Assert.NotEqual(firstPage[1].Id, secondPage[1].Id);
+ Assert.NotEqual(firstPage[2].Id, secondPage[2].Id);
+ Assert.NotEqual(firstPage[3].Id, secondPage[3].Id);
+ Assert.NotEqual(firstPage[4].Id, secondPage[4].Id);
+ }
+
[IntegrationTest]
public async Task CanCreateRetrieveAndCloseIssue()
{
@@ -54,9 +101,7 @@ public class IssuesClientTests : IDisposable
}
finally
{
- var closed = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number,
- new IssueUpdate { State = ItemState.Closed })
- .Result;
+ var closed = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed }).Result;
Assert.NotNull(closed);
}
}
@@ -87,9 +132,10 @@ public class IssuesClientTests : IDisposable
var newIssue3 = new NewIssue("A test issue3") { Body = "A new unassigned issue" };
var newIssue4 = new NewIssue("A test issue4") { Body = "A new unassigned issue" };
await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue1);
- Thread.Sleep(1000);
+
+ await Task.Delay(1000);
await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue2);
- Thread.Sleep(1000);
+ await Task.Delay(1000);
await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue3);
var closed = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue4);
await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, closed.Number,
@@ -111,9 +157,9 @@ public class IssuesClientTests : IDisposable
var newIssue3 = new NewIssue("A test issue3") { Body = "A new unassigned issue" };
var newIssue4 = new NewIssue("A test issue4") { Body = "A new unassigned issue" };
await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue1);
- Thread.Sleep(1000);
+ await Task.Delay(1000);
await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue2);
- Thread.Sleep(1000);
+ await Task.Delay(1000);
await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue3);
var closed = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue4);
await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, closed.Number,
@@ -162,7 +208,7 @@ public class IssuesClientTests : IDisposable
Assert.Equal("A milestone issue", issues[0].Title);
}
- [IntegrationTest(Skip = "This is paging for a long long time")]
+ [IntegrationTest]
public async Task CanRetrieveAllIssues()
{
var newIssue1 = new NewIssue("A test issue1") { Body = "A new unassigned issue" };
@@ -173,13 +219,13 @@ public class IssuesClientTests : IDisposable
var issue2 = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue2);
var issue3 = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue3);
var issue4 = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue4);
- await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue4.Number,
- new IssueUpdate { State = ItemState.Closed });
+ await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue4.Number, new IssueUpdate { State = ItemState.Closed });
- var retrieved = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName,
- new RepositoryIssueRequest { });
+ var request = new RepositoryIssueRequest { State = ItemStateFilter.All };
- Assert.True(retrieved.Count >= 4);
+ var retrieved = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, request);
+
+ Assert.Equal(4, retrieved.Count);
Assert.True(retrieved.Any(i => i.Number == issue1.Number));
Assert.True(retrieved.Any(i => i.Number == issue2.Number));
Assert.True(retrieved.Any(i => i.Number == issue3.Number));
diff --git a/Octokit.Tests.Integration/Clients/OrganizationClientTests.cs b/Octokit.Tests.Integration/Clients/OrganizationClientTests.cs
new file mode 100644
index 00000000..5577f154
--- /dev/null
+++ b/Octokit.Tests.Integration/Clients/OrganizationClientTests.cs
@@ -0,0 +1,124 @@
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Octokit.Tests.Integration.Clients
+{
+ public class OrganizationClientTests
+ {
+ public class TheGetAllMethod
+ {
+ readonly IGitHubClient _github;
+ readonly IOrganizationsClient _organizationsClient;
+
+ public TheGetAllMethod()
+ {
+ _github = EnterpriseHelper.GetAuthenticatedClient();
+
+ _organizationsClient = _github.Organization;
+ }
+
+ [GitHubEnterpriseTest]
+ public async Task CanListOrganizations()
+ {
+ string orgLogin = Helper.MakeNameWithTimestamp("MyOrganization");
+ string orgName = string.Concat(orgLogin, " Display Name");
+
+ var newOrganization = new NewOrganization(orgLogin, EnterpriseHelper.UserName, orgName);
+ var organization = await
+ _github.Enterprise.Organization.Create(newOrganization);
+
+ Assert.NotNull(organization);
+
+ var milestones = await _organizationsClient.GetAllForCurrent();
+
+ Assert.NotEmpty(milestones);
+ }
+
+ [GitHubEnterpriseTest]
+ public async Task ReturnsCorrectCountOfOrganizationsWithoutStart()
+ {
+ string orgLogin1 = Helper.MakeNameWithTimestamp("MyOrganization1");
+ string orgName1 = string.Concat(orgLogin1, " Display Name 1");
+ string orgLogin2 = Helper.MakeNameWithTimestamp("MyOrganization2");
+ string orgName2 = string.Concat(orgLogin2, " Display Name 2");
+
+ var newOrganization1 = new NewOrganization(orgLogin1, EnterpriseHelper.UserName, orgName1);
+ var newOrganization2 = new NewOrganization(orgLogin2, EnterpriseHelper.UserName, orgName2);
+ await _github.Enterprise.Organization.Create(newOrganization1);
+ await _github.Enterprise.Organization.Create(newOrganization2);
+
+ var options = new ApiOptions
+ {
+ PageSize = 2,
+ PageCount = 1
+ };
+
+ var organizations = await _organizationsClient.GetAllForCurrent(options);
+
+ Assert.Equal(2, organizations.Count);
+ }
+
+ [GitHubEnterpriseTest]
+ public async Task ReturnsCorrectCountOfOrganizationsWithStart()
+ {
+ string orgLogin1 = Helper.MakeNameWithTimestamp("MyOrganization1");
+ string orgName1 = string.Concat(orgLogin1, " Display Name 1");
+ string orgLogin2 = Helper.MakeNameWithTimestamp("MyOrganization2");
+ string orgName2 = string.Concat(orgLogin2, " Display Name 2");
+
+ var newOrganization1 = new NewOrganization(orgLogin1, EnterpriseHelper.UserName, orgName1);
+ var newOrganization2 = new NewOrganization(orgLogin2, EnterpriseHelper.UserName, orgName2);
+ await _github.Enterprise.Organization.Create(newOrganization1);
+ await _github.Enterprise.Organization.Create(newOrganization2);
+
+ var options = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2,
+ };
+
+ var organizations = await _organizationsClient.GetAllForCurrent(options);
+
+ Assert.Equal(1, organizations.Count);
+ }
+
+ [GitHubEnterpriseTest]
+ public async Task ReturnsDistinctResultsBasedOnStartPage()
+ {
+ string orgLogin1 = Helper.MakeNameWithTimestamp("MyOrganization1");
+ string orgName1 = string.Concat(orgLogin1, " Display Name 1");
+ string orgLogin2 = Helper.MakeNameWithTimestamp("MyOrganization2");
+ string orgName2 = string.Concat(orgLogin2, " Display Name 2");
+ string orgLogin3 = Helper.MakeNameWithTimestamp("MyOrganization3");
+ string orgName3 = string.Concat(orgLogin3, " Display Name 3");
+
+ var newOrganization1 = new NewOrganization(orgLogin1, EnterpriseHelper.UserName, orgName1);
+ var newOrganization2 = new NewOrganization(orgLogin2, EnterpriseHelper.UserName, orgName2);
+ var newOrganization3 = new NewOrganization(orgLogin3, EnterpriseHelper.UserName, orgName3);
+ await _github.Enterprise.Organization.Create(newOrganization1);
+ await _github.Enterprise.Organization.Create(newOrganization2);
+ await _github.Enterprise.Organization.Create(newOrganization3);
+
+ var startOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1
+ };
+
+ var firstPage = await _organizationsClient.GetAllForCurrent(startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await _organizationsClient.GetAllForCurrent(skipStartOptions);
+
+ Assert.NotEqual(firstPage[0].Login, secondPage[0].Login);
+ }
+ }
+ }
+}
diff --git a/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs b/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs
index d0cb22b9..5e3d4c56 100644
--- a/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs
@@ -20,8 +20,64 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task ReturnsMembers()
{
- var members = _gitHub.Organization.Member.GetAll(_organizationFixture);
- Assert.NotNull(members);
+ var members = await
+ _gitHub.Organization.Member.GetAll(_organizationFixture);
+ Assert.NotEmpty(members);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfMembersWithoutStart()
+ {
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1
+ };
+
+ var members = await _gitHub.Organization.Member.GetAll(_organizationFixture, options);
+
+ Assert.Equal(1, members.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfMembersWithStart()
+ {
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 1
+ };
+
+ var members = await _gitHub.Organization.Member.GetAll(_organizationFixture, options);
+
+ Assert.Equal(1, members.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsDistinctMembersBasedOnStartPage()
+ {
+ var startOptions = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 1
+ };
+
+ var firstPage = await _gitHub.Organization.Member.GetAll(_organizationFixture, startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await _gitHub.Organization.Member.GetAll(_organizationFixture, skipStartOptions);
+
+ Assert.Equal(1, firstPage.Count);
+ Assert.Equal(1, secondPage.Count);
+ Assert.NotEqual(firstPage.First().Id, secondPage.First().Id);
}
[IntegrationTest(Skip = "TwoFactor filter can't be used unless the requester is an organization owner")]
diff --git a/Octokit.Tests.Integration/Clients/SearchClientTests.cs b/Octokit.Tests.Integration/Clients/SearchClientTests.cs
index 8ae98250..b1267410 100644
--- a/Octokit.Tests.Integration/Clients/SearchClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/SearchClientTests.cs
@@ -57,6 +57,20 @@ public class SearchClientTests
Assert.NotEmpty(repos.Items);
}
+ [IntegrationTest]
+ public async Task SearchForFileNameInCodeWithoutTerm()
+ {
+ var request = new SearchCodeRequest()
+ {
+ FileName = "readme.md",
+ Repos = new RepositoryCollection { "octokit/octokit.net" }
+ };
+
+ var repos = await _gitHubClient.Search.SearchCode(request);
+
+ Assert.NotEmpty(repos.Items);
+ }
+
[IntegrationTest]
public async Task SearchForWordInCode()
{
diff --git a/Octokit.Tests.Integration/Clients/StarredClientTests.cs b/Octokit.Tests.Integration/Clients/StarredClientTests.cs
index e55880e8..82f8a2f3 100644
--- a/Octokit.Tests.Integration/Clients/StarredClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/StarredClientTests.cs
@@ -1,35 +1,739 @@
using System;
-using Octokit.Tests.Integration.Helpers;
using System.Linq;
using System.Threading.Tasks;
+using Octokit.Tests.Integration.Helpers;
using Xunit;
namespace Octokit.Tests.Integration.Clients
{
- public class StarredClientTests
+ public class StarredClientTests : IDisposable
{
private readonly IGitHubClient _client;
private readonly IStarredClient _fixture;
+ private readonly RepositoryContext _repositoryContext;
public StarredClientTests()
{
_client = Helper.GetAuthenticatedClient();
_fixture = _client.Activity.Starring;
+
+ var github = Helper.GetAuthenticatedClient();
+ var repoName = Helper.MakeNameWithTimestamp("public-repo1");
+
+ _repositoryContext = github.CreateRepositoryContext(new NewRepository(repoName)).Result;
+
+ _fixture.RemoveStarFromRepo(_repositoryContext.RepositoryOwner, _repositoryContext.RepositoryName).Wait();
+ _fixture.RemoveStarFromRepo("octokit", "octokit.net").Wait();
+ _fixture.StarRepo(_repositoryContext.RepositoryOwner, _repositoryContext.RepositoryName).Wait();
+ _fixture.StarRepo("octokit", "octokit.net").Wait();
}
[IntegrationTest]
- public async Task CanCreateAndRetrieveStarsWithTimestamps()
+ public async Task CanGetAllForCurrent()
{
- using (var context = await _client.CreateRepositoryContext("public-repo"))
+ var repositories = await _fixture.GetAllForCurrent();
+ Assert.NotEmpty(repositories);
+
+ var repo = repositories.FirstOrDefault(repository => repository.Owner.Login == _repositoryContext.RepositoryOwner && repository.Name == _repositoryContext.RepositoryName);
+ Assert.NotNull(repo);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithoutStartForCurrent()
+ {
+ var options = new ApiOptions
{
- await _fixture.RemoveStarFromRepo(context.RepositoryOwner, context.RepositoryName);
- await _fixture.StarRepo(context.RepositoryOwner, context.RepositoryName);
- var currentUser = await _client.User.Current();
- var userStars = await _fixture.GetAllStargazersWithTimestamps(context.RepositoryOwner, context.RepositoryName);
- var userStar = userStars.SingleOrDefault(x => x.User.Id == currentUser.Id);
- Assert.NotNull(userStar);
- Assert.True(DateTimeOffset.UtcNow.Subtract(userStar.StarredAt) < TimeSpan.FromMinutes(5));
+ PageCount = 1,
+ PageSize = 1
+ };
+
+ var repositories = await _fixture.GetAllForCurrent(options);
+ Assert.Equal(1, repositories.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithStartForCurrent()
+ {
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 2
+ };
+
+ var repositories = await _fixture.GetAllForCurrent(options);
+ Assert.Equal(1, repositories.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsDistinctRepositoriesBasedOnStartPageForCurrent()
+ {
+ var startOptions = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 1
+ };
+
+ var firstPage = await _fixture.GetAllForCurrent(startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await _fixture.GetAllForCurrent(skipStartOptions);
+
+ Assert.Equal(1, firstPage.Count);
+ Assert.Equal(1, secondPage.Count);
+ Assert.NotEqual(firstPage.First().Id, secondPage.First().Id);
+ }
+
+ [IntegrationTest]
+ public async Task CanGetAllForCurrentParameterized()
+ {
+ var starredRequest = new StarredRequest { SortDirection = SortDirection.Ascending, SortProperty = StarredSort.Created };
+
+ var repositories = await _fixture.GetAllForCurrent(starredRequest);
+ Assert.NotEmpty(repositories);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithoutStartForCurrentParameterized()
+ {
+ var starredRequest = new StarredRequest { SortDirection = SortDirection.Ascending, SortProperty = StarredSort.Created };
+
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1
+ };
+
+ var repositories = await _fixture.GetAllForCurrent(starredRequest, options);
+ Assert.Equal(1, repositories.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithStartForCurrentParameterized()
+ {
+ var starredRequest = new StarredRequest { SortDirection = SortDirection.Ascending, SortProperty = StarredSort.Created };
+
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 2
+ };
+
+ var repositories = await _fixture.GetAllForCurrent(starredRequest, options);
+ Assert.Equal(1, repositories.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsDistinctRepositoriesBasedOnStartPageForCurrentParameterized()
+ {
+ var starredRequestFirstPage = new StarredRequest { SortDirection = SortDirection.Ascending, SortProperty = StarredSort.Created };
+ var starredRequestSecondPage = new StarredRequest { SortDirection = SortDirection.Descending, SortProperty = StarredSort.Updated };
+
+ var startOptions = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 1
+ };
+
+ var firstPage = await _fixture.GetAllForCurrent(starredRequestFirstPage, startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await _fixture.GetAllForCurrent(starredRequestSecondPage, skipStartOptions);
+
+ Assert.Equal(1, firstPage.Count);
+ Assert.Equal(1, secondPage.Count);
+ Assert.NotEqual(firstPage.First().Id, secondPage.First().Id);
+ }
+
+ [IntegrationTest]
+ public async Task CanGetAllForCurrentWithTimestamps()
+ {
+ var stars = await _fixture.GetAllForCurrentWithTimestamps();
+ Assert.NotEmpty(stars);
+
+ var repo = stars.FirstOrDefault(star => star.Repo.Owner.Login == _repositoryContext.RepositoryOwner && star.Repo.Name == _repositoryContext.RepositoryName);
+ Assert.NotNull(repo);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithoutStartForCurrentWithTimestamps()
+ {
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1
+ };
+
+ var repositories = await _fixture.GetAllForCurrentWithTimestamps(options);
+ Assert.Equal(1, repositories.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithStartForCurrentWithTimestamps()
+ {
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 2
+ };
+
+ var repositories = await _fixture.GetAllForCurrentWithTimestamps(options);
+ Assert.Equal(1, repositories.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsDistinctRepositoriesBasedOnStartPageForCurrentWithTimestamps()
+ {
+ var startOptions = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 1
+ };
+
+ var firstPage = await _fixture.GetAllForCurrentWithTimestamps(startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await _fixture.GetAllForCurrentWithTimestamps(skipStartOptions);
+
+ Assert.Equal(1, firstPage.Count);
+ Assert.Equal(1, secondPage.Count);
+ Assert.NotEqual(firstPage.First().Repo.Id, secondPage.First().Repo.Id);
+ }
+
+ [IntegrationTest]
+ public async Task CanGetAllForCurrentWithTimestampsParameterized()
+ {
+ var starredRequest = new StarredRequest { SortProperty = StarredSort.Created, SortDirection = SortDirection.Descending };
+
+ var stars = await _fixture.GetAllForCurrentWithTimestamps(starredRequest);
+ Assert.NotEmpty(stars);
+
+ var repo = stars.FirstOrDefault(star => star.Repo.Owner.Login == _repositoryContext.RepositoryOwner && star.Repo.Name == _repositoryContext.RepositoryName);
+ Assert.NotNull(repo);
+
+ for (int i = 1; i < stars.Count; i++)
+ {
+ Assert.True(stars[i - 1].StarredAt >= stars[i].StarredAt);
}
}
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithoutStartForCurrentWithTimestampsParameterized()
+ {
+ var starredRequest = new StarredRequest { SortProperty = StarredSort.Created, SortDirection = SortDirection.Descending };
+
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1
+ };
+
+ var stars = await _fixture.GetAllForCurrentWithTimestamps(starredRequest, options);
+ Assert.Equal(1, stars.Count);
+
+ for (int i = 1; i < stars.Count; i++)
+ {
+ Assert.True(stars[i - 1].StarredAt >= stars[i].StarredAt);
+ }
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithStartForCurrentWithTimestampsParameterized()
+ {
+ var starredRequest = new StarredRequest { SortProperty = StarredSort.Created, SortDirection = SortDirection.Descending };
+
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 2
+ };
+
+ var stars = await _fixture.GetAllForCurrentWithTimestamps(starredRequest, options);
+ Assert.Equal(1, stars.Count);
+
+ for (int i = 1; i < stars.Count; i++)
+ {
+ Assert.True(stars[i - 1].StarredAt >= stars[i].StarredAt);
+ }
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsDistinctRepositoriesBasedOnStartPageForCurrentWithTimestampsParameterized()
+ {
+ var starredRequest = new StarredRequest { SortDirection = SortDirection.Descending, SortProperty = StarredSort.Created };
+
+ var startOptions = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 1
+ };
+
+ var firstPage = await _fixture.GetAllForCurrentWithTimestamps(starredRequest, startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await _fixture.GetAllForCurrentWithTimestamps(starredRequest, skipStartOptions);
+
+ Assert.Equal(1, firstPage.Count);
+ Assert.Equal(1, secondPage.Count);
+ Assert.NotEqual(firstPage.First().Repo.Id, secondPage.First().Repo.Id);
+
+ for (int i = 1; i < firstPage.Count; i++)
+ {
+ Assert.True(firstPage[i].StarredAt >= secondPage[i].StarredAt);
+ }
+ }
+
+ [IntegrationTest]
+ public async Task CanGetAllForUser()
+ {
+ var repositories = await _fixture.GetAllForUser(Helper.UserName);
+ Assert.NotEmpty(repositories);
+
+ var repo = repositories.FirstOrDefault(repository => repository.Owner.Login == _repositoryContext.RepositoryOwner && repository.Name == _repositoryContext.RepositoryName);
+ Assert.NotNull(repo);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithoutStartForUser()
+ {
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1
+ };
+
+ var repositories = await _fixture.GetAllForUser(Helper.UserName, options);
+ Assert.Equal(1, repositories.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithStartForUser()
+ {
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 2
+ };
+
+ var repositories = await _fixture.GetAllForUser(Helper.UserName, options);
+ Assert.Equal(1, repositories.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsDistinctRepositoriesBasedOnStartPageForUser()
+ {
+ var startOptions = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 1
+ };
+
+ var firstPage = await _fixture.GetAllForUser(Helper.UserName, startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await _fixture.GetAllForUser(Helper.UserName, skipStartOptions);
+
+ Assert.Equal(1, firstPage.Count);
+ Assert.Equal(1, secondPage.Count);
+ Assert.NotEqual(firstPage.First().Id, secondPage.First().Id);
+ }
+
+ [IntegrationTest]
+ public async Task CanGetAllForUserParameterized()
+ {
+ var starredRequest = new StarredRequest { SortDirection = SortDirection.Ascending, SortProperty = StarredSort.Created };
+
+ var repositories = await _fixture.GetAllForUser(Helper.UserName, starredRequest);
+ Assert.NotEmpty(repositories);
+
+ var repo = repositories.FirstOrDefault(repository => repository.Owner.Login == _repositoryContext.RepositoryOwner && repository.Name == _repositoryContext.RepositoryName);
+ Assert.NotNull(repo);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithoutStartForUserParameterized()
+ {
+ var starredRequest = new StarredRequest { SortDirection = SortDirection.Ascending, SortProperty = StarredSort.Created };
+
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1
+ };
+
+ var repositories = await _fixture.GetAllForUser(Helper.UserName, starredRequest, options);
+ Assert.Equal(1, repositories.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithStartForUserParameterized()
+ {
+ var starredRequest = new StarredRequest { SortDirection = SortDirection.Ascending, SortProperty = StarredSort.Created };
+
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 2
+ };
+
+ var repositories = await _fixture.GetAllForUser(Helper.UserName, starredRequest, options);
+ Assert.Equal(1, repositories.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsDistinctRepositoriesBasedOnStartPageForUserParameterized()
+ {
+ var starredRequestFirstPage = new StarredRequest { SortDirection = SortDirection.Ascending, SortProperty = StarredSort.Created };
+ var starredRequestSecondPage = new StarredRequest { SortDirection = SortDirection.Ascending, SortProperty = StarredSort.Created };
+
+ var startOptions = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 1
+ };
+
+ var firstPage = await _fixture.GetAllForUser(Helper.UserName, starredRequestFirstPage, startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await _fixture.GetAllForUser(Helper.UserName, starredRequestSecondPage, skipStartOptions);
+
+ Assert.Equal(1, firstPage.Count);
+ Assert.Equal(1, secondPage.Count);
+ Assert.NotEqual(firstPage.First().Id, secondPage.First().Id);
+ }
+
+ [IntegrationTest]
+ public async Task CanGetAllForUserWithTimestamps()
+ {
+ var stars = await _fixture.GetAllForUserWithTimestamps(Helper.UserName);
+ Assert.NotEmpty(stars);
+
+ var star = stars.FirstOrDefault(repositoryStar => repositoryStar.Repo.Owner.Login == _repositoryContext.RepositoryOwner && repositoryStar.Repo.Name == _repositoryContext.RepositoryName);
+ Assert.NotNull(star);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithoutStartForUserWithTimestamps()
+ {
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1
+ };
+
+ var stars = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, options);
+ Assert.Equal(1, stars.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithStartForUserWithTimestamps()
+ {
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 2
+ };
+
+ var stars = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, options);
+ Assert.Equal(1, stars.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsDistinctRepositoriesBasedOnStartPageForUserWithTimestamps()
+ {
+ var startOptions = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 1
+ };
+
+ var firstPage = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, skipStartOptions);
+
+ Assert.Equal(1, firstPage.Count);
+ Assert.Equal(1, secondPage.Count);
+ Assert.NotEqual(firstPage.First().Repo.Id, secondPage.First().Repo.Id);
+ }
+
+ [IntegrationTest]
+ public async Task CanGetAllForUserWithTimestampsParameterized()
+ {
+ var starredRequest = new StarredRequest { SortProperty = StarredSort.Created, SortDirection = SortDirection.Descending };
+
+ var stars = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, starredRequest);
+ Assert.NotEmpty(stars);
+
+ var repo = stars.FirstOrDefault(repository => repository.Repo.Owner.Login == _repositoryContext.RepositoryOwner && repository.Repo.Name == _repositoryContext.RepositoryName);
+ Assert.NotNull(repo);
+
+ for (int i = 1; i < stars.Count; i++)
+ {
+ Assert.True(stars[i - 1].StarredAt >= stars[i].StarredAt);
+ }
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithoutStartForUserWithTimestampsParameterized()
+ {
+ var starredRequest = new StarredRequest { SortProperty = StarredSort.Created, SortDirection = SortDirection.Descending };
+
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1
+ };
+
+ var stars = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, starredRequest, options);
+ Assert.Equal(1, stars.Count);
+
+ for (int i = 1; i < stars.Count; i++)
+ {
+ Assert.True(stars[i - 1].StarredAt >= stars[i].StarredAt);
+ }
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithStartForUserWithTimestampsParameterized()
+ {
+ var starredRequest = new StarredRequest { SortProperty = StarredSort.Created, SortDirection = SortDirection.Ascending };
+
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 2
+ };
+
+ var stars = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, starredRequest, options);
+ Assert.Equal(1, stars.Count);
+
+ for (int i = 1; i < stars.Count; i++)
+ {
+ Assert.True(stars[i - 1].StarredAt >= stars[i].StarredAt);
+ }
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsDistinctRepositoriesBasedOnStartPageForUserWithTimestampsParameterized()
+ {
+ var starredRequest = new StarredRequest { SortProperty = StarredSort.Created, SortDirection = SortDirection.Descending };
+
+ var startOptions = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 1
+ };
+
+ var firstPage = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, starredRequest, startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, starredRequest, skipStartOptions);
+
+ Assert.Equal(1, firstPage.Count);
+ Assert.Equal(1, secondPage.Count);
+ Assert.NotEqual(firstPage.First().Repo.Id, secondPage.First().Repo.Id);
+
+ for (int i = 0; i < firstPage.Count; i++)
+ {
+ Assert.True(firstPage[i].StarredAt >= secondPage[i].StarredAt);
+ }
+ }
+
+ [IntegrationTest]
+ public async Task CanGetAllStargazers()
+ {
+ var users = await _fixture.GetAllStargazers(_repositoryContext.RepositoryOwner, _repositoryContext.RepositoryName);
+ Assert.NotEmpty(users);
+
+ var user = users.FirstOrDefault(u => u.Login == Helper.UserName);
+ Assert.NotNull(user);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithoutStartAllStargazers()
+ {
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1
+ };
+
+ var users = await _fixture.GetAllStargazers("octokit", "octokit.net", options);
+ Assert.Equal(1, users.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithStartAllStargazers()
+ {
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 2
+ };
+
+ var users = await _fixture.GetAllStargazers("octokit", "octokit.net", options);
+ Assert.Equal(1, users.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsDistinctRepositoriesBasedOnStartPageAllStargazers()
+ {
+ var startOptions = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 1
+ };
+
+ var firstPage = await _fixture.GetAllStargazers("octokit", "octokit.net", startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await _fixture.GetAllStargazers("octokit", "octokit.net", skipStartOptions);
+
+ Assert.Equal(1, firstPage.Count);
+ Assert.Equal(1, secondPage.Count);
+ Assert.NotEqual(firstPage.First().Id, secondPage.First().Id);
+ }
+
+ [IntegrationTest]
+ public async Task CanGetAllStargazersWithTimestamps()
+ {
+ var users = await _fixture.GetAllStargazersWithTimestamps(_repositoryContext.RepositoryOwner, _repositoryContext.RepositoryName);
+ Assert.NotEmpty(users);
+
+ var userStar = users.FirstOrDefault(star => star.User.Login == _repositoryContext.RepositoryOwner);
+ Assert.NotNull(userStar);
+
+ Assert.True(DateTimeOffset.UtcNow.Subtract(userStar.StarredAt) < TimeSpan.FromMinutes(5));
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithoutStartAllStargazersWithTimestamps()
+ {
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1
+ };
+
+ var userStars = await _fixture.GetAllStargazersWithTimestamps("octokit", "octokit.net", options);
+ Assert.Equal(1, userStars.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoriesWithStartAllStargazersWithTimestamps()
+ {
+ var options = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 2
+ };
+
+ var userStars = await _fixture.GetAllStargazersWithTimestamps("octokit", "octokit.net", options);
+ Assert.Equal(1, userStars.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsDistinctRepositoriesBasedOnStartPageAllStargazersWithTimestamps()
+ {
+ var startOptions = new ApiOptions
+ {
+ PageCount = 1,
+ PageSize = 1,
+ StartPage = 1
+ };
+
+ var firstPage = await _fixture.GetAllStargazersWithTimestamps("octokit", "octokit.net", startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await _fixture.GetAllStargazersWithTimestamps("octokit", "octokit.net", skipStartOptions);
+
+ Assert.Equal(1, firstPage.Count);
+ Assert.Equal(1, secondPage.Count);
+ Assert.NotEqual(firstPage.First().StarredAt, secondPage.First().StarredAt);
+ }
+
+ public void Dispose()
+ {
+ _repositoryContext.Dispose();
+ }
}
}
diff --git a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
index d5adfaaf..be61279e 100644
--- a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
+++ b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
@@ -94,6 +94,7 @@
+
diff --git a/Octokit.Tests.Integration/Reactive/ObservableIssuesClientTests.cs b/Octokit.Tests.Integration/Reactive/ObservableIssuesClientTests.cs
index 9c6acf98..dc195ee1 100644
--- a/Octokit.Tests.Integration/Reactive/ObservableIssuesClientTests.cs
+++ b/Octokit.Tests.Integration/Reactive/ObservableIssuesClientTests.cs
@@ -33,11 +33,47 @@ public class ObservableIssuesClientTests : IDisposable
}
[IntegrationTest]
- public async Task ReturnsAllIssuesForARepository()
+ public async Task ReturnsPageOfIssuesForARepository()
{
- var issues = await _client.GetAllForRepository("libgit2", "libgit2sharp").ToList();
+ var options = new ApiOptions
+ {
+ PageSize = 5,
+ PageCount = 1
+ };
- Assert.NotEmpty(issues);
+ var issues = await _client.GetAllForRepository("libgit2", "libgit2sharp", options).ToList();
+
+ Assert.Equal(5, issues.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsPageOfIssuesFromStartForARepository()
+ {
+ var first = new ApiOptions
+ {
+ PageSize = 5,
+ PageCount = 1
+ };
+
+ var firstPage = await _client.GetAllForRepository("libgit2", "libgit2sharp", first).ToList();
+
+ var second = new ApiOptions
+ {
+ PageSize = 5,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await _client.GetAllForRepository("libgit2", "libgit2sharp", second).ToList();
+
+ Assert.Equal(5, firstPage.Count);
+ Assert.Equal(5, secondPage.Count);
+
+ Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
+ Assert.NotEqual(firstPage[1].Id, secondPage[1].Id);
+ Assert.NotEqual(firstPage[2].Id, secondPage[2].Id);
+ Assert.NotEqual(firstPage[3].Id, secondPage[3].Id);
+ Assert.NotEqual(firstPage[4].Id, secondPage[4].Id);
}
[IntegrationTest]
diff --git a/Octokit.Tests/Clients/IssuesClientTests.cs b/Octokit.Tests/Clients/IssuesClientTests.cs
index 9dbe0436..131f6ac5 100644
--- a/Octokit.Tests/Clients/IssuesClientTests.cs
+++ b/Octokit.Tests/Clients/IssuesClientTests.cs
@@ -35,6 +35,17 @@ namespace Octokit.Tests.Clients
public class TheGetAllForCurrentMethod
{
+ [Fact]
+ public async Task EnsuresNonNullArguments()
+ {
+ var client = new IssuesClient(Substitute.For());
+
+ await Assert.ThrowsAsync(() => client.GetAllForCurrent((ApiOptions)null));
+ await Assert.ThrowsAsync(() => client.GetAllForCurrent((IssueRequest)null));
+ await Assert.ThrowsAsync(() => client.GetAllForCurrent(null, new ApiOptions()));
+ await Assert.ThrowsAsync(() => client.GetAllForCurrent(new IssueRequest(), null));
+ }
+
[Fact]
public void RequestsCorrectUrl()
{
@@ -44,7 +55,7 @@ namespace Octokit.Tests.Clients
client.GetAllForCurrent();
connection.Received().GetAll(Arg.Is(u => u.ToString() == "issues"),
- Arg.Any>());
+ Arg.Any>(), Args.ApiOptions);
}
[Fact]
@@ -60,12 +71,24 @@ namespace Octokit.Tests.Clients
&& d["filter"] == "assigned"
&& d["sort"] == "created"
&& d["state"] == "open"
- && d["direction"] == "asc"));
+ && d["direction"] == "asc"),
+ Args.ApiOptions);
}
}
public class TheGetAllForOwnedAndMemberRepositoriesMethod
{
+ [Fact]
+ public async Task EnsuresNonNullArguments()
+ {
+ var client = new IssuesClient(Substitute.For());
+
+ await Assert.ThrowsAsync(() => client.GetAllForOwnedAndMemberRepositories((ApiOptions)null));
+ await Assert.ThrowsAsync(() => client.GetAllForOwnedAndMemberRepositories((IssueRequest)null));
+ await Assert.ThrowsAsync(() => client.GetAllForOwnedAndMemberRepositories(null, new ApiOptions()));
+ await Assert.ThrowsAsync(() => client.GetAllForOwnedAndMemberRepositories(new IssueRequest(), null));
+ }
+
[Fact]
public void RequestsCorrectUrl()
{
@@ -75,12 +98,109 @@ namespace Octokit.Tests.Clients
client.GetAllForOwnedAndMemberRepositories();
connection.Received().GetAll(Arg.Is(u => u.ToString() == "user/issues"),
- Arg.Any>());
+ Arg.Any>(),
+ Args.ApiOptions);
}
}
- public class TheGetForRepositoryMethod
+ public class TheGetAllForOrganizationMethod
{
+ [Fact]
+ public async Task EnsuresArgumentsNotNull()
+ {
+ var client = new IssuesClient(Substitute.For());
+
+ var options = new ApiOptions();
+ var request = new RepositoryIssueRequest();
+
+ await Assert.ThrowsAsync(() => client.GetAllForOrganization(null));
+ await Assert.ThrowsAsync(() => client.GetAllForOrganization(null, options));
+ await Assert.ThrowsAsync(() => client.GetAllForOrganization(null, request));
+ await Assert.ThrowsAsync(() => client.GetAllForOrganization(null, request, options));
+
+ await Assert.ThrowsAsync(() => client.GetAllForOrganization(""));
+ await Assert.ThrowsAsync(() => client.GetAllForOrganization("", options));
+ await Assert.ThrowsAsync(() => client.GetAllForOrganization("", request));
+ await Assert.ThrowsAsync(() => client.GetAllForOrganization("", request, options));
+
+ await Assert.ThrowsAsync(() => client.GetAllForOrganization("org", (ApiOptions)null));
+ await Assert.ThrowsAsync(() => client.GetAllForOrganization("org", (IssueRequest)null));
+
+ await Assert.ThrowsAsync(() => client.GetAllForOrganization("org", null, options));
+ await Assert.ThrowsAsync(() => client.GetAllForOrganization("org", request, null));
+ }
+
+ [Fact]
+ public void RequestsCorrectUrl()
+ {
+ var connection = Substitute.For();
+ var client = new IssuesClient(connection);
+
+ client.GetAllForOrganization("fake");
+
+ connection.Received().GetAll(Arg.Is(u => u.ToString() == "orgs/fake/issues"),
+ Arg.Any>(),
+ Args.ApiOptions);
+ }
+
+ [Fact]
+ public void SendsAppropriateParameters()
+ {
+ var connection = Substitute.For();
+ var client = new IssuesClient(connection);
+
+ client.GetAllForOrganization("fake", new RepositoryIssueRequest
+ {
+ SortDirection = SortDirection.Ascending
+ });
+
+ connection.Received().GetAll(Arg.Is(u => u.ToString() == "orgs/fake/issues"),
+ Arg.Is>(d => d.Count == 4
+ && d["state"] == "open"
+ && d["direction"] == "asc"
+ && d["sort"] == "created"
+ && d["filter"] == "assigned"),
+ Args.ApiOptions);
+ }
+ }
+
+ public class TheGetAllForRepositoryMethod
+ {
+ [Fact]
+ public async Task EnsuresArgumentsNotNull()
+ {
+ var client = new IssuesClient(Substitute.For());
+
+ var options = new ApiOptions();
+ var request = new RepositoryIssueRequest();
+
+ await Assert.ThrowsAsync(() => client.GetAllForRepository(null, "name"));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository(null, "name", options));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository(null, "name", request));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository(null, "name", request, options));
+
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("", "name"));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("", "name", options));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("", "name", request));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("", "name", request, options));
+
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", null));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", null, options));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", null, request));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", null, request, options));
+
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", ""));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", "", options));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", "", request));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", "", request, options));
+
+ await Assert.ThrowsAsync