feature: Embed Frame Player
This commit is contained in:
@@ -50,4 +50,22 @@ public class TrackClient
|
||||
? ApiResult<PagedResult<TrackDto>>.CreatePassResult(paged)
|
||||
: ApiResult<PagedResult<TrackDto>>.CreateFailResult("Failed to deserialize response");
|
||||
}
|
||||
|
||||
public async Task<ApiResult<TrackDto>> GetTrack(string entryKey)
|
||||
{
|
||||
var response = await _http.GetAsync($"api/track/meta/by-key/{Uri.EscapeDataString(entryKey)}");
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
return ApiResult<TrackDto>.CreateFailResult($"HTTP {(int)response.StatusCode}");
|
||||
|
||||
var json = await response.Content.ReadAsStringAsync();
|
||||
var track = JsonSerializer.Deserialize<TrackDto>(json, new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
});
|
||||
|
||||
return track is not null
|
||||
? ApiResult<TrackDto>.CreatePassResult(track)
|
||||
: ApiResult<TrackDto>.CreateFailResult("Failed to deserialize response");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user