phase 1
This commit is contained in:
81
ModVersionChecker/repository/api/dto/AppResponse.cs
Normal file
81
ModVersionChecker/repository/api/dto/AppResponse.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using ModVersionChecker.enums;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ModVersionChecker.repository.api.dto
|
||||
{
|
||||
public class AppResponse
|
||||
{
|
||||
public AppResponse() { }
|
||||
|
||||
[JsonPropertyName("id")]
|
||||
public string Id { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("uid")]
|
||||
public string Uid { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("type")]
|
||||
public string Type { get; set; } = string.Empty;
|
||||
|
||||
|
||||
[JsonPropertyName("source")]
|
||||
public string Source { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("params")]
|
||||
public Dictionary<string, string> Params { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
[JsonPropertyName("fields")]
|
||||
public Dictionary<string, string> Fields { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
[JsonPropertyName("downloadUrl")]
|
||||
public string DownloadUrl { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("currentVersion")]
|
||||
public string CurrentVersion { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("latestVersion")]
|
||||
public string LatestVersion { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("status")]
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public AppStatus Status { get; set; } = AppStatus.NONE;
|
||||
|
||||
[JsonPropertyName("createdAt")]
|
||||
public long CreatedAt { get; set; } = 0;
|
||||
|
||||
[JsonPropertyName("updatedAt")]
|
||||
public long UpdatedAt { get; set; } = 0;
|
||||
|
||||
[JsonPropertyName("lastCheckedAt")]
|
||||
public long LastCheckedAt { get; set; } = 0;
|
||||
|
||||
[JsonPropertyName("active")]
|
||||
public bool Active { get; set; } = false;
|
||||
|
||||
public static App toModel(AppResponse appResponse)
|
||||
{
|
||||
if (appResponse == null)
|
||||
{
|
||||
return new App();
|
||||
}
|
||||
return new App()
|
||||
{
|
||||
Id = appResponse.Id,
|
||||
Uid = appResponse.Uid,
|
||||
Name = appResponse.Name,
|
||||
Type = appResponse.Type,
|
||||
Source = appResponse.Source,
|
||||
Params = appResponse.Params,
|
||||
Fields = appResponse.Fields,
|
||||
DownloadUrl = appResponse.DownloadUrl,
|
||||
CurrentVersion = appResponse.CurrentVersion,
|
||||
LatestVersion = appResponse.LatestVersion,
|
||||
Status = appResponse.Status,
|
||||
LastCheckedAt = appResponse.LastCheckedAt,
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user