Lots of additions and restructuring
This commit is contained in:
@@ -3,5 +3,6 @@ namespace TOOHUCardAPI.DTO
|
||||
public abstract class AbstractPlayerTargetedRequest : AbstractRequest
|
||||
{
|
||||
public string SteamId { get; set; }
|
||||
public string UserId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -5,23 +5,10 @@ namespace TOOHUCardAPI.DTO
|
||||
{
|
||||
public abstract class AbstractResponse
|
||||
{
|
||||
public static string SUCCESS_CODE = "0000";
|
||||
[JsonProperty("code")]
|
||||
public string Code { get; set; } = SUCCESS_CODE;
|
||||
public abstract string Code { get; }
|
||||
[JsonProperty("msg")]
|
||||
public string Message { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class InvalidUserResponse : AbstractResponse
|
||||
{
|
||||
public InvalidUserResponse()
|
||||
{
|
||||
Code = "0001";
|
||||
Message = "Invalid user";
|
||||
}
|
||||
}
|
||||
|
||||
public class OkResponse : AbstractResponse
|
||||
{
|
||||
public abstract string Message { get; }
|
||||
}
|
||||
|
||||
}
|
||||
39
TOOHUCardAPI/DTO/GenericResponses.cs
Normal file
39
TOOHUCardAPI/DTO/GenericResponses.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
namespace TOOHUCardAPI.DTO
|
||||
{
|
||||
public class InvalidUserResponse : AbstractResponse
|
||||
{
|
||||
public override string Code => "0001";
|
||||
|
||||
public override string Message => "Invalid User";
|
||||
}
|
||||
|
||||
public class OkResponse : AbstractResponse
|
||||
{
|
||||
public override string Code => "0000";
|
||||
|
||||
public override string Message => string.Empty;
|
||||
}
|
||||
|
||||
public class InsufficientPointsResponse : AbstractResponse
|
||||
{
|
||||
public override string Code => "0002";
|
||||
|
||||
public override string Message => "Insufficient points";
|
||||
|
||||
}
|
||||
|
||||
public class NotFirstWinResponse : AbstractResponse
|
||||
{
|
||||
public override string Code => "0003";
|
||||
|
||||
public override string Message => "Not a first win";
|
||||
|
||||
}
|
||||
|
||||
public class InvalidCardResponse : AbstractResponse
|
||||
{
|
||||
public override string Code => "0004";
|
||||
|
||||
public override string Message => "Invalid card";
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace TOOHUCardAPI.DTO
|
||||
{
|
||||
public class PlayerBaseDataResponse: AbstractResponse
|
||||
public class PlayerBaseDataResponse: OkResponse
|
||||
{
|
||||
[JsonProperty("steamid")]
|
||||
public string SteamId { get; set; }
|
||||
|
||||
@@ -2,7 +2,6 @@ namespace TOOHUCardAPI.DTO.PlayerData
|
||||
{
|
||||
public class PlayerDataBuyMagicKeyRequest : AbstractPlayerTargetedRequest
|
||||
{
|
||||
public string UserId { get; set; }
|
||||
public int Count { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace TOOHUCardAPI.DTO.PlayerData
|
||||
{
|
||||
public class PlayerDataBuyMagicKeyResponse : AbstractResponse
|
||||
public class PlayerDataBuyMagicKeyResponse : OkResponse
|
||||
{
|
||||
[JsonProperty("cost_point")]
|
||||
public int TotalCost { get; set; }
|
||||
|
||||
@@ -2,7 +2,7 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace TOOHUCardAPI.DTO.PlayerData
|
||||
{
|
||||
public class PlayerDataFirstWinResponse : AbstractResponse
|
||||
public class PlayerDataFirstWinResponse : OkResponse
|
||||
{
|
||||
[JsonProperty("bonus_point")]
|
||||
public int BonusPoints { get; set; }
|
||||
|
||||
@@ -8,7 +8,7 @@ using TOOHUCardAPI.Data.Models;
|
||||
|
||||
namespace TOOHUCardAPI.DTO.PlayerData
|
||||
{
|
||||
public class PlayerDataGetResponseObject: AbstractResponse
|
||||
public class PlayerDataGetResponseObject: OkResponse
|
||||
{
|
||||
// Instead of using a defined object, use a dictionary so we can add the necessary cardgroup items. I dont want to make 20 of them in the class
|
||||
[JsonProperty("bo")]
|
||||
@@ -19,7 +19,7 @@ namespace TOOHUCardAPI.DTO.PlayerData
|
||||
* Fields pulled from the game code
|
||||
* Looking up Gamerules.Playerdata
|
||||
*/
|
||||
public class PlayerDataGetResponseObjectPlayer: AbstractResponse
|
||||
public class PlayerDataGetResponseObjectPlayer: OkResponse
|
||||
{
|
||||
[JsonProperty("steamid")]
|
||||
public string SteamId { get; set; }
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace TOOHUCardAPI.DTO.PlayerData
|
||||
{
|
||||
public class PlayerDataSaveCardGroupRequest: AbstractPlayerTargetedRequest
|
||||
{
|
||||
public string UserId { get; set; }
|
||||
[JsonProperty("group_key")]
|
||||
public string GroupKey { get; set; }
|
||||
[JsonProperty("group_data")]
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace TOOHUCardAPI.DTO.PlayerData
|
||||
{
|
||||
public class PlayerDataSaveCardGroupResponseObject : AbstractResponse
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace TOOHUCardAPI.DTO.PlayerData
|
||||
{
|
||||
public class PlayerDataSaveCardLevelRequest : AbstractPlayerTargetedRequest
|
||||
{
|
||||
[JsonProperty("card")]
|
||||
public string CardItemCode { get; set; }
|
||||
[JsonProperty("level")]
|
||||
public int LevelIncrease { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace TOOHUCardAPI.DTO.PlayerData
|
||||
{
|
||||
public class PlayerDataSaveCardLevelResponse : OkResponse
|
||||
{
|
||||
[JsonProperty("cost_point")]
|
||||
public int TotalCost { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ namespace TOOHUCardAPI.DTO.PlayerData
|
||||
{
|
||||
public class PlayerDataSaveKeyCountRequest: AbstractPlayerTargetedRequest
|
||||
{
|
||||
public string UserId { get; set; }
|
||||
[JsonProperty("key_total")]public int KeyTotal { get; set; }
|
||||
[JsonProperty("key_use_count")]public int KeyUseCount { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user