Skip to content

Commit 1dec13a

Browse files
tomazt-srzb-sr
authored andcommitted
rg entities
Added new operations: SendSessionLimitInformAsync SendLimitReachedInformAsync SendFinancialLimitInformAsync SendAccountStatusInformAsync
1 parent 82aa2d9 commit 1dec13a

16 files changed

+600
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Text.Json;
2+
using System.Text.Json.Serialization;
3+
4+
namespace Sportradar.Mbs.Sdk.Entities.Common;
5+
6+
[JsonConverter(typeof(FinancialLimitTypeJsonConverter))]
7+
public enum FinancialLimitType {
8+
DEPOSIT,
9+
STAKE,
10+
LOSS
11+
}
12+
13+
public class FinancialLimitTypeJsonConverter : JsonConverter<FinancialLimitType> {
14+
15+
public override FinancialLimitType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
16+
{
17+
var jsonVal = reader.GetString();
18+
return jsonVal switch
19+
{
20+
"deposit" => FinancialLimitType.DEPOSIT,
21+
"stake" => FinancialLimitType.STAKE,
22+
"loss" => FinancialLimitType.LOSS,
23+
_ => throw new JsonException("Unknown type of FinancialLimitType: " + jsonVal)
24+
};
25+
}
26+
27+
public override void Write(Utf8JsonWriter writer, FinancialLimitType value, JsonSerializerOptions options)
28+
{
29+
string jsonVal = value switch
30+
{
31+
FinancialLimitType.DEPOSIT => "deposit",
32+
FinancialLimitType.STAKE => "stake",
33+
FinancialLimitType.LOSS => "loss",
34+
_ => throw new ArgumentOutOfRangeException(nameof(value), value, null)
35+
};
36+
writer.WriteStringValue(jsonVal);
37+
}
38+
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System.Text.Json;
2+
using System.Text.Json.Serialization;
3+
4+
namespace Sportradar.Mbs.Sdk.Entities.Common;
5+
6+
[JsonConverter(typeof(InitiatorJsonConverter))]
7+
public enum Initiator {
8+
REGULATOR,
9+
OTHER,
10+
OPERATOR,
11+
PLAYER
12+
}
13+
14+
public class InitiatorJsonConverter : JsonConverter<Initiator> {
15+
16+
public override Initiator Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
17+
{
18+
var jsonVal = reader.GetString();
19+
return jsonVal switch
20+
{
21+
"regulator" => Initiator.REGULATOR,
22+
"other" => Initiator.OTHER,
23+
"operator" => Initiator.OPERATOR,
24+
"player" => Initiator.PLAYER,
25+
_ => throw new JsonException("Unknown type of Initiator: " + jsonVal)
26+
};
27+
}
28+
29+
public override void Write(Utf8JsonWriter writer, Initiator value, JsonSerializerOptions options)
30+
{
31+
string jsonVal = value switch
32+
{
33+
Initiator.REGULATOR => "regulator",
34+
Initiator.OTHER => "other",
35+
Initiator.OPERATOR => "operator",
36+
Initiator.PLAYER => "player",
37+
_ => throw new ArgumentOutOfRangeException(nameof(value), value, null)
38+
};
39+
writer.WriteStringValue(jsonVal);
40+
}
41+
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Text.Json;
2+
using System.Text.Json.Serialization;
3+
4+
namespace Sportradar.Mbs.Sdk.Entities.Common;
5+
6+
[JsonConverter(typeof(LimitFrequencyJsonConverter))]
7+
public enum LimitFrequency {
8+
MONTHLY,
9+
DAILY,
10+
WEEKLY
11+
}
12+
13+
public class LimitFrequencyJsonConverter : JsonConverter<LimitFrequency> {
14+
15+
public override LimitFrequency Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
16+
{
17+
var jsonVal = reader.GetString();
18+
return jsonVal switch
19+
{
20+
"monthly" => LimitFrequency.MONTHLY,
21+
"daily" => LimitFrequency.DAILY,
22+
"weekly" => LimitFrequency.WEEKLY,
23+
_ => throw new JsonException("Unknown type of LimitFrequency: " + jsonVal)
24+
};
25+
}
26+
27+
public override void Write(Utf8JsonWriter writer, LimitFrequency value, JsonSerializerOptions options)
28+
{
29+
string jsonVal = value switch
30+
{
31+
LimitFrequency.MONTHLY => "monthly",
32+
LimitFrequency.DAILY => "daily",
33+
LimitFrequency.WEEKLY => "weekly",
34+
_ => throw new ArgumentOutOfRangeException(nameof(value), value, null)
35+
};
36+
writer.WriteStringValue(jsonVal);
37+
}
38+
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System.Text.Json;
2+
using System.Text.Json.Serialization;
3+
4+
namespace Sportradar.Mbs.Sdk.Entities.Common;
5+
6+
[JsonConverter(typeof(LimitTypeJsonConverter))]
7+
public enum LimitType {
8+
DEPOSIT,
9+
SESSION,
10+
LOSS,
11+
STAKE
12+
}
13+
14+
public class LimitTypeJsonConverter : JsonConverter<LimitType> {
15+
16+
public override LimitType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
17+
{
18+
var jsonVal = reader.GetString();
19+
return jsonVal switch
20+
{
21+
"deposit" => LimitType.DEPOSIT,
22+
"session" => LimitType.SESSION,
23+
"loss" => LimitType.LOSS,
24+
"stake" => LimitType.STAKE,
25+
_ => throw new JsonException("Unknown type of LimitType: " + jsonVal)
26+
};
27+
}
28+
29+
public override void Write(Utf8JsonWriter writer, LimitType value, JsonSerializerOptions options)
30+
{
31+
string jsonVal = value switch
32+
{
33+
LimitType.DEPOSIT => "deposit",
34+
LimitType.SESSION => "session",
35+
LimitType.LOSS => "loss",
36+
LimitType.STAKE => "stake",
37+
_ => throw new ArgumentOutOfRangeException(nameof(value), value, null)
38+
};
39+
writer.WriteStringValue(jsonVal);
40+
}
41+
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Text.Json;
2+
using System.Text.Json.Serialization;
3+
4+
namespace Sportradar.Mbs.Sdk.Entities.Common;
5+
6+
[JsonConverter(typeof(StatusDurationJsonConverter))]
7+
public enum StatusDuration {
8+
TEMPORARY,
9+
PERMANENT
10+
}
11+
12+
public class StatusDurationJsonConverter : JsonConverter<StatusDuration> {
13+
14+
public override StatusDuration Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
15+
{
16+
var jsonVal = reader.GetString();
17+
return jsonVal switch
18+
{
19+
"temporary" => StatusDuration.TEMPORARY,
20+
"permanent" => StatusDuration.PERMANENT,
21+
_ => throw new JsonException("Unknown type of StatusDuration: " + jsonVal)
22+
};
23+
}
24+
25+
public override void Write(Utf8JsonWriter writer, StatusDuration value, JsonSerializerOptions options)
26+
{
27+
string jsonVal = value switch
28+
{
29+
StatusDuration.TEMPORARY => "temporary",
30+
StatusDuration.PERMANENT => "permanent",
31+
_ => throw new ArgumentOutOfRangeException(nameof(value), value, null)
32+
};
33+
writer.WriteStringValue(jsonVal);
34+
}
35+
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Text.Json;
2+
using System.Text.Json.Serialization;
3+
4+
namespace Sportradar.Mbs.Sdk.Entities.Common;
5+
6+
[JsonConverter(typeof(StatusValueJsonConverter))]
7+
public enum StatusValue {
8+
DISABLED,
9+
EXCLUDED,
10+
ACTIVE
11+
}
12+
13+
public class StatusValueJsonConverter : JsonConverter<StatusValue> {
14+
15+
public override StatusValue Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
16+
{
17+
var jsonVal = reader.GetString();
18+
return jsonVal switch
19+
{
20+
"disabled" => StatusValue.DISABLED,
21+
"excluded" => StatusValue.EXCLUDED,
22+
"active" => StatusValue.ACTIVE,
23+
_ => throw new JsonException("Unknown type of StatusValue: " + jsonVal)
24+
};
25+
}
26+
27+
public override void Write(Utf8JsonWriter writer, StatusValue value, JsonSerializerOptions options)
28+
{
29+
string jsonVal = value switch
30+
{
31+
StatusValue.DISABLED => "disabled",
32+
StatusValue.EXCLUDED => "excluded",
33+
StatusValue.ACTIVE => "active",
34+
_ => throw new ArgumentOutOfRangeException(nameof(value), value, null)
35+
};
36+
writer.WriteStringValue(jsonVal);
37+
}
38+
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
using Sportradar.Mbs.Sdk.Entities.Common;
2+
using System.Text.Json.Serialization;
3+
4+
namespace Sportradar.Mbs.Sdk.Entities.Request;
5+
6+
/// <summary>
7+
/// Represents a request to inform about an account status change.
8+
/// </summary>
9+
public class AccountStatusInformRequest : ContentRequestBase
10+
{
11+
/// <summary>
12+
/// JSON property that defines the type of request.
13+
/// </summary>
14+
[JsonInclude]
15+
[JsonPropertyName("type")]
16+
private string Type => "account-status-inform";
17+
18+
/// <summary>
19+
/// Duration of the account status change.
20+
/// </summary>
21+
[JsonPropertyName("duration")]
22+
public StatusDuration? Duration { get; set; }
23+
24+
/// <summary>
25+
/// Reason for the account status change.
26+
/// </summary>
27+
[JsonPropertyName("reason")]
28+
public string? Reason { get; set; }
29+
30+
/// <summary>
31+
/// Entity that initiated the request.
32+
/// </summary>
33+
[JsonPropertyName("initiator")]
34+
public Initiator? Initiator { get; set; }
35+
36+
/// <summary>
37+
/// End customer affected by the status change.
38+
/// </summary>
39+
[JsonPropertyName("endCustomer")]
40+
public EndCustomer? EndCustomer { get; set; }
41+
42+
/// <summary>
43+
/// Start time of the status period in UTC (epoch time).
44+
/// </summary>
45+
[JsonPropertyName("periodStartUtc")]
46+
public long PeriodStartUtc { get; set; }
47+
48+
/// <summary>
49+
/// Status value associated with the request.
50+
/// </summary>
51+
[JsonPropertyName("status")]
52+
public StatusValue? Status { get; set; }
53+
54+
/// <summary>
55+
/// End time of the status period in UTC (epoch time).
56+
/// </summary>
57+
[JsonPropertyName("periodEndUtc")]
58+
public long PeriodEndUtc { get; set; }
59+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using Sportradar.Mbs.Sdk.Entities.Common;
2+
using System.Text.Json.Serialization;
3+
4+
namespace Sportradar.Mbs.Sdk.Entities.Request;
5+
6+
/// <summary>
7+
/// Represents a request to inform about a financial limit.
8+
/// </summary>
9+
public class FinancialLimitInformRequest : ContentRequestBase
10+
{
11+
/// <summary>
12+
/// JSON property that defines the type of request.
13+
/// </summary>
14+
[JsonInclude]
15+
[JsonPropertyName("type")]
16+
private string Type => "financial-limit-inform";
17+
18+
/// <summary>
19+
/// The amount associated with the financial limit.
20+
/// </summary>
21+
[JsonPropertyName("amount")]
22+
public Amount? Amount { get; set; }
23+
24+
/// <summary>
25+
/// The end customer affected by the financial limit.
26+
/// </summary>
27+
[JsonPropertyName("endCustomer")]
28+
public EndCustomer? EndCustomer { get; set; }
29+
30+
/// <summary>
31+
/// The type of financial limit.
32+
/// </summary>
33+
[JsonPropertyName("limitType")]
34+
public FinancialLimitType? LimitType { get; set; }
35+
36+
/// <summary>
37+
/// The frequency of the financial limit.
38+
/// </summary>
39+
[JsonPropertyName("frequency")]
40+
public LimitFrequency? Frequency { get; set; }
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using Sportradar.Mbs.Sdk.Entities.Common;
2+
using System.Text.Json.Serialization;
3+
4+
namespace Sportradar.Mbs.Sdk.Entities.Request;
5+
6+
/// <summary>
7+
/// Represents a request to inform when a limit has been reached.
8+
/// </summary>
9+
public class LimitReachedInformRequest : ContentRequestBase
10+
{
11+
/// <summary>
12+
/// JSON property that defines the type of request.
13+
/// </summary>
14+
[JsonInclude]
15+
[JsonPropertyName("type")]
16+
private string Type => "limit-reached-inform";
17+
18+
/// <summary>
19+
/// The end customer affected by the reached limit.
20+
/// </summary>
21+
[JsonPropertyName("endCustomer")]
22+
public EndCustomer? EndCustomer { get; set; }
23+
24+
/// <summary>
25+
/// The type of limit that has been reached.
26+
/// </summary>
27+
[JsonPropertyName("limitType")]
28+
public LimitType? LimitType { get; set; }
29+
}

0 commit comments

Comments
 (0)