本文整理汇总了C#中StackExchange.StacMan.ApiUrlBuilder类的典型用法代码示例。如果您正苦于以下问题:C# ApiUrlBuilder类的具体用法?C# ApiUrlBuilder怎么用?C# ApiUrlBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApiUrlBuilder类属于StackExchange.StacMan命名空间,在下文中一共展示了ApiUrlBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateString
Task<StacManResponse<Question>> ISearchMethods.GetMatches(string site, string filter, int? page, int? pagesize, DateTime? fromdate, DateTime? todate, Questions.SearchSort? sort, DateTime? mindate, DateTime? maxdate, int? min, int? max, Order? order, string tagged, string nottagged, string intitle)
{
ValidateString(site, "site");
ValidatePaging(page, pagesize);
ValidateSortMinMax(sort, mindate: mindate, maxdate: maxdate, min: min, max: max);
var ub = new ApiUrlBuilder(Version, "/search", useHttps: false);
ub.AddParameter("site", site);
ub.AddParameter("filter", filter);
ub.AddParameter("page", page);
ub.AddParameter("pagesize", pagesize);
ub.AddParameter("fromdate", fromdate);
ub.AddParameter("todate", todate);
ub.AddParameter("sort", sort);
ub.AddParameter("min", mindate);
ub.AddParameter("max", maxdate);
ub.AddParameter("min", min);
ub.AddParameter("max", max);
ub.AddParameter("order", order);
ub.AddParameter("tagged", tagged);
ub.AddParameter("nottagged", nottagged);
ub.AddParameter("intitle", intitle);
return CreateApiTask<Question>(ub, HttpMethod.GET, "/search");
}
示例2: ValidateAndGetFilter
Task<StacManResponse<Post>> IPostMethods.GetByIds(string site, IEnumerable<int> ids, string filter = null, int? page = null, int? pagesize = null, DateTime? fromdate = null, DateTime? todate = null, Posts.Sort? sort = null, DateTime? mindate = null, DateTime? maxdate = null, int? min = null, int? max = null, Order? order = null)
{
var filterObj = ValidateAndGetFilter(filter);
ValidateString(site, "site");
ValidateEnumerable(ids, "ids");
ValidatePaging(page, pagesize);
ValidateSortMinMax(sort, mindate: mindate, maxdate: maxdate, min: min, max: max);
var ub = new ApiUrlBuilder(String.Format("/posts/{0}", String.Join(";", ids)), useHttps: false);
ub.AddParameter("site", site);
ub.AddParameter("filter", filter);
ub.AddParameter("page", page);
ub.AddParameter("pagesize", pagesize);
ub.AddParameter("fromdate", fromdate);
ub.AddParameter("todate", todate);
ub.AddParameter("sort", sort);
ub.AddParameter("min", mindate);
ub.AddParameter("max", maxdate);
ub.AddParameter("min", min);
ub.AddParameter("max", max);
ub.AddParameter("order", order);
return CreateApiTask<Post>(ub, filterObj, "/posts/{ids}");
}
示例3: ValidateAndGetFilter
Task<StacManResponse<Answer>> IAnswerMethods.GetAll(string site, string filter = null, int? page = null, int? pagesize = null, DateTime? fromdate = null, DateTime? todate = null, Answers.Sort? sort = null, DateTime? mindate = null, DateTime? maxdate = null, int? min = null, int? max = null, Order? order = null)
{
var filterObj = ValidateAndGetFilter(filter);
ValidateString(site, "site");
ValidatePaging(page, pagesize);
ValidateSortMinMax(sort, mindate: mindate, maxdate: maxdate, min: min, max: max);
var ub = new ApiUrlBuilder("/answers", useHttps: false);
ub.AddParameter("site", site);
ub.AddParameter("filter", filter);
ub.AddParameter("page", page);
ub.AddParameter("pagesize", pagesize);
ub.AddParameter("fromdate", fromdate);
ub.AddParameter("todate", todate);
ub.AddParameter("sort", sort);
ub.AddParameter("min", mindate);
ub.AddParameter("max", maxdate);
ub.AddParameter("min", min);
ub.AddParameter("max", max);
ub.AddParameter("order", order);
return CreateApiTask<Answer>(ub, filterObj, "/answers");
}
示例4: ValidateAndGetFilter
Task<StacManResponse<Badge>> IBadgeMethods.GetByIds(string site, IEnumerable<int> ids, string filter = null, int? page = null, int? pagesize = null, DateTime? fromdate = null, DateTime? todate = null, Badges.AllSort? sort = null, Badges.Rank? minrank = null, Badges.Rank? maxrank = null, string minname = null, string maxname = null, Badges.BadgeType? mintype = null, Badges.BadgeType? maxtype = null, Order? order = null)
{
var filterObj = ValidateAndGetFilter(filter);
ValidateString(site, "site");
ValidateEnumerable(ids, "ids");
ValidatePaging(page, pagesize);
ValidateSortMinMax(sort, minrank: minrank, maxrank: maxrank, minname: minname, maxname: maxname, mintype: mintype, maxtype: maxtype);
var ub = new ApiUrlBuilder(String.Format("/badges/{0}", String.Join(";", ids)), useHttps: false);
ub.AddParameter("site", site);
ub.AddParameter("filter", filter);
ub.AddParameter("page", page);
ub.AddParameter("pagesize", pagesize);
ub.AddParameter("fromdate", fromdate);
ub.AddParameter("todate", todate);
ub.AddParameter("sort", sort);
ub.AddParameter("min", minrank);
ub.AddParameter("max", maxrank);
ub.AddParameter("min", minname);
ub.AddParameter("max", maxname);
ub.AddParameter("min", mintype);
ub.AddParameter("max", maxtype);
ub.AddParameter("order", order);
return CreateApiTask<Badge>(ub, filterObj, "/badges/{ids}");
}
示例5: ValidateString
Task<StacManResponse<Badge>> IBadgeMethods.GetAll(string site, string filter, int? page, int? pagesize, DateTime? fromdate, DateTime? todate, Badges.AllSort? sort, Badges.Rank? minrank, Badges.Rank? maxrank, string minname, string maxname, Badges.BadgeType? mintype, Badges.BadgeType? maxtype, Order? order, string inname)
{
ValidateString(site, "site");
ValidatePaging(page, pagesize);
ValidateSortMinMax(sort, minrank: minrank, maxrank: maxrank, minname: minname, maxname: maxname, mintype: mintype, maxtype: maxtype);
var ub = new ApiUrlBuilder(Version, "/badges", useHttps: false);
ub.AddParameter("site", site);
ub.AddParameter("filter", filter);
ub.AddParameter("page", page);
ub.AddParameter("pagesize", pagesize);
ub.AddParameter("fromdate", fromdate);
ub.AddParameter("todate", todate);
ub.AddParameter("sort", sort);
ub.AddParameter("min", minrank);
ub.AddParameter("max", maxrank);
ub.AddParameter("min", minname);
ub.AddParameter("max", maxname);
ub.AddParameter("min", mintype);
ub.AddParameter("max", maxtype);
ub.AddParameter("order", order);
ub.AddParameter("inname", inname);
return CreateApiTask<Badge>(ub, HttpMethod.GET, "/badges");
}
示例6: ValidateAndGetFilter
Task<StacManResponse<Question>> ISearchMethods.GetSimilar(string site, string filter = null, int? page = null, int? pagesize = null, DateTime? fromdate = null, DateTime? todate = null, Questions.SearchSort? sort = null, DateTime? mindate = null, DateTime? maxdate = null, int? min = null, int? max = null, Order? order = null, string tagged = null, string nottagged = null, string inttitle = null)
{
var filterObj = ValidateAndGetFilter(filter);
ValidateString(site, "site");
ValidatePaging(page, pagesize);
ValidateSortMinMax(sort, mindate: mindate, maxdate: maxdate, min: min, max: max);
var ub = new ApiUrlBuilder("/similar", useHttps: false);
ub.AddParameter("site", site);
ub.AddParameter("filter", filter);
ub.AddParameter("page", page);
ub.AddParameter("pagesize", pagesize);
ub.AddParameter("fromdate", fromdate);
ub.AddParameter("todate", todate);
ub.AddParameter("sort", sort);
ub.AddParameter("min", mindate);
ub.AddParameter("max", maxdate);
ub.AddParameter("min", min);
ub.AddParameter("max", max);
ub.AddParameter("order", order);
ub.AddParameter("tagged", tagged);
ub.AddParameter("nottagged", nottagged);
ub.AddParameter("inttitle", inttitle);
return CreateApiTask<Question>(ub, filterObj, "/similar");
}
示例7: ApiUrlBuilder
Task<StacManResponse<Error>> IErrorMethods.Simulate(int id, string filter)
{
var ub = new ApiUrlBuilder(Version, String.Format("/errors/{0}", id), useHttps: false);
ub.AddParameter("filter", filter);
return CreateApiTask<Error>(ub, HttpMethod.GET, "/errors/{id}");
}
示例8: ValidateEnumerable
Task<StacManResponse<Filter>> IFilterMethods.Read(IEnumerable<string> filters, string filter)
{
ValidateEnumerable(filters, "filters");
var ub = new ApiUrlBuilder(Version, String.Format("/filters/{0}", String.Join(";", filters.Select(HttpUtility.UrlEncode))), useHttps: false);
ub.AddParameter("filter", filter);
return CreateApiTask<Filter>(ub, HttpMethod.GET, "/filters/{filters}");
}
示例9: ValidateAndGetFilter
Task<StacManResponse<Error>> IErrorMethods.Simulate(int id, string filter = null)
{
var filterObj = ValidateAndGetFilter(filter);
var ub = new ApiUrlBuilder(String.Format("/errors/{0}", id), useHttps: false);
ub.AddParameter("filter", filter);
return CreateApiTask<Error>(ub, filterObj, "/errors/{id}");
}
示例10: ValidateString
Task<StacManResponse<Info>> IInfoMethods.Get(string site, string filter)
{
ValidateString(site, "site");
var ub = new ApiUrlBuilder(Version, "/info", useHttps: false);
ub.AddParameter("site", site);
ub.AddParameter("filter", filter);
return CreateApiTask<Info>(ub, HttpMethod.GET, "/info");
}
示例11: ApiUrlBuilder
Task<StacManResponse<Filter>> IFilterMethods.Create(string filter, IEnumerable<string> include, IEnumerable<string> exclude, string @base, bool? @unsafe)
{
var ub = new ApiUrlBuilder(Version, "/filters/create", useHttps: false);
ub.AddParameter("filter", filter);
ub.AddParameter("include", include);
ub.AddParameter("exclude", exclude);
ub.AddParameter("base", @base);
ub.AddParameter("unsafe", @unsafe);
return CreateApiTask<Filter>(ub, HttpMethod.GET, "/filters/create");
}
示例12: ValidateAndGetFilter
Task<StacManResponse<Filter>> IFilterMethods.Read(IEnumerable<string> filters, string filter = null)
{
var filterObj = ValidateAndGetFilter(filter);
ValidateEnumerable(filters, "filters");
var ub = new ApiUrlBuilder(String.Format("/filters/{0}", String.Join(";", filters)), useHttps: false);
ub.AddParameter("filter", filter);
return CreateApiTask<Filter>(ub, filterObj, "/filters/{filters}");
}
示例13: ValidatePaging
Task<StacManResponse<Error>> IErrorMethods.GetAll(string filter, int? page, int? pagesize)
{
ValidatePaging(page, pagesize);
var ub = new ApiUrlBuilder(Version, "/errors", useHttps: false);
ub.AddParameter("filter", filter);
ub.AddParameter("page", page);
ub.AddParameter("pagesize", pagesize);
return CreateApiTask<Error>(ub, HttpMethod.GET, "/errors");
}
示例14: ValidateEnumerable
Task<StacManResponse<AccessToken>> IAccessTokenMethods.Invalidate(IEnumerable<string> accessTokens, string filter, int? page, int? pagesize)
{
ValidateEnumerable(accessTokens, "accessTokens");
ValidatePaging(page, pagesize);
var ub = new ApiUrlBuilder(Version, String.Format("/access-tokens/{0}/invalidate", String.Join(";", accessTokens.Select(HttpUtility.UrlEncode))), useHttps: false);
ub.AddParameter("filter", filter);
ub.AddParameter("page", page);
ub.AddParameter("pagesize", pagesize);
return CreateApiTask<AccessToken>(ub, HttpMethod.GET, "/access-tokens/{accessTokens}/invalidate");
}
示例15: ValidateAndGetFilter
Task<StacManResponse<Site>> ISiteMethods.GetAll(string filter = null, int? page = null, int? pagesize = null)
{
var filterObj = ValidateAndGetFilter(filter);
ValidatePaging(page, pagesize);
var ub = new ApiUrlBuilder("/sites", useHttps: false);
ub.AddParameter("filter", filter);
ub.AddParameter("page", page);
ub.AddParameter("pagesize", pagesize);
return CreateApiTask<Site>(ub, filterObj, "/sites");
}