web: verze API na jednom místě a číslo verze v patičce

This commit is contained in:
PatTheEvil committed 2026-12-02 18:54:15 +01:00
1 parent 946ff5ce12
commit 5d8b71c435
11 files changed
+102 -18

No files matched your search

+8 -8
View File
@@ -10,13 +10,13 @@ public sealed class HelpdeskApiClient(HttpClient http)
{
public async Task<UserDto> GetMeAsync(CancellationToken ct)
{
using var response = await http.GetAsync("api/v1/users/me", ct);
using var response = await http.GetAsync("users/me", ct);
return await ApiResponse.ReadAsync<UserDto>(response, ct);
}
public async Task<UserDto> UpdateMeAsync(UpdateProfileRequest request, CancellationToken ct)
{
using var response = await http.PutAsJsonAsync("api/v1/users/me", request, ct);
using var response = await http.PutAsJsonAsync("users/me", request, ct);
return await ApiResponse.ReadAsync<UserDto>(response, ct);
}
@@ -30,7 +30,7 @@ public sealed class HelpdeskApiClient(HttpClient http)
["page"] = query.Page.ToString(CultureInfo.InvariantCulture),
["pageSize"] = query.PageSize.ToString(CultureInfo.InvariantCulture),
};
using var response = await http.GetAsync(QueryHelpers.AddQueryString("api/v1/issues", parameters.Where(p => !string.IsNullOrEmpty(p.Value))), ct);
using var response = await http.GetAsync(QueryHelpers.AddQueryString("issues", parameters.Where(p => !string.IsNullOrEmpty(p.Value))), ct);
return await ApiResponse.ReadAsync<PagedResult<IssueSummary>>(response, ct);
}
@@ -60,33 +60,33 @@ public sealed class HelpdeskApiClient(HttpClient http)
content.Add(part, "files", file.FileName);
}
using var response = await http.PostAsync("api/v1/issues", content, ct);
using var response = await http.PostAsync("issues", content, ct);
return await ApiResponse.ReadAsync<IssueDetail>(response, ct);
}
public async Task<IReadOnlyList<CategoryDto>> GetIssueCategoriesAsync(CancellationToken ct)
{
using var response = await http.GetAsync("api/v1/issue-categories", ct);
using var response = await http.GetAsync("issue-categories", ct);
return await ApiResponse.ReadAsync<List<CategoryDto>>(response, ct);
}
public async Task<IReadOnlyList<BuildingDto>> GetBuildingsAsync(CancellationToken ct)
{
using var response = await http.GetAsync("api/v1/buildings", ct);
using var response = await http.GetAsync("buildings", ct);
return await ApiResponse.ReadAsync<List<BuildingDto>>(response, ct);
}
/// <summary>Odhlásí ze všech zařízení – API zneplatní všechny tokeny uživatele.</summary>
public async Task LogoutAllAsync(CancellationToken ct)
{
using var response = await http.PostAsync("api/v1/auth/logout-all", content: null, ct);
using var response = await http.PostAsync("auth/logout-all", content: null, ct);
await ApiResponse.EnsureSuccessAsync(response, ct);
}
/// <summary>Odhlásí toto zařízení – API zneplatní aktuální access token i předaný refresh token.</summary>
public async Task LogoutAsync(string refreshToken, CancellationToken ct)
{
using var response = await http.PostAsJsonAsync("api/v1/auth/logout", new RefreshTokenRequest(refreshToken), ct);
using var response = await http.PostAsJsonAsync("auth/logout", new RefreshTokenRequest(refreshToken), ct);
await ApiResponse.EnsureSuccessAsync(response, ct);
}
}