public async Task <MovieInfo?> SearchSingleAsync(OMDbQueryType type, string query) { if (this.IsDisabled) { return(null); } string url = $"{Endpoint}?apikey={this.key}&{type.ToApiString()}={WebUtility.UrlEncode(query)}"; string response = await _http.GetStringAsync(url).ConfigureAwait(false); MovieInfo data = JsonConvert.DeserializeObject <MovieInfo>(response); return(data.Success ? data : null); }
public async Task <MovieInfo> GetSingleResultAsync(OMDbQueryType type, string query) { if (this.IsDisabled()) { return(null); } if (string.IsNullOrWhiteSpace(query)) { throw new ArgumentException("Query missing!", nameof(query)); } string response = await _http.GetStringAsync($"{_url}?apikey={this.key}&{type.ToApiString()}={query}").ConfigureAwait(false); MovieInfo data = JsonConvert.DeserializeObject <MovieInfo>(response); return(data.Success ? data : null); }