From b0ab485ed13344c4443f9a1f047077bb47eba485 Mon Sep 17 00:00:00 2001 From: Henrik Andersson Date: Sun, 22 Mar 2015 19:09:08 +1000 Subject: [PATCH 1/4] Add a convention test --- ...nationGetAllMethodNameMismatchException.cs | 24 ++++++++++++++++++ Octokit.Tests.Conventions/ModelTests.cs | 25 +++++++++++++++++++ .../Octokit.Tests.Conventions.csproj | 1 + 3 files changed, 50 insertions(+) create mode 100644 Octokit.Tests.Conventions/Exception/PaginationGetAllMethodNameMismatchException.cs diff --git a/Octokit.Tests.Conventions/Exception/PaginationGetAllMethodNameMismatchException.cs b/Octokit.Tests.Conventions/Exception/PaginationGetAllMethodNameMismatchException.cs new file mode 100644 index 0000000000..8c20067ee9 --- /dev/null +++ b/Octokit.Tests.Conventions/Exception/PaginationGetAllMethodNameMismatchException.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace Octokit.Tests.Conventions +{ + public class PaginationGetAllMethodNameMismatchException : Exception + { + public PaginationGetAllMethodNameMismatchException(Type type, IEnumerable methods) + : base(CreateMessage(type, methods)) { } + + static string CreateMessage(Type type, IEnumerable methods) + { + var methodsFormatted = String.Join("\r\n", methods.Select(m => String.Format(" - {0}", m))); + return "Methods found on type {0} should follow the 'GetAll*' naming convention:\r\n{1}" + .FormatWithNewLine( + type.Name, + methodsFormatted); + } + } +} diff --git a/Octokit.Tests.Conventions/ModelTests.cs b/Octokit.Tests.Conventions/ModelTests.cs index 19e54cc529..df87d961a8 100644 --- a/Octokit.Tests.Conventions/ModelTests.cs +++ b/Octokit.Tests.Conventions/ModelTests.cs @@ -59,6 +59,31 @@ public void ResponseModelsHaveReadOnlyCollections(Type modelType) } } + //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")); + + if (invalidMethods.Any()) + { + throw new PaginationGetAllMethodNameMismatchException(clientInterface, invalidMethods); + } + } + + public static IEnumerable GetClientInterfaces() + { + return typeof(IEventsClient).Assembly.ExportedTypes.Where(TypeExtensions.IsClientInterface).Select(type => new[] { type }); + } + public static IEnumerable ModelTypes { get { return GetModelTypes(includeRequestModels: true).Select(type => new[] { type }); } diff --git a/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj b/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj index 0f4f72447a..d7ec4332e7 100644 --- a/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj +++ b/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj @@ -57,6 +57,7 @@ + From 78e76be7d9d7ea33c6dfa64e4c5cfb08123ae869 Mon Sep 17 00:00:00 2001 From: Henrik Andersson Date: Tue, 24 Mar 2015 00:11:52 +1000 Subject: [PATCH 2/4] Update clients --- Octokit/Clients/AssigneesClient.cs | 2 +- Octokit/Clients/EventsClient.cs | 10 +++++----- Octokit/Clients/FollowersClient.cs | 4 ++-- Octokit/Clients/GistCommentsClient.cs | 2 +- Octokit/Clients/IAssigneesClient.cs | 2 +- Octokit/Clients/IEventsClient.cs | 10 +++++----- Octokit/Clients/IFollowersClient.cs | 4 ++-- Octokit/Clients/IGistCommentsClient.cs | 2 +- Octokit/Clients/IIssueCommentsClient.cs | 4 ++-- Octokit/Clients/IIssuesClient.cs | 4 ++-- Octokit/Clients/IIssuesEventsClient.cs | 4 ++-- Octokit/Clients/IIssuesLabelsClient.cs | 6 +++--- Octokit/Clients/IMilestonesClient.cs | 4 ++-- Octokit/Clients/IMiscellaneousClient.cs | 6 +++--- Octokit/Clients/IOrganizationMembersClient.cs | 2 +- Octokit/Clients/IPullRequestReviewCommentsClient.cs | 4 ++-- Octokit/Clients/IPullRequestsClient.cs | 4 ++-- Octokit/Clients/IReleasesClient.cs | 2 +- Octokit/Clients/IRepositoryCommentsClient.cs | 4 ++-- Octokit/Clients/IRepositoryContentsClient.cs | 2 +- Octokit/Clients/ITeamsClient.cs | 4 ++-- Octokit/Clients/IssueCommentsClient.cs | 4 ++-- Octokit/Clients/IssuesClient.cs | 6 +++--- Octokit/Clients/IssuesEventsClient.cs | 4 ++-- Octokit/Clients/IssuesLabelsClient.cs | 6 +++--- Octokit/Clients/MilestonesClient.cs | 6 +++--- Octokit/Clients/MiscellaneousClient.cs | 6 +++--- Octokit/Clients/OrganizationMembersClient.cs | 2 +- Octokit/Clients/PullRequestReviewCommentsClient.cs | 6 +++--- Octokit/Clients/PullRequestsClient.cs | 6 +++--- Octokit/Clients/ReleasesClient.cs | 2 +- Octokit/Clients/RepositoryCommentsClient.cs | 4 ++-- Octokit/Clients/RepositoryContentsClient.cs | 2 +- Octokit/Clients/TeamsClient.cs | 4 ++-- 34 files changed, 72 insertions(+), 72 deletions(-) diff --git a/Octokit/Clients/AssigneesClient.cs b/Octokit/Clients/AssigneesClient.cs index 46e9cb4e70..110a37dc53 100644 --- a/Octokit/Clients/AssigneesClient.cs +++ b/Octokit/Clients/AssigneesClient.cs @@ -26,7 +26,7 @@ public AssigneesClient(IApiConnection apiConnection) : base(apiConnection) /// The owner of the repository /// The name of the repository /// - public Task> GetForRepository(string owner, string name) + public Task> GetAllForRepository(string owner, string name) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); diff --git a/Octokit/Clients/EventsClient.cs b/Octokit/Clients/EventsClient.cs index c58083498a..65e420f0f1 100644 --- a/Octokit/Clients/EventsClient.cs +++ b/Octokit/Clients/EventsClient.cs @@ -89,7 +89,7 @@ public Task> GetAllForOrganization(string organization) /// /// The login of the user /// All the s that a particular user has received. - public Task> GetUserReceived(string user) + public Task> GetAllUserReceived(string user) { Ensure.ArgumentNotNullOrEmptyString(user, "user"); @@ -104,7 +104,7 @@ public Task> GetUserReceived(string user) /// /// The login of the user /// All the s that a particular user has received. - public Task> GetUserReceivedPublic(string user) + public Task> GetAllUserReceivedPublic(string user) { Ensure.ArgumentNotNullOrEmptyString(user, "user"); @@ -119,7 +119,7 @@ public Task> GetUserReceivedPublic(string user) /// /// The login of the user /// All the s that a particular user has performed. - public Task> GetUserPerformed(string user) + public Task> GetAllUserPerformed(string user) { Ensure.ArgumentNotNullOrEmptyString(user, "user"); @@ -134,7 +134,7 @@ public Task> GetUserPerformed(string user) /// /// The login of the user /// All the public s that a particular user has performed. - public Task> GetUserPerformedPublic(string user) + public Task> GetAllUserPerformedPublic(string user) { Ensure.ArgumentNotNullOrEmptyString(user, "user"); @@ -150,7 +150,7 @@ public Task> GetUserPerformedPublic(string user) /// The login of the user /// The name of the organization /// All the public s that are associated with an organization. - public Task> GetForAnOrganization(string user, string organization) + public Task> GetAllForAnOrganization(string user, string organization) { Ensure.ArgumentNotNullOrEmptyString(user, "user"); Ensure.ArgumentNotNullOrEmptyString(organization, "organization"); diff --git a/Octokit/Clients/FollowersClient.cs b/Octokit/Clients/FollowersClient.cs index 9059371c46..9d85c4dcc7 100644 --- a/Octokit/Clients/FollowersClient.cs +++ b/Octokit/Clients/FollowersClient.cs @@ -54,7 +54,7 @@ public Task> GetAll(string login) /// See the API documentation for more information. /// /// A of s that the authenticated user follows. - public Task> GetFollowingForCurrent() + public Task> GetAllFollowingForCurrent() { return ApiConnection.GetAll(ApiUrls.Following()); } @@ -67,7 +67,7 @@ public Task> GetFollowingForCurrent() /// See the API documentation for more information. /// /// A of s that the passed user follows. - public Task> GetFollowing(string login) + public Task> GetAllFollowing(string login) { Ensure.ArgumentNotNullOrEmptyString(login, "login"); diff --git a/Octokit/Clients/GistCommentsClient.cs b/Octokit/Clients/GistCommentsClient.cs index f32a055e9b..474871593b 100644 --- a/Octokit/Clients/GistCommentsClient.cs +++ b/Octokit/Clients/GistCommentsClient.cs @@ -37,7 +37,7 @@ public Task Get(string gistId, int commentId) /// http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist /// The id of the gist /// Task{IReadOnlyList{GistComment}}. - public Task> GetForGist(string gistId) + public Task> GetAllForGist(string gistId) { return ApiConnection.GetAll(ApiUrls.GistComments(gistId)); } diff --git a/Octokit/Clients/IAssigneesClient.cs b/Octokit/Clients/IAssigneesClient.cs index 2d6297510e..2a1e0cdf30 100644 --- a/Octokit/Clients/IAssigneesClient.cs +++ b/Octokit/Clients/IAssigneesClient.cs @@ -17,7 +17,7 @@ public interface IAssigneesClient /// The owner of the repository /// The name of the repository /// - Task> GetForRepository(string owner, string name); + Task> GetAllForRepository(string owner, string name); /// /// Checks to see if a user is an assignee for a repository. diff --git a/Octokit/Clients/IEventsClient.cs b/Octokit/Clients/IEventsClient.cs index 8213b5bd4d..ec14881501 100644 --- a/Octokit/Clients/IEventsClient.cs +++ b/Octokit/Clients/IEventsClient.cs @@ -61,7 +61,7 @@ public interface IEventsClient /// /// The login of the user /// All the s that a particular user has received. - Task> GetUserReceived(string user); + Task> GetAllUserReceived(string user); /// /// Gets all the events that have been received by a given user. @@ -71,7 +71,7 @@ public interface IEventsClient /// /// The login of the user /// All the s that a particular user has received. - Task> GetUserReceivedPublic(string user); + Task> GetAllUserReceivedPublic(string user); /// /// Gets all the events that have been performed by a given user. @@ -81,7 +81,7 @@ public interface IEventsClient /// /// The login of the user /// All the s that a particular user has performed. - Task> GetUserPerformed(string user); + Task> GetAllUserPerformed(string user); /// /// Gets all the public events that have been performed by a given user. @@ -91,7 +91,7 @@ public interface IEventsClient /// /// The login of the user /// All the public s that a particular user has performed. - Task> GetUserPerformedPublic(string user); + Task> GetAllUserPerformedPublic(string user); /// /// Gets all the events that are associated with an organization. @@ -102,6 +102,6 @@ public interface IEventsClient /// The login of the user /// The name of the organization /// All the public s that are associated with an organization. - Task> GetForAnOrganization(string user, string organization); + Task> GetAllForAnOrganization(string user, string organization); } } \ No newline at end of file diff --git a/Octokit/Clients/IFollowersClient.cs b/Octokit/Clients/IFollowersClient.cs index b73dc5833c..00f7b7e01b 100644 --- a/Octokit/Clients/IFollowersClient.cs +++ b/Octokit/Clients/IFollowersClient.cs @@ -40,7 +40,7 @@ public interface IFollowersClient /// /// A of s that the authenticated user follows. [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] - Task> GetFollowingForCurrent(); + Task> GetAllFollowingForCurrent(); /// /// List who a user is following @@ -50,7 +50,7 @@ public interface IFollowersClient /// See the API documentation for more information. /// /// A of s that the passed user follows. - Task> GetFollowing(string login); + Task> GetAllFollowing(string login); /// /// Check if the authenticated user follows another user diff --git a/Octokit/Clients/IGistCommentsClient.cs b/Octokit/Clients/IGistCommentsClient.cs index af11e668e3..3bcd814ada 100644 --- a/Octokit/Clients/IGistCommentsClient.cs +++ b/Octokit/Clients/IGistCommentsClient.cs @@ -29,7 +29,7 @@ public interface IGistCommentsClient /// http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist /// The id of the gist /// Task{IReadOnlyList{GistComment}}. - Task> GetForGist(string gistId); + Task> GetAllForGist(string gistId); /// /// Creates a comment for the gist with the specified id. diff --git a/Octokit/Clients/IIssueCommentsClient.cs b/Octokit/Clients/IIssueCommentsClient.cs index dd3c279550..fdfbc389a4 100644 --- a/Octokit/Clients/IIssueCommentsClient.cs +++ b/Octokit/Clients/IIssueCommentsClient.cs @@ -31,7 +31,7 @@ public interface IIssueCommentsClient /// The owner of the repository /// The name of the repository /// - Task> GetForRepository(string owner, string name); + Task> GetAllForRepository(string owner, string name); /// /// Gets Issue Comments for a specified Issue. @@ -41,7 +41,7 @@ public interface IIssueCommentsClient /// The name of the repository /// The issue number /// - Task> GetForIssue(string owner, string name, int number); + Task> GetAllForIssue(string owner, string name, int number); /// /// Creates a new Issue Comment for a specified Issue. diff --git a/Octokit/Clients/IIssuesClient.cs b/Octokit/Clients/IIssuesClient.cs index b0071f2cb2..bc0e362cb9 100644 --- a/Octokit/Clients/IIssuesClient.cs +++ b/Octokit/Clients/IIssuesClient.cs @@ -126,7 +126,7 @@ public interface IIssuesClient /// The owner of the repository /// The name of the repository /// - Task> GetForRepository(string owner, string name); + Task> GetAllForRepository(string owner, string name); /// /// Gets issues for a repository. @@ -138,7 +138,7 @@ public interface IIssuesClient /// The name of the repository /// Used to filter and sort the list of issues returned /// - Task> GetForRepository(string owner, string name, RepositoryIssueRequest request); + Task> GetAllForRepository(string owner, string name, RepositoryIssueRequest request); /// /// Creates an issue for the specified repository. Any user with pull access to a repository can create an diff --git a/Octokit/Clients/IIssuesEventsClient.cs b/Octokit/Clients/IIssuesEventsClient.cs index 6b711a9ccc..ae51a608c0 100644 --- a/Octokit/Clients/IIssuesEventsClient.cs +++ b/Octokit/Clients/IIssuesEventsClient.cs @@ -22,7 +22,7 @@ public interface IIssuesEventsClient /// The name of the repository /// The issue number /// - Task> GetForIssue(string owner, string name, int number); + Task> GetAllForIssue(string owner, string name, int number); /// /// Gets all events for the repository. @@ -33,7 +33,7 @@ public interface IIssuesEventsClient /// The owner of the repository /// The name of the repository /// - Task> GetForRepository(string owner, string name); + Task> GetAllForRepository(string owner, string name); /// /// Gets a single event diff --git a/Octokit/Clients/IIssuesLabelsClient.cs b/Octokit/Clients/IIssuesLabelsClient.cs index 1976953d90..3f4169dbc2 100644 --- a/Octokit/Clients/IIssuesLabelsClient.cs +++ b/Octokit/Clients/IIssuesLabelsClient.cs @@ -16,7 +16,7 @@ public interface IIssuesLabelsClient /// The name of the repository /// The number of the issue /// The list of labels - Task> GetForIssue(string owner, string repo, int number); + Task> GetAllForIssue(string owner, string repo, int number); /// /// Gets all labels for the repository. @@ -27,7 +27,7 @@ public interface IIssuesLabelsClient /// The owner of the repository /// The name of the repository /// The list of labels - Task> GetForRepository(string owner, string repo); + Task> GetAllForRepository(string owner, string repo); /// /// Gets a single Label by name. @@ -141,6 +141,6 @@ public interface IIssuesLabelsClient /// The name of the repository /// The number of the milestone /// - Task> GetForMilestone(string owner, string repo, int number); + Task> GetAllForMilestone(string owner, string repo, int number); } } \ No newline at end of file diff --git a/Octokit/Clients/IMilestonesClient.cs b/Octokit/Clients/IMilestonesClient.cs index d0635db406..5ef5b41e05 100644 --- a/Octokit/Clients/IMilestonesClient.cs +++ b/Octokit/Clients/IMilestonesClient.cs @@ -32,7 +32,7 @@ public interface IMilestonesClient /// The owner of the repository /// The name of the repository /// - Task> GetForRepository(string owner, string name); + Task> GetAllForRepository(string owner, string name); /// /// Gets all open milestones for the repository. @@ -44,7 +44,7 @@ public interface IMilestonesClient /// The name of the repository /// Used to filter and sort the list of Milestones returned /// - Task> GetForRepository(string owner, string name, MilestoneRequest request); + Task> GetAllForRepository(string owner, string name, MilestoneRequest request); /// /// Creates a milestone for the specified repository. Any user with pull access to a repository can create an diff --git a/Octokit/Clients/IMiscellaneousClient.cs b/Octokit/Clients/IMiscellaneousClient.cs index 5010416821..04153a319a 100644 --- a/Octokit/Clients/IMiscellaneousClient.cs +++ b/Octokit/Clients/IMiscellaneousClient.cs @@ -20,7 +20,7 @@ public interface IMiscellaneousClient /// Thrown when a general API error occurs. /// An of emoji and their URI. [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] - Task> GetEmojis(); + Task> GetAllEmojis(); /// /// Gets the rendered Markdown for the specified plain-text Markdown document. @@ -35,7 +35,7 @@ public interface IMiscellaneousClient /// /// A list of template names [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] - Task> GetGitIgnoreTemplates(); + Task> GetAllGitIgnoreTemplates(); /// /// Retrieves the source for a single GitIgnore template @@ -51,7 +51,7 @@ public interface IMiscellaneousClient /// This is a PREVIEW API! Use it at your own risk. /// A list of licenses available on the site [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] - Task> GetLicenses(); + Task> GetAllLicenses(); /// /// Retrieves a license based on the licence key such as "mit" diff --git a/Octokit/Clients/IOrganizationMembersClient.cs b/Octokit/Clients/IOrganizationMembersClient.cs index 1e84967009..29609af772 100644 --- a/Octokit/Clients/IOrganizationMembersClient.cs +++ b/Octokit/Clients/IOrganizationMembersClient.cs @@ -72,7 +72,7 @@ public interface IOrganizationMembersClient /// http://developer.github.com/v3/orgs/members/#public-members-list /// The login for the organization /// - Task> GetPublic(string org); + Task> GetAllPublic(string org); /// /// Check if a user is, publicly or privately, a member of the organization. diff --git a/Octokit/Clients/IPullRequestReviewCommentsClient.cs b/Octokit/Clients/IPullRequestReviewCommentsClient.cs index f2d73c513f..a58b3c1fc3 100644 --- a/Octokit/Clients/IPullRequestReviewCommentsClient.cs +++ b/Octokit/Clients/IPullRequestReviewCommentsClient.cs @@ -28,7 +28,7 @@ public interface IPullRequestReviewCommentsClient /// The owner of the repository /// The name of the repository /// The list of s for the specified repository - Task> GetForRepository(string owner, string name); + Task> GetAllForRepository(string owner, string name); /// /// Gets a list of the pull request review comments in a specified repository. @@ -38,7 +38,7 @@ public interface IPullRequestReviewCommentsClient /// The name of the repository /// The sorting parameters /// The list of s for the specified repository - Task> GetForRepository(string owner, string name, PullRequestReviewCommentRequest request); + Task> GetAllForRepository(string owner, string name, PullRequestReviewCommentRequest request); /// /// Gets a single pull request review comment by number. diff --git a/Octokit/Clients/IPullRequestsClient.cs b/Octokit/Clients/IPullRequestsClient.cs index e612850bd4..0ed1cd259f 100644 --- a/Octokit/Clients/IPullRequestsClient.cs +++ b/Octokit/Clients/IPullRequestsClient.cs @@ -31,7 +31,7 @@ public interface IPullRequestsClient /// The owner of the repository /// The name of the repository /// A of s which are currently open - Task> GetForRepository(string owner, string name); + Task> GetAllForRepository(string owner, string name); /// /// Query pull requests for the repository based on criteria @@ -43,7 +43,7 @@ public interface IPullRequestsClient /// The name of the repository /// Used to filter and sort the list of pull requests returned /// A of s which match the criteria - Task> GetForRepository(string owner, string name, PullRequestRequest request); + Task> GetAllForRepository(string owner, string name, PullRequestRequest request); /// /// Create a pull request for the specified repository. diff --git a/Octokit/Clients/IReleasesClient.cs b/Octokit/Clients/IReleasesClient.cs index bfbbc96cc0..742806ad6d 100644 --- a/Octokit/Clients/IReleasesClient.cs +++ b/Octokit/Clients/IReleasesClient.cs @@ -91,7 +91,7 @@ public interface IReleasesClient /// The id of the . /// Thrown when a general API error occurs. /// The list of for the specified release of the specified repository. - Task> GetAssets(string owner, string name, int id); + Task> GetAllAssets(string owner, string name, int id); /// /// Uploads a for the specified release. diff --git a/Octokit/Clients/IRepositoryCommentsClient.cs b/Octokit/Clients/IRepositoryCommentsClient.cs index 11a6754566..3156870f24 100644 --- a/Octokit/Clients/IRepositoryCommentsClient.cs +++ b/Octokit/Clients/IRepositoryCommentsClient.cs @@ -31,7 +31,7 @@ public interface IRepositoryCommentsClient /// The owner of the repository /// The name of the repository /// - Task> GetForRepository(string owner, string name); + Task> GetAllForRepository(string owner, string name); /// /// Gets Commit Comments for a specified Commit. @@ -41,7 +41,7 @@ public interface IRepositoryCommentsClient /// The name of the repository /// The sha of the commit /// - Task> GetForCommit(string owner, string name, string sha); + Task> GetAllForCommit(string owner, string name, string sha); /// /// Creates a new Commit Comment for a specified Commit. diff --git a/Octokit/Clients/IRepositoryContentsClient.cs b/Octokit/Clients/IRepositoryContentsClient.cs index 89dfa3ec85..84b7db96cb 100644 --- a/Octokit/Clients/IRepositoryContentsClient.cs +++ b/Octokit/Clients/IRepositoryContentsClient.cs @@ -20,7 +20,7 @@ public interface IRepositoryContentsClient /// /// A collection of representing the content at the specified path /// - Task> GetContents(string owner, string name, string path); + Task> GetAllContents(string owner, string name, string path); /// /// Gets the preferred README for the specified repository. diff --git a/Octokit/Clients/ITeamsClient.cs b/Octokit/Clients/ITeamsClient.cs index 566fc87c26..63f40fa2a4 100644 --- a/Octokit/Clients/ITeamsClient.cs +++ b/Octokit/Clients/ITeamsClient.cs @@ -41,7 +41,7 @@ public interface ITeamsClient /// https://developer.github.com/v3/orgs/teams/#list-team-members /// /// A list of the team's member s. - Task> GetMembers(int id); + Task> GetAllMembers(int id); /// /// Returns newly created for the current org. @@ -92,7 +92,7 @@ public interface ITeamsClient /// /// Thrown when a general API error occurs. /// The team's repositories - Task> GetRepositories(int id); + Task> GetAllRepositories(int id); /// /// Add a repository to the team diff --git a/Octokit/Clients/IssueCommentsClient.cs b/Octokit/Clients/IssueCommentsClient.cs index 72bdfbf90b..1b84f8b2b8 100644 --- a/Octokit/Clients/IssueCommentsClient.cs +++ b/Octokit/Clients/IssueCommentsClient.cs @@ -42,7 +42,7 @@ public Task Get(string owner, string name, int number) /// The owner of the repository /// The name of the repository /// - public Task> GetForRepository(string owner, string name) + public Task> GetAllForRepository(string owner, string name) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); @@ -58,7 +58,7 @@ public Task> GetForRepository(string owner, string n /// The name of the repository /// The issue number /// - public Task> GetForIssue(string owner, string name, int number) + public Task> GetAllForIssue(string owner, string name, int number) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); diff --git a/Octokit/Clients/IssuesClient.cs b/Octokit/Clients/IssuesClient.cs index 4b96db0b3d..2dbabc8997 100644 --- a/Octokit/Clients/IssuesClient.cs +++ b/Octokit/Clients/IssuesClient.cs @@ -164,9 +164,9 @@ public Task> GetAllForOrganization(string organization, Iss /// The owner of the repository /// The name of the repository /// - public Task> GetForRepository(string owner, string name) + public Task> GetAllForRepository(string owner, string name) { - return GetForRepository(owner, name, new RepositoryIssueRequest()); + return GetAllForRepository(owner, name, new RepositoryIssueRequest()); } /// @@ -179,7 +179,7 @@ public Task> GetForRepository(string owner, string name) /// The name of the repository /// Used to filter and sort the list of issues returned /// - public Task> GetForRepository(string owner, string name, + public Task> GetAllForRepository(string owner, string name, RepositoryIssueRequest request) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); diff --git a/Octokit/Clients/IssuesEventsClient.cs b/Octokit/Clients/IssuesEventsClient.cs index c476683b64..836a29135f 100644 --- a/Octokit/Clients/IssuesEventsClient.cs +++ b/Octokit/Clients/IssuesEventsClient.cs @@ -27,7 +27,7 @@ public IssuesEventsClient(IApiConnection apiConnection) : base(apiConnection) /// The name of the repository /// The issue number /// - public Task> GetForIssue(string owner, string name, int number) + public Task> GetAllForIssue(string owner, string name, int number) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); @@ -44,7 +44,7 @@ public Task> GetForIssue(string owner, string name, int /// The owner of the repository /// The name of the repository /// - public Task> GetForRepository(string owner, string name) + public Task> GetAllForRepository(string owner, string name) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); diff --git a/Octokit/Clients/IssuesLabelsClient.cs b/Octokit/Clients/IssuesLabelsClient.cs index ee6404193a..36a68c19e0 100644 --- a/Octokit/Clients/IssuesLabelsClient.cs +++ b/Octokit/Clients/IssuesLabelsClient.cs @@ -20,7 +20,7 @@ public IssuesLabelsClient(IApiConnection apiConnection) /// The name of the repository /// The number of the issue /// The list of labels - public Task> GetForIssue(string owner, string repo, int number) + public Task> GetAllForIssue(string owner, string repo, int number) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(repo, "repo"); @@ -37,7 +37,7 @@ public Task> GetForIssue(string owner, string repo, int num /// The owner of the repository /// The name of the repository /// The list of labels - public Task> GetForRepository(string owner, string repo) + public Task> GetAllForRepository(string owner, string repo) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(repo, "repo"); @@ -211,7 +211,7 @@ public Task RemoveAllFromIssue(string owner, string repo, int number) /// The name of the repository /// The number of the milestone /// - public Task> GetForMilestone(string owner, string repo, int number) + public Task> GetAllForMilestone(string owner, string repo, int number) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(repo, "repo"); diff --git a/Octokit/Clients/MilestonesClient.cs b/Octokit/Clients/MilestonesClient.cs index c6f1cb58c5..61b0738659 100644 --- a/Octokit/Clients/MilestonesClient.cs +++ b/Octokit/Clients/MilestonesClient.cs @@ -43,9 +43,9 @@ public Task Get(string owner, string name, int number) /// The owner of the repository /// The name of the repository /// - public Task> GetForRepository(string owner, string name) + public Task> GetAllForRepository(string owner, string name) { - return GetForRepository(owner, name, new MilestoneRequest()); + return GetAllForRepository(owner, name, new MilestoneRequest()); } /// @@ -58,7 +58,7 @@ public Task> GetForRepository(string owner, string name /// The name of the repository /// Used to filter and sort the list of Milestones returned /// - public Task> GetForRepository(string owner, string name, MilestoneRequest request) + public Task> GetAllForRepository(string owner, string name, MilestoneRequest request) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); diff --git a/Octokit/Clients/MiscellaneousClient.cs b/Octokit/Clients/MiscellaneousClient.cs index 76dac9ae24..05025a3666 100644 --- a/Octokit/Clients/MiscellaneousClient.cs +++ b/Octokit/Clients/MiscellaneousClient.cs @@ -34,7 +34,7 @@ public MiscellaneousClient(IConnection connection) /// /// Thrown when a general API error occurs. /// An of emoji and their URI. - public async Task> GetEmojis() + public async Task> GetAllEmojis() { var endpoint = new Uri("emojis", UriKind.Relative); var response = await _connection.Get>(endpoint, null, null) @@ -61,7 +61,7 @@ public async Task RenderRawMarkdown(string markdown) /// List all templates available to pass as an option when creating a repository. /// /// A list of template names - public async Task> GetGitIgnoreTemplates() + public async Task> GetAllGitIgnoreTemplates() { var endpoint = new Uri("gitignore/templates", UriKind.Relative); @@ -92,7 +92,7 @@ public async Task GetGitIgnoreTemplate(string templateName) /// /// This is a PREVIEW API! Use it at your own risk. /// A list of licenses available on the site - public async Task> GetLicenses() + public async Task> GetAllLicenses() { const string previewAcceptsHeader = "application/vnd.github.drax-preview+json"; var endpoint = new Uri("licenses", UriKind.Relative); diff --git a/Octokit/Clients/OrganizationMembersClient.cs b/Octokit/Clients/OrganizationMembersClient.cs index 76a5e756b4..d8fe75cfd4 100644 --- a/Octokit/Clients/OrganizationMembersClient.cs +++ b/Octokit/Clients/OrganizationMembersClient.cs @@ -118,7 +118,7 @@ public Task> GetAll(string org, string filter) /// http://developer.github.com/v3/orgs/members/#public-members-list /// The login for the organization /// - public Task> GetPublic(string org) + public Task> GetAllPublic(string org) { Ensure.ArgumentNotNullOrEmptyString(org, "org"); diff --git a/Octokit/Clients/PullRequestReviewCommentsClient.cs b/Octokit/Clients/PullRequestReviewCommentsClient.cs index b171a61f49..5d8363b265 100644 --- a/Octokit/Clients/PullRequestReviewCommentsClient.cs +++ b/Octokit/Clients/PullRequestReviewCommentsClient.cs @@ -40,9 +40,9 @@ public Task> GetAll(string owner, string /// The owner of the repository /// The name of the repository /// The list of s for the specified repository - public Task> GetForRepository(string owner, string name) + public Task> GetAllForRepository(string owner, string name) { - return GetForRepository(owner, name, new PullRequestReviewCommentRequest()); + return GetAllForRepository(owner, name, new PullRequestReviewCommentRequest()); } /// @@ -53,7 +53,7 @@ public Task> GetForRepository(string own /// The name of the repository /// The sorting parameters /// The list of s for the specified repository - public Task> GetForRepository(string owner, string name, PullRequestReviewCommentRequest request) + public Task> GetAllForRepository(string owner, string name, PullRequestReviewCommentRequest request) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); diff --git a/Octokit/Clients/PullRequestsClient.cs b/Octokit/Clients/PullRequestsClient.cs index bb449f9dfb..90c035f104 100644 --- a/Octokit/Clients/PullRequestsClient.cs +++ b/Octokit/Clients/PullRequestsClient.cs @@ -40,9 +40,9 @@ public Task Get(string owner, string name, int number) /// The owner of the repository /// The name of the repository /// A of s which are currently open - public Task> GetForRepository(string owner, string name) + public Task> GetAllForRepository(string owner, string name) { - return GetForRepository(owner, name, new PullRequestRequest()); + return GetAllForRepository(owner, name, new PullRequestRequest()); } /// @@ -55,7 +55,7 @@ public Task> GetForRepository(string owner, string na /// The name of the repository /// Used to filter and sort the list of pull requests returned /// A of s which match the criteria - public Task> GetForRepository(string owner, string name, PullRequestRequest request) + public Task> GetAllForRepository(string owner, string name, PullRequestRequest request) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); diff --git a/Octokit/Clients/ReleasesClient.cs b/Octokit/Clients/ReleasesClient.cs index 934ba1b6ab..d832de92db 100644 --- a/Octokit/Clients/ReleasesClient.cs +++ b/Octokit/Clients/ReleasesClient.cs @@ -134,7 +134,7 @@ public Task Delete(string owner, string name, int id) /// The id of the . /// Thrown when a general API error occurs. /// The list of for the specified release of the specified repository. - public Task> GetAssets(string owner, string name, int id) + public Task> GetAllAssets(string owner, string name, int id) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); diff --git a/Octokit/Clients/RepositoryCommentsClient.cs b/Octokit/Clients/RepositoryCommentsClient.cs index f4017a2aa6..a196c287f2 100644 --- a/Octokit/Clients/RepositoryCommentsClient.cs +++ b/Octokit/Clients/RepositoryCommentsClient.cs @@ -44,7 +44,7 @@ public Task Get(string owner, string name, int number) /// The owner of the repository /// The name of the repository /// - public Task> GetForRepository(string owner, string name) + public Task> GetAllForRepository(string owner, string name) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); @@ -60,7 +60,7 @@ public Task> GetForRepository(string owner, string /// The name of the repository /// The sha of the commit /// - public Task> GetForCommit(string owner, string name, string sha) + public Task> GetAllForCommit(string owner, string name, string sha) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); diff --git a/Octokit/Clients/RepositoryContentsClient.cs b/Octokit/Clients/RepositoryContentsClient.cs index 5b08e43c50..5cf1caaee6 100644 --- a/Octokit/Clients/RepositoryContentsClient.cs +++ b/Octokit/Clients/RepositoryContentsClient.cs @@ -24,7 +24,7 @@ public RepositoryContentsClient(IApiConnection apiConnection) : base(apiConnecti /// /// A collection of representing the content at the specified path /// - public async Task> GetContents(string owner, string name, string path) + public async Task> GetAllContents(string owner, string name, string path) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); diff --git a/Octokit/Clients/TeamsClient.cs b/Octokit/Clients/TeamsClient.cs index e328758837..3cacc7dc18 100644 --- a/Octokit/Clients/TeamsClient.cs +++ b/Octokit/Clients/TeamsClient.cs @@ -60,7 +60,7 @@ public Task> GetAll(string org) /// https://developer.github.com/v3/orgs/teams/#list-team-members /// /// A list of the team's member s. - public Task> GetMembers(int id) + public Task> GetAllMembers(int id) { var endpoint = ApiUrls.TeamMembers(id); @@ -158,7 +158,7 @@ public Task RemoveMember(int id, string login) /// /// Thrown when a general API error occurs. /// The team's repositories - public Task> GetRepositories(int id) + public Task> GetAllRepositories(int id) { var endpoint = ApiUrls.TeamRepositories(id); From 2427ab6922f87928bca18ff2a41574e655d3795b Mon Sep 17 00:00:00 2001 From: Henrik Andersson Date: Tue, 24 Mar 2015 00:12:41 +1000 Subject: [PATCH 3/4] Update observable clients --- .../Clients/IObservableAssigneesClient.cs | 2 +- Octokit.Reactive/Clients/IObservableEventsClient.cs | 10 +++++----- .../Clients/IObservableFollowersClient.cs | 4 ++-- .../Clients/IObservableGistCommentsClient.cs | 2 +- .../Clients/IObservableIssueCommentsClient.cs | 4 ++-- Octokit.Reactive/Clients/IObservableIssuesClient.cs | 4 ++-- .../Clients/IObservableIssuesEventsClient.cs | 4 ++-- .../Clients/IObservableIssuesLabelsClient.cs | 6 +++--- .../Clients/IObservableMilestonesClient.cs | 4 ++-- .../Clients/IObservableMiscellaneousClient.cs | 6 +++--- .../Clients/IObservableOrganizationMembersClient.cs | 2 +- .../IObservablePullRequestReviewCommentsClient.cs | 4 ++-- .../Clients/IObservablePullRequestsClient.cs | 4 ++-- .../Clients/IObservableReleasesClient.cs | 2 +- .../Clients/IObservableRepositoryCommentsClient.cs | 4 ++-- .../Clients/IObservableRepositoryContentsClient.cs | 2 +- Octokit.Reactive/Clients/IObservableTeamsClient.cs | 4 ++-- .../Clients/ObservableAssigneesClient.cs | 2 +- Octokit.Reactive/Clients/ObservableEventsClient.cs | 10 +++++----- .../Clients/ObservableFollowersClient.cs | 4 ++-- .../Clients/ObservableGistCommentsClient.cs | 2 +- .../Clients/ObservableIssueCommentsClient.cs | 4 ++-- Octokit.Reactive/Clients/ObservableIssuesClient.cs | 6 +++--- .../Clients/ObservableIssuesEventsClient.cs | 4 ++-- .../Clients/ObservableIssuesLabelsClient.cs | 6 +++--- .../Clients/ObservableMilestonesClient.cs | 4 ++-- .../Clients/ObservableMiscellaneousClient.cs | 12 ++++++------ .../Clients/ObservableOrganizationMembersClient.cs | 2 +- .../ObservablePullRequestReviewCommentsClient.cs | 6 +++--- .../Clients/ObservablePullRequestsClient.cs | 4 ++-- Octokit.Reactive/Clients/ObservableReleasesClient.cs | 2 +- .../Clients/ObservableRepositoryCommentsClient.cs | 4 ++-- .../Clients/ObservableRepositoryContentsClient.cs | 2 +- Octokit.Reactive/Clients/ObservableTeamsClient.cs | 4 ++-- 34 files changed, 73 insertions(+), 73 deletions(-) diff --git a/Octokit.Reactive/Clients/IObservableAssigneesClient.cs b/Octokit.Reactive/Clients/IObservableAssigneesClient.cs index 502ef625d3..c1de226523 100644 --- a/Octokit.Reactive/Clients/IObservableAssigneesClient.cs +++ b/Octokit.Reactive/Clients/IObservableAssigneesClient.cs @@ -11,7 +11,7 @@ public interface IObservableAssigneesClient /// The owner of the repository /// The name of the repository /// - IObservable GetForRepository(string owner, string name); + IObservable GetAllForRepository(string owner, string name); /// /// Checks to see if a user is an assignee for a repository. diff --git a/Octokit.Reactive/Clients/IObservableEventsClient.cs b/Octokit.Reactive/Clients/IObservableEventsClient.cs index ced8b7ff64..5c037fdbf4 100644 --- a/Octokit.Reactive/Clients/IObservableEventsClient.cs +++ b/Octokit.Reactive/Clients/IObservableEventsClient.cs @@ -54,7 +54,7 @@ public interface IObservableEventsClient /// /// The login of the user /// All the s that a particular user has received. - IObservable GetUserReceived(string user); + IObservable GetAllUserReceived(string user); /// /// Gets all the events that have been received by a given user. @@ -64,7 +64,7 @@ public interface IObservableEventsClient /// /// The login of the user /// All the s that a particular user has received. - IObservable GetUserReceivedPublic(string user); + IObservable GetAllUserReceivedPublic(string user); /// /// Gets all the events that have been performed by a given user. @@ -74,7 +74,7 @@ public interface IObservableEventsClient /// /// The login of the user /// All the s that a particular user has performed. - IObservable GetUserPerformed(string user); + IObservable GetAllUserPerformed(string user); /// /// Gets all the public events that have been performed by a given user. @@ -84,7 +84,7 @@ public interface IObservableEventsClient /// /// The login of the user /// All the public s that a particular user has performed. - IObservable GetUserPerformedPublic(string user); + IObservable GetAllUserPerformedPublic(string user); /// /// Gets all the events that are associated with an organization. @@ -95,6 +95,6 @@ public interface IObservableEventsClient /// The login of the user /// The name of the organization /// All the public s that are associated with an organization. - IObservable GetForAnOrganization(string user, string organization); + IObservable GetAllForAnOrganization(string user, string organization); } } \ No newline at end of file diff --git a/Octokit.Reactive/Clients/IObservableFollowersClient.cs b/Octokit.Reactive/Clients/IObservableFollowersClient.cs index bae85c301d..b867e97059 100644 --- a/Octokit.Reactive/Clients/IObservableFollowersClient.cs +++ b/Octokit.Reactive/Clients/IObservableFollowersClient.cs @@ -38,7 +38,7 @@ public interface IObservableFollowersClient /// /// A of s that the authenticated user follows. [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] - IObservable GetFollowingForCurrent(); + IObservable GetAllFollowingForCurrent(); /// /// List who a user is following @@ -48,7 +48,7 @@ public interface IObservableFollowersClient /// See the API documentation for more information. /// /// A of s that the passed user follows. - IObservable GetFollowing(string login); + IObservable GetAllFollowing(string login); /// /// Check if the authenticated user follows another user diff --git a/Octokit.Reactive/Clients/IObservableGistCommentsClient.cs b/Octokit.Reactive/Clients/IObservableGistCommentsClient.cs index 11accd8c07..be577f1603 100644 --- a/Octokit.Reactive/Clients/IObservableGistCommentsClient.cs +++ b/Octokit.Reactive/Clients/IObservableGistCommentsClient.cs @@ -23,7 +23,7 @@ public interface IObservableGistCommentsClient /// http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist /// The id of the gist /// IObservable{GistComment}. - IObservable GetForGist(string gistId); + IObservable GetAllForGist(string gistId); /// /// Creates a comment for the gist with the specified id. diff --git a/Octokit.Reactive/Clients/IObservableIssueCommentsClient.cs b/Octokit.Reactive/Clients/IObservableIssueCommentsClient.cs index c6c6a67d76..256c299024 100644 --- a/Octokit.Reactive/Clients/IObservableIssueCommentsClient.cs +++ b/Octokit.Reactive/Clients/IObservableIssueCommentsClient.cs @@ -25,7 +25,7 @@ public interface IObservableIssueCommentsClient /// The owner of the repository /// The name of the repository /// The list of s for the specified Repository. - IObservable GetForRepository(string owner, string name); + IObservable GetAllForRepository(string owner, string name); /// /// Gets Issue Comments for a specified Issue. @@ -35,7 +35,7 @@ public interface IObservableIssueCommentsClient /// The name of the repository /// The issue number /// The list of s for the specified Issue. - IObservable GetForIssue(string owner, string name, int number); + IObservable GetAllForIssue(string owner, string name, int number); /// /// Creates a new Issue Comment for a specified Issue. diff --git a/Octokit.Reactive/Clients/IObservableIssuesClient.cs b/Octokit.Reactive/Clients/IObservableIssuesClient.cs index 1003288465..008d9955b0 100644 --- a/Octokit.Reactive/Clients/IObservableIssuesClient.cs +++ b/Octokit.Reactive/Clients/IObservableIssuesClient.cs @@ -119,7 +119,7 @@ public interface IObservableIssuesClient /// The owner of the repository /// The name of the repository /// - IObservable GetForRepository(string owner, string name); + IObservable GetAllForRepository(string owner, string name); /// /// Gets issues for a repository. @@ -131,7 +131,7 @@ public interface IObservableIssuesClient /// The name of the repository /// Used to filter and sort the list of issues returned /// - IObservable GetForRepository(string owner, string name, RepositoryIssueRequest request); + IObservable GetAllForRepository(string owner, string name, RepositoryIssueRequest request); /// /// Creates an issue for the specified repository. Any user with pull access to a repository can create an diff --git a/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs b/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs index 7dc0b2b6bf..2e40960b54 100644 --- a/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs +++ b/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs @@ -15,7 +15,7 @@ public interface IObservableIssuesEventsClient /// The name of the repository /// The issue number /// - IObservable GetForIssue(string owner, string name, int number); + IObservable GetAllForIssue(string owner, string name, int number); /// /// Gets all events for the repository. @@ -26,7 +26,7 @@ public interface IObservableIssuesEventsClient /// The owner of the repository /// The name of the repository /// - IObservable GetForRepository(string owner, string name); + IObservable GetAllForRepository(string owner, string name); /// /// Gets a single event diff --git a/Octokit.Reactive/Clients/IObservableIssuesLabelsClient.cs b/Octokit.Reactive/Clients/IObservableIssuesLabelsClient.cs index 97afc96cae..ec84de518b 100644 --- a/Octokit.Reactive/Clients/IObservableIssuesLabelsClient.cs +++ b/Octokit.Reactive/Clients/IObservableIssuesLabelsClient.cs @@ -16,7 +16,7 @@ public interface IObservableIssuesLabelsClient /// The name of the repository /// The number of the issue /// The list of labels - IObservable