private async Task <T> GetTvSeasonMethod <T>(int tvShowId, int seasonNumber, TvSeasonMethods tvShowMethod, string dateFormat = null, string language = null) where T : new() { RestRequest req = new RestRequest("tv/{id}/season/{season_number}/{method}"); req.AddUrlSegment("id", tvShowId.ToString(CultureInfo.InvariantCulture)); req.AddUrlSegment("season_number", seasonNumber.ToString(CultureInfo.InvariantCulture)); req.AddUrlSegment("method", tvShowMethod.GetDescription()); if (dateFormat != null) { req.DateFormat = dateFormat; } language = language ?? DefaultLanguage; if (!String.IsNullOrWhiteSpace(language)) { req.AddParameter("language", language); } return((await _client.ExecuteGetTaskAsync <T>(req).ConfigureAwait(false)).Data); }
private async Task <T> GetTvSeasonMethod <T>(int tvShowId, int seasonNumber, TvSeasonMethods tvShowMethod, string dateFormat = null, string language = null) where T : new() { RestRequest req = _client.Create("tv/{id}/season/{season_number}/{method}"); req.AddUrlSegment("id", tvShowId.ToString(CultureInfo.InvariantCulture)); req.AddUrlSegment("season_number", seasonNumber.ToString(CultureInfo.InvariantCulture)); req.AddUrlSegment("method", tvShowMethod.GetDescription()); // TODO: Dateformat? //if (dateFormat != null) // req.DateFormat = dateFormat; language = language ?? DefaultLanguage; if (!string.IsNullOrWhiteSpace(language)) { req.AddParameter("language", language); } RestResponse <T> response = await req.ExecuteGet <T>().ConfigureAwait(false); return(response); }
private T GetTvSeasonMethod <T>(int tvShowId, int seasonNumber, TvSeasonMethods tvShowMethod, string dateFormat = null, string language = null) where T : new() { var req = new RestRequest("tv/{id}/season/{season_number}/{method}"); req.AddUrlSegment("id", tvShowId.ToString(CultureInfo.InvariantCulture)); req.AddUrlSegment("season_number", seasonNumber.ToString(CultureInfo.InvariantCulture)); req.AddUrlSegment("method", tvShowMethod.GetDescription()); if (dateFormat != null) { req.DateFormat = dateFormat; } if (language != null) { req.AddParameter("language", language); } IRestResponse <T> resp = _client.Get <T>(req); return(resp.Data); }