Skip to content

Commit 4ffff8f

Browse files
committed
Initial version
1 parent 4e01181 commit 4ffff8f

File tree

844 files changed

+138036
-3
lines changed

Some content is hidden

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

844 files changed

+138036
-3
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: JKorf

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
What endpoints and subscriptions are called.
15+
16+
**Expected behavior**
17+
A clear and concise description of what you expected to happen.
18+
19+
**Debug logging**
20+
Add debug logging related to the issue. Enable Debug logging in the client options by settings LogLevel to Debug.

.github/workflows/dotnet.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: .NET
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: 6.0.x
20+
- name: Restore dependencies
21+
run: dotnet restore
22+
- name: Build
23+
run: dotnet build --no-restore
24+
- name: Test
25+
run: dotnet test --no-build --verbosity normal

Examples/Examples.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.32002.185
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TODO.Examples.Api", "TODO.Api\TODO.Examples.Api.csproj", "{8D7694ED-912A-4F92-B924-CFD107EB20CA}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TODO.Examples.Console", "TODO.Console\TODO.Examples.Console.csproj", "{5B869493-8271-45C5-93AE-5357B45FE005}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{8D7694ED-912A-4F92-B924-CFD107EB20CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{8D7694ED-912A-4F92-B924-CFD107EB20CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{8D7694ED-912A-4F92-B924-CFD107EB20CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{8D7694ED-912A-4F92-B924-CFD107EB20CA}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{5B869493-8271-45C5-93AE-5357B45FE005}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{5B869493-8271-45C5-93AE-5357B45FE005}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{5B869493-8271-45C5-93AE-5357B45FE005}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{5B869493-8271-45C5-93AE-5357B45FE005}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {0FC03929-769B-4314-AF91-AF01E06278DD}
30+
EndGlobalSection
31+
EndGlobal

Examples/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Examples
2+
3+
### TODO.Examples.Api
4+
A minimal API showing how to integrate TODO.Net in a web API project
5+
6+
### TODO.Examples.Console
7+
A simple console client demonstrating basic usage

Examples/TODO.Api/Program.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
3+
var builder = WebApplication.CreateBuilder(args);
4+
5+
builder.Services.AddEndpointsApiExplorer();
6+
builder.Services.AddSwaggerGen();
7+
8+
// Add the TODO services
9+
builder.Services.AddTODO();
10+
11+
// OR to provide API credentials for accessing private endpoints, or setting other options:
12+
/*
13+
builder.Services.AddTODO(restOptions =>
14+
{
15+
restOptions.ApiCredentials = new ApiCredentials("<APIKEY>", "<APISECRET>");
16+
restOptions.RequestTimeout = TimeSpan.FromSeconds(5);
17+
}, socketOptions =>
18+
{
19+
socketOptions.ApiCredentials = new ApiCredentials("<APIKEY>", "<APISECRET>");
20+
});
21+
*/
22+
23+
var app = builder.Build();
24+
app.UseSwagger();
25+
app.UseSwaggerUI();
26+
app.UseHttpsRedirection();
27+
28+
// Map the endpoint and inject the rest client
29+
app.MapGet("/{Symbol}", async ([FromServices] ITODORestClient client, string symbol) =>
30+
{
31+
var result = await client.SpotApi.ExchangeData.GetSpotTickersAsync(symbol);
32+
return result.Data.List.First().LastPrice;
33+
})
34+
.WithOpenApi();
35+
36+
37+
app.MapGet("/Balances", async ([FromServices] ITODORestClient client) =>
38+
{
39+
var result = await client.SpotApi.Account.GetBalancesAsync();
40+
return (object)(result.Success ? result.Data : result.Error!);
41+
})
42+
.WithOpenApi();
43+
44+
app.Run();
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"$schema": "http://json.schemastore.org/launchsettings.json",
3+
"iisSettings": {
4+
"windowsAuthentication": false,
5+
"anonymousAuthentication": true,
6+
"iisExpress": {
7+
"applicationUrl": "http://localhost:23442",
8+
"sslPort": 44376
9+
}
10+
},
11+
"profiles": {
12+
"http": {
13+
"commandName": "Project",
14+
"dotnetRunMessages": true,
15+
"launchBrowser": true,
16+
"launchUrl": "swagger",
17+
"applicationUrl": "http://localhost:5114",
18+
"environmentVariables": {
19+
"ASPNETCORE_ENVIRONMENT": "Development"
20+
}
21+
},
22+
"https": {
23+
"commandName": "Project",
24+
"dotnetRunMessages": true,
25+
"launchBrowser": true,
26+
"launchUrl": "swagger",
27+
"applicationUrl": "https://localhost:7266;http://localhost:5114",
28+
"environmentVariables": {
29+
"ASPNETCORE_ENVIRONMENT": "Development"
30+
}
31+
},
32+
"IIS Express": {
33+
"commandName": "IISExpress",
34+
"launchBrowser": true,
35+
"launchUrl": "swagger",
36+
"environmentVariables": {
37+
"ASPNETCORE_ENVIRONMENT": "Development"
38+
}
39+
}
40+
}
41+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<InvariantGlobalization>true</InvariantGlobalization>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="TODO.Net" Version="3.5.2" />
12+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0" />
13+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
14+
</ItemGroup>
15+
16+
</Project>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
}
8+
}

Examples/TODO.Api/appsettings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
},
8+
"AllowedHosts": "*"
9+
}

0 commit comments

Comments
 (0)