forked from loafle/openapi-generator-original
[csharp] Add interface for API config aspects
This allows developers to gain access to each API's Configuration and GetBasePath without need for reflection.
This commit is contained in:
parent
726228a27d
commit
993a21ed5f
@ -218,6 +218,8 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
binRelativePath += "vendor";
|
binRelativePath += "vendor";
|
||||||
additionalProperties.put("binRelativePath", binRelativePath);
|
additionalProperties.put("binRelativePath", binRelativePath);
|
||||||
|
|
||||||
|
supportingFiles.add(new SupportingFile("IApiAccessor.mustache",
|
||||||
|
clientPackageDir, "IApiAccessor.cs"));
|
||||||
supportingFiles.add(new SupportingFile("Configuration.mustache",
|
supportingFiles.add(new SupportingFile("Configuration.mustache",
|
||||||
clientPackageDir, "Configuration.cs"));
|
clientPackageDir, "Configuration.cs"));
|
||||||
supportingFiles.add(new SupportingFile("ApiClient.mustache",
|
supportingFiles.add(new SupportingFile("ApiClient.mustache",
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using RestSharp;
|
||||||
|
|
||||||
|
namespace {{packageName}}.Client
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents configuration aspects required to interact with the API endpoints.
|
||||||
|
/// </summary>
|
||||||
|
public interface IApiAccessor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the configuration object
|
||||||
|
/// </summary>
|
||||||
|
/// <value>An instance of the Configuration</value>
|
||||||
|
Configuration Configuration {get; set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the base path of the API client.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The base path</value>
|
||||||
|
String GetBasePath();
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,7 @@ namespace {{packageName}}.Api
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a collection of functions to interact with the API endpoints
|
/// Represents a collection of functions to interact with the API endpoints
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface I{{classname}}
|
public interface I{{classname}} : IApiAccessor
|
||||||
{
|
{
|
||||||
#region Synchronous Operations
|
#region Synchronous Operations
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user