Skip to content

Commit

Permalink
TEST-0011 Add api client project (#373)
Browse files Browse the repository at this point in the history
<!--- Provide a general summary of your changes in the Title above -->

## Description 💬
<!--- Describe your changes in detail -->

## Motivation and Context 🥅
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## How has this been tested? 🧪
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, tests ran to see how
-->
<!--- your change affects other areas of the code, etc. -->
- [ ] Local build ⚒️
- [ ] Local tests 🧪
- [ ] (optional) Local run and endpoint tested in swagger 🚀

## Screenshots (if appropriate) 💻

## Types of changes 🌊
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)

## Checklist ☑️

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] The pull request title starts with the jira case number (when
applicable), e.g. "TEST-1234 Add some feature"
- [ ] The person responsible for following up on requested review
changes has been assigned to the pull request
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.

## Highly optional checks, only use these if you have a reason to do so
✔️

- [ ] This PR changes the database so I have added the *create-diagram*
label to assist reviewers with a db diagram
- [ ] This PR changes platform or backend and I need others to be able
to test against these changes before merging to dev, so I have added the
*deploy-azure* label to deploy before merging the PR

## Checklist for the approver ✅

- [ ] I've checked the files view for spelling issues, code quality
warnings and similar
- [ ] I've waited until all checks have passed (green check/without
error)
- [ ] I've checked that only the intended files are changed
  • Loading branch information
hwinther authored Nov 13, 2024
1 parent aabafb9 commit c2e4643
Show file tree
Hide file tree
Showing 8 changed files with 479 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/backend/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
"dotnet-outdated"
],
"rollForward": false
},
"refitter": {
"version": "1.4.0",
"commands": [
"refitter"
],
"rollForward": false
}
}
}
19 changes: 19 additions & 0 deletions src/backend/ApiClient/ApiClient.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<Target Name="RefitGenerator" BeforeTargets="build" Condition="'$(Configuration)' == 'Debug'">
<Warning Code="DSAMPLE002" Text="Generating API client with refitter" />
<Exec Command="dotnet refitter ..\WebApi\swagger.json --namespace WebApi.Client --output WebApiClient.cs" />
</Target>

<ItemGroup>
<PackageReference Include="Refit" Version="8.0.0" />
</ItemGroup>

</Project>
5 changes: 5 additions & 0 deletions src/backend/ApiClient/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Refit;
using WebApi.Client;

var testApiClient = RestService.For<IExampleAPI>("https://localhost:44380");
await testApiClient.Ping();
Loading

0 comments on commit c2e4643

Please sign in to comment.