diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 22a32416..64a9bb71 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,66 +1,35 @@
# How to Contribute
-We love Pull Requests! Your contributions help make Octokit great.
+Contributions take many forms from submitting issues, writing docs, to making
+code changes - we welcome it all!
## Getting Started
-So you want to contribute to Octokit. Great! Contributions take many forms
-from submitting issues, writing docs, to making code changes. We welcome
-it all. Don't forget to sign up for a [GitHub account](https://github.com/signup/free),
-if you haven't already.
+If you don't have a GitHub account, you can [sign up](https://github.com/signup/free)
+as it will help you to participate with the project.
-## Getting Started
+If you are looking to contribute to the codebase, please ensure you have Visual
+Studio 2015 installed - you can download the Community edition from
+[here](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx)
-You can clone this repository locally from GitHub using the "Clone in Desktop"
-button from the main project site, or run this command in the Git Shell:
+If you are running GitHub Desktop, you can clone this repository locally from
+GitHub using the "Clone in Desktop" button from the Octokit.net project page,
+or run this command in your Git-enabled shell:
-`git clone git@github.com:octokit/Octokit.net.git Octokit`
+`git clone https://github.com/octokit/Octokit.net.git Octokit`
-If you want to make contributions to the project,
-[forking the project](https://help.github.com/articles/fork-a-repo) is the
+If you want to make contributions to the project,
+[forking the project](https://help.github.com/articles/fork-a-repo) is the
easiest way to do this. You can then clone down your fork instead:
-`git clone git@github.com:MY-USERNAME-HERE/Octokit.net.git Octokit`
+`git clone https://github.com/MY-USERNAME-HERE/Octokit.net.git Octokit`
-After doing that, run the `.\build.cmd` script at the root of the repository
-to ensure all the tests pass.
+After doing that, run the `.\build` script at the root of the repository
+to ensure everything builds and the tests pass.
-### How is the codebase organised?
+## How can I get involved?
-The two main projects are the `Octokit` and `Octokit.Reactive` projects.
-
-The `Octokit.Reactive` library is a thin wrapper over the `Octokit`
-library - for those who want to use Reactive Extensions (Rx) instead of tasks.
-
-The namespaces are organised so that the relevant components are easy to discover:
-
- - **Authentication** - everything related to authenticating requests
- - **Clients** - the logic for interacting with various parts of the GitHub API
- - **Exceptions** - types which represent exceptional behaviour from the API
- - **Helpers** - assorted extensions and helpers to keep the code neat and tidy
- - **Http** - the internal networking components which Octokit requires
- - **Models** - types which represent request/response objects
-
-Unless you're modifying some core behaviour, the **Clients** and **Models** namespaces
-are likely to be the most interesting areas.
-
-The clients within a project are organized similarly to the endpoints in the
-[GitHub API documentation](http://developer.github.com/v3/)
-
-Some clients are "sub-clients". For example, when you navigate to the
-[Issues API](http://developer.github.com/v3/issues/) you'll notice there's an
-endpoint for issues. But in the right navbar, there are other APIs such as
-[Assignees](http://developer.github.com/v3/issues/assignees/) and
-[Milestones](http://developer.github.com/v3/issues/milestones/).
-
-We've tried to mirror this structure. So the `IObservableMilestoneClient` isn't
-a direct property of `IObservableGitHubClient`. Instead, it's a property of the
-`IObservableIssuesClient`. And thus you can get to it by going to
-`client.Issues.Milestones`.
-
-### What needs to be done?
-
-We have a [`easy-fix`](https://github.com/octokit/octokit.net/issues?labels=easy-fix&state=open)
+We have an [`up-for-grabs`](https://github.com/octokit/octokit.net/issues/labels/up-for-grabs)
tag on our issue tracker to indicate tasks which contributors can pick up.
If you've found something you'd like to contribute to, leave a comment in the issue
@@ -72,28 +41,63 @@ for ways to improve the API to make it easy to work with the GitHub API.
## Making Changes
-When you're ready to make a change,
-[create a branch](https://help.github.com/articles/fork-a-repo#create-branches)
-off the `master` branch. We use `master` as the default branch for the
-repository, and it holds the most recent contributions, so any changes you make
-in master might cause conflicts down the track.
+When you're ready to make a change, create a branch off the `master` branch:
+
+```
+git checkout master
+git pull origin master
+git checkout -b SOME-BRANCH-NAME
+```
+
+We use `master` as the default branch for the repository, and it holds the most
+recent contributions. By working in a branch away from `master` you can handle
+potential conflicts that may occur in the future.
If you make focused commits (instead of one monolithic commit) and have descriptive
commit messages, this will help speed up the review process.
-If you're adding new files to the Octokit project, we have a helper script to
-synchronize these changes with the Mono* projects in the solution.
+### Adding New files
-Just run this command: `.\build FixProjects`
+To ensure new files are available in the various projects, we have a helper script
+to synchronize these changes across all the projects in the solution.
+
+If you need to create new files:
+
+ - add the file to the main `Octokit` project
+ - build the project (to ensure the `csproj` change is saved)
+ - run this command: `.\build FixProjects`
+
+At any time you can build the project with `.\build BuildApp` - this will also
+run FxCop analysis.
+
+### Running Tests
Octokit.net also has a suite of tests which you can run to ensure existing
-behaviour is unchanged. If you're adding new features, please add some
-tests alongside so the maintainers can sleep at night, knowing their
+behaviour is not affected. If you're adding new features, please add some
+tests alongside so the maintainers can sleep at night, knowing their
safety blanket is nice and green!
-Run this command to confirm all the tests pass: `.\build`
+The test suite is arranged into fast and slow tests.
-### Running integration tests
+#### Fast Tests
+
+**Unit Tests:** `.\build UnitTests`
+
+These tests verify specific behaviour while being isolated from the rest of the
+library. If you are not familiar with unit testing, have a look at the existing
+examples - they should be easy to apply to your work.
+
+**Convention Tests:** `.\build ConventionTests`
+
+These tests verify conventions and structure across the entire codebase -
+ensuring everything is consistent and predictable. When writing new features,
+these tests may fail and should help indicate where the changes have violated
+the conventions, so feel free to run them locally while you're working on new
+features.
+
+#### Slow Tests
+
+**Integration Tests**
Octokit has integration tests that access the GitHub API, but they require a
bit of setup to run. The tests make use of a set of test accounts accessed via
@@ -104,9 +108,23 @@ variables:
`.\script\configure-integration-tests.ps1`
-Once these are set, the integration tests will be executed both when
-running the IntegrationTests build target, or when running the
-Octokit.Tests.Integration assembly in the Visual Studio test runner.
+After running this, ensure any existing instances of Visual Studio are restarted
+so they pick up the new environment variables are detected.
+
+With these variables set, you can run the integration tests locally using
+`.\build IntegrationTests` or by running the `Octokit.Tests.Integration`
+assembly in the Visual Studio test runner.
+
+**Note:** as the integration tests rely on using the actual GitHub API, you may
+encounter issues if running the tests too frequently. Please use a test account
+so that you're not impacted in the unlikely scenario of your account being
+flagged as a spammer.
+
+### Testing Documentation
+
+If you are making changes to the documentation for Octokit, you can test these
+changes locally using the [guide](https://github.com/shiftkey/octokit.net/blob/rewrite-contributing/docs/contributing.md)
+under the `docs` folder.
### Submitting Changes
@@ -116,29 +134,34 @@ the Git Shell:
`git push origin MY-BRANCH-NAME`
Once your changes are ready to be reviewed, publish the branch to GitHub and
-[open a pull request](https://help.github.com/articles/using-pull-requests)
+[open a pull request](https://help.github.com/articles/using-pull-requests)
against it.
-A few little tips with pull requests:
+A few suggestions when opening a pull request:
+
+ - if you are addressing a particular issue, reference it like this:
+
+> Fixes #1145
- prefix the title with `[WIP]` to indicate this is a work-in-progress. It's
- always good to get feedback early, so don't be afraid to open the PR before it's "done".
- - use [checklists](https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments)
- to indicate the tasks which need to be done, so everyone knows how close you are to done.
- - add comments to the PR about things that are unclear or you would like suggestions on
+ always good to get feedback early, so don't be afraid to open the PR before
+ it's "done".
+ - use [checklists](https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments)
+ to indicate the tasks which need to be done, so everyone knows how close you
+ are to done.
+ - add comments to the PR about things that are unclear or you would like
+ suggestions on
-Don't forget to mention in the pull request description which issue/issues are
-being addressed.
-
-Some things that will increase the chance that your pull request is accepted.
+Some things that will increase the chance that your pull request is accepted:
* Follow existing code conventions. Most of what we do follows [standard .NET
conventions](https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md) except in a few places. We include a ReSharper team settings file.
-* Include unit tests that would otherwise fail without your code, but pass with
+* Include unit tests that would otherwise fail without your code, but pass with
it.
-* Update the documentation, the surrounding one, examples elsewhere, guides,
+* Update the documentation, the surrounding one, examples elsewhere, guides,
whatever is affected by your contribution
# Additional Resources
+* [Octokit Codebase Overview](https://github.com/octokit/octokit.net/blob/master/OVERVIEW.md)
* [General GitHub documentation](http://help.github.com/)
diff --git a/OVERVIEW.md b/OVERVIEW.md
new file mode 100644
index 00000000..8276639b
--- /dev/null
+++ b/OVERVIEW.md
@@ -0,0 +1,32 @@
+### How is the codebase organised?
+
+The two main projects are the `Octokit` and `Octokit.Reactive` projects.
+
+The `Octokit.Reactive` library is a thin wrapper over the `Octokit`
+library - for those who want to use Reactive Extensions (Rx) instead of tasks.
+
+The namespaces are organised so that the relevant components are easy to discover:
+
+ - **Authentication** - everything related to authenticating requests
+ - **Clients** - the logic for interacting with various parts of the GitHub API
+ - **Exceptions** - types which represent exceptional behaviour from the API
+ - **Helpers** - assorted extensions and helpers to keep the code neat and tidy
+ - **Http** - the internal networking components which Octokit requires
+ - **Models** - types which represent request/response objects
+
+Unless you're modifying some core behaviour, the **Clients** and **Models** namespaces
+are likely to be the most interesting areas.
+
+The clients within a project are organized similarly to the endpoints in the
+[GitHub API documentation](http://developer.github.com/v3/)
+
+Some clients are "sub-clients". For example, when you navigate to the
+[Issues API](http://developer.github.com/v3/issues/) you'll notice there's an
+endpoint for issues. But in the right navbar, there are other APIs such as
+[Assignees](http://developer.github.com/v3/issues/assignees/) and
+[Milestones](http://developer.github.com/v3/issues/milestones/).
+
+We've tried to mirror this structure. So the `IObservableMilestoneClient` isn't
+a direct property of `IObservableGitHubClient`. Instead, it's a property of the
+`IObservableIssuesClient`. And thus you can get to it by going to
+`client.Issues.Milestones`.
diff --git a/Octokit.Reactive/Clients/Enterprise/IObservableEnterpriseLdapClient.cs b/Octokit.Reactive/Clients/Enterprise/IObservableEnterpriseLdapClient.cs
index d5f4bd1f..1791d57e 100644
--- a/Octokit.Reactive/Clients/Enterprise/IObservableEnterpriseLdapClient.cs
+++ b/Octokit.Reactive/Clients/Enterprise/IObservableEnterpriseLdapClient.cs
@@ -33,7 +33,7 @@ namespace Octokit.Reactive
/// The username to sync LDAP mapping
/// The of the queue request.
IObservable QueueSyncUserMapping(string userName);
-
+
///
/// Update the LDAP mapping for a team on a GitHub Enterprise appliance (must be Site Admin user).
///
diff --git a/Octokit.Reactive/Clients/Enterprise/ObservableEnterpriseLdapClient.cs b/Octokit.Reactive/Clients/Enterprise/ObservableEnterpriseLdapClient.cs
index f096e496..0a037406 100644
--- a/Octokit.Reactive/Clients/Enterprise/ObservableEnterpriseLdapClient.cs
+++ b/Octokit.Reactive/Clients/Enterprise/ObservableEnterpriseLdapClient.cs
@@ -49,7 +49,7 @@ namespace Octokit.Reactive
{
return _client.QueueSyncUserMapping(userName).ToObservable();
}
-
+
///
/// Update the LDAP mapping for a team on a GitHub Enterprise appliance (must be Site Admin user).
///
diff --git a/Octokit.Reactive/Clients/IObservableAssigneesClient.cs b/Octokit.Reactive/Clients/IObservableAssigneesClient.cs
index b4be296d..b47ad18e 100644
--- a/Octokit.Reactive/Clients/IObservableAssigneesClient.cs
+++ b/Octokit.Reactive/Clients/IObservableAssigneesClient.cs
@@ -12,6 +12,15 @@ namespace Octokit.Reactive
///
IObservable GetAllForRepository(string owner, string name);
+ ///
+ /// Gets all the available assignees (owner + collaborators) to which issues may be assigned.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The options to change API's behaviour.
+ ///
+ IObservable GetAllForRepository(string owner, string name, ApiOptions options);
+
///
/// Checks to see if a user is an assignee for a repository.
///
diff --git a/Octokit.Reactive/Clients/IObservableAuthorizationsClient.cs b/Octokit.Reactive/Clients/IObservableAuthorizationsClient.cs
index c72986fd..0e5083fd 100644
--- a/Octokit.Reactive/Clients/IObservableAuthorizationsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableAuthorizationsClient.cs
@@ -13,11 +13,24 @@ namespace Octokit.Reactive
/// See API documentation for more
/// details.
///
- /// An
+ /// A list of s for the authenticated user.
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate",
Justification = "It's an API call, so it's not a property.")]
IObservable GetAll();
+ ///
+ /// Get all s for the authenticated user. This method requires basic auth.
+ ///
+ ///
+ /// See API documentation for more
+ /// details.
+ ///
+ /// Options for changing the API response
+ /// A list of s for the authenticated user.
+ [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate",
+ Justification = "It's an API call, so it's not a property.")]
+ IObservable GetAll(ApiOptions options);
+
///
/// Get a specific for the authenticated user. This method requires basic auth.
///
diff --git a/Octokit.Reactive/Clients/IObservableReleasesClient.cs b/Octokit.Reactive/Clients/IObservableReleasesClient.cs
index a8bfa4cc..242e13d2 100644
--- a/Octokit.Reactive/Clients/IObservableReleasesClient.cs
+++ b/Octokit.Reactive/Clients/IObservableReleasesClient.cs
@@ -18,6 +18,19 @@ namespace Octokit.Reactive
/// The list of s for the specified repository.
IObservable GetAll(string owner, string name);
+ ///
+ /// Gets all s for the specified repository.
+ ///
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// Options for changing the API response
+ /// Thrown when a general API error occurs.
+ /// The list of s for the specified repository.
+ IObservable GetAll(string owner, string name, ApiOptions options);
+
///
/// Gets a single for the specified repository.
///
diff --git a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs
index 493e90b8..123860bc 100644
--- a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs
+++ b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs
@@ -328,7 +328,7 @@ namespace Octokit.Reactive
/// Access GitHub's Releases API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/repos/releases/
///
IObservableReleasesClient Release { get; }
diff --git a/Octokit.Reactive/Clients/IObservableRepositoryCommitsClients.cs b/Octokit.Reactive/Clients/IObservableRepositoryCommitsClients.cs
index 927b34c0..29d4d55e 100644
--- a/Octokit.Reactive/Clients/IObservableRepositoryCommitsClients.cs
+++ b/Octokit.Reactive/Clients/IObservableRepositoryCommitsClients.cs
@@ -43,5 +43,14 @@ namespace Octokit.Reactive
/// Used to filter list of commits returned
///
IObservable GetAll(string owner, string name, CommitRequest request);
+
+ ///
+ /// Get the SHA-1 of a commit reference
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The repository reference
+ ///
+ IObservable GetSha1(string owner, string name, string reference);
}
}
diff --git a/Octokit.Reactive/Clients/IObservableUserEmailsClient.cs b/Octokit.Reactive/Clients/IObservableUserEmailsClient.cs
index 5198ef1a..dd1c99c1 100644
--- a/Octokit.Reactive/Clients/IObservableUserEmailsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableUserEmailsClient.cs
@@ -22,6 +22,17 @@ namespace Octokit.Reactive
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable GetAll();
+ ///
+ /// Gets all email addresses for the authenticated user.
+ ///
+ ///
+ /// http://developer.github.com/v3/users/emails/#list-email-addresses-for-a-user
+ ///
+ /// Options for changing the API response
+ /// The es for the authenticated user.
+ [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
+ IObservable GetAll(ApiOptions options);
+
///
/// Adds email addresses for the authenticated user.
///
diff --git a/Octokit.Reactive/Clients/ObservableAssigneesClient.cs b/Octokit.Reactive/Clients/ObservableAssigneesClient.cs
index 63fe37d7..beabc06d 100644
--- a/Octokit.Reactive/Clients/ObservableAssigneesClient.cs
+++ b/Octokit.Reactive/Clients/ObservableAssigneesClient.cs
@@ -24,11 +24,24 @@ namespace Octokit.Reactive
/// The name of the repository
///
public IObservable GetAllForRepository(string owner, string name)
+ {
+ return GetAllForRepository(owner, name, ApiOptions.None);
+ }
+
+ ///
+ /// Gets all the available assignees (owner + collaborators) to which issues may be assigned.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The options to change API's behaviour
+ ///
+ 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.Assignees(owner, name));
+ return _connection.GetAndFlattenAllPages(ApiUrls.Assignees(owner, name), options);
}
///
diff --git a/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs b/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs
index 9d5127b7..d5cd1989 100644
--- a/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs
@@ -25,10 +25,26 @@ namespace Octokit.Reactive
/// See API documentation for more
/// details.
///
- /// An
+ /// A list of s for the authenticated user.
public IObservable GetAll()
{
- return _connection.GetAndFlattenAllPages(ApiUrls.Authorizations());
+ return GetAll(ApiOptions.None);
+ }
+
+ ///
+ /// Get all s for the authenticated user. This method requires basic auth.
+ ///
+ ///
+ /// See API documentation for more
+ /// details.
+ ///
+ /// Options for changing the API response
+ /// A list of s for the authenticated user.
+ public IObservable GetAll(ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Authorizations(), options);
}
///
diff --git a/Octokit.Reactive/Clients/ObservableReleasesClient.cs b/Octokit.Reactive/Clients/ObservableReleasesClient.cs
index dfc9478e..100bd131 100644
--- a/Octokit.Reactive/Clients/ObservableReleasesClient.cs
+++ b/Octokit.Reactive/Clients/ObservableReleasesClient.cs
@@ -36,6 +36,26 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages(ApiUrls.Releases(owner, name));
}
+ ///
+ /// Gets all s for the specified repository.
+ ///
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// Options for changing the API response
+ /// Thrown when a general API error occurs.
+ /// The list of s for the specified repository.
+ public IObservable GetAll(string owner, string name, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Releases(owner, name), options);
+ }
+
///
/// Gets a single for the specified repository.
///
diff --git a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs
index 1495afb7..005270bb 100644
--- a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs
+++ b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs
@@ -475,7 +475,7 @@ namespace Octokit.Reactive
/// Access GitHub's Releases API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/repos/releases/
///
public IObservableReleasesClient Release { get; private set; }
diff --git a/Octokit.Reactive/Clients/ObservableRepositoryCommitsClients.cs b/Octokit.Reactive/Clients/ObservableRepositoryCommitsClients.cs
index 7982485e..629142d7 100644
--- a/Octokit.Reactive/Clients/ObservableRepositoryCommitsClients.cs
+++ b/Octokit.Reactive/Clients/ObservableRepositoryCommitsClients.cs
@@ -73,5 +73,21 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages(ApiUrls.RepositoryCommits(owner, name),
request.ToParametersDictionary());
}
+
+ ///
+ /// Get the SHA-1 of a commit reference
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The repository reference
+ ///
+ public IObservable GetSha1(string owner, string name, string reference)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
+
+ return _commit.GetSha1(owner, name, reference).ToObservable();
+ }
}
}
diff --git a/Octokit.Reactive/Clients/ObservableUserEmailsClient.cs b/Octokit.Reactive/Clients/ObservableUserEmailsClient.cs
index 2a2d1071..96076c30 100644
--- a/Octokit.Reactive/Clients/ObservableUserEmailsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableUserEmailsClient.cs
@@ -34,7 +34,22 @@ namespace Octokit.Reactive
/// The es for the authenticated user.
public IObservable GetAll()
{
- return _connection.GetAndFlattenAllPages(ApiUrls.Emails());
+ return GetAll(ApiOptions.None);
+ }
+
+ ///
+ /// Gets all email addresses for the authenticated user.
+ ///
+ ///
+ /// http://developer.github.com/v3/users/emails/#list-email-addresses-for-a-user
+ ///
+ /// Options for changing the API response
+ /// The es for the authenticated user.
+ public IObservable GetAll(ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Emails(), options);
}
///
diff --git a/Octokit.Reactive/Helpers/ConnectionExtensions.cs b/Octokit.Reactive/Helpers/ConnectionExtensions.cs
index 0094134c..becbf01c 100644
--- a/Octokit.Reactive/Helpers/ConnectionExtensions.cs
+++ b/Octokit.Reactive/Helpers/ConnectionExtensions.cs
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
@@ -12,6 +14,15 @@ namespace Octokit.Reactive.Internal
return GetPages(url, null, (pageUrl, pageParams) => connection.Get>(pageUrl, null, null).ToObservable());
}
+ public static IObservable GetAndFlattenAllPages(this IConnection connection, Uri url, ApiOptions options)
+ {
+ return GetPagesWithOptions(url, options, (pageUrl, o) =>
+ {
+ var parameters = Pagination.Setup(new Dictionary(), options);
+ return connection.Get>(pageUrl, parameters, null).ToObservable();
+ });
+ }
+
public static IObservable GetAndFlattenAllPages(this IConnection connection, Uri url, IDictionary parameters)
{
return GetPages(url, parameters, (pageUrl, pageParams) => connection.Get>(pageUrl, pageParams, null).ToObservable());
@@ -35,5 +46,24 @@ namespace Octokit.Reactive.Internal
.Where(resp => resp != null)
.SelectMany(resp => resp.Body);
}
+
+ static IObservable GetPagesWithOptions(Uri uri, ApiOptions options,
+ Func>>> getPageFunc)
+ {
+ return getPageFunc(uri, options).Expand(resp =>
+ {
+ var nextPageUri = resp.HttpResponse.ApiInfo.GetNextPageUrl();
+
+ var shouldContinue = Pagination.ShouldContinue(
+ nextPageUri,
+ options);
+
+ return shouldContinue
+ ? Observable.Defer(() => getPageFunc(nextPageUri, null))
+ : Observable.Empty>>();
+ })
+ .Where(resp => resp != null)
+ .SelectMany(resp => resp.Body);
+ }
}
}
diff --git a/Octokit.Reactive/Octokit.Reactive-Mono.csproj b/Octokit.Reactive/Octokit.Reactive-Mono.csproj
index 41db9810..6cf3a026 100644
--- a/Octokit.Reactive/Octokit.Reactive-Mono.csproj
+++ b/Octokit.Reactive/Octokit.Reactive-Mono.csproj
@@ -52,6 +52,9 @@
Helpers\Ensure.cs
+
+ Helpers\Pagination.cs
+
Properties\SolutionInfo.cs
@@ -181,4 +184,4 @@
Octokit-Mono
-
\ No newline at end of file
+
diff --git a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj
index 2a01d4da..146e66b0 100644
--- a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj
+++ b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj
@@ -60,6 +60,9 @@
Helpers\Ensure.cs
+
+ Helpers\Pagination.cs
+
Properties\SolutionInfo.cs
@@ -189,4 +192,4 @@
Octokit-MonoAndroid
-
\ No newline at end of file
+
diff --git a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj
index c3855b70..c3d64929 100644
--- a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj
+++ b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj
@@ -56,6 +56,9 @@
Helpers\Ensure.cs
+
+ Helpers\Pagination.cs
+
Properties\SolutionInfo.cs
@@ -185,4 +188,4 @@
Octokit-Monotouch
-
\ No newline at end of file
+
diff --git a/Octokit.Reactive/Octokit.Reactive.csproj b/Octokit.Reactive/Octokit.Reactive.csproj
index 4c69b57f..8d1d8e99 100644
--- a/Octokit.Reactive/Octokit.Reactive.csproj
+++ b/Octokit.Reactive/Octokit.Reactive.csproj
@@ -72,6 +72,9 @@
Helpers\Ensure.cs
+
+ Helpers\Pagination.cs
+
Properties\SolutionInfo.cs
diff --git a/Octokit.Tests.Conventions/Exception/ApiOptionsMissingException.cs b/Octokit.Tests.Conventions/Exception/ApiOptionsMissingException.cs
new file mode 100644
index 00000000..61d1111f
--- /dev/null
+++ b/Octokit.Tests.Conventions/Exception/ApiOptionsMissingException.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+namespace Octokit.Tests.Conventions
+{
+ public class ApiOptionsMissingException : Exception
+ {
+ public ApiOptionsMissingException(Type type, IEnumerable methods)
+ : base(CreateMessage(type, methods)) { }
+
+ static string CreateMessage(Type type, IEnumerable methods)
+ {
+ var methodsFormatted = String.Join("\r\n", methods.Select(FormatMethod));
+ return "Methods found on type {0} require an overload which accepts an parameter of type ApiOptions:\r\n{1}"
+ .FormatWithNewLine(
+ type.Name,
+ methodsFormatted);
+ }
+
+ static string FormatMethod(MethodInfo m)
+ {
+ var formattedParameters = m.GetParameters()
+ .Select(p => string.Format("{0} {1}", p.ParameterType.Name, p.Name));
+
+ var parameterList = string.Join(", ", formattedParameters);
+
+ return string.Format(" - {0}({1})", m.Name, parameterList);
+ }
+ }
+}
diff --git a/Octokit.Tests.Conventions/ModelTests.cs b/Octokit.Tests.Conventions/ModelTests.cs
index f126e8cd..0cfcb3c8 100644
--- a/Octokit.Tests.Conventions/ModelTests.cs
+++ b/Octokit.Tests.Conventions/ModelTests.cs
@@ -95,27 +95,6 @@ namespace Octokit.Tests.Conventions
}
}
- //TODO: This should (probably) be moved to the PaginationTests class that is being introduced in PR #760
- [Theory]
- [MemberData("GetClientInterfaces")]
- public void CheckPaginationGetAllMethodNames(Type clientInterface)
- {
- var methodsOrdered = clientInterface.GetMethodsOrdered();
-
- var methodsThatCanPaginate = methodsOrdered
- .Where(x => x.ReturnType.GetTypeInfo().TypeCategory == TypeCategory.ReadOnlyList)
- .Where(x => x.Name.StartsWith("Get"));
-
- var invalidMethods = methodsThatCanPaginate
- .Where(x => !x.Name.StartsWith("GetAll"))
- .ToList();
-
- if (invalidMethods.Any())
- {
- throw new PaginationGetAllMethodNameMismatchException(clientInterface, invalidMethods);
- }
- }
-
public static IEnumerable
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/issues/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/issues/
///
public IIssuesClient Issue { get; private set; }
@@ -171,7 +171,7 @@ namespace Octokit
/// Access GitHub's Miscellaneous API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/misc/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/misc/
///
public IMiscellaneousClient Miscellaneous { get; private set; }
@@ -179,7 +179,7 @@ namespace Octokit
/// Access GitHub's OAuth API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/oauth/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/oauth/
///
public IOauthClient Oauth { get; private set; }
@@ -187,7 +187,7 @@ namespace Octokit
/// Access GitHub's Organizations API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/orgs/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/orgs/
///
public IOrganizationsClient Organization { get; private set; }
@@ -195,7 +195,7 @@ namespace Octokit
/// Access GitHub's Pull Requests API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/pulls/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/pulls/
///
public IPullRequestsClient PullRequest { get; private set; }
@@ -203,7 +203,7 @@ namespace Octokit
/// Access GitHub's Repositories API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/repos/
///
public IRepositoriesClient Repository { get; private set; }
@@ -211,7 +211,7 @@ namespace Octokit
/// Access GitHub's Gists API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/gists/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/gists/
///
public IGistsClient Gist { get; private set; }
@@ -219,7 +219,7 @@ namespace Octokit
/// Access GitHub's Releases API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/repos/releases/
///
[Obsolete("Use Repository.Release instead")]
public IReleasesClient Release
@@ -233,7 +233,7 @@ namespace Octokit
/// Access GitHub's Public Keys API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/users/keys/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/users/keys/
///
public ISshKeysClient SshKey { get; private set; }
@@ -241,7 +241,7 @@ namespace Octokit
/// Access GitHub's Users API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/users/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/users/
///
public IUsersClient User { get; private set; }
@@ -250,7 +250,7 @@ namespace Octokit
/// Access GitHub's Notifications API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/activity/notifications/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/activity/notifications/
///
public INotificationsClient Notification { get; private set; }
@@ -258,7 +258,7 @@ namespace Octokit
/// Access GitHub's Git Data API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/git/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/git/
///
[Obsolete("Use Git instead")]
public IGitDatabaseClient GitDatabase { get { return Git; } }
@@ -267,7 +267,7 @@ namespace Octokit
/// Access GitHub's Git Data API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/git/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/git/
///
public IGitDatabaseClient Git { get; private set; }
@@ -275,7 +275,7 @@ namespace Octokit
/// Access GitHub's Search API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/search/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/search/
///
public ISearchClient Search { get; private set; }
@@ -284,7 +284,7 @@ namespace Octokit
/// Access GitHub's Deployments API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/deployments/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/repos/deployments/
///
public IDeploymentsClient Deployment { get; private set; }
@@ -292,7 +292,7 @@ namespace Octokit
/// Access GitHub's Enterprise API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/enterprise/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/enterprise/
///
public IEnterpriseClient Enterprise { get; private set; }
diff --git a/Octokit/Helpers/AcceptHeaders.cs b/Octokit/Helpers/AcceptHeaders.cs
index d94e7e15..21c0047e 100644
--- a/Octokit/Helpers/AcceptHeaders.cs
+++ b/Octokit/Helpers/AcceptHeaders.cs
@@ -13,5 +13,7 @@
public const string ProtectedBranchesApiPreview = "application/vnd.github.loki-preview+json";
public const string StarCreationTimestamps = "application/vnd.github.v3.star+json";
+
+ public const string CommitReferenceSha1Preview = "application/vnd.github.chitauri-preview+sha";
}
}
diff --git a/Octokit/Helpers/ApiExtensions.cs b/Octokit/Helpers/ApiExtensions.cs
index 5a3c9a15..81b1ab8e 100644
--- a/Octokit/Helpers/ApiExtensions.cs
+++ b/Octokit/Helpers/ApiExtensions.cs
@@ -26,7 +26,7 @@ namespace Octokit
Ensure.ArgumentNotNull(connection, "connection");
Ensure.ArgumentNotNull(uri, "uri");
- return connection.GetAll(uri, null);
+ return connection.GetAll(uri, ApiOptions.None);
}
///
diff --git a/Octokit/Helpers/Pagination.cs b/Octokit/Helpers/Pagination.cs
new file mode 100644
index 00000000..1acf39ea
--- /dev/null
+++ b/Octokit/Helpers/Pagination.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+
+namespace Octokit
+{
+ internal static class Pagination
+ {
+ internal static IDictionary Setup(IDictionary parameters, ApiOptions options)
+ {
+ parameters = parameters ?? new Dictionary();
+
+ if (options.PageSize.HasValue)
+ {
+ parameters.Add("per_page", options.PageSize.Value.ToString(CultureInfo.InvariantCulture));
+ }
+
+ if (options.StartPage.HasValue)
+ {
+ parameters.Add("page", options.StartPage.Value.ToString(CultureInfo.InvariantCulture));
+ }
+
+ return parameters;
+ }
+
+ internal static bool ShouldContinue(
+ Uri uri,
+ ApiOptions options)
+ {
+ if (uri == null)
+ {
+ return false;
+ }
+
+ if (uri.Query.Contains("page=") && options.PageCount.HasValue)
+ {
+ var allValues = ToQueryStringDictionary(uri);
+
+ string pageValue;
+ if (allValues.TryGetValue("page", out pageValue))
+ {
+ var startPage = options.StartPage ?? 1;
+ var pageCount = options.PageCount.Value;
+
+ var endPage = startPage + pageCount;
+ if (pageValue.Equals(endPage.ToString(CultureInfo.InvariantCulture), StringComparison.OrdinalIgnoreCase))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ static Dictionary ToQueryStringDictionary(Uri uri)
+ {
+ return uri.Query.Split('&')
+ .Select(keyValue =>
+ {
+ var indexOf = keyValue.IndexOf('=');
+ if (indexOf > 0)
+ {
+ var key = keyValue.Substring(0, indexOf);
+ var value = keyValue.Substring(indexOf + 1);
+ return new KeyValuePair(key, value);
+ }
+
+ //just a plain old value, return it
+ return new KeyValuePair(keyValue, null);
+ })
+ .ToDictionary(x => x.Key, x => x.Value);
+ }
+ }
+}
diff --git a/Octokit/Http/ApiConnection.cs b/Octokit/Http/ApiConnection.cs
index 33a77f6e..c1d2710a 100644
--- a/Octokit/Http/ApiConnection.cs
+++ b/Octokit/Http/ApiConnection.cs
@@ -115,7 +115,20 @@ namespace Octokit
/// Thrown when an API error occurs.
public Task> GetAll(Uri uri)
{
- return GetAll(uri, null, null);
+ return GetAll(uri, ApiOptions.None);
+ }
+
+ ///
+ /// Gets all API resources in the list at the specified URI.
+ ///
+ /// Type of the API resource in the list.
+ /// URI of the API resource to get
+ /// Options for changing the API response
+ /// of the The API resources in the list.
+ /// Thrown when an API error occurs.
+ public Task> GetAll(Uri uri, ApiOptions options)
+ {
+ return GetAll(uri, null, null, options);
}
///
@@ -128,7 +141,21 @@ namespace Octokit
/// Thrown when an API error occurs.
public Task> GetAll(Uri uri, IDictionary parameters)
{
- return GetAll(uri, parameters, null);
+ return GetAll(uri, parameters, null, ApiOptions.None);
+ }
+
+ ///
+ /// Gets all API resources in the list at the specified URI.
+ ///
+ /// Type of the API resource in the list.
+ /// URI of the API resource to get
+ /// Parameters to add to the API request
+ /// Options for changing the API response
+ /// of the The API resources in the list.
+ /// Thrown when an API error occurs.
+ public Task> GetAll(Uri uri, IDictionary parameters, ApiOptions options)
+ {
+ return GetAll(uri, parameters, null, options);
}
///
@@ -148,6 +175,17 @@ namespace Octokit
.ConfigureAwait(false), uri);
}
+ public Task> GetAll(Uri uri, IDictionary parameters, string accepts, ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(uri, "uri");
+ Ensure.ArgumentNotNull(options, "options");
+
+ parameters = Pagination.Setup(parameters, options);
+
+ return _pagination.GetAllPages(async () => await GetPage(uri, parameters, accepts, options)
+ .ConfigureAwait(false), uri);
+ }
+
///
/// Creates a new API resource in the list at the specified URI.
///
@@ -498,5 +536,30 @@ namespace Octokit
response,
nextPageUri => Connection.Get>(nextPageUri, parameters, accepts));
}
+
+ async Task> GetPage(
+ Uri uri,
+ IDictionary parameters,
+ string accepts,
+ ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(uri, "uri");
+
+ var connection = Connection;
+
+ var response = await connection.Get>(uri, parameters, accepts).ConfigureAwait(false);
+ return new ReadOnlyPagedCollection(
+ response,
+ nextPageUri =>
+ {
+ var shouldContinue = Pagination.ShouldContinue(
+ nextPageUri,
+ options);
+
+ return shouldContinue
+ ? connection.Get>(nextPageUri, parameters, accepts)
+ : null;
+ });
+ }
}
}
diff --git a/Octokit/Http/ApiInfo.cs b/Octokit/Http/ApiInfo.cs
index 0c6c7705..ce6ef0c2 100644
--- a/Octokit/Http/ApiInfo.cs
+++ b/Octokit/Http/ApiInfo.cs
@@ -66,7 +66,7 @@ namespace Octokit
return new ApiInfo(Links.Clone(),
OauthScopes.Clone(),
AcceptedOauthScopes.Clone(),
- new string(this.Etag.ToCharArray()),
+ new string(Etag.ToCharArray()),
RateLimit.Clone());
}
}
diff --git a/Octokit/Http/Credentials.cs b/Octokit/Http/Credentials.cs
index 37261bac..f62efa63 100644
--- a/Octokit/Http/Credentials.cs
+++ b/Octokit/Http/Credentials.cs
@@ -6,7 +6,7 @@ namespace Octokit
{
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes"
, Justification = "Credentials is immutable")]
- public readonly static Credentials Anonymous = new Credentials();
+ public static readonly Credentials Anonymous = new Credentials();
private Credentials()
{
diff --git a/Octokit/Http/HttpClientAdapter.cs b/Octokit/Http/HttpClientAdapter.cs
index 8f4f6d83..1c6a65a5 100644
--- a/Octokit/Http/HttpClientAdapter.cs
+++ b/Octokit/Http/HttpClientAdapter.cs
@@ -64,7 +64,7 @@ namespace Octokit.Internal
return cancellationTokenForRequest;
}
- protected async virtual Task BuildResponse(HttpResponseMessage responseMessage)
+ protected virtual async Task BuildResponse(HttpResponseMessage responseMessage)
{
Ensure.ArgumentNotNull(responseMessage, "responseMessage");
diff --git a/Octokit/Http/IApiConnection.cs b/Octokit/Http/IApiConnection.cs
index 5805df83..81966a10 100644
--- a/Octokit/Http/IApiConnection.cs
+++ b/Octokit/Http/IApiConnection.cs
@@ -71,6 +71,16 @@ namespace Octokit
/// Thrown when an API error occurs.
Task> GetAll(Uri uri);
+ ///
+ /// Gets all API resources in the list at the specified URI.
+ ///
+ /// Type of the API resource in the list.
+ /// URI of the API resource to get
+ /// Options for changing the API response
+ /// of the The API resources in the list.
+ /// Thrown when an API error occurs.
+ Task> GetAll(Uri uri, ApiOptions options);
+
///
/// Gets all API resources in the list at the specified URI.
///
@@ -81,6 +91,17 @@ namespace Octokit
/// Thrown when an API error occurs.
Task> GetAll(Uri uri, IDictionary parameters);
+ ///
+ /// Gets all API resources in the list at the specified URI.
+ ///
+ /// Type of the API resource in the list.
+ /// URI of the API resource to get
+ /// Parameters to add to the API request
+ /// Options for changing the API response
+ /// of the The API resources in the list.
+ /// Thrown when an API error occurs.
+ Task> GetAll(Uri uri, IDictionary parameters, ApiOptions options);
+
///
/// Gets all API resources in the list at the specified URI.
///
@@ -92,6 +113,18 @@ namespace Octokit
/// Thrown when an API error occurs.
Task> GetAll(Uri uri, IDictionary parameters, string accepts);
+ ///
+ /// Gets all API resources in the list at the specified URI.
+ ///
+ /// Type of the API resource in the list.
+ /// URI of the API resource to get
+ /// Parameters to add to the API request
+ /// Accept header to use for the API request
+ /// Options for changing the API response
+ /// of the The API resources in the list.
+ /// Thrown when an API error occurs.
+ Task> GetAll(Uri uri, IDictionary parameters, string accepts, ApiOptions options);
+
///
/// Creates a new API resource in the list at the specified URI.
///
@@ -108,7 +141,7 @@ namespace Octokit
/// The created API resource.
/// Thrown when an API error occurs.
Task Post(Uri uri);
-
+
///
/// Creates a new API resource in the list at the specified URI.
///
diff --git a/Octokit/Http/ReadOnlyPagedCollection.cs b/Octokit/Http/ReadOnlyPagedCollection.cs
index 9e642824..520f107b 100644
--- a/Octokit/Http/ReadOnlyPagedCollection.cs
+++ b/Octokit/Http/ReadOnlyPagedCollection.cs
@@ -28,7 +28,14 @@ namespace Octokit.Internal
var nextPageUrl = _info.GetNextPageUrl();
if (nextPageUrl == null) return null;
- var response = await _nextPageFunc(nextPageUrl).ConfigureAwait(false);
+ var maybeTask = _nextPageFunc(nextPageUrl);
+
+ if (maybeTask == null)
+ {
+ return null;
+ }
+
+ var response = await maybeTask.ConfigureAwait(false);
return new ReadOnlyPagedCollection(response, _nextPageFunc);
}
}
diff --git a/Octokit/IGitHubClient.cs b/Octokit/IGitHubClient.cs
index f6a996c9..d39eeb03 100644
--- a/Octokit/IGitHubClient.cs
+++ b/Octokit/IGitHubClient.cs
@@ -16,7 +16,7 @@ namespace Octokit
/// Access GitHub's Authorization API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/oauth_authorizations/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/oauth_authorizations/
///
IAuthorizationsClient Authorization { get; }
@@ -24,7 +24,7 @@ namespace Octokit
/// Access GitHub's Activity API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/activity/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/activity/
///
IActivitiesClient Activity { get; }
@@ -32,7 +32,7 @@ namespace Octokit
/// Access GitHub's Issue API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/issues/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/issues/
///
IIssuesClient Issue { get; }
@@ -40,7 +40,7 @@ namespace Octokit
/// Access GitHub's Miscellaneous API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/misc/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/misc/
///
IMiscellaneousClient Miscellaneous { get; }
@@ -48,7 +48,7 @@ namespace Octokit
/// Access GitHub's OAuth API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/oauth/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/oauth/
///
IOauthClient Oauth { get; }
@@ -56,7 +56,7 @@ namespace Octokit
/// Access GitHub's Organizations API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/orgs/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/orgs/
///
IOrganizationsClient Organization { get; }
@@ -64,7 +64,7 @@ namespace Octokit
/// Access GitHub's Pull Requests API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/pulls/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/pulls/
///
IPullRequestsClient PullRequest { get; }
@@ -72,7 +72,7 @@ namespace Octokit
/// Access GitHub's Repositories API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/repos/
///
IRepositoriesClient Repository { get; }
@@ -80,7 +80,7 @@ namespace Octokit
/// Access GitHub's Gists API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/gists/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/gists/
///
IGistsClient Gist { get; }
@@ -89,7 +89,7 @@ namespace Octokit
/// Access GitHub's Releases API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/repos/releases/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/repos/releases/
///
[Obsolete("Use Repository.Release instead")]
IReleasesClient Release { get; }
@@ -100,7 +100,7 @@ namespace Octokit
/// Access GitHub's Public Keys API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/users/keys/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/users/keys/
///
ISshKeysClient SshKey { get; }
@@ -108,7 +108,7 @@ namespace Octokit
/// Access GitHub's Users API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/users/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/users/
///
IUsersClient User { get; }
@@ -117,7 +117,7 @@ namespace Octokit
/// Access GitHub's Notifications API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/activity/notifications/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/activity/notifications/
///
[System.Obsolete("Notifications are now available under the Activities client. This will be removed in a future update.")]
INotificationsClient Notification { get; }
@@ -126,7 +126,7 @@ namespace Octokit
/// Access GitHub's Git Data API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/git/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/git/
///
[Obsolete("Use Git instead")]
IGitDatabaseClient GitDatabase { get; }
@@ -135,7 +135,7 @@ namespace Octokit
/// Access GitHub's Git Data API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/git/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/git/
///
IGitDatabaseClient Git { get; }
@@ -143,7 +143,7 @@ namespace Octokit
/// Access GitHub's Search API.
///
///
- /// Refer to the API docmentation for more information: https://developer.github.com/v3/search/
+ /// Refer to the API documentation for more information: https://developer.github.com/v3/search/
///
ISearchClient Search { get; }
diff --git a/Octokit/Models/Request/ApiOptions.cs b/Octokit/Models/Request/ApiOptions.cs
new file mode 100644
index 00000000..cdc3cbf3
--- /dev/null
+++ b/Octokit/Models/Request/ApiOptions.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+namespace Octokit
+{
+ [DebuggerDisplay("{DebuggerDisplay,nq}")]
+ public class ApiOptions
+ {
+ public static ApiOptions None
+ {
+ get { return new ApiOptions(); }
+ }
+
+ ///
+ /// Specify the start page for pagination actions
+ ///
+ ///
+ /// Page numbering is 1-based on the server
+ ///
+ public int? StartPage { get; set; }
+
+ ///
+ /// Specify the number of pages to return
+ ///
+ public int? PageCount { get; set; }
+
+ ///
+ /// Specify the number of results to return for each page
+ ///
+ ///
+ /// Results returned may be less than this total if you reach the final page of results
+ ///
+ public int? PageSize { get; set; }
+
+ internal string DebuggerDisplay
+ {
+ get
+ {
+ var values = new List();
+
+ if (StartPage.HasValue)
+ {
+ values.Add("StartPage: " + StartPage.Value);
+ }
+
+ if (PageCount.HasValue)
+ {
+ values.Add("PageCount: " + PageCount.Value);
+ }
+
+ if (PageSize.HasValue)
+ {
+ values.Add("PageSize: " + PageSize.Value);
+ }
+
+ return String.Join(", ", values);
+ }
+ }
+ }
+}
diff --git a/Octokit/Models/Request/CreateFileRequest.cs b/Octokit/Models/Request/CreateFileRequest.cs
index b9529e3b..7104b364 100644
--- a/Octokit/Models/Request/CreateFileRequest.cs
+++ b/Octokit/Models/Request/CreateFileRequest.cs
@@ -26,7 +26,7 @@ namespace Octokit
///
/// The message.
/// The branch the request is for.
- protected ContentRequest(string message, string branch): this(message)
+ protected ContentRequest(string message, string branch) : this(message)
{
Ensure.ArgumentNotNullOrEmptyString(branch, "branch");
diff --git a/Octokit/Octokit-Mono.csproj b/Octokit/Octokit-Mono.csproj
index eca26aea..abbfe348 100644
--- a/Octokit/Octokit-Mono.csproj
+++ b/Octokit/Octokit-Mono.csproj
@@ -447,6 +447,8 @@
+
+
diff --git a/Octokit/Octokit-MonoAndroid.csproj b/Octokit/Octokit-MonoAndroid.csproj
index 5b72f2a8..60896d14 100644
--- a/Octokit/Octokit-MonoAndroid.csproj
+++ b/Octokit/Octokit-MonoAndroid.csproj
@@ -456,6 +456,8 @@
+
+
@@ -467,4 +469,4 @@
-
\ No newline at end of file
+
diff --git a/Octokit/Octokit-Monotouch.csproj b/Octokit/Octokit-Monotouch.csproj
index f02ec307..41d2a7e0 100644
--- a/Octokit/Octokit-Monotouch.csproj
+++ b/Octokit/Octokit-Monotouch.csproj
@@ -452,6 +452,8 @@
+
+
@@ -464,4 +466,4 @@
-
\ No newline at end of file
+
diff --git a/Octokit/Octokit-Portable.csproj b/Octokit/Octokit-Portable.csproj
index e4d48b60..0f950019 100644
--- a/Octokit/Octokit-Portable.csproj
+++ b/Octokit/Octokit-Portable.csproj
@@ -444,6 +444,8 @@
+
+
diff --git a/Octokit/Octokit-netcore45.csproj b/Octokit/Octokit-netcore45.csproj
index da554e94..3cfdc341 100644
--- a/Octokit/Octokit-netcore45.csproj
+++ b/Octokit/Octokit-netcore45.csproj
@@ -451,6 +451,8 @@
+
+
diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj
index b30d6435..f6004fb9 100644
--- a/Octokit/Octokit.csproj
+++ b/Octokit/Octokit.csproj
@@ -103,6 +103,7 @@
+
@@ -112,6 +113,7 @@
+
diff --git a/SolutionInfo.cs b/SolutionInfo.cs
index a52961be..22509412 100644
--- a/SolutionInfo.cs
+++ b/SolutionInfo.cs
@@ -6,8 +6,10 @@ using System.Runtime.InteropServices;
[assembly: AssemblyVersionAttribute("0.19.0")]
[assembly: AssemblyFileVersionAttribute("0.19.0")]
[assembly: ComVisibleAttribute(false)]
-namespace System {
- internal static class AssemblyVersionInformation {
+namespace System
+{
+ internal static class AssemblyVersionInformation
+ {
internal const string Version = "0.19.0";
}
}
diff --git a/build.cmd b/build.cmd
index d5ac4da4..3e500ca4 100644
--- a/build.cmd
+++ b/build.cmd
@@ -1,9 +1,9 @@
@echo off
-"tools\nuget\nuget.exe" "install" "xunit.runner.console" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "2.1.0"
-"tools\nuget\nuget.exe" "install" "FAKE.Core" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "4.4.2"
-"tools\nuget\nuget.exe" "install" "SourceLink.Fake" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.1.0"
-"tools\nuget\nuget.exe" "install" "Octokit.CodeFormatter" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.0.0-preview" -Pre
+"tools\nuget\nuget.exe" "install" "xunit.runner.console" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "2.1.0" -verbosity quiet
+"tools\nuget\nuget.exe" "install" "FAKE.Core" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "4.22.2" -verbosity quiet
+"tools\nuget\nuget.exe" "install" "SourceLink.Fake" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.1.0" -verbosity quiet
+"tools\nuget\nuget.exe" "install" "Octokit.CodeFormatter" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.0.0-preview" -Pre -verbosity quiet
:Build
cls
diff --git a/build.sh b/build.sh
index 907b1b01..3c455fb4 100755
--- a/build.sh
+++ b/build.sh
@@ -3,16 +3,18 @@ if test "$OS" = "Windows_NT"
then
# use .Net
-"./tools/nuget/nuget.exe" "install" "xunit.runner.console" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "2.0.0"
-"./tools/nuget/nuget.exe" "install" "FAKE.Core" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "4.4.2"
-"./tools/nuget/nuget.exe" "install" "SourceLink.Fake" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.1.0"
-packages/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
+"./tools/nuget/nuget.exe" "install" "xunit.runner.console" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "2.0.0" -verbosity quiet
+"./tools/nuget/nuget.exe" "install" "FAKE.Core" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "4.22.2" -verbosity quiet
+"./tools/nuget/nuget.exe" "install" "SourceLink.Fake" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.1.0" -verbosity quiet
+"./tools/nuget/nuget.exe" "install" "Octokit.CodeFormatter" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.0.0-preview" -Pre -verbosity quiet
+packages/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
else
# use mono
-mono "./tools/nuget/NuGet.exe" "install" "xunit.runner.console" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "2.0.0"
-mono "./tools/nuget/NuGet.exe" "install" "FAKE.Core" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "4.4.2"
-mono "./tools/nuget/NuGet.exe" "install" "SourceLink.Fake" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.1.0"
-mono "./tools/nuget/NuGet.exe" "install" "System.Net.Http" "-OutputDirectory" "tools"
-mono "./tools/nuget/NuGet.exe" "install" "Microsoft.Net.Http" "-OutputDirectory" "tools"
-mono ./tools/FAKE.Core/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
+mono "./tools/nuget/NuGet.exe" "install" "xunit.runner.console" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "2.0.0" -verbosity quiet
+mono "./tools/nuget/NuGet.exe" "install" "FAKE.Core" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "4.22.2" -verbosity quiet
+mono "./tools/nuget/NuGet.exe" "install" "SourceLink.Fake" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.1.0" -verbosity quiet
+mono "./tools/nuget/NuGet.exe" "install" "Octokit.CodeFormatter" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.0.0-preview" -Pre -verbosity quiet
+mono "./tools/nuget/NuGet.exe" "install" "System.Net.Http" "-OutputDirectory" "tools" -verbosity quiet
+mono "./tools/nuget/NuGet.exe" "install" "Microsoft.Net.Http" "-OutputDirectory" "tools" -verbosity quiet
+mono ./tools/FAKE.Core/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
fi
diff --git a/docs/extensibility.md b/docs/extensibility.md
new file mode 100644
index 00000000..abab1675
--- /dev/null
+++ b/docs/extensibility.md
@@ -0,0 +1,25 @@
+# Extensibility
+
+Octokit.net has been designed to be easy to get started, but there are options
+available to tweak the default behaviour once you know the basics.
+
+## Pagination
+
+The GitHub API supports paging results whenever collections are returned.
+
+By default, Octokit.net will fetch the entire set of data. Any method prefixed with
+`GetAll*` now has an overload which accepts an `ApiOptions` parameter.
+
+```csharp
+var options = new ApiOptions();
+var repositories = await client.Repository.GetAllForCurrent(options);
+```
+
+`ApiOptions` has a number of properties:
+
+ - `PageCount` - return a set number of pages
+ - `PageSize` - change the number of results to return per page
+ - `StartPage` - start results from a given page
+
+These parameters can be used in any sort of group. If you don't specify a
+`PageSize` the default page size is 30.
diff --git a/mkdocs.yml b/mkdocs.yml
index 713d7cbf..3ac0cf66 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -29,6 +29,7 @@ pages:
- 'Exploring Pull Requests' : 'demos/exploring-pull-requests.md'
- Advanced:
+ - 'API Options': 'extensibility.md'
- 'Debugging from Source': 'debugging-source.md'
- 'OAuth Flow': 'oauth-flow.md'
- 'HttpClient': 'http-client.md'