-
Notifications
You must be signed in to change notification settings - Fork 1
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 #196 from SSchulze1989/develop
v 0.12.0
- Loading branch information
Showing
456 changed files
with
142,228 additions
and
374 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,10 @@ jobs: | |
env: | ||
BUILD_CONFIG: Debug | ||
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
TEST_USER: root | ||
TEST_PASSWORD: TestPass123 | ||
TEST_DATABASE: TestDatabase | ||
DB_TEST_PROJECT: test/DbIntegrationTests | ||
|
||
runs-on: ubuntu-latest | ||
|
||
|
@@ -21,6 +25,15 @@ jobs: | |
with: | ||
dotnet-version: 6.0.x | ||
source-url: https://nuget.pkg.github.com/SSchulze1989/index.json | ||
- name: Setup MySQL | ||
uses: mirromutth/[email protected] | ||
with: | ||
# Required if "mysql user" is empty, default is empty. The root superuser password | ||
mysql root password: $TEST_PASSWORD | ||
# MYSQL_DATABASE - name for the default database that is created | ||
mysql database: $TEST_DATABASE | ||
- name: Set secrets | ||
run: dotnet user-secrets set "ConnectionStrings:ModelDb" "server=localhost;database=$TEST_DATABASE;user=$TEST_USER;password=$TEST_PASSWORD" --project $DB_TEST_PROJECT | ||
- name: Restore dependencies | ||
run: dotnet restore | ||
- name: Build | ||
|
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 |
---|---|---|
|
@@ -9,6 +9,10 @@ jobs: | |
env: | ||
BUILD_CONFIG: Release | ||
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
TEST_USER: root | ||
TEST_PASSWORD: TestPass123 | ||
TEST_DATABASE: TestDatabase | ||
DB_TEST_PROJECT: test/DbIntegrationTests | ||
|
||
runs-on: ubuntu-latest | ||
|
||
|
@@ -19,6 +23,15 @@ jobs: | |
with: | ||
dotnet-version: 6.0.x | ||
source-url: https://nuget.pkg.github.com/SSchulze1989/index.json | ||
- name: Setup MySQL | ||
uses: mirromutth/[email protected] | ||
with: | ||
# Required if "mysql user" is empty, default is empty. The root superuser password | ||
mysql root password: $TEST_PASSWORD | ||
# MYSQL_DATABASE - name for the default database that is created | ||
mysql database: $TEST_DATABASE | ||
- name: Set secrets | ||
run: dotnet user-secrets set "ConnectionStrings:ModelDb" "server=localhost;database=$TEST_DATABASE;user=$TEST_USER;password=$TEST_PASSWORD" --project $DB_TEST_PROJECT | ||
- name: Restore dependencies | ||
run: dotnet restore | ||
- name: Build | ||
|
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 |
---|---|---|
|
@@ -9,6 +9,10 @@ jobs: | |
env: | ||
BUILD_CONFIG: Release | ||
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
TEST_USER: root | ||
TEST_PASSWORD: TestPass123 | ||
TEST_DATABASE: TestDatabase | ||
DB_TEST_PROJECT: test/DbIntegrationTests | ||
|
||
runs-on: ubuntu-latest | ||
|
||
|
@@ -19,6 +23,15 @@ jobs: | |
with: | ||
dotnet-version: 6.0.x | ||
source-url: https://nuget.pkg.github.com/SSchulze1989/index.json | ||
- name: Setup MySQL | ||
uses: mirromutth/[email protected] | ||
with: | ||
# Required if "mysql user" is empty, default is empty. The root superuser password | ||
mysql root password: $TEST_PASSWORD | ||
# MYSQL_DATABASE - name for the default database that is created | ||
mysql database: $TEST_DATABASE | ||
- name: Set secrets | ||
run: dotnet user-secrets set "ConnectionStrings:ModelDb" "server=localhost;database=$TEST_DATABASE;user=$TEST_USER;password=$TEST_PASSWORD" --project $DB_TEST_PROJECT | ||
- name: Restore dependencies | ||
run: dotnet restore | ||
- name: Build | ||
|
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 |
---|---|---|
|
@@ -9,7 +9,11 @@ jobs: | |
publish: | ||
env: | ||
BUILD_CONFIG: Release | ||
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}} | ||
TEST_USER: root | ||
TEST_PASSWORD: TestPass123 | ||
TEST_DATABASE: TestDatabase | ||
DB_TEST_PROJECT: test/DbIntegrationTests | ||
|
||
runs-on: ubuntu-latest | ||
|
||
|
@@ -19,12 +23,21 @@ jobs: | |
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 6.0.x | ||
source-url: https://nuget.pkg.github.com/SSchulze1989/index.json | ||
source-url: https://api.nuget.org/v3/index.json | ||
- name: Setup MySQL | ||
uses: mirromutth/[email protected] | ||
with: | ||
# Required if "mysql user" is empty, default is empty. The root superuser password | ||
mysql root password: $TEST_PASSWORD | ||
# MYSQL_DATABASE - name for the default database that is created | ||
mysql database: $TEST_DATABASE | ||
- name: Set secrets | ||
run: dotnet user-secrets set "ConnectionStrings:ModelDb" "server=localhost;database=$TEST_DATABASE;user=$TEST_USER;password=$TEST_PASSWORD" --project $DB_TEST_PROJECT | ||
- name: Restore dependencies | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build -c $BUILD_CONFIG --no-restore | ||
- name: Test | ||
run: dotnet test -c $BUILD_CONFIG --no-build --verbosity normal | ||
- name: Publish | ||
run: dotnet nuget push **\*.nupkg --skip-duplicate | ||
run: dotnet nuget push **\*.nupkg --skip-duplicate -k ${NUGET_AUTH_TOKEN} |
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
Empty file.
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,17 @@ | ||
using iRLeagueApiCore.Client.Http; | ||
using iRLeagueApiCore.Client.QueryBuilder; | ||
using iRLeagueApiCore.Client.Results; | ||
|
||
namespace iRLeagueApiCore.Client.Endpoints; | ||
|
||
internal class PutEndpoint<TResult, TModel> : EndpointBase, IPutEndpoint<TResult, TModel> where TModel : notnull | ||
{ | ||
public PutEndpoint(HttpClientWrapper httpClientWrapper, RouteBuilder routeBuilder) : | ||
base(httpClientWrapper, routeBuilder) | ||
{ } | ||
|
||
async Task<ClientActionResult<TResult>> IPutEndpoint<TResult, TModel>.Put(TModel model, CancellationToken cancellationToken) | ||
{ | ||
return await HttpClientWrapper.PutAsClientActionResult<TResult>(QueryUrl, model, cancellationToken); | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
src/iRLeagueApiCore.Client/Endpoints/Results/IRawResultsEndpoint.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,8 @@ | ||
using iRLeagueApiCore.Common.Models; | ||
|
||
namespace iRLeagueApiCore.Client.Endpoints.Results; | ||
public interface IRawResultsEndpoint | ||
{ | ||
public IGetEndpoint<RawEventResultModel> EventResult(long eventId); | ||
public IPutEndpoint<RawResultRowModel, RawResultRowModel> ModifyResultRow(long resultRowId, bool triggerCalculation = false); | ||
} |
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/iRLeagueApiCore.Client/Endpoints/Results/RawResultsEndpoint.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 iRLeagueApiCore.Client.Http; | ||
using iRLeagueApiCore.Client.QueryBuilder; | ||
using iRLeagueApiCore.Common.Models; | ||
|
||
namespace iRLeagueApiCore.Client.Endpoints.Results; | ||
|
||
internal sealed class RawResultsEndpoint : GetEndpoint<RawEventResultModel> | ||
{ | ||
public RawResultsEndpoint(HttpClientWrapper httpClient, RouteBuilder routeBuilder) : base(httpClient, routeBuilder) | ||
{ | ||
RouteBuilder.AddEndpoint("Raw"); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# iRLeagueApiCore.Client | ||
|
||
Simple client for using the iRLeagueManager API from a .NET application | ||
|
||
## Usage | ||
|
||
### Register service | ||
|
||
```csharp | ||
services.AddLeagueApiClient(); | ||
``` | ||
|
||
### Use client | ||
|
||
```csharp | ||
client = service.GetRequiredService<ILeagueApiClient>(); | ||
|
||
var leagues = await client.Leagues().Get(); | ||
``` | ||
|
||
### Log in as API user | ||
|
||
```csharp | ||
await client.LogIn("Username", "Password"); | ||
``` |
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: 41 additions & 0 deletions
41
src/iRLeagueApiCore.Common/Converters/JsonTimeSpanConverter.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,41 @@ | ||
#if NETCOREAPP | ||
using System.Text.Json; | ||
|
||
namespace iRLeagueApiCore.Common.Converters; | ||
|
||
public class JsonTimeSpanConverter : JsonConverter<TimeSpan> | ||
{ | ||
public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | ||
{ | ||
if (typeof(long).IsAssignableFrom(typeToConvert)) | ||
{ | ||
var longValue = reader.GetInt64(); | ||
return new TimeSpan(longValue); | ||
} | ||
else | ||
{ | ||
var timeSpanString = reader.GetString(); | ||
if (string.IsNullOrWhiteSpace(timeSpanString)) | ||
{ | ||
return TimeSpan.Zero; | ||
} | ||
var hasDays = timeSpanString.Count(c => c == '.') > 1; | ||
if (hasDays) | ||
{ | ||
return TimeSpan.ParseExact(timeSpanString, @"dd\.hh\:mm\:ss\.fffff", null); | ||
} | ||
return TimeSpan.ParseExact(timeSpanString, @"hh\:mm\:ss\.fffff", null); | ||
} | ||
} | ||
|
||
public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options) | ||
{ | ||
if (value.Days > 0) | ||
{ | ||
writer.WriteStringValue(value.ToString(@"dd\.hh\:mm\:ss\.fffff")); | ||
return; | ||
} | ||
writer.WriteStringValue(value.ToString(@"hh\:mm\:ss\.fffff")); | ||
} | ||
} | ||
#endif |
21 changes: 21 additions & 0 deletions
21
src/iRLeagueApiCore.Common/Converters/JsonTimeSpanToTicksConverter.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,21 @@ | ||
using System.Text.Json; | ||
|
||
namespace iRLeagueApiCore.Common.Converters; | ||
|
||
public sealed class JsonTimeSpanToTicksConverter : JsonConverter<TimeSpan> | ||
{ | ||
public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | ||
{ | ||
if (typeof(long).IsAssignableFrom(typeToConvert)) | ||
{ | ||
var longValue = reader.GetInt64(); | ||
return new TimeSpan(longValue); | ||
} | ||
return TimeSpan.Zero; | ||
} | ||
|
||
public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options) | ||
{ | ||
writer.WriteNumberValue(value.Ticks); | ||
} | ||
} |
Oops, something went wrong.