AbstractTopApiResponse.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System.Text.Json.Serialization;
  2. namespace Topsdk.Top;
  3. public abstract class AbstractTopApiResponse
  4. {
  5. protected int? topCode;
  6. protected string? msg;
  7. protected string? subCode;
  8. protected string? subMsg;
  9. protected string? requestId;
  10. [JsonIgnore]
  11. protected string? body;
  12. public bool isSuccess()
  13. {
  14. return (this.topCode == null || this.topCode.Equals(0))
  15. && string.IsNullOrEmpty(this.subCode);
  16. }
  17. [JsonPropertyName("code")]
  18. public int? TopCode
  19. {
  20. get => topCode;
  21. set => topCode = value;
  22. }
  23. [JsonPropertyName("msg")]
  24. public string? Msg
  25. {
  26. get => msg;
  27. set => msg = value;
  28. }
  29. [JsonPropertyName("sub_code")]
  30. public string? SubCode
  31. {
  32. get => subCode;
  33. set => subCode = value;
  34. }
  35. [JsonPropertyName("sub_msg")]
  36. public string? SubMsg
  37. {
  38. get => subMsg;
  39. set => subMsg = value;
  40. }
  41. [JsonPropertyName("request_id")]
  42. public string? RequestId
  43. {
  44. get => requestId;
  45. set => requestId = value;
  46. }
  47. [JsonIgnore]
  48. public string? Body
  49. {
  50. get => body;
  51. set => body = value;
  52. }
  53. }