Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit 9661364

Browse files
committed
drop http client pool
1 parent ce71baa commit 9661364

88 files changed

Lines changed: 2178 additions & 12832 deletions

File tree

Some content is hidden

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

Readme.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ The client supports synchronous and asynchronous GET requests on the following e
2727

2828
Authentication via HTTP is supported to update user profiles. POST/PUT requests on other endpoints are not possible, since users are missing the required privileges.
2929

30-
The client also supports a user defined number of HTTP clients. Using a pool size of > 10 is not recommended.
31-
3230
---
3331

3432
## Requirements

SRLApiClient/Endpoints/Countries/CountriesClient.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.ObjectModel;
33
using System.Runtime.Serialization;
44
using System.Threading.Tasks;
5-
using SRLApiClient.Exceptions;
65

76
namespace SRLApiClient.Endpoints.Countries
87
{

SRLApiClient/Endpoints/Games/GamesClient.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Collections.ObjectModel;
44
using System.Runtime.Serialization;
55
using System.Threading.Tasks;
6-
using SRLApiClient.Exceptions;
76

87
namespace SRLApiClient.Endpoints.Games
98
{
@@ -65,7 +64,7 @@ private sealed class GameCollection : SRLData
6564
/// <returns>Returns a list of games matching the search query</returns>
6665
public ReadOnlyCollection<Game> Search(string name)
6766
{
68-
if (String.IsNullOrWhiteSpace(name)) throw new ArgumentException(nameof(name), "Parameter can't be empty");
67+
if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException(nameof(name), "Parameter can't be empty");
6968
GameCollection gs = SrlClient.Get<GameCollection>($"{BasePath}?search={name.ToLower()}");
7069
return gs?.Games?.AsReadOnly();
7170
}
@@ -77,7 +76,7 @@ public ReadOnlyCollection<Game> Search(string name)
7776
/// <returns>Returns a list of games matching the search query</returns>
7877
public async Task<ReadOnlyCollection<Game>> SearchAsync(string name)
7978
{
80-
if (String.IsNullOrWhiteSpace(name)) throw new ArgumentException(nameof(name), "Parameter can't be empty");
79+
if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException(nameof(name), "Parameter can't be empty");
8180
GameCollection gs = await SrlClient.GetAsync<GameCollection>($"{BasePath}?search={name.ToLower()}").ConfigureAwait(false);
8281
return gs?.Games?.AsReadOnly();
8382
}
@@ -110,7 +109,7 @@ public string GetRules(Game g)
110109
/// <returns>Returns the rules string</returns>
111110
public string GetRules(string gameAbbreviation)
112111
{
113-
if (String.IsNullOrWhiteSpace(gameAbbreviation)) throw new ArgumentException(nameof(gameAbbreviation), "Parameter can't be empty");
112+
if (string.IsNullOrWhiteSpace(gameAbbreviation)) throw new ArgumentException(nameof(gameAbbreviation), "Parameter can't be empty");
114113
return SrlClient.Get<GameRules>($"/rules/{gameAbbreviation}")?.Rules;
115114
}
116115

@@ -129,7 +128,7 @@ public async Task<string> GetRulesAsync(Game g)
129128
/// <returns>Returns the rules string</returns>
130129
public async Task<string> GetRulesAsync(string gameAbbreviation)
131130
{
132-
if (String.IsNullOrWhiteSpace(gameAbbreviation)) throw new ArgumentException(nameof(gameAbbreviation), "Parameter can't be empty");
131+
if (string.IsNullOrWhiteSpace(gameAbbreviation)) throw new ArgumentException(nameof(gameAbbreviation), "Parameter can't be empty");
133132
return (await SrlClient.GetAsync<GameRules>($"/rules/{gameAbbreviation}").ConfigureAwait(false))?.Rules;
134133
}
135134
}

SRLApiClient/Endpoints/Leaderboards/LeaderboardsClient.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Threading.Tasks;
2-
using SRLApiClient.Exceptions;
32

43
namespace SRLApiClient.Endpoints.Leaderboards
54
{

SRLApiClient/Endpoints/PastRaces/PastRacesClient.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Linq;
55
using System.Runtime.Serialization;
66
using System.Threading.Tasks;
7-
using SRLApiClient.Exceptions;
87

98
namespace SRLApiClient.Endpoints.PastRaces
109
{
@@ -42,8 +41,8 @@ public ReadOnlyCollection<PastRace> Get(string playerName = null, string gameAbb
4241
if (page < 1) throw new ArgumentException(nameof(page), "Parameter must be 1 or greater");
4342
if (pageSize < 1) throw new ArgumentException(nameof(pageSize), "Parameter must be 1 or greater");
4443

45-
string playerFilter = !String.IsNullOrWhiteSpace(playerName) ? $"&player={playerName}" : "";
46-
string gameFilter = !String.IsNullOrWhiteSpace(gameAbbreviation) ? $"&game={gameAbbreviation}" : "";
44+
string playerFilter = !string.IsNullOrWhiteSpace(playerName) ? $"&player={playerName}" : "";
45+
string gameFilter = !string.IsNullOrWhiteSpace(gameAbbreviation) ? $"&game={gameAbbreviation}" : "";
4746

4847
return SrlClient.Get<PastRacesCollection>($"{BasePath}?page={page}&pageSize={pageSize}{playerFilter}{gameFilter}")?.Races?.AsReadOnly();
4948
}
@@ -61,8 +60,8 @@ public async Task<ReadOnlyCollection<PastRace>> GetAsync(string playerName = nul
6160
if (page < 1) throw new ArgumentException(nameof(page), "Parameter must be 1 or greater");
6261
if (pageSize < 1) throw new ArgumentException(nameof(pageSize), "Parameter must be 1 or greater");
6362

64-
string playerFilter = !String.IsNullOrWhiteSpace(playerName) ? $"&player={playerName}" : "";
65-
string gameFilter = !String.IsNullOrWhiteSpace(gameAbbreviation) ? $"&game={gameAbbreviation}" : "";
63+
string playerFilter = !string.IsNullOrWhiteSpace(playerName) ? $"&player={playerName}" : "";
64+
string gameFilter = !string.IsNullOrWhiteSpace(gameAbbreviation) ? $"&game={gameAbbreviation}" : "";
6665

6766
return (await SrlClient.GetAsync<PastRacesCollection>($"{BasePath}?page={page}&pageSize={pageSize}{playerFilter}{gameFilter}").ConfigureAwait(false))?.Races?.AsReadOnly();
6867
}
@@ -74,7 +73,7 @@ public async Task<ReadOnlyCollection<PastRace>> GetAsync(string playerName = nul
7473
/// <returns>Returns the past race</returns>
7574
public PastRace Get(string raceId)
7675
{
77-
if (String.IsNullOrWhiteSpace(raceId)) throw new ArgumentException(nameof(raceId), "Parameter can't be empty");
76+
if (string.IsNullOrWhiteSpace(raceId)) throw new ArgumentException(nameof(raceId), "Parameter can't be empty");
7877
return SrlClient.Get<PastRacesCollection>($"{BasePath}/{raceId.ToLower()}")?.Races?.FirstOrDefault();
7978
}
8079

@@ -85,7 +84,7 @@ public PastRace Get(string raceId)
8584
/// <returns>Returns the past race</returns>
8685
public async Task<PastRace> GetAsync(string raceId)
8786
{
88-
if (String.IsNullOrWhiteSpace(raceId)) throw new ArgumentException(nameof(raceId), "Parameter can't be empty");
87+
if (string.IsNullOrWhiteSpace(raceId)) throw new ArgumentException(nameof(raceId), "Parameter can't be empty");
8988
return (await SrlClient.GetAsync<PastRacesCollection>($"{BasePath}/{raceId.ToLower()}").ConfigureAwait(false))?.Races?.FirstOrDefault();
9089
}
9190
}

SRLApiClient/Endpoints/Players/PlayersClient.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Collections.ObjectModel;
44
using System.Runtime.Serialization;
55
using System.Threading.Tasks;
6-
using SRLApiClient.Exceptions;
76
using SRLApiClient.User;
87

98
namespace SRLApiClient.Endpoints.Players
@@ -51,7 +50,7 @@ private sealed class PlayerSearch : SRLData
5150
/// <returns>List of players matching the queried name</returns>
5251
public ReadOnlyCollection<Player> Search(string name)
5352
{
54-
if (String.IsNullOrWhiteSpace(name)) throw new ArgumentException(nameof(name), "Parameter can't be empty");
53+
if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException(nameof(name), "Parameter can't be empty");
5554
return SrlClient.Get<PlayerSearch>($"{BasePath}?search={name.ToLower()}")?.Players?.AsReadOnly();
5655
}
5756

@@ -62,7 +61,7 @@ public ReadOnlyCollection<Player> Search(string name)
6261
/// <returns>List of players matching the queried name</returns>
6362
public async Task<ReadOnlyCollection<Player>> SearchAsync(string name)
6463
{
65-
if (String.IsNullOrWhiteSpace(name)) throw new ArgumentException(nameof(name), "Parameter can't be empty");
64+
if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException(nameof(name), "Parameter can't be empty");
6665
return (await SrlClient.GetAsync<PlayerSearch>($"{BasePath}?search={name.ToLower()}").ConfigureAwait(false))?.Players?.AsReadOnly();
6766
}
6867

SRLApiClient/Endpoints/Races/RacesClient.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.ObjectModel;
33
using System.Runtime.Serialization;
44
using System.Threading.Tasks;
5-
using SRLApiClient.Exceptions;
65

76
namespace SRLApiClient.Endpoints.Races
87
{

SRLApiClient/Endpoints/SRLData.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ public class SRLData
1818

1919
[OnDeserialized()]
2020
private void SetTimeStamp(StreamingContext context)
21-
{
22-
Deserialized = DateTime.Now;
23-
}
21+
=> Deserialized = DateTime.Now;
2422
}
2523
}

SRLApiClient/Endpoints/Stats/StatsClient.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Collections.ObjectModel;
44
using System.Runtime.Serialization;
55
using System.Threading.Tasks;
6-
using SRLApiClient.Exceptions;
76

87
namespace SRLApiClient.Endpoints.Stats
98
{

SRLApiClient/Exceptions/SRLParseException.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,20 @@ namespace SRLApiClient.Exceptions
77
{
88
public class SRLParseException : Exception
99
{
10-
public SRLParseException() { }
11-
public SRLParseException(string message) : base(message) { }
12-
public SRLParseException(string message, Exception inner) : base(message, inner) { }
13-
protected SRLParseException(SerializationInfo info, StreamingContext context) : base(info, context) { }
10+
public SRLParseException()
11+
{
12+
}
13+
14+
public SRLParseException(string message) : base(message)
15+
{
16+
}
17+
18+
public SRLParseException(string message, Exception inner) : base(message, inner)
19+
{
20+
}
21+
22+
protected SRLParseException(SerializationInfo info, StreamingContext context) : base(info, context)
23+
{
24+
}
1425
}
1526
}

0 commit comments

Comments
 (0)