mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 11:05:56 +00:00
Separate out the classes for readability
was too messy, fixed all relevant projects to contain the new classes.
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Octokit.Tests.Clients
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
client.SearchUsers(new UsersRequest("something"));
|
||||
client.SearchUsers(new SearchUsersRequest("something"));
|
||||
connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "search/users"), Arg.Any<Dictionary<string, string>>());
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Octokit.Tests.Clients
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
client.SearchRepo(new RepositoriesRequest("something"));
|
||||
client.SearchRepo(new SearchRepositoriesRequest("something"));
|
||||
connection.Received().GetAll<Repository>(Arg.Is<Uri>(u => u.ToString() == "search/repositories"), Arg.Any<Dictionary<string, string>>());
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
|
||||
var request = new RepositoriesRequest("something");
|
||||
var request = new SearchRepositoriesRequest("something");
|
||||
|
||||
//method 1...
|
||||
request.Size = new Range(55); //match 55Mb Exactly
|
||||
@@ -86,10 +86,10 @@ namespace Octokit.Tests.Clients
|
||||
//method 2...
|
||||
|
||||
//check sizes for repos that are greater than 50 MB
|
||||
request = new RepositoriesRequest("github", size: Range.GreaterThan(50));
|
||||
request = new SearchRepositoriesRequest("github", size: Range.GreaterThan(50));
|
||||
|
||||
//check sizes for repos that are greater than 50 MB and has less than 5000 stargazers
|
||||
request = new RepositoriesRequest("github", size: Range.GreaterThan(50), stars: Range.LessThan(5000));
|
||||
request = new SearchRepositoriesRequest("github", size: Range.GreaterThan(50), stars: Range.LessThan(5000));
|
||||
|
||||
|
||||
connection.Received().GetAll<Repository>(Arg.Is<Uri>(u => u.ToString() == "search/repositories"), Arg.Any<Dictionary<string, string>>());
|
||||
@@ -101,7 +101,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
//check sizes for repos that are greater than 50 MB
|
||||
var request = new RepositoriesRequest("github", size: Range.GreaterThan(50));
|
||||
var request = new SearchRepositoriesRequest("github", size: Range.GreaterThan(50));
|
||||
|
||||
client.SearchRepo(request);
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
//get repos whos stargazers are greater than 500
|
||||
var request = new RepositoriesRequest("github", stars: Range.GreaterThan(500));
|
||||
var request = new SearchRepositoriesRequest("github", stars: Range.GreaterThan(500));
|
||||
|
||||
client.SearchRepo(request);
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
//get repos which has forks that are greater than 50
|
||||
var request = new RepositoriesRequest("github", forks: Range.GreaterThan(50));
|
||||
var request = new SearchRepositoriesRequest("github", forks: Range.GreaterThan(50));
|
||||
|
||||
client.SearchRepo(request);
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
//search repos that contains rails and forks are included in the search
|
||||
var request = new RepositoriesRequest("rails", fork: ForkQualifier.IncludeForks);
|
||||
var request = new SearchRepositoriesRequest("rails", fork: ForkQualifier.IncludeForks);
|
||||
|
||||
client.SearchRepo(request);
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
//get repos whos language is Ruby
|
||||
var request = new RepositoriesRequest("github", language: Language.Ruby);
|
||||
var request = new SearchRepositoriesRequest("github", language: Language.Ruby);
|
||||
|
||||
client.SearchRepo(request);
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
//get repos where the Description contains the test 'github'
|
||||
var request = new RepositoriesRequest("github", inQualifiers: new List<InQualifier>() { { InQualifier.Description } });
|
||||
var request = new SearchRepositoriesRequest("github", inQualifiers: new List<InQualifier>() { { InQualifier.Description } });
|
||||
|
||||
client.SearchRepo(request);
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
//get repos where the search contains 'github' and has been created after year jan 1 2011
|
||||
var request = new RepositoriesRequest("github", created: DateRange.GreaterThan(new DateTime(2011, 1, 1)));
|
||||
var request = new SearchRepositoriesRequest("github", created: DateRange.GreaterThan(new DateTime(2011, 1, 1)));
|
||||
|
||||
client.SearchRepo(request);
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
//get repos where the search contains 'github' and has been pushed before year jan 1 2013
|
||||
var request = new RepositoriesRequest("github", updated: DateRange.LessThan(new DateTime(2013, 1, 1)));
|
||||
var request = new SearchRepositoriesRequest("github", updated: DateRange.LessThan(new DateTime(2013, 1, 1)));
|
||||
|
||||
client.SearchRepo(request);
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
//get repos where the Description contains rails and user/org is 'github'
|
||||
var request = new RepositoriesRequest("rails", user: "github");
|
||||
var request = new SearchRepositoriesRequest("rails", user: "github");
|
||||
|
||||
client.SearchRepo(request);
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
//get repos where the Description contains rails and user/org is 'github'
|
||||
var request = new RepositoriesRequest("rails", sort: RepoSearchSort.Forks);
|
||||
var request = new SearchRepositoriesRequest("rails", sort: RepoSearchSort.Forks);
|
||||
|
||||
client.SearchRepo(request);
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace Octokit.Tests.Clients
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
client.SearchIssues(new IssuesRequest("something"));
|
||||
client.SearchIssues(new SearchIssuesRequest("something"));
|
||||
connection.Received().GetAll<Issue>(Arg.Is<Uri>(u => u.ToString() == "search/issues"), Arg.Any<Dictionary<string, string>>());
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ namespace Octokit.Tests.Clients
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new SearchClient(connection);
|
||||
client.SearchCode(new CodeRequest("something"));
|
||||
client.SearchCode(new SearchCodeRequest("something"));
|
||||
connection.Received().GetAll<SearchCode>(Arg.Is<Uri>(u => u.ToString() == "search/code"), Arg.Any<Dictionary<string, string>>());
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Octokit
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <returns>List of repos</returns>
|
||||
Task<IReadOnlyList<Repository>> SearchRepo(RepositoriesRequest search);
|
||||
Task<IReadOnlyList<Repository>> SearchRepo(SearchRepositoriesRequest search);
|
||||
|
||||
/// <summary>
|
||||
/// search users
|
||||
@@ -24,7 +24,7 @@ namespace Octokit
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <returns>List of users</returns>
|
||||
Task<IReadOnlyList<User>> SearchUsers(UsersRequest search);
|
||||
Task<IReadOnlyList<User>> SearchUsers(SearchUsersRequest search);
|
||||
|
||||
/// <summary>
|
||||
/// search issues
|
||||
@@ -32,7 +32,7 @@ namespace Octokit
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <returns>List of issues</returns>
|
||||
Task<IReadOnlyList<Issue>> SearchIssues(IssuesRequest search);
|
||||
Task<IReadOnlyList<Issue>> SearchIssues(SearchIssuesRequest search);
|
||||
|
||||
/// <summary>
|
||||
/// search code
|
||||
@@ -40,6 +40,6 @@ namespace Octokit
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <returns>List of files</returns>
|
||||
Task<IReadOnlyList<SearchCode>> SearchCode(CodeRequest search);
|
||||
Task<IReadOnlyList<SearchCode>> SearchCode(SearchCodeRequest search);
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ namespace Octokit
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <returns>List of repos</returns>
|
||||
public Task<IReadOnlyList<Repository>> SearchRepo(RepositoriesRequest search)
|
||||
public Task<IReadOnlyList<Repository>> SearchRepo(SearchRepositoriesRequest search)
|
||||
{
|
||||
Ensure.ArgumentNotNull(search, "search");
|
||||
return ApiConnection.GetAll<Repository>("search/repositories".FormatUri(), search.Parameters);
|
||||
@@ -34,7 +34,7 @@ namespace Octokit
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <returns>List of users</returns>
|
||||
public Task<IReadOnlyList<User>> SearchUsers(UsersRequest search)
|
||||
public Task<IReadOnlyList<User>> SearchUsers(SearchUsersRequest search)
|
||||
{
|
||||
Ensure.ArgumentNotNull(search, "search");
|
||||
return ApiConnection.GetAll<User>("search/users".FormatUri(), search.Parameters);
|
||||
@@ -46,7 +46,7 @@ namespace Octokit
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <returns>List of issues</returns>
|
||||
public Task<IReadOnlyList<Issue>> SearchIssues(IssuesRequest search)
|
||||
public Task<IReadOnlyList<Issue>> SearchIssues(SearchIssuesRequest search)
|
||||
{
|
||||
Ensure.ArgumentNotNull(search, "search");
|
||||
return ApiConnection.GetAll<Issue>("search/issues".FormatUri(), search.Parameters);
|
||||
@@ -58,7 +58,7 @@ namespace Octokit
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <returns>List of files</returns>
|
||||
public Task<IReadOnlyList<SearchCode>> SearchCode(CodeRequest search)
|
||||
public Task<IReadOnlyList<SearchCode>> SearchCode(SearchCodeRequest search)
|
||||
{
|
||||
Ensure.ArgumentNotNull(search, "search");
|
||||
return ApiConnection.GetAll<SearchCode>("search/code".FormatUri(), search.Parameters);
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
/// <summary>
|
||||
/// Searching Code/Files
|
||||
/// http://developer.github.com/v3/search/#search-code
|
||||
/// </summary>
|
||||
public class SearchCodeRequest
|
||||
{
|
||||
public SearchCodeRequest(string term)
|
||||
{
|
||||
Term = term;
|
||||
Page = 1;
|
||||
PerPage = 100;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The search term
|
||||
/// </summary>
|
||||
public string Term { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional Sort field. Can only be indexed, which indicates how recently a file has been indexed by the GitHub search infrastructure. If not provided, results are sorted by best match.
|
||||
/// </summary>
|
||||
public string Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional Sort order if sort parameter is provided. One of asc or desc; the default is desc.
|
||||
/// </summary>
|
||||
public SortDirection? Order { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Page of paginated results
|
||||
/// </summary>
|
||||
public int Page { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of items per page
|
||||
/// </summary>
|
||||
public int PerPage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// get the params in the correct format...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.Int32.ToString")]
|
||||
public System.Collections.Generic.IDictionary<string, string> Parameters
|
||||
{
|
||||
get
|
||||
{
|
||||
var d = new System.Collections.Generic.Dictionary<string, string>();
|
||||
d.Add("q", Term);
|
||||
d.Add("page", Page.ToString());
|
||||
d.Add("per_page ", PerPage.ToString());
|
||||
|
||||
if (Sort.IsNotBlank()) //only add if not blank
|
||||
d.Add("sort", Sort);
|
||||
|
||||
if (Order.HasValue)
|
||||
d.Add("order", Order.Value.ToString());
|
||||
|
||||
return d;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
/// <summary>
|
||||
/// Searching Issues
|
||||
/// </summary>
|
||||
public class SearchIssuesRequest
|
||||
{
|
||||
public SearchIssuesRequest(string term)
|
||||
{
|
||||
Term = term;
|
||||
Page = 1;
|
||||
PerPage = 100;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The search terms. This can be any combination of the supported repository search parameters:
|
||||
/// http://developer.github.com/v3/search/#search-code
|
||||
/// </summary>
|
||||
public string Term { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For http://developer.github.com/v3/search/#search-issues
|
||||
/// Optional Sort field. One of comments, created, or updated. If not provided, results are sorted by best match.
|
||||
/// </summary>
|
||||
public string Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional Sort order if sort parameter is provided. One of asc or desc; the default is desc.
|
||||
/// </summary>
|
||||
public SortDirection? Order { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Page of paginated results
|
||||
/// </summary>
|
||||
public int Page { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of items per page
|
||||
/// </summary>
|
||||
public int PerPage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// get the params in the correct format...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.Int32.ToString")]
|
||||
public System.Collections.Generic.IDictionary<string, string> Parameters
|
||||
{
|
||||
get
|
||||
{
|
||||
var d = new System.Collections.Generic.Dictionary<string, string>();
|
||||
d.Add("q", Term);
|
||||
d.Add("page", Page.ToString());
|
||||
d.Add("per_page ", PerPage.ToString());
|
||||
|
||||
if (Sort.IsNotBlank()) //only add if not blank
|
||||
d.Add("sort", Sort);
|
||||
|
||||
if (Order.HasValue)
|
||||
d.Add("order", Order.Value.ToString());
|
||||
|
||||
return d;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-196
@@ -8,10 +8,10 @@ namespace Octokit
|
||||
/// <summary>
|
||||
/// Searching Repositories
|
||||
/// </summary>
|
||||
public class RepositoriesRequest
|
||||
public class SearchRepositoriesRequest
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
|
||||
public RepositoriesRequest(string term, Range size = null, Range stars = null, Range forks = null, ForkQualifier? fork = null, Language? language = null,
|
||||
public SearchRepositoriesRequest(string term, Range size = null, Range stars = null, Range forks = null, ForkQualifier? fork = null, Language? language = null,
|
||||
IEnumerable<InQualifier> inQualifiers = null, string user = null, DateRange created = null, DateRange updated = null, RepoSearchSort? sort = null)
|
||||
{
|
||||
Term = term;
|
||||
@@ -132,7 +132,7 @@ namespace Octokit
|
||||
{
|
||||
parameters.Add(String.Format("forks:{0}", Forks));
|
||||
}
|
||||
|
||||
|
||||
if (Fork != null)
|
||||
{
|
||||
parameters.Add(String.Format("fork:{0}", Fork));
|
||||
@@ -290,7 +290,7 @@ namespace Octokit
|
||||
/// We will use the <see cref="op"/> to see what operator will be applied to the date qualifier
|
||||
/// </summary>
|
||||
/// <param name="year"></param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.DateTime.ToString(System.String)"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object)")]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object[])"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.DateTime.ToString(System.String)"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object)")]
|
||||
public DateRange(DateTime date, QualifierOperator op)
|
||||
{
|
||||
switch (op)
|
||||
@@ -737,196 +737,4 @@ namespace Octokit
|
||||
/// </summary>
|
||||
ExcludeForks
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searching Users
|
||||
/// </summary>
|
||||
public class UsersRequest
|
||||
{
|
||||
public UsersRequest(string term)
|
||||
{
|
||||
Term = term;
|
||||
Page = 1;
|
||||
PerPage = 100;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The search terms. This can be any combination of the supported repository search parameters:
|
||||
/// http://developer.github.com/v3/search/#search-code
|
||||
/// </summary>
|
||||
public string Term { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For http://developer.github.com/v3/search/#search-users
|
||||
/// Optional Sort field. One of followers, repositories, or joined. If not provided, results are sorted by best match.
|
||||
/// </summary>
|
||||
public string Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional Sort order if sort parameter is provided. One of asc or desc; the default is desc.
|
||||
/// </summary>
|
||||
public SortDirection? Order { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Page of paginated results
|
||||
/// </summary>
|
||||
public int Page { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of items per page
|
||||
/// </summary>
|
||||
public int PerPage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// get the params in the correct format...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.Int32.ToString")]
|
||||
public System.Collections.Generic.IDictionary<string, string> Parameters
|
||||
{
|
||||
get
|
||||
{
|
||||
var d = new System.Collections.Generic.Dictionary<string, string>();
|
||||
d.Add("q", Term);
|
||||
d.Add("page", Page.ToString());
|
||||
d.Add("per_page ", PerPage.ToString());
|
||||
|
||||
if (Sort.IsNotBlank()) //only add if not blank
|
||||
d.Add("sort", Sort);
|
||||
|
||||
if (Order.HasValue)
|
||||
d.Add("order", Order.Value.ToString());
|
||||
|
||||
return d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searching Code/Files
|
||||
/// </summary>
|
||||
public class CodeRequest
|
||||
{
|
||||
public CodeRequest(string term)
|
||||
{
|
||||
Term = term;
|
||||
Page = 1;
|
||||
PerPage = 100;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The search terms. This can be any combination of the supported repository search parameters:
|
||||
/// http://developer.github.com/v3/search/#search-code
|
||||
/// </summary>
|
||||
public string Term { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For http://developer.github.com/v3/search/#search-code
|
||||
/// Optional Sort field. Can only be indexed, which indicates how recently a file has been indexed by the GitHub search infrastructure. If not provided, results are sorted by best match.
|
||||
/// </summary>
|
||||
public string Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional Sort order if sort parameter is provided. One of asc or desc; the default is desc.
|
||||
/// </summary>
|
||||
public SortDirection? Order { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Page of paginated results
|
||||
/// </summary>
|
||||
public int Page { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of items per page
|
||||
/// </summary>
|
||||
public int PerPage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// get the params in the correct format...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.Int32.ToString")]
|
||||
public System.Collections.Generic.IDictionary<string, string> Parameters
|
||||
{
|
||||
get
|
||||
{
|
||||
var d = new System.Collections.Generic.Dictionary<string, string>();
|
||||
d.Add("q", Term);
|
||||
d.Add("page", Page.ToString());
|
||||
d.Add("per_page ", PerPage.ToString());
|
||||
|
||||
if (Sort.IsNotBlank()) //only add if not blank
|
||||
d.Add("sort", Sort);
|
||||
|
||||
if (Order.HasValue)
|
||||
d.Add("order", Order.Value.ToString());
|
||||
|
||||
return d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searching Issues
|
||||
/// </summary>
|
||||
public class IssuesRequest
|
||||
{
|
||||
public IssuesRequest(string term)
|
||||
{
|
||||
Term = term;
|
||||
Page = 1;
|
||||
PerPage = 100;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The search terms. This can be any combination of the supported repository search parameters:
|
||||
/// http://developer.github.com/v3/search/#search-code
|
||||
/// </summary>
|
||||
public string Term { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For http://developer.github.com/v3/search/#search-issues
|
||||
/// Optional Sort field. One of comments, created, or updated. If not provided, results are sorted by best match.
|
||||
/// </summary>
|
||||
public string Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional Sort order if sort parameter is provided. One of asc or desc; the default is desc.
|
||||
/// </summary>
|
||||
public SortDirection? Order { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Page of paginated results
|
||||
/// </summary>
|
||||
public int Page { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of items per page
|
||||
/// </summary>
|
||||
public int PerPage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// get the params in the correct format...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.Int32.ToString")]
|
||||
public System.Collections.Generic.IDictionary<string, string> Parameters
|
||||
{
|
||||
get
|
||||
{
|
||||
var d = new System.Collections.Generic.Dictionary<string, string>();
|
||||
d.Add("q", Term);
|
||||
d.Add("page", Page.ToString());
|
||||
d.Add("per_page ", PerPage.ToString());
|
||||
|
||||
if (Sort.IsNotBlank()) //only add if not blank
|
||||
d.Add("sort", Sort);
|
||||
|
||||
if (Order.HasValue)
|
||||
d.Add("order", Order.Value.ToString());
|
||||
|
||||
return d;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
/// <summary>
|
||||
/// Searching Users
|
||||
/// </summary>
|
||||
public class SearchUsersRequest
|
||||
{
|
||||
public SearchUsersRequest(string term)
|
||||
{
|
||||
Term = term;
|
||||
Page = 1;
|
||||
PerPage = 100;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The search terms. This can be any combination of the supported repository search parameters:
|
||||
/// http://developer.github.com/v3/search/#search-code
|
||||
/// </summary>
|
||||
public string Term { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For http://developer.github.com/v3/search/#search-users
|
||||
/// Optional Sort field. One of followers, repositories, or joined. If not provided, results are sorted by best match.
|
||||
/// </summary>
|
||||
public string Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional Sort order if sort parameter is provided. One of asc or desc; the default is desc.
|
||||
/// </summary>
|
||||
public SortDirection? Order { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Page of paginated results
|
||||
/// </summary>
|
||||
public int Page { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of items per page
|
||||
/// </summary>
|
||||
public int PerPage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// get the params in the correct format...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.Int32.ToString")]
|
||||
public System.Collections.Generic.IDictionary<string, string> Parameters
|
||||
{
|
||||
get
|
||||
{
|
||||
var d = new System.Collections.Generic.Dictionary<string, string>();
|
||||
d.Add("q", Term);
|
||||
d.Add("page", Page.ToString());
|
||||
d.Add("per_page ", PerPage.ToString());
|
||||
|
||||
if (Sort.IsNotBlank()) //only add if not blank
|
||||
d.Add("sort", Sort);
|
||||
|
||||
if (Order.HasValue)
|
||||
d.Add("order", Order.Value.ToString());
|
||||
|
||||
return d;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,13 +214,16 @@
|
||||
<Compile Include="SimpleJson.cs" />
|
||||
<Compile Include="Models\Request\NewRepository.cs" />
|
||||
<Compile Include="Clients\UsersClient.cs" />
|
||||
<Compile Include="Models\Request\SearchTerm.cs" />
|
||||
<Compile Include="Models\Response\SearchCode.cs" />
|
||||
<Compile Include="Clients\ISearchClient.cs" />
|
||||
<Compile Include="Clients\SearchClient.cs" />
|
||||
<Compile Include="Models\Response\BlobReference.cs" />
|
||||
<Compile Include="Clients\RepoCollaboratorsClient.cs" />
|
||||
<Compile Include="Clients\IRepoCollaboratorsClient.cs" />
|
||||
<Compile Include="Models\Request\SearchCodeRequest.cs" />
|
||||
<Compile Include="Models\Request\SearchIssuesRequest.cs" />
|
||||
<Compile Include="Models\Request\SearchRepositoriesRequest.cs" />
|
||||
<Compile Include="Models\Request\SearchUsersRequest.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -232,6 +232,10 @@
|
||||
<Compile Include="Models\Response\BlobReference.cs" />
|
||||
<Compile Include="Clients\RepoCollaboratorsClient.cs" />
|
||||
<Compile Include="Clients\IRepoCollaboratorsClient.cs" />
|
||||
<Compile Include="Models\Request\SearchCodeRequest.cs" />
|
||||
<Compile Include="Models\Request\SearchIssuesRequest.cs" />
|
||||
<Compile Include="Models\Request\SearchRepositoriesRequest.cs" />
|
||||
<Compile Include="Models\Request\SearchUsersRequest.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -227,6 +227,10 @@
|
||||
<Compile Include="Models\Response\BlobReference.cs" />
|
||||
<Compile Include="Clients\RepoCollaboratorsClient.cs" />
|
||||
<Compile Include="Clients\IRepoCollaboratorsClient.cs" />
|
||||
<Compile Include="Models\Request\SearchCodeRequest.cs" />
|
||||
<Compile Include="Models\Request\SearchIssuesRequest.cs" />
|
||||
<Compile Include="Models\Request\SearchRepositoriesRequest.cs" />
|
||||
<Compile Include="Models\Request\SearchUsersRequest.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -212,13 +212,16 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Helpers\StringExtensions.cs" />
|
||||
<Compile Include="SimpleJson.cs" />
|
||||
<Compile Include="Models\Request\SearchTerm.cs" />
|
||||
<Compile Include="Models\Response\SearchCode.cs" />
|
||||
<Compile Include="Clients\ISearchClient.cs" />
|
||||
<Compile Include="Clients\SearchClient.cs" />
|
||||
<Compile Include="Models\Response\BlobReference.cs" />
|
||||
<Compile Include="Clients\RepoCollaboratorsClient.cs" />
|
||||
<Compile Include="Clients\IRepoCollaboratorsClient.cs" />
|
||||
<Compile Include="Models\Request\SearchCodeRequest.cs" />
|
||||
<Compile Include="Models\Request\SearchIssuesRequest.cs" />
|
||||
<Compile Include="Models\Request\SearchRepositoriesRequest.cs" />
|
||||
<Compile Include="Models\Request\SearchUsersRequest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
|
||||
@@ -55,6 +55,9 @@
|
||||
<Compile Include="Clients\ActivitiesClient.cs" />
|
||||
<Compile Include="Clients\SearchClient.cs" />
|
||||
<Compile Include="Clients\ISearchClient.cs" />
|
||||
<Compile Include="Models\Request\SearchCodeRequest.cs" />
|
||||
<Compile Include="Models\Request\SearchIssuesRequest.cs" />
|
||||
<Compile Include="Models\Request\SearchUsersRequest.cs" />
|
||||
<Compile Include="Models\Response\BlobReference.cs" />
|
||||
<Compile Include="Clients\IBlobsClient.cs" />
|
||||
<Compile Include="Models\Request\NewBlob.cs" />
|
||||
@@ -64,7 +67,7 @@
|
||||
<Compile Include="Clients\IRepoCollaboratorsClient.cs" />
|
||||
<Compile Include="Clients\EventsClient.cs" />
|
||||
<Compile Include="Clients\IActivitiesClient.cs" />
|
||||
<Compile Include="Models\Request\SearchTerm.cs" />
|
||||
<Compile Include="Models\Request\SearchRepositoriesRequest.cs" />
|
||||
<Compile Include="Clients\ITreesClient.cs" />
|
||||
<Compile Include="Models\Request\NewTreeItem.cs" />
|
||||
<Compile Include="Models\Request\NewTree.cs" />
|
||||
|
||||
Reference in New Issue
Block a user