本文整理汇总了C#中Request.AddParameter方法的典型用法代码示例。如果您正苦于以下问题:C# Request.AddParameter方法的具体用法?C# Request.AddParameter怎么用?C# Request.AddParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request.AddParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SearchCompanyAsync
/// <summary>
/// Searches for companies that match the query string.
/// </summary>
/// <param name="query">The query string.</param>
/// <param name="page">The request page of the search results, giving 0 will give all results.</param>
/// <returns>The resultset with the found company summaries.</returns>
public static async Task<SearchResult<CompanySummary>> SearchCompanyAsync(string query, int page = 1)
{
var request = new Request<CompanySummary>("search/company");
request.AddParameter("query", query.EscapeString());
request.AddParameter("page", page);
return await request.ProcessSearchRequestAsync();
}
示例2: GetCompanyCreditsAsync
/// <summary>
/// Gets the credits of the specified company.
/// </summary>
/// <param name="CompanyId">The id of the company</param>
/// <param name="page">The request page of the search results, giving 0 will give all results.</param>
/// <returns>A page of credits</returns>
public static async Task<SearchResult<MovieSummary>> GetCompanyCreditsAsync(int CompanyId, int page = 1)
{
Request<MovieSummary> request = new Request<MovieSummary>("company/" + CompanyId.ToString() + "/movies");
request.AddParameter("page", page);
if(!string.IsNullOrEmpty(Language))
request.AddParameter("language", Language);
return await request.ProcessSearchRequestAsync();
}
示例3: SearchCollectionAsync
/// <summary>
/// Searches for collections that match the query string.
/// </summary>
/// <param name="query">The query string</param>
/// <param name="page">The request page of the search results, giving 0 will give all results.</param>
/// <returns>The resultset with found collections.</returns>
public static async Task<SearchResult<CollectionSummary>> SearchCollectionAsync(string query, int page = 1)
{
var request = new Request<CollectionSummary>("search/collection");
request.AddParameter("query", query.EscapeString());
request.AddParameter("page", page);
if (!string.IsNullOrEmpty(Language))
request.AddParameter("language", Language);
return await request.ProcessSearchRequestAsync();
}
示例4: SearchMovieAsync
/// <summary>
/// Searches for movies that match the query string.
/// </summary>
/// <param name="query">The query string</param>
/// <param name="page">The request page of the search results, giving 0 will give all results.</param>
/// <param name="includeAdult">Indicates whether to include adult movies.</param>
/// <param name="year">If specified the year the movies are released.</param>
/// <returns>A search result set of movie summaries.</returns>
public static async Task<SearchResult<MovieSummary>> SearchMovieAsync(string query, int page = 1, bool? includeAdult = null, int? year = null)
{
var request = new Request<MovieSummary>("search/movie");
request.AddParameter("query", query.EscapeString());
request.AddParameter("page", page);
if (!string.IsNullOrEmpty(Language))
request.AddParameter("language", Language);
if (includeAdult.HasValue)
request.AddParameter("include_adult", includeAdult.Value ? "true" : "false");
if (year.HasValue)
request.AddParameter("year", year.Value.ToString());
return await request.ProcessSearchRequestAsync();
}
示例5: GetMovieByImdbAsync
/// <summary>
/// Gets a movie by the IMDB id.
/// </summary>
/// <param name="imdbId">The IMDB id</param>
/// <returns>The specified movie.</returns>
public static async Task<Movie> GetMovieByImdbAsync(string imdbId)
{
var request = new Request<Movie>("movie/" + imdbId);
if (!string.IsNullOrEmpty(Language))
request.AddParameter("language", Language);
return await request.ProcesRequestAsync();
}
示例6: GetMovieAlternateTitlesAsync
/// <summary>
/// Gets a list of altenative titles for the specified country
/// </summary>
/// <param name="movieId">Id of the movie</param>
/// <param name="country">Code of the country</param>
/// <returns>A list of alternative titles.</returns>
public static async Task<IReadOnlyList<AlternativeTitle>> GetMovieAlternateTitlesAsync(int movieId, string country)
{
var request = new Request<AlternativeTitle>("movie/" + movieId + "/alternative_titles");
if (!string.IsNullOrEmpty(country))
request.AddParameter("country", country);
return await request.ProcesRequestListAsync("titles");
}
示例7: GetMovieAlternateTitlesAsync
/// <summary>
/// Gets a list of altenative titles for the specified country
/// </summary>
/// <param name="MovieID">Id of the movie</param>
/// <param name="Country">Code of the country</param>
/// <returns>A list of alternative titles.</returns>
public static async Task<IReadOnlyList<AlternativeTitle>> GetMovieAlternateTitlesAsync(int MovieID, string Country)
{
Request<AlternativeTitle> request = new Request<AlternativeTitle>("movie/" + MovieID.ToString() + "/alternative_titles");
if (!string.IsNullOrEmpty(Country))
request.AddParameter("country", Country);
return await request.ProcesRequestListAsync("titles");
}
示例8: GetMovieAsync
/// <summary>
/// Gets a movie by the movie database id.
/// </summary>
/// <param name="movieId">Id of the movie</param>
/// <param name="extra">Indicates which parts should be prefetched.</param>
/// <returns>The specified movie.</returns>
public static async Task<Movie> GetMovieAsync(int movieId, MovieExtras extra = 0)
{
var movie = DatabaseCache.GetObject<Movie>(movieId);
if (movie == null)
{
var request = new Request<Movie>("movie/" + movieId);
if (!string.IsNullOrEmpty(Language))
request.AddParameter("language", Language);
if (extra != 0)
{
request.AddParameter("append_to_response", extra.ToString().Replace(" ", ""));
}
movie = await request.ProcesRequestAsync();
DatabaseCache.SetObject(movieId, movie);
}
return movie;
}
示例9: GetTvAsync
/// <summary>
/// Gets a TvSeries by the movie database id.
/// </summary>
/// <param name="tvSeriesId">The id of the tv series</param>
/// <param name="extra">Indicates which parts should be prefetched.</param>
/// <returns>The specified tv series</returns>
public static async Task<TVSeries> GetTvAsync(int tvSeriesId, TVSeriesExtras extra = 0)
{
var tvSeries = DatabaseCache.GetObject<TVSeries>(tvSeriesId);
if(tvSeries == null){
var request = new Request<TVSeries>("tv/" + tvSeriesId);
if (!string.IsNullOrEmpty(Language))
request.AddParameter("language", Language);
if (extra != 0)
{
request.AddParameter("append_to_response", extra.ToString().Replace(" ", ""));
}
tvSeries = await request.ProcesRequestAsync();
DatabaseCache.SetObject(tvSeriesId, tvSeries);
}
return tvSeries;
}
示例10: GetPersonAsync
/// <summary>
/// Gets the information of the specified person.
/// </summary>
/// <param name="PersonID">The id of the person.</param>
/// <param name="extras">Indicates which parts should be prefetched.</param>
/// <returns>The person.</returns>
public static async Task<Person> GetPersonAsync(int PersonID, PersonExtras extras = 0)
{
Person result = DatabaseCache.GetObject<Person>(PersonID);
if (result == null)
{
Request<Person> request = new Request<Person>("person/" + PersonID.ToString());
if (extras != 0)
{
request.AddParameter("append_to_response", extras.ToString().Replace(" ", ""));
}
result = await request.ProcesRequestAsync();
DatabaseCache.SetObject(PersonID, result);
}
return result;
}
示例11: GetSeasonAsync
/// <summary>
/// Gets a season of a tv series by the database id of the series and the sequence number of the season.
/// </summary>
/// <param name="tvSeriesId">The if of the tv series.</param>
/// <param name="seasonNumber">The sequence number of the season.</param>
/// <returns>The season</returns>
public static async Task<Season> GetSeasonAsync(int tvSeriesId, int seasonNumber)
{
Season season = null;
var series = DatabaseCache.GetObject<TVSeries>(tvSeriesId);
if (series != null)
{
var summary = series.SeasonSummaries.FirstOrDefault(s => s.SeasonNumber == seasonNumber);
if(summary != null){
season = DatabaseCache.GetObject<Season>(summary.Id);
}
}
if (season == null)
{
var request = new Request<Season>("tv/" + tvSeriesId + "/season/" + seasonNumber);
if (!string.IsNullOrEmpty(Language))
request.AddParameter("language", Language);
season = await request.ProcesRequestAsync();
DatabaseCache.SetObject(season.Id, season);
}
return season;
}
示例12: GetSimilarMoviesAsync
/// <summary>
/// Gets movies that are similiar to the specified movie.
/// </summary>
/// <param name="movieId">The specific movie.</param>
/// <param name="page">The request page of the search results, giving 0 will give all results.</param>
/// <returns>A result set with movie summaries.</returns>
public static async Task<SearchResult<MovieSummary>> GetSimilarMoviesAsync(int movieId, int page = 1)
{
var request = new Request<MovieSummary>("movie/" + movieId + "/similar_movies");
request.AddParameter("page", page);
if (!string.IsNullOrEmpty(Language))
request.AddParameter("language", Language);
return await request.ProcessSearchRequestAsync();
}
示例13: GenerateLabel
/// <summary>
/// Generate a postage label for this shipment.
/// </summary>
/// <param name="fileFormat">Format to generate the label in. Valid formats: "pdf", "zpl" and "epl2".</param>
public void GenerateLabel(string fileFormat)
{
Request request = new Request("shipments/{id}/label");
request.AddUrlSegment("id", id);
// This is a GET, but uses the request body, so use ParameterType.GetOrPost instead.
request.AddParameter("file_format", fileFormat, ParameterType.GetOrPost);
this.Merge(request.Execute<Shipment>());
}
示例14: Verify
/// <summary>
/// Verify an address.
/// </summary>
/// <returns>EasyPost.Address instance. Check message for verification failures.</returns>
public void Verify(string carrier = null)
{
if (id == null)
Create();
Request request = new Request("addresses/{id}/verify");
request.RootElement = "address";
request.AddUrlSegment("id", id);
if (carrier != null)
request.AddParameter("carrier", carrier, ParameterType.QueryString);
this.Merge(request.Execute<Address>());
}
示例15: GetMovieImagesAsync
/// <summary>
/// All images of a specific movie.
/// </summary>
/// <param name="movieId">The id of the movie.</param>
/// <returns>The images.</returns>
public static async Task<Image> GetMovieImagesAsync(int movieId)
{
var images = DatabaseCache.GetObject<Image>(movieId);
if (images == null)
{
var request = new Request<Image>("movie/" + movieId + "/images");
if (!string.IsNullOrEmpty(Language))
request.AddParameter("language", Language);
images = await request.ProcesRequestAsync();
DatabaseCache.SetObject(movieId, images);
}
return images;
}