Skip to content

Commit d4e4b4c

Browse files
Srđan Totzb-sr
Srđan Tot
authored andcommitted
Add max stake operation
1 parent 0c5b5ab commit d4e4b4c

File tree

6 files changed

+66
-0
lines changed

6 files changed

+66
-0
lines changed

src/Sportradar.Mbs.Sdk/Entities/Request/ContentRequestBase.cs

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public override ContentRequestBase Read(ref Utf8JsonReader reader, Type typeToCo
3636
"ext-settlement-ack" => JsonSerializer.Deserialize<ExtSettlementAckRequest>(root.GetRawText()),
3737
"balance-change-inform" => JsonSerializer.Deserialize<BalanceChangeInformRequest>(root.GetRawText()),
3838
"cashout-inform" => JsonSerializer.Deserialize<CashoutInformRequest>(root.GetRawText()),
39+
"max-stake" => JsonSerializer.Deserialize<MaxStakeRequest>(root.GetRawText()),
3940
_ => throw new JsonException("Unknown type of ContentRequestBase: " + type)
4041
};
4142
return result ?? throw new NullReferenceException("Null ContentRequestBase: " + type);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace Sportradar.Mbs.Sdk.Entities.Request;
4+
5+
/// <summary>
6+
/// Represents a max stake request.
7+
/// </summary>
8+
public class MaxStakeRequest : ContentRequestBase
9+
{
10+
[JsonInclude]
11+
[JsonPropertyName("type")]
12+
private string Type => "max-stake";
13+
14+
/// <summary>
15+
/// Gets or sets the ticket request.
16+
/// </summary>
17+
[JsonPropertyName("ticket")]
18+
public TicketRequest? Ticket { get; set; }
19+
}

src/Sportradar.Mbs.Sdk/Entities/Response/ContentResponseBase.cs

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public override ContentResponseBase Read(ref Utf8JsonReader reader, Type typeToC
3737
"ticket-reply" => JsonSerializer.Deserialize<TicketResponse>(root.GetRawText()),
3838
"withdrawal-inform-reply" => JsonSerializer.Deserialize<WithdrawalInformResponse>(root.GetRawText()),
3939
"cashout-inform-reply" => JsonSerializer.Deserialize<CashoutInformResponse>(root.GetRawText()),
40+
"max-stake-reply" => JsonSerializer.Deserialize<MaxStakeResponse>(root.GetRawText()),
4041
_ => throw new JsonException("Unknown type of ContentResponseBase: " + type)
4142
};
4243
return result ?? throw new NullReferenceException("Null ContentResponseBase: " + type);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System.Text.Json.Serialization;
2+
using Sportradar.Mbs.Sdk.Entities.Common;
3+
4+
namespace Sportradar.Mbs.Sdk.Entities.Response;
5+
6+
/// <summary>
7+
/// Represents the response received from max stake API.
8+
/// </summary>
9+
public class MaxStakeResponse : ContentResponseBase
10+
{
11+
[JsonInclude]
12+
[JsonPropertyName("type")]
13+
private string Type => "max-stake-reply";
14+
15+
/// <summary>
16+
/// Gets or sets the code of the max stake response.
17+
/// </summary>
18+
[JsonPropertyName("code")]
19+
public int Code { get; set; }
20+
21+
/// <summary>
22+
/// Gets or sets the bets associated with the max stake response.
23+
/// </summary>
24+
[JsonPropertyName("bets")]
25+
public Bet[]? Bets { get; set; }
26+
27+
/// <summary>
28+
/// Gets or sets the message of the max stake response.
29+
/// </summary>
30+
[JsonPropertyName("message")]
31+
public String? Message { get; set; }
32+
}

src/Sportradar.Mbs.Sdk/Internal/Protocol/ProtocolProvider.ITicketProtocol.cs

+5
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,9 @@ public async Task<ExtSettlementAckResponse> SendExtSettlementAckAsync(ExtSettlem
5757
{
5858
return await ProcessRequestAsync<ExtSettlementAckResponse>("ticket-ext-settlement-ack", request).ConfigureAwait(false);
5959
}
60+
61+
public async Task<MaxStakeResponse> SendMaxStakeAsync(MaxStakeRequest request)
62+
{
63+
return await ProcessRequestAsync<MaxStakeResponse>("max-stake", request).ConfigureAwait(false);
64+
}
6065
}

src/Sportradar.Mbs.Sdk/Protocol/ITicketProtocol.cs

+8
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,12 @@ public interface ITicketProtocol
8787
/// <returns>A task that represents the asynchronous operation. The task result contains the external settlement acknowledgement response.</returns>
8888
/// <exception cref="SdkException">Thrown when operation has failed.</exception>
8989
Task<ExtSettlementAckResponse> SendExtSettlementAckAsync(ExtSettlementAckRequest request);
90+
91+
/// <summary>
92+
/// Sends a max stake request asynchronously.
93+
/// </summary>
94+
/// <param name="request">The max stake request to send.</param>
95+
/// <returns>A task that represents the asynchronous operation. The task result contains the max stake response.</returns>
96+
/// <exception cref="SdkException">Thrown when operation has failed.</exception>
97+
Task<MaxStakeResponse> SendMaxStakeAsync(MaxStakeRequest request);
9098
}

0 commit comments

Comments
 (0)