-
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.
- Loading branch information
Showing
11 changed files
with
237 additions
and
2 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
14 changes: 14 additions & 0 deletions
14
examples/advanced/ExampleService.Api/ExampleService.Api.csproj
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,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.2"/> | ||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/> | ||
</ItemGroup> | ||
|
||
</Project> |
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,44 @@ | ||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
// Add services to the container. | ||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle | ||
builder.Services.AddEndpointsApiExplorer(); | ||
builder.Services.AddSwaggerGen(); | ||
|
||
var app = builder.Build(); | ||
|
||
// Configure the HTTP request pipeline. | ||
if (app.Environment.IsDevelopment()) | ||
{ | ||
app.UseSwagger(); | ||
app.UseSwaggerUI(); | ||
} | ||
|
||
app.UseHttpsRedirection(); | ||
|
||
var summaries = new[] | ||
{ | ||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" | ||
}; | ||
|
||
app.MapGet("/weatherforecast", () => | ||
{ | ||
var forecast = Enumerable.Range(1, 5).Select(index => | ||
new WeatherForecast | ||
( | ||
DateOnly.FromDateTime(DateTime.Now.AddDays(index)), | ||
Random.Shared.Next(-20, 55), | ||
summaries[Random.Shared.Next(summaries.Length)] | ||
)) | ||
.ToArray(); | ||
return forecast; | ||
}) | ||
.WithName("GetWeatherForecast") | ||
.WithOpenApi(); | ||
|
||
app.Run(); | ||
|
||
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) | ||
{ | ||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); | ||
} |
41 changes: 41 additions & 0 deletions
41
examples/advanced/ExampleService.Api/Properties/launchSettings.json
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 @@ | ||
{ | ||
"$schema": "http://json.schemastore.org/launchsettings.json", | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:60353", | ||
"sslPort": 44347 | ||
} | ||
}, | ||
"profiles": { | ||
"http": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"applicationUrl": "http://localhost:5167", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"https": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"applicationUrl": "https://localhost:7125;http://localhost:5167", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
examples/advanced/ExampleService.Api/appsettings.Development.json
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 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
} | ||
} |
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,9 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"AllowedHosts": "*" | ||
} |
27 changes: 27 additions & 0 deletions
27
examples/advanced/ExampleService.Client/ExampleService.Client.csproj
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,27 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>true</IsPackable> | ||
<PackageId>ExampleService.Client</PackageId> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ExampleService.Api\ExampleService.Api.csproj" ExcludeAssets="All" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Kiota.Autogen.Swagger" Version="1.15.0" PrivateAssets="All" /> | ||
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.9.9" /> | ||
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.9.9" /> | ||
<PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.9.9" /> | ||
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.9.9" /> | ||
<PackageReference Include="Microsoft.Kiota.Serialization.Multipart" Version="1.9.9" /> | ||
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.9.9" /> | ||
</ItemGroup> | ||
|
||
</Project> |
13 changes: 13 additions & 0 deletions
13
examples/advanced/ExampleService.Client/WeatherParseNodeFactory.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 Microsoft.Kiota.Abstractions.Serialization; | ||
|
||
namespace Weather.Client; | ||
|
||
public class WeatherParseNodeFactory : IParseNodeFactory | ||
{ | ||
public IParseNode GetRootParseNode(string contentType, Stream content) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public string ValidContentType { get; } | ||
} |
13 changes: 13 additions & 0 deletions
13
examples/advanced/ExampleService.Client/WeatherSerializationWriterFactory.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 Microsoft.Kiota.Abstractions.Serialization; | ||
|
||
namespace Weather.Client; | ||
|
||
public class WeatherSerializationWriterFactory : ISerializationWriterFactory | ||
{ | ||
public ISerializationWriter GetSerializationWriter(string contentType) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public string ValidContentType { get; } | ||
} |
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,7 @@ | ||
[ | ||
{ | ||
"name": "WeatherClient", | ||
"namespace": "Weather.Client", | ||
"version": "v1" | ||
} | ||
] |
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,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExampleService.Api", "ExampleService.Api\ExampleService.Api.csproj", "{F5231CDA-3DDE-461D-A48C-B631DB986876}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExampleService.Client", "ExampleService.Client\ExampleService.Client.csproj", "{838C542F-EAA3-41F3-B0E9-70950DE32DF3}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{F5231CDA-3DDE-461D-A48C-B631DB986876}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F5231CDA-3DDE-461D-A48C-B631DB986876}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F5231CDA-3DDE-461D-A48C-B631DB986876}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F5231CDA-3DDE-461D-A48C-B631DB986876}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{838C542F-EAA3-41F3-B0E9-70950DE32DF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{838C542F-EAA3-41F3-B0E9-70950DE32DF3}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{838C542F-EAA3-41F3-B0E9-70950DE32DF3}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{838C542F-EAA3-41F3-B0E9-70950DE32DF3}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |