Add AnalyzeEarlySlotRegistrationsAsync method and update Program menu

This commit is contained in:
2026-02-03 07:41:37 +01:00
parent 0b1e735a9f
commit d177a25c3d
3 changed files with 144 additions and 0 deletions

View File

@@ -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>