Skip to content

Commit 31f3b50

Browse files
Release v3.5.0
1 parent bd6f069 commit 31f3b50

File tree

77 files changed

+4625
-1418
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+4625
-1418
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Change Log
22

3-
## 2025-06-30 3.4.0
3+
## 3.5.0
4+
- enabling player and competitor URNs to support varied prefixes
5+
6+
## 2025-07-07 3.4.0
47
- Soccer tournaments 86 and 853 (Club Friendly Games) with increased amount of data are preloaded using a longer timeout.
58

69
## 2025-05-08 3.3.0

src/Sportradar.OddsFeed.SDK.DemoProject/Sportradar.OddsFeed.SDK.DemoProject.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.1" />
2525
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
2626
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
27-
<PackageReference Include="Sportradar.OddsFeed.SDKCore" Version="3.4.0" />
27+
<PackageReference Include="Sportradar.OddsFeed.SDKCore" Version="3.5.0" />
2828
</ItemGroup>
2929

3030
<ItemGroup>

src/Sportradar.OddsFeed.SDK.Tests.Common/Builders/ExecutionPathDataProvider.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (C) Sportradar AG.See LICENSE for full license governing this code
22

33
using Sportradar.OddsFeed.SDK.Api.Internal.ApiAccess;
4-
using Sportradar.OddsFeed.SDK.Entities.Rest.Internal;
54

65
namespace Sportradar.OddsFeed.SDK.Tests.Common.Builders;
76

src/Sportradar.OddsFeed.SDK.Tests.Common/Builders/Extensions/DataRouterManagerBuilderExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public static DataRouterManagerBuilder AddMockedDependencies(this DataRouterMana
128128
.WithMockedCalculateProbabilityFilteredProvider();
129129
}
130130

131-
public static DataRouterManagerBuilder WithDefaultListProviders(this DataRouterManagerBuilder builder)
131+
public static DataRouterManagerBuilder WithDefaultMarketListProviders(this DataRouterManagerBuilder builder)
132132
{
133133
var invariantMdProviderMock = new Mock<IDataProvider<EntityList<MarketDescriptionDto>>>();
134134
var variantMdProviderMock = new Mock<IDataProvider<EntityList<VariantDescriptionDto>>>();
@@ -141,7 +141,7 @@ public static DataRouterManagerBuilder WithDefaultListProviders(this DataRouterM
141141
.WithVariantDescriptionsProvider(variantMdProviderMock.Object);
142142
}
143143

144-
public static DataRouterManagerBuilder WithDefaultListProviders(this DataRouterManagerBuilder builder, IReadOnlyList<CultureInfo> languages)
144+
public static DataRouterManagerBuilder WithDefaultMarketListProviders(this DataRouterManagerBuilder builder, IReadOnlyList<CultureInfo> languages)
145145
{
146146
var invariantMdProviderMock = new Mock<IDataProvider<EntityList<MarketDescriptionDto>>>();
147147
var variantMdProviderMock = new Mock<IDataProvider<EntityList<VariantDescriptionDto>>>();
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
// Copyright (C) Sportradar AG.See LICENSE for full license governing this code
2+
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Globalization;
6+
using Sportradar.OddsFeed.SDK.Common.Internal;
7+
using Sportradar.OddsFeed.SDK.Entities.Rest.Market;
8+
using Sportradar.OddsFeed.SDK.Entities.Rest.MarketMapping;
9+
using Sportradar.OddsFeed.SDK.Messages.Rest;
10+
using Sportradar.OddsFeed.SDK.Tests.Common.Builders.Markets;
11+
12+
namespace Sportradar.OddsFeed.SDK.Tests.Common.Builders;
13+
14+
public class MarketDescriptionBuilder
15+
{
16+
private long _id;
17+
private ICollection<IOutcomeDescription> _outcomes = new List<IOutcomeDescription>();
18+
private ICollection<ISpecifier> _specifiers = new List<ISpecifier>();
19+
private ICollection<IMarketMappingData> _mappings = new List<IMarketMappingData>();
20+
private ICollection<IMarketAttribute> _attributes = new List<IMarketAttribute>();
21+
private string _outcomeType;
22+
private ICollection<string> _groups = new List<string>();
23+
private readonly Dictionary<CultureInfo, string> _names = new Dictionary<CultureInfo, string>();
24+
private readonly Dictionary<CultureInfo, string> _descriptions = new Dictionary<CultureInfo, string>();
25+
26+
public MarketDescriptionBuilder WithId(long id)
27+
{
28+
_id = id;
29+
return this;
30+
}
31+
32+
public MarketDescriptionBuilder WithOutcomes(ICollection<IOutcomeDescription> outcomes)
33+
{
34+
_outcomes = outcomes;
35+
return this;
36+
}
37+
38+
public MarketDescriptionBuilder WithSpecifiers(ICollection<ISpecifier> specifiers)
39+
{
40+
_specifiers = specifiers;
41+
return this;
42+
}
43+
44+
public MarketDescriptionBuilder WithMappings(ICollection<IMarketMappingData> mappings)
45+
{
46+
_mappings = mappings;
47+
return this;
48+
}
49+
50+
public MarketDescriptionBuilder WithAttributes(ICollection<IMarketAttribute> attributes)
51+
{
52+
_attributes = attributes;
53+
return this;
54+
}
55+
56+
public MarketDescriptionBuilder WithOutcomeType(string outcomeType)
57+
{
58+
_outcomeType = outcomeType;
59+
return this;
60+
}
61+
62+
public MarketDescriptionBuilder WithGroups(ICollection<string> groups)
63+
{
64+
_groups = groups;
65+
return this;
66+
}
67+
68+
public MarketDescriptionBuilder WithName(string name, CultureInfo language)
69+
{
70+
_names[language] = name;
71+
return this;
72+
}
73+
74+
public MarketDescriptionBuilder WithDescription(string description, CultureInfo language)
75+
{
76+
_descriptions[language] = description;
77+
return this;
78+
}
79+
80+
public IMarketDescription Build()
81+
{
82+
return new MarketDescription(_id, _outcomes, _specifiers, _mappings, _attributes, _outcomeType, _groups, _names, _descriptions);
83+
}
84+
85+
public IMarketDescription BuildWith(desc_market apiMarketDescription, CultureInfo culture)
86+
{
87+
var outcomes = new List<IOutcomeDescription>();
88+
foreach (var outcome in apiMarketDescription.outcomes)
89+
{
90+
outcomes.Add(new OutcomeDescription(outcome, culture));
91+
}
92+
93+
var specifiers = new List<ISpecifier>();
94+
foreach (var specifier in apiMarketDescription.specifiers)
95+
{
96+
specifiers.Add(new Specifier(specifier));
97+
}
98+
99+
var mappings = new List<IMarketMappingData>();
100+
foreach (var mapping in apiMarketDescription.mappings)
101+
{
102+
mappings.Add(new MarketMapping(apiMarketDescription.id.ToString(), mapping, culture));
103+
}
104+
105+
var attributes = new List<IMarketAttribute>();
106+
foreach (var attribute in apiMarketDescription.attributes)
107+
{
108+
attributes.Add(new MarketAttribute(attribute));
109+
}
110+
111+
var groups = apiMarketDescription.groups?.Split([SdkInfo.MarketGroupsDelimiter], StringSplitOptions.RemoveEmptyEntries);
112+
113+
return new MarketDescription(apiMarketDescription.id,
114+
outcomes,
115+
specifiers,
116+
mappings,
117+
attributes,
118+
apiMarketDescription.outcome_type,
119+
groups,
120+
_names,
121+
_descriptions);
122+
}
123+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (C) Sportradar AG.See LICENSE for full license governing this code
2+
3+
using Sportradar.OddsFeed.SDK.Entities.Rest.Market;
4+
using Sportradar.OddsFeed.SDK.Messages.Rest;
5+
6+
namespace Sportradar.OddsFeed.SDK.Tests.Common.Builders.Markets;
7+
8+
internal class MarketAttribute : IMarketAttribute
9+
{
10+
public MarketAttribute(string name, string description)
11+
{
12+
Name = name;
13+
Description = description;
14+
}
15+
16+
public MarketAttribute(attributesAttribute attribute)
17+
: this(attribute.name, attribute.description)
18+
{
19+
}
20+
21+
public string Name
22+
{
23+
get;
24+
}
25+
26+
public string Description
27+
{
28+
get;
29+
}
30+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright (C) Sportradar AG.See LICENSE for full license governing this code
2+
3+
using System.Collections.Generic;
4+
using System.Globalization;
5+
using Sportradar.OddsFeed.SDK.Entities.Rest.Market;
6+
using Sportradar.OddsFeed.SDK.Entities.Rest.MarketMapping;
7+
8+
namespace Sportradar.OddsFeed.SDK.Tests.Common.Builders.Markets;
9+
10+
internal class MarketDescription : IMarketDescription
11+
{
12+
public long Id { get; }
13+
public IEnumerable<IOutcomeDescription> Outcomes { get; }
14+
public IEnumerable<ISpecifier> Specifiers { get; }
15+
public IEnumerable<IMarketMappingData> Mappings { get; }
16+
public IEnumerable<IMarketAttribute> Attributes { get; }
17+
public string OutcomeType { get; }
18+
public IEnumerable<string> Groups { get; }
19+
private readonly Dictionary<CultureInfo, string> _names;
20+
private readonly Dictionary<CultureInfo, string> _descriptions;
21+
22+
public MarketDescription(long id,
23+
ICollection<IOutcomeDescription> outcomes,
24+
ICollection<ISpecifier> specifiers,
25+
ICollection<IMarketMappingData> mappings,
26+
ICollection<IMarketAttribute> attributes,
27+
string outcomeType,
28+
ICollection<string> groups,
29+
Dictionary<CultureInfo, string> names,
30+
Dictionary<CultureInfo, string> descriptions)
31+
{
32+
Id = id;
33+
Outcomes = outcomes;
34+
Specifiers = specifiers;
35+
Mappings = mappings;
36+
Attributes = attributes;
37+
OutcomeType = outcomeType;
38+
Groups = groups;
39+
_names = names;
40+
_descriptions = descriptions;
41+
}
42+
43+
public string GetName(CultureInfo culture)
44+
{
45+
return _names.GetValueOrDefault(culture);
46+
}
47+
48+
public string GetDescription(CultureInfo culture)
49+
{
50+
return _descriptions.GetValueOrDefault(culture);
51+
}
52+
}
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// Copyright (C) Sportradar AG.See LICENSE for full license governing this code
2+
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Globalization;
6+
using System.Linq;
7+
using Sportradar.OddsFeed.SDK.Common;
8+
using Sportradar.OddsFeed.SDK.Common.Internal;
9+
using Sportradar.OddsFeed.SDK.Entities.Rest.MarketMapping;
10+
using Sportradar.OddsFeed.SDK.Messages.Rest;
11+
12+
namespace Sportradar.OddsFeed.SDK.Tests.Common.Builders.Markets;
13+
14+
internal class MarketMapping : IMarketMappingData
15+
{
16+
public IEnumerable<int> ProducerIds
17+
{
18+
get;
19+
}
20+
public Urn SportId
21+
{
22+
get;
23+
}
24+
public string MarketId
25+
{
26+
get;
27+
}
28+
public int MarketTypeId
29+
{
30+
get;
31+
}
32+
public int? MarketSubTypeId
33+
{
34+
get;
35+
}
36+
public string SovTemplate
37+
{
38+
get;
39+
}
40+
public string ValidFor
41+
{
42+
get;
43+
}
44+
public IEnumerable<IOutcomeMappingData> OutcomeMappings
45+
{
46+
get;
47+
}
48+
49+
public MarketMapping(string marketId, mappingsMapping mapping, CultureInfo culture)
50+
{
51+
ProducerIds = string.IsNullOrEmpty(mapping.product_ids)
52+
? new List<int> { mapping.product_id }.AsReadOnly()
53+
: mapping.product_ids.Split(new[] { SdkInfo.MarketMappingProductsDelimiter }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse);
54+
SportId = mapping.sport_id == "all" ? null : Urn.Parse(mapping.sport_id);
55+
MarketId = marketId;
56+
if (!SdkInfo.IsMarketMappingMarketIdValid(mapping.market_id))
57+
{
58+
throw new FormatException($"Mapping market_id '{mapping.market_id}' is not valid");
59+
}
60+
var mappingMarketId = mapping.market_id.Split(':'); // legacy
61+
int.TryParse(mappingMarketId[0], out var typeId);
62+
MarketTypeId = typeId;
63+
if (mappingMarketId.Length == 2)
64+
{
65+
MarketSubTypeId = int.TryParse(mappingMarketId[1], out var subTypeId) ? subTypeId : null;
66+
}
67+
SovTemplate = mapping.sov_template;
68+
ValidFor = mapping.valid_for;
69+
70+
OutcomeMappings = new List<OutcomeMappingData>();
71+
if (mapping.mapping_outcome != null)
72+
{
73+
OutcomeMappings = mapping.mapping_outcome.Select(o => new OutcomeMappingData(MarketId, o, culture));
74+
}
75+
}
76+
77+
public bool CanMap(int producerId, Urn sportId, IReadOnlyDictionary<string, string> specifiers)
78+
{
79+
if (!ProducerIds.Contains(producerId) || (SportId != null && !SportId.Equals(sportId)))
80+
{
81+
return false;
82+
}
83+
84+
return true;
85+
}
86+
87+
private class OutcomeMappingData : IOutcomeMappingData
88+
{
89+
public string OutcomeId { get; private set; }
90+
91+
public string ProducerOutcomeId { get; private set; }
92+
93+
public IDictionary<CultureInfo, string> ProducerOutcomeNames { get; }
94+
95+
public string MarketId { get; private set; }
96+
97+
public OutcomeMappingData(string marketId, mappingsMappingMapping_outcome mappingOutcome, CultureInfo culture)
98+
{
99+
ProducerOutcomeNames = new Dictionary<CultureInfo, string>();
100+
101+
Merge(marketId, mappingOutcome, culture);
102+
}
103+
104+
public void Merge(string marketId, mappingsMappingMapping_outcome mappingOutcome, CultureInfo culture)
105+
{
106+
OutcomeId = mappingOutcome.outcome_id;
107+
ProducerOutcomeId = mappingOutcome.product_outcome_id;
108+
ProducerOutcomeNames[culture] = mappingOutcome.product_outcome_name;
109+
MarketId = marketId;
110+
}
111+
112+
public string GetProducerOutcomeName(CultureInfo culture)
113+
{
114+
ProducerOutcomeNames.TryGetValue(culture, out var name);
115+
116+
return name;
117+
}
118+
}
119+
}

0 commit comments

Comments
 (0)