Class Extensions
Inherited Members
Namespace: FastEndpoints.ClientGen
Assembly: FastEndpoints.ClientGen.dll
Syntax
public static class Extensions
Methods
ExportSwaggerJsonAndExitAsync(WebApplication, string, string)
exports swagger.json files to disk if the application is run with the commandline argument --exportswaggerjson true
and exits the program with a zero exit code.
HINT: make sure to place the call straight after app.UseFastEndpoints()
Declaration
public static Task ExportSwaggerJsonAndExitAsync(this WebApplication app, string documentName, string destinationPath)
Parameters
Type | Name | Description |
---|---|---|
WebApplication | app | |
string | documentName | the name of the swagger document to generate the clients for |
string | destinationPath | the folder path (without file name) where the client files will be save to |
Returns
Type | Description |
---|---|
Task |
GenerateCSharpClient(AspNetCoreOpenApiDocumentGeneratorSettings, Action<CSharpClientGeneratorSettings>, string, ClientGeneratorOutputType)
generates a c# api client and saves it to disk at the specified location.
Declaration
public static void GenerateCSharpClient(this AspNetCoreOpenApiDocumentGeneratorSettings gen, Action<CSharpClientGeneratorSettings> settings, string destination, ClientGeneratorOutputType outputType = ClientGeneratorOutputType.Full)
Parameters
Type | Name | Description |
---|---|---|
AspNetCoreOpenApiDocumentGeneratorSettings | gen | |
Action<CSharpClientGeneratorSettings> | settings | client generator settings |
string | destination | the output file path including file name |
ClientGeneratorOutputType | outputType | the type of the generated client file |
GenerateClientsAndExitAsync(WebApplication, string, string, Action<CSharpClientGeneratorSettings>?, Action<TypeScriptClientGeneratorSettings>?)
generates c# and/or typescript clients and saves them to disk if the application is run with the commandline argument --generateclients true
and exits the program with a zero exit code.
HINT: make sure to place the call straight after app.UseFastEndpoints()
Declaration
public static Task GenerateClientsAndExitAsync(this WebApplication app, string documentName, string destinationPath, Action<CSharpClientGeneratorSettings>? csSettings, Action<TypeScriptClientGeneratorSettings>? tsSettings)
Parameters
Type | Name | Description |
---|---|---|
WebApplication | app | |
string | documentName | the name of the swagger document to generate the clients for |
string | destinationPath | the folder path (without file name) where the client files will be save to |
Action<CSharpClientGeneratorSettings> | csSettings | client generator settings for c# |
Action<TypeScriptClientGeneratorSettings> | tsSettings | client generator settings for typescript |
Returns
Type | Description |
---|---|
Task |
GenerateTypeScriptClient(AspNetCoreOpenApiDocumentGeneratorSettings, Action<TypeScriptClientGeneratorSettings>, string, ClientGeneratorOutputType)
generates a typescript api client and saves it to disk at the specified location.
Declaration
public static void GenerateTypeScriptClient(this AspNetCoreOpenApiDocumentGeneratorSettings gen, Action<TypeScriptClientGeneratorSettings> settings, string destination, ClientGeneratorOutputType outputType = ClientGeneratorOutputType.Full)
Parameters
Type | Name | Description |
---|---|---|
AspNetCoreOpenApiDocumentGeneratorSettings | gen | |
Action<TypeScriptClientGeneratorSettings> | settings | client generator settings |
string | destination | the output file path including file name |
ClientGeneratorOutputType | outputType | the type of the generated client file |
MapCSharpClientEndpoint(IEndpointRouteBuilder, string, string, Action<CSharpClientGeneratorSettings>?)
registers an endpoint that provides a download of the c# api client file for a given swagger document.
Declaration
public static IEndpointRouteBuilder MapCSharpClientEndpoint(this IEndpointRouteBuilder builder, string route, string documentName, Action<CSharpClientGeneratorSettings>? settings = null)
Parameters
Type | Name | Description |
---|---|---|
IEndpointRouteBuilder | builder | |
string | route | the route to register |
string | documentName | the name of the document to generate the client for |
Action<CSharpClientGeneratorSettings> | settings | c# client generator settings |
Returns
Type | Description |
---|---|
IEndpointRouteBuilder |
MapTypeScriptClientEndpoint(IEndpointRouteBuilder, string, string, Action<TypeScriptClientGeneratorSettings>?)
registers an endpoint that provides a download of the typescript api client file for a given swagger document.
Declaration
public static IEndpointRouteBuilder MapTypeScriptClientEndpoint(this IEndpointRouteBuilder builder, string route, string documentName, Action<TypeScriptClientGeneratorSettings>? settings = null)
Parameters
Type | Name | Description |
---|---|---|
IEndpointRouteBuilder | builder | |
string | route | the route to register |
string | documentName | the name of the document to generate the client for |
Action<TypeScriptClientGeneratorSettings> | settings | typescript client generator settings |
Returns
Type | Description |
---|---|
IEndpointRouteBuilder |