Kiota.Autogen.Swagger 1.16.1-pre.2

This is a prerelease version of Kiota.Autogen.Swagger.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Kiota.Autogen.Swagger --version 1.16.1-pre.2                
NuGet\Install-Package Kiota.Autogen.Swagger -Version 1.16.1-pre.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kiota.Autogen.Swagger" Version="1.16.1-pre.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kiota.Autogen.Swagger --version 1.16.1-pre.2                
#r "nuget: Kiota.Autogen.Swagger, 1.16.1-pre.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Kiota.Autogen.Swagger as a Cake Addin
#addin nuget:?package=Kiota.Autogen.Swagger&version=1.16.1-pre.2&prerelease

// Install Kiota.Autogen.Swagger as a Cake Tool
#tool nuget:?package=Kiota.Autogen.Swagger&version=1.16.1-pre.2&prerelease                

Kiota.Autogen.Swagger is a package for auto-generating API clients based on Swashbuckle.AspNetCore using Kiota


Basic Usage

  1. Add a Class Library project to the solution that contains WebApi project
  2. Add WebApi project reference with ExcludeAssets="All"
<ItemGroup>
    <ProjectReference Include="..\ExampleService.Api\ExampleService.Api.csproj" ExcludeAssets="All" />
</ItemGroup>
  1. Install Kiota.Autogen.Swagger with PrivateAssets="All"
<ItemGroup>
    <PackageReference Include="Kiota.Autogen.Swagger" Version="1.15.0" PrivateAssets="All" />
</ItemGroup>
  1. Install following Kiota packages
<ItemGroup>
    <PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.9.10" />
    <PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.9.10" />
    <PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.9.10" />
    <PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.9.10" />
    <PackageReference Include="Microsoft.Kiota.Serialization.Multipart" Version="1.9.10" />
    <PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.9.10" />
</ItemGroup>
  1. Create a gensettings.json file with the following structure
[
  {
    "name": "WeatherClient", // API client name to be generated
    "namespace": "Weather.Client", // API client namespace
    "version": "v1" // WebApi Swagger document version
  },
  {
    "name": "WeatherClientNew",
    "namespace": "Weather.Client.New",
    "version": "v2"
  }
]
  1. Set up Class library project to build as a nuget package
<PropertyGroup>
    ... other properties

    <IsPackable>true</IsPackable>
    <PackageId>ExampleService.Client</PackageId>
</PropertyGroup>
  1. Pack Class library project
  2. Enjoy using API client
using Microsoft.Kiota.Abstractions.Authentication;
using Microsoft.Kiota.Http.HttpClientLibrary;
using Weather.Client;

using var httpClient = new HttpClient();
httpClient.BaseAddress = new Uri("http://your_service_url");

var provider = new AnonymousAuthenticationProvider();
using var adapter = new HttpClientRequestAdapter(provider, httpClient: httpClient);
var client = new WeatherClient(adapter);

var forecasts = await client.Weatherforecast.GetAsync();

Advanced Usage

You can provide your own implementations of Microsoft.Kiota.Abstractions from the Class library project if you need
Usage:

using Microsoft.Kiota.Abstractions.Authentication;
using Microsoft.Kiota.Http.HttpClientLibrary;
using Weather.Client;

using var httpClient = new HttpClient();
httpClient.BaseAddress = new Uri("http://your_service_url");

var provider = new AnonymousAuthenticationProvider();
using var adapter = new HttpClientRequestAdapter(provider, new WeatherParseNodeFactory(), new WeatherSerializationWriterFactory(), httpClient: httpClient);
var client = new WeatherClient(adapter);

var forecasts = await client.Weatherforecast.GetAsync();

More Examples

See more examples here

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.16.1 120 7/23/2024
1.16.1-pre.2 59 7/23/2024