/// <inheritdoc /> public async Task <Response?> FetchOneAsync(SlugMapping data, CancellationToken cancellationToken = default) { try { return(await this.FetchAsync(data.TravelTimeID, cancellationToken)); } catch (Exception e) { var msg = e switch { HttpRequestException => "Unable to fetch from the WSDOT API", JsonException => "Unable to deserialize response from the WSDOT API", _ => "Unable to send to the WSDOT API" }; this.Logger.LogError(msg + "; {exception}", e); return(null); } }
/// <inheritdoc /> public async Task <Models.Source.Response?> FetchOneAsync(SlugMapping key, CancellationToken cancellationToken = default) { try { return(await this.FetchAsync(key.LRID, cancellationToken)); } catch (Exception e) { var msg = e switch { HttpRequestException => "Unable to fetch from the Litter Robot API", JsonException => "Unable to deserialize response from the Litter Robot API", _ => "Unable to send to the Litter Robot API" }; this.Logger.LogError(msg + "; {exception}", e); return(null); } }
/// <summary> /// Fetch one response from the source. /// </summary> /// <param name="key"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task <Response?> FetchOneAsync(SlugMapping key, CancellationToken cancellationToken = default) { try { return(await this.FetchAsync(key.Address, DateTime.Today, cancellationToken)); } catch (Exception e) { var msg = e switch { HttpRequestException => "Unable to fetch from the Seattle Waste API", JsonException => "Unable to deserialize response from the Seattle Waste API", _ => "Unable to send to the Seattle Waste API" }; this.Logger.LogError(msg + "; {exception}", e); return(null); } }