Skip to content

Commit

Permalink
Balancing Authority Parameter Renamed to Region
Browse files Browse the repository at this point in the history
Balancing Authority Renamed to Region.  Does not include updates to API, just the Query String parameter.
  • Loading branch information
vaughanknight committed May 31, 2024
1 parent ab1205d commit 7c115fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public WattTimeClient(IHttpClientFactory factory, IOptionsMonitor<WattTimeClient
_client.BaseAddress = new Uri(this._configuration.BaseUrl);
_client.DefaultRequestHeaders.Accept.Clear();
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(MediaTypeNames.Application.Json));

_authenticationClient.BaseAddress = new Uri(this._configuration.AuthenticationBaseUrl);
_authenticationClient.DefaultRequestHeaders.Accept.Clear();
_authenticationClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(MediaTypeNames.Application.Json));

_memoryCache = memoryCache;
}

Expand All @@ -61,14 +61,14 @@ public async Task<IEnumerable<GridEmissionDataPoint>> GetDataAsync(string balanc

var parameters = new Dictionary<string, string>()
{
{ QueryStrings.BalancingAuthorityAbbreviation, balancingAuthorityAbbreviation },
{ QueryStrings.Region, balancingAuthorityAbbreviation },
{ QueryStrings.StartTime, startTime.ToUniversalTime().ToString("O", CultureInfo.InvariantCulture) },
{ QueryStrings.EndTime, endTime.ToUniversalTime().ToString("O", CultureInfo.InvariantCulture) }
};

var tags = new Dictionary<string, string>()
{
{ QueryStrings.BalancingAuthorityAbbreviation, balancingAuthorityAbbreviation }
{ QueryStrings.Region, balancingAuthorityAbbreviation }
};

using (var result = await this.MakeRequestGetStreamAsync(Paths.Data, parameters, tags))
Expand All @@ -91,12 +91,12 @@ public async Task<Forecast> GetCurrentForecastAsync(string balancingAuthorityAbb

var parameters = new Dictionary<string, string>()
{
{ QueryStrings.BalancingAuthorityAbbreviation, balancingAuthorityAbbreviation }
{ QueryStrings.Region, balancingAuthorityAbbreviation }
};

var tags = new Dictionary<string, string>()
{
{ QueryStrings.BalancingAuthorityAbbreviation, balancingAuthorityAbbreviation }
{ QueryStrings.Region, balancingAuthorityAbbreviation }
};

var result = await this.MakeRequestGetStreamAsync(Paths.Forecast, parameters, tags);
Expand All @@ -119,14 +119,14 @@ public Task<Forecast> GetCurrentForecastAsync(BalancingAuthority balancingAuthor

var parameters = new Dictionary<string, string>()
{
{ QueryStrings.BalancingAuthorityAbbreviation, balancingAuthorityAbbreviation },
{ QueryStrings.Region, balancingAuthorityAbbreviation },
{ QueryStrings.StartTime, requestedAt.ToUniversalTime().ToString("O", CultureInfo.InvariantCulture) },
{ QueryStrings.EndTime, requestedAt.ToUniversalTime().ToString("O", CultureInfo.InvariantCulture) }
};

var tags = new Dictionary<string, string>()
{
{ QueryStrings.BalancingAuthorityAbbreviation, balancingAuthorityAbbreviation }
{ QueryStrings.Region, balancingAuthorityAbbreviation }
};
using (var result = await this.MakeRequestGetStreamAsync(Paths.Forecast, parameters, tags))
{
Expand Down Expand Up @@ -161,7 +161,7 @@ public async Task<Stream> GetHistoricalDataAsync(string balancingAuthorityAbbrev

var parameters = new Dictionary<string, string>()
{
{ QueryStrings.BalancingAuthorityAbbreviation, balancingAuthorityAbbreviation }
{ QueryStrings.Region, balancingAuthorityAbbreviation }
};

var url = BuildUrlWithQueryString(Paths.Historical, parameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

internal class QueryStrings
{
public const string BalancingAuthorityAbbreviation = "ba";
public const string Region = "region";
public const string StartTime = "start";
public const string EndTime = "end";
public const string Latitude = "latitude";
Expand Down

0 comments on commit 7c115fa

Please sign in to comment.