feat(friend): wire DTOs for /friend/* endpoints

12 files: 3 entry types (FriendEntryDto, FriendApplyEntryDto,
PlayedTogetherEntryDto), 5 response wrappers, 4 request DTOs.
All carry [MessagePackObject] + [Key] + [JsonPropertyName] per convention.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-09 22:06:36 -04:00
parent b5b4781693
commit a6e5c9f0bc
12 changed files with 179 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Friend;
[MessagePackObject]
public sealed class ApplyIdRequest
{
[JsonPropertyName("apply_id")][Key("apply_id")]
public int ApplyId { get; set; }
}

View File

@@ -0,0 +1,23 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Friend;
[MessagePackObject]
public sealed class FriendApplyEntryDto
{
[JsonPropertyName("id")][Key("id")] public int Id { get; set; }
[JsonPropertyName("viewer_id")][Key("viewer_id")] public int ViewerId { get; set; }
[JsonPropertyName("name")][Key("name")] public string Name { get; set; } = string.Empty;
[JsonPropertyName("country_code")][Key("country_code")] public string CountryCode { get; set; } = string.Empty;
[JsonPropertyName("rank")][Key("rank")] public int Rank { get; set; }
[JsonPropertyName("emblem_id")][Key("emblem_id")] public long EmblemId { get; set; }
[JsonPropertyName("degree_id")][Key("degree_id")] public int DegreeId { get; set; }
[JsonPropertyName("last_play_time")][Key("last_play_time")] public string LastPlayTime { get; set; } = string.Empty;
[JsonPropertyName("create_time")][Key("create_time")] public string CreateTime { get; set; } = string.Empty;
/// <summary>Only emitted when non-zero (matches prod's optional shape).</summary>
[JsonPropertyName("mission_type")][Key("mission_type")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int MissionType { get; set; }
}

View File

@@ -0,0 +1,29 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Friend;
/// <summary>
/// One friend entry. Mirrors the prod capture's 15-field shape exactly — numeric fields
/// (viewer_id, rank, emblem_id, degree_id) ship as native ints; everything else as
/// stringified ints / strings.
/// </summary>
[MessagePackObject]
public sealed class FriendEntryDto
{
[JsonPropertyName("device_type")][Key("device_type")] public string DeviceType { get; set; } = "0";
[JsonPropertyName("name")][Key("name")] public string Name { get; set; } = string.Empty;
[JsonPropertyName("country_code")][Key("country_code")] public string CountryCode { get; set; } = string.Empty;
[JsonPropertyName("max_friend")][Key("max_friend")] public string MaxFriend { get; set; } = "0";
[JsonPropertyName("last_play_time")][Key("last_play_time")] public string LastPlayTime { get; set; } = string.Empty;
[JsonPropertyName("is_received_two_pick_mission")][Key("is_received_two_pick_mission")] public string IsReceivedTwoPickMission { get; set; } = "0";
[JsonPropertyName("birth")][Key("birth")] public string Birth { get; set; } = "0";
[JsonPropertyName("mission_change_time")][Key("mission_change_time")] public string MissionChangeTime { get; set; } = string.Empty;
[JsonPropertyName("mission_receive_type")][Key("mission_receive_type")] public string MissionReceiveType { get; set; } = "0";
[JsonPropertyName("is_official")][Key("is_official")] public string IsOfficial { get; set; } = "0";
[JsonPropertyName("is_official_mark_displayed")][Key("is_official_mark_displayed")] public string IsOfficialMarkDisplayed { get; set; } = "0";
[JsonPropertyName("viewer_id")][Key("viewer_id")] public int ViewerId { get; set; }
[JsonPropertyName("rank")][Key("rank")] public int Rank { get; set; }
[JsonPropertyName("emblem_id")][Key("emblem_id")] public long EmblemId { get; set; }
[JsonPropertyName("degree_id")][Key("degree_id")] public int DegreeId { get; set; }
}

View File

@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Friend;
[MessagePackObject]
public sealed class FriendInfoResponse
{
[JsonPropertyName("friends")][Key("friends")] public List<FriendEntryDto> Friends { get; set; } = new();
[JsonPropertyName("friend_count")][Key("friend_count")] public int FriendCount { get; set; }
[JsonPropertyName("friend_max_count")][Key("friend_max_count")] public int FriendMaxCount { get; set; }
}

View File

@@ -0,0 +1,23 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Friend;
[MessagePackObject]
public sealed class PlayedTogetherEntryDto
{
[JsonPropertyName("viewer_id")][Key("viewer_id")] public int ViewerId { get; set; }
[JsonPropertyName("name")][Key("name")] public string Name { get; set; } = string.Empty;
[JsonPropertyName("country_code")][Key("country_code")] public string CountryCode { get; set; } = string.Empty;
[JsonPropertyName("rank")][Key("rank")] public int Rank { get; set; }
[JsonPropertyName("emblem_id")][Key("emblem_id")] public long EmblemId { get; set; }
[JsonPropertyName("degree_id")][Key("degree_id")] public int DegreeId { get; set; }
[JsonPropertyName("last_play_time")][Key("last_play_time")] public string LastPlayTime { get; set; } = string.Empty;
[JsonPropertyName("played_time")][Key("played_time")] public string PlayedTime { get; set; } = string.Empty;
[JsonPropertyName("friend_status")][Key("friend_status")] public int FriendStatus { get; set; }
[JsonPropertyName("friend_apply_id")][Key("friend_apply_id")] public int FriendApplyId { get; set; }
[JsonPropertyName("played_mode")][Key("played_mode")] public int PlayedMode { get; set; }
[JsonPropertyName("battle_type")][Key("battle_type")] public int BattleType { get; set; }
[JsonPropertyName("deck_format")][Key("deck_format")] public int DeckFormat { get; set; }
[JsonPropertyName("two_pick_type")][Key("two_pick_type")] public int TwoPickType { get; set; }
}

View File

@@ -0,0 +1,10 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Friend;
[MessagePackObject]
public sealed class PlayedTogetherInfoResponse
{
[JsonPropertyName("histories")][Key("histories")] public List<PlayedTogetherEntryDto> Histories { get; set; } = new();
}

View File

@@ -0,0 +1,11 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Friend;
[MessagePackObject]
public sealed class ReceiveApplyInfoResponse
{
[JsonPropertyName("receive_applies")][Key("receive_applies")] public List<FriendApplyEntryDto> ReceiveApplies { get; set; } = new();
[JsonPropertyName("approve_apply_count")][Key("approve_apply_count")] public int ApproveApplyCount { get; set; }
}

View File

@@ -0,0 +1,11 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Friend;
[MessagePackObject]
public sealed class RejectFriendRequest
{
[JsonPropertyName("friend_id")][Key("friend_id")]
public int FriendId { get; set; }
}

View File

@@ -0,0 +1,11 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Friend;
[MessagePackObject]
public sealed class SearchUserRequest
{
[JsonPropertyName("search_viewer_id")][Key("search_viewer_id")]
public int SearchViewerId { get; set; }
}

View File

@@ -0,0 +1,15 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Friend;
/// <summary>
/// Search result. When no match, <see cref="UserInfo"/> serializes as <c>{}</c>
/// (an empty JSON object). When matched, it's a populated <see cref="FriendEntryDto"/>.
/// </summary>
[MessagePackObject]
public sealed class SearchUserResponse
{
[JsonPropertyName("user_info")][Key("user_info")]
public object UserInfo { get; set; } = new();
}

View File

@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Friend;
[MessagePackObject]
public sealed class SendApplyInfoResponse
{
[JsonPropertyName("send_applies")][Key("send_applies")] public List<FriendApplyEntryDto> SendApplies { get; set; } = new();
[JsonPropertyName("remaining_apply_count")][Key("remaining_apply_count")] public int RemainingApplyCount { get; set; }
[JsonPropertyName("send_apply_max_count")][Key("send_apply_max_count")] public int SendApplyMaxCount { get; set; }
}

View File

@@ -0,0 +1,11 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Friend;
[MessagePackObject]
public sealed class SendApplyRequest
{
[JsonPropertyName("friend_id")][Key("friend_id")]
public int FriendId { get; set; }
}