Skip to content

Commit 8fa8760

Browse files
authored
Refactor response models (#4)
1 parent f5036fa commit 8fa8760

File tree

10 files changed

+36
-22
lines changed

10 files changed

+36
-22
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Runtime.Serialization;
2+
3+
namespace MatchTraderBApi.Enums;
4+
5+
public enum MTrSystemType
6+
{
7+
[EnumMember(Value = "MT4")]
8+
MT4,
9+
10+
[EnumMember(Value = "MT5")]
11+
MT5,
12+
13+
[EnumMember(Value = "QFX")]
14+
QFX,
15+
}

MatchTraderBApi/Models/Dtos/General/MTrBranch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class MTrBranch
88
public string Uuid { get; set; }
99

1010
[JsonPropertyName("partnerId")]
11-
public string PartnerId { get; set; }
11+
public long? PartnerId { get; set; }
1212

1313
[JsonPropertyName("created")]
1414
public DateTime Created { get; set; }

MatchTraderBApi/Models/Dtos/General/MTrMailingConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class MTrMailingConfiguration
1414
public string EmailHost { get; set; }
1515

1616
[JsonPropertyName("emailPort")]
17-
public int? EmailPort { get; set; } // Nullable int for emailPort
17+
public int? EmailPort { get; set; }
1818

1919
[JsonPropertyName("emailTls")]
2020
public bool EmailTls { get; set; }

MatchTraderBApi/Models/Dtos/General/MTrOffer.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ public class MTrOffer
1111
public long? PartnerId { get; set; }
1212

1313
[JsonPropertyName("created")]
14-
public string Created { get; set; }
14+
public DateTime Created { get; set; }
1515

1616
[JsonPropertyName("updated")]
17-
public string Updated { get; set; }
17+
public DateTime Updated { get; set; }
1818

1919
[JsonPropertyName("name")]
2020
public string Name { get; set; }
@@ -23,10 +23,10 @@ public class MTrOffer
2323
public string Currency { get; set; }
2424

2525
[JsonPropertyName("demo")]
26-
public bool Demo { get; set; }
26+
public bool IsDemo { get; set; }
2727

2828
[JsonPropertyName("hidden")]
29-
public bool Hidden { get; set; }
29+
public bool IsHidden { get; set; }
3030

3131
[JsonPropertyName("description")]
3232
public string Description { get; set; }
@@ -35,16 +35,16 @@ public class MTrOffer
3535
public string? MoneyManager { get; set; }
3636

3737
[JsonPropertyName("initialDeposit")]
38-
public double InitialDeposit { get; set; }
38+
public decimal InitialDeposit { get; set; }
3939

4040
[JsonPropertyName("leverage")]
41-
public double Leverage { get; set; }
41+
public int Leverage { get; set; }
4242

4343
[JsonPropertyName("verificationRequired")]
44-
public bool VerificationRequired { get; set; }
44+
public bool IsVerificationRequired { get; set; }
4545

4646
[JsonPropertyName("tradingAccountAutoCreation")]
47-
public bool TradingAccountAutoCreation { get; set; }
47+
public bool IsTradingAccountAutoCreation { get; set; }
4848

4949
[JsonPropertyName("groupName")]
5050
public string GroupName { get; set; }

MatchTraderBApi/Models/Dtos/General/MTrOfferBranch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class MTrOfferBranch
1111
public long? PartnerId { get; set; }
1212

1313
[JsonPropertyName("created")]
14-
public string Created { get; set; }
14+
public DateTime Created { get; set; }
1515

1616
[JsonPropertyName("name")]
1717
public string Name { get; set; }

MatchTraderBApi/Models/Dtos/General/MTrOfferSystem.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Text.Json.Serialization;
2+
using MatchTraderBApi.Enums;
23

34
namespace MatchTraderBApi.Models.Dtos.General;
45

@@ -11,17 +12,17 @@ public class MTrOfferSystem
1112
public long? PartnerId { get; set; }
1213

1314
[JsonPropertyName("created")]
14-
public string Created { get; set; }
15+
public DateTime Created { get; set; }
1516

1617
[JsonPropertyName("name")]
1718
public string Name { get; set; }
1819

1920
[JsonPropertyName("demo")]
20-
public bool Demo { get; set; }
21+
public bool IsDemo { get; set; }
2122

2223
[JsonPropertyName("active")]
23-
public bool Active { get; set; }
24+
public bool IsActive { get; set; }
2425

2526
[JsonPropertyName("systemType")]
26-
public string SystemType { get; set; }
27+
public MTrSystemType SystemType { get; set; }
2728
}

MatchTraderBApi/Models/Dtos/General/MTrRole.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public class MTrRole
1414
public long? PartnerId { get; set; }
1515

1616
[JsonPropertyName("created")]
17-
public string created { get; set; }
17+
public DateTime created { get; set; }
1818

1919
[JsonPropertyName("updated")]
20-
public string updated { get; set; }
20+
public DateTime updated { get; set; }
2121
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
using System.Text.Json.Serialization;
2-
using MatchTraderBApi.Models.Dtos;
32
using MatchTraderBApi.Models.Dtos.General;
43

54
namespace MatchTraderBApi.Models.Responses.General;
65

76
public class MTrGetBranchesResponse
87
{
9-
[JsonPropertyName("branches")]
10-
public List<MTrBranch> Branches { get; set; }
8+
[JsonPropertyName("branches")]
9+
public List<MTrBranch> Branches { get; set; } = [];
1110
}

MatchTraderBApi/Models/Responses/General/MTrGetOffersResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ namespace MatchTraderBApi.Models.Responses.General;
66
public class MTrGetOffersResponse
77
{
88
[JsonPropertyName("offers")]
9-
public List<MTrOffer> Offers { get; set; }
9+
public List<MTrOffer> Offers { get; set; } = [];
1010
}

MatchTraderBApi/Models/Responses/General/MTrGetRolesResponse.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Text.Json.Serialization;
2-
using MatchTraderBApi.Models.Dtos;
32
using MatchTraderBApi.Models.Dtos.General;
43

54
namespace MatchTraderBApi.Models.Responses.General;

0 commit comments

Comments
 (0)