| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- using System.Text.Json.Serialization;
- namespace XafPet.Desktop.PetEngine;
- /// <summary>CFC 统一响应包装 Result<T></summary>
- public sealed class ApiResult<T>
- {
- [JsonPropertyName("code")]
- public int Code { get; set; }
- [JsonPropertyName("message")]
- public string? Message { get; set; }
- [JsonPropertyName("data")]
- public T? Data { get; set; }
- public bool IsSuccess => Code == 200;
- }
- public sealed class CfcTask
- {
- [JsonPropertyName("id")]
- public long Id { get; set; }
- [JsonPropertyName("title")]
- public string? Title { get; set; }
- [JsonPropertyName("status")]
- public string? Status { get; set; } // PENDING / IN_PROGRESS / COMPLETED / REJECTED
- [JsonPropertyName("dueDate")]
- public string? DueDate { get; set; }
- }
- public sealed class DimensionValue
- {
- [JsonPropertyName("dimension")]
- public string? Dimension { get; set; }
- [JsonPropertyName("value")]
- public int Value { get; set; }
- [JsonPropertyName("color")]
- public string? Color { get; set; }
- }
- public sealed class EnergyOverview
- {
- [JsonPropertyName("dimensions")]
- public List<DimensionValue> Dimensions { get; set; } = new();
- }
- public sealed class DailyCheckin
- {
- [JsonPropertyName("checked")]
- public bool Checked { get; set; }
- [JsonPropertyName("items")]
- public List<string> Items { get; set; } = new();
- }
- /// <summary>API 返回非 200 code 时抛出</summary>
- public sealed class ApiException : Exception
- {
- public int ApiCode { get; }
- public ApiException(int apiCode, string message) : base(message)
- {
- ApiCode = apiCode;
- }
- }
- public sealed class MascotInfo
- {
- [JsonPropertyName("mascotId")]
- public string? MascotId { get; set; }
- [JsonPropertyName("name")]
- public string? Name { get; set; }
- public sealed class MascotInfo
- {
- [JsonPropertyName("mascotId")]
- public string? MascotId { get; set; }
- [JsonPropertyName("name")]
- public string? Name { get; set; }
- }
- }
|