Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Nov 2, 2023. It is now read-only.

MikeFH/dotnetinteractive-openapi

Repository files navigation

OpenApi client generator for .NET Interactive

Nuget build

Quickly generate a C# client for an OpenApi compliant API for use in your .NET Interactive notebooks.

Powered by NSwag

Examples

#r "nuget:MfhSoft.DotNet.Interactive.OpenApi,1.1.0-beta"
#!openapi-client "https://petstore.swagger.io/v2/swagger.json"

var client = new OpenApiClient();
var response = await client.StoreInventoryAsync();

HTTP requests/responses can be traced to inspect them :

#!openapi-client "https://petstore.swagger.io/v2/swagger.json" --enable-tracing

Provide your own System.Net.Http.HttpClient to the constructor if you need custom behavior

using System.Net.Http;
using System.Net.Http.Headers;

var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("apikey", "xxxxx");

var client = new OpenApiClient(httpClient);
var r = await client.StoreInventoryAsync();
r

Documentation

#!openapi-client
  Generate an api client based on its OpenAPI schema

Usage:
  [options] #!openapi-client <schema>

Arguments:
  <schema>

Options:
  -c, --class-name <class-name>          Name of the generated client class name [default: OpenApiClient]
  --method-name-type <OperationId|Path>  Defines how method names are generated (based on path or operation name) [default: Path]
  -t, --enable-tracing                   Enabled tracing of HTTP requests/responses [default: False]
  -v, --verbose                          Show more detailed output like the generated client code [default: False]
  -?, -h, --help                         Show help and usage information

About

OpenApi client generator for .NET Interactive

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.