-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from KrystianLesniak/develop
RC: 0.2.0-alpha
- Loading branch information
Showing
37 changed files
with
514 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/RetroAchievements.Api/Exceptions/ArgumentExceptionHelpers.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Collections; | ||
|
||
namespace RetroAchievements.Api.Exceptions | ||
{ | ||
internal static class ArgumentExceptionGuard | ||
{ | ||
public static void ThrowIfEmpty<T>(IEnumerable<T> enumerable, string parameterName) | ||
{ | ||
if(!enumerable.Any()) | ||
throw new ArgumentException($"{enumerable.GetType().Name} cannot be empty.", parameterName); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 21 additions & 20 deletions
41
src/RetroAchievements.Api/Requests/Users/GetGameInfoAndUserProgressRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
using RetroAchievements.Api.Request; | ||
using RetroAchievements.Api.Response.Users; | ||
//using RetroAchievements.Api.Request; | ||
//using RetroAchievements.Api.Response.Users; | ||
|
||
namespace RetroAchievements.Api.Requests.Users | ||
{ | ||
public record GetGameInfoAndUserProgressRequest : IRetroAchievementsRequest<GetGameInfoAndUserProgressResponse> | ||
{ | ||
public string RequestEndpoint => "API_GetGameInfoAndUserProgress"; | ||
//namespace RetroAchievements.Api.Requests.Users | ||
//{ | ||
// TODO: Request disabled until issue will be resolved: https://github.com/RetroAchievements/retroachievements-api-js/issues/46 | ||
// public record GetGameInfoAndUserProgressRequest : IRetroAchievementsRequest<GetGameInfoAndUserProgressResponse> | ||
// { | ||
// public string RequestEndpoint => "API_GetGameInfoAndUserProgress"; | ||
|
||
public GetGameInfoAndUserProgressRequest(int gameId, string username) | ||
{ | ||
ArgumentNullException.ThrowIfNull(gameId, nameof(gameId)); | ||
ArgumentNullException.ThrowIfNull(username, nameof(username)); | ||
// public GetGameInfoAndUserProgressRequest(int gameId, string username) | ||
// { | ||
// ArgumentNullException.ThrowIfNull(gameId, nameof(gameId)); | ||
// ArgumentNullException.ThrowIfNull(username, nameof(username)); | ||
|
||
GameId = gameId; | ||
Username = username; | ||
} | ||
// GameId = gameId; | ||
// Username = username; | ||
// } | ||
|
||
[ApiInputKey("g")] | ||
public int GameId { get; init; } | ||
// [ApiInputKey("g")] | ||
// public int GameId { get; init; } | ||
|
||
[ApiInputKey("u")] | ||
public string Username { get; init; } | ||
} | ||
} | ||
// [ApiInputKey("u")] | ||
// public string Username { get; init; } | ||
// } | ||
//} |
31 changes: 16 additions & 15 deletions
31
src/RetroAchievements.Api/Requests/Users/GetUserClaimsRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
//using RetroAchievements.Api.Request; | ||
using RetroAchievements.Api.Request; | ||
using RetroAchievements.Api.Response.Users; | ||
|
||
//namespace RetroAchievements.Api.Requests.Users | ||
//{ | ||
// public record GetUserClaimsRequest : IRetroAchievementsRequest | ||
// { | ||
// public GetUserClaimsRequest(string username) | ||
// { | ||
// ArgumentNullException.ThrowIfNull(username, nameof(username)); | ||
namespace RetroAchievements.Api.Requests.Users | ||
{ | ||
public record GetUserClaimsRequest : IRetroAchievementsRequest<GetUserClaimsResponse> | ||
{ | ||
public GetUserClaimsRequest(string username) | ||
{ | ||
ArgumentNullException.ThrowIfNull(username, nameof(username)); | ||
|
||
// Username = username; | ||
// } | ||
Username = username; | ||
} | ||
|
||
// public string RequestEndpoint => "API_GetUserClaims"; | ||
public string RequestEndpoint => "API_GetUserClaims"; | ||
|
||
// [ApiInputKey("u")] | ||
// public string Username { get; init; } | ||
// } | ||
//} | ||
[ApiInputKey("u")] | ||
public string Username { get; init; } | ||
} | ||
} |
31 changes: 16 additions & 15 deletions
31
src/RetroAchievements.Api/Requests/Users/GetUserCompletedGamesRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
//using RetroAchievements.Api.Request; | ||
using RetroAchievements.Api.Request; | ||
using RetroAchievements.Api.Response.Users; | ||
|
||
//namespace RetroAchievements.Api.Requests.Users | ||
//{ | ||
// public record GetUserCompletedGamesRequest : IRetroAchievementsRequest | ||
// { | ||
// public GetUserCompletedGamesRequest(string username) | ||
// { | ||
// ArgumentNullException.ThrowIfNull(username, nameof(username)); | ||
namespace RetroAchievements.Api.Requests.Users | ||
{ | ||
public record GetUserCompletedGamesRequest : IRetroAchievementsRequest<GetUserCompletedGamesResponse> | ||
{ | ||
public GetUserCompletedGamesRequest(string username) | ||
{ | ||
ArgumentNullException.ThrowIfNull(username, nameof(username)); | ||
|
||
// Username = username; | ||
// } | ||
Username = username; | ||
} | ||
|
||
// public string RequestEndpoint => "API_GetUserCompletedGames"; | ||
public string RequestEndpoint => "API_GetUserCompletedGames"; | ||
|
||
// [ApiInputKey("u")] | ||
// public string Username { get; init; } | ||
// } | ||
//} | ||
[ApiInputKey("u")] | ||
public string Username { get; init; } | ||
} | ||
} |
37 changes: 19 additions & 18 deletions
37
src/RetroAchievements.Api/Requests/Users/GetUserGameRankAndScoreRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
//using RetroAchievements.Api.Request; | ||
using RetroAchievements.Api.Request; | ||
using RetroAchievements.Api.Response.Users; | ||
|
||
//namespace RetroAchievements.Api.Requests.Users | ||
//{ | ||
// public record GetUserGameRankAndScoreRequest : IRetroAchievementsRequest | ||
// { | ||
// public GetUserGameRankAndScoreRequest(string username, int gameId) | ||
// { | ||
// ArgumentNullException.ThrowIfNull(username, nameof(username)); | ||
namespace RetroAchievements.Api.Requests.Users | ||
{ | ||
public record GetUserGameRankAndScoreRequest : IRetroAchievementsRequest<GetUserGameRankAndScoreResponse> | ||
{ | ||
public GetUserGameRankAndScoreRequest(string username, int gameId) | ||
{ | ||
ArgumentNullException.ThrowIfNull(username, nameof(username)); | ||
|
||
// Username = username; | ||
// GameId = gameId; | ||
// } | ||
Username = username; | ||
GameId = gameId; | ||
} | ||
|
||
// public string RequestEndpoint => "API_GetUserGameRankAndScore"; | ||
public string RequestEndpoint => "API_GetUserGameRankAndScore"; | ||
|
||
// [ApiInputKey("g")] | ||
// public int GameId { get; init; } | ||
[ApiInputKey("g")] | ||
public int GameId { get; init; } | ||
|
||
// [ApiInputKey("u")] | ||
// public string Username { get; init; } | ||
// } | ||
//} | ||
[ApiInputKey("u")] | ||
public string Username { get; init; } | ||
} | ||
} |
31 changes: 16 additions & 15 deletions
31
src/RetroAchievements.Api/Requests/Users/GetUserPointsRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
//using RetroAchievements.Api.Request; | ||
using RetroAchievements.Api.Request; | ||
using RetroAchievements.Api.Response.Users; | ||
|
||
//namespace RetroAchievements.Api.Requests.Users | ||
//{ | ||
// public record GetUserPointsRequest : IRetroAchievementsRequest | ||
// { | ||
// public GetUserPointsRequest(string username) | ||
// { | ||
// ArgumentNullException.ThrowIfNull(username, nameof(username)); | ||
namespace RetroAchievements.Api.Requests.Users | ||
{ | ||
public record GetUserPointsRequest : IRetroAchievementsRequest<GetUserPointsResponse> | ||
{ | ||
public GetUserPointsRequest(string username) | ||
{ | ||
ArgumentNullException.ThrowIfNull(username, nameof(username)); | ||
|
||
// Username = username; | ||
// } | ||
Username = username; | ||
} | ||
|
||
// public string RequestEndpoint => "API_GetUserPoints"; | ||
public string RequestEndpoint => "API_GetUserPoints"; | ||
|
||
// [ApiInputKey("u")] | ||
// public string Username { get; init; } | ||
// } | ||
//} | ||
[ApiInputKey("u")] | ||
public string Username { get; init; } | ||
} | ||
} |
43 changes: 23 additions & 20 deletions
43
src/RetroAchievements.Api/Requests/Users/GetUserProgressRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
//using RetroAchievements.Api.Request; | ||
using RetroAchievements.Api.Exceptions; | ||
using RetroAchievements.Api.Request; | ||
using RetroAchievements.Api.Response.Users; | ||
|
||
//namespace RetroAchievements.Api.Requests.Users | ||
//{ | ||
// public record GetUserProgressRequest : IRetroAchievementsRequest | ||
// { | ||
// public GetUserProgressRequest(string username, IEnumerable<int> gameIds) | ||
// { | ||
// ArgumentNullException.ThrowIfNull(username, nameof(username)); | ||
// ArgumentNullException.ThrowIfNull(gameIds, nameof(gameIds)); | ||
|
||
// Username = username; | ||
// GameIds = gameIds; | ||
// } | ||
namespace RetroAchievements.Api.Requests.Users | ||
{ | ||
public record GetUserProgressRequest : IRetroAchievementsRequest<GetUserProgressResponse> | ||
{ | ||
public GetUserProgressRequest(string username, IEnumerable<int> gameIds) | ||
{ | ||
ArgumentNullException.ThrowIfNull(username, nameof(username)); | ||
ArgumentNullException.ThrowIfNull(gameIds, nameof(gameIds)); | ||
ArgumentExceptionGuard.ThrowIfEmpty(gameIds, nameof(gameIds)); | ||
|
||
// public string RequestEndpoint => "API_GetUserProgress"; | ||
Username = username; | ||
GameIds = gameIds; | ||
} | ||
|
||
// [ApiInputKey("u")] | ||
// public string Username { get; init; } | ||
public string RequestEndpoint => "API_GetUserProgress"; | ||
|
||
// //TODO: Add support for CSV: collect(explode(',', $gameCSV)) | ||
// [ApiInputKey("i")] | ||
// public IEnumerable<int> GameIds { get; init; } | ||
// } | ||
//} | ||
[ApiInputKey("u")] | ||
public string Username { get; init; } | ||
|
||
[ApiInputKey("i")] | ||
public IEnumerable<int> GameIds { get; init; } | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/RetroAchievements.Api/Requests/Users/GetUserRankAndPointsRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using RetroAchievements.Api.Request; | ||
using RetroAchievements.Api.Response.Users; | ||
|
||
namespace RetroAchievements.Api.Requests.Users | ||
{ | ||
public record GetUserRankAndPointsRequest : IRetroAchievementsRequest<GetUserRankAndPointsResponse> | ||
{ | ||
public GetUserRankAndPointsRequest(string username) | ||
{ | ||
ArgumentNullException.ThrowIfNull(username, nameof(username)); | ||
|
||
Username = username; | ||
} | ||
|
||
public string RequestEndpoint => "API_GetUserRankAndScore"; | ||
|
||
[ApiInputKey("u")] | ||
public string Username { get; init; } | ||
} | ||
} |
Oops, something went wrong.