Add AnalyzeEarlySlotRegistrationsAsync method and update Program menu
This commit is contained in:
@@ -82,6 +82,47 @@ namespace FsToolbox.Cli.Tasks
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Method GetStoreInformationAsync
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves store information including the calendar interval.
|
||||
/// </summary>
|
||||
/// <param name="httpClient">The HTTP client used to send the request.</param>
|
||||
/// <param name="storeId">The store identifier to query.</param>
|
||||
/// <returns>The store information, or null when the call fails.</returns>
|
||||
public static async Task<StoreInformation?> GetStoreInformationAsync(HttpClient httpClient, int storeId)
|
||||
{
|
||||
await AuthHelper.EnsureAuthenticationAsync(httpClient);
|
||||
|
||||
var uri = string.Format(Endpoints.StoreInformation, storeId);
|
||||
var response = await httpClient.GetAsync(uri);
|
||||
var responseBody = await response.Content.ReadAsStringAsync();
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
Logger.Error("Store information retrieval failed ({Status} {Reason}): {Body}", (int)response.StatusCode, response.ReasonPhrase, responseBody);
|
||||
return null;
|
||||
}
|
||||
|
||||
var opts = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
PropertyNamingPolicy = null
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
return JsonSerializer.Deserialize<StoreInformation>(responseBody, opts);
|
||||
}
|
||||
catch (JsonException ex)
|
||||
{
|
||||
Logger.Error(ex, "Failed to parse store information response.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Method GetStoreLogAsync
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user