Skip to content

Commit 72a7737

Browse files
author
Francisco Liberal
committed
feat: Add IHttpClientFactory, DI extensions, ASP.NET Core example
- IHttpClientFactory support with named clients - ASP.NET Core DI extensions (AddArcadeClient) - 5 DI tests (all passing) - ASP.NET Core example project - Pre-commit hooks - PR template - .gitattributes for generated files - Consolidated TryParseBaseUrl 18 files changed, 739 insertions(+), 182 deletions(-)
1 parent 02c7d8f commit 72a7737

File tree

13 files changed

+437
-163
lines changed

13 files changed

+437
-163
lines changed

.gitattributes

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Mark generated files
2+
src/ArcadeDotnet/Models/** linguist-generated=true
3+
src/ArcadeDotnet/Core/ModelBase.cs linguist-generated=true
4+
src/ArcadeDotnet/Core/ModelConverter.cs linguist-generated=true
5+
src/ArcadeDotnet/Core/ParamsBase.cs linguist-generated=true
6+
7+
# Line endings - preserve original for generated code
8+
src/ArcadeDotnet/Models/** -text
9+
src/ArcadeDotnet/Core/ModelBase.cs -text
10+
src/ArcadeDotnet/Core/ModelConverter.cs -text
11+
src/ArcadeDotnet/Core/ParamsBase.cs -text
12+
src/ArcadeDotnet/Services/** -text
13+
14+
# New code uses LF
15+
src/ArcadeDotnet/Extensions/** text eol=lf
16+
src/ArcadeDotnet.Tests/Extensions/** text eol=lf
17+
examples/** text eol=lf
18+
docs/** text eol=lf
19+
.github/** text eol=lf
20+
21+
# Binary files
22+
*.dll binary
23+
*.exe binary
24+
*.png binary
25+
*.jpg binary
26+
*.jpeg binary
27+
*.gif binary
28+

.github/pull_request_template.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Description
2+
3+
## Type of Change
4+
- [ ] Bug fix
5+
- [ ] New feature
6+
- [ ] Breaking change
7+
- [ ] Documentation
8+
9+
## Testing
10+
- [ ] Tests pass
11+
- [ ] Build succeeds
12+
13+
## Checklist
14+
- [ ] Code formatted (`dotnet format`)
15+
- [ ] Documentation updated
16+

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-json
9+
exclude: ^\.devcontainer/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
<PropertyGroup>
3+
<TargetFramework>net8.0</TargetFramework>
4+
<Nullable>enable</Nullable>
5+
</PropertyGroup>
6+
<ItemGroup>
7+
<ProjectReference Include="..\..\src\ArcadeDotnet\ArcadeDotnet.csproj" />
8+
</ItemGroup>
9+
</Project>
10+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using ArcadeDotnet;
2+
using ArcadeDotnet.Extensions;
3+
using Microsoft.AspNetCore.Mvc;
4+
5+
var builder = WebApplication.CreateBuilder(args);
6+
7+
builder.Services.AddArcadeClient(
8+
builder.Configuration["Arcade:ApiKey"] ?? throw new InvalidOperationException("Arcade:ApiKey not configured")
9+
);
10+
11+
var app = builder.Build();
12+
13+
app.MapGet("/tools", async (IArcadeClient arcade) =>
14+
{
15+
var tools = await arcade.Tools.List();
16+
tools.Validate();
17+
return Results.Ok(new { count = tools.Items?.Count ?? 0 });
18+
});
19+
20+
app.MapGet("/health", async (IArcadeClient arcade) =>
21+
{
22+
var health = await arcade.Health.Check();
23+
health.Validate();
24+
return Results.Ok(new { healthy = health.Healthy });
25+
});
26+
27+
app.Run();
28+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"Arcade": {
3+
"ApiKey": "your-api-key-here"
4+
}
5+
}
6+

0 commit comments

Comments
 (0)