Skip to content

Commit c1b4f8d

Browse files
committedFeb 18, 2016
Merge pull request #2132 from jimschubert/csharp_35_client
[csharp] Initial settings for v3.5 client compatibility
2 parents c4d799a + 1d57e70 commit c1b4f8d

File tree

25 files changed

+557
-413
lines changed

25 files changed

+557
-413
lines changed
 

‎modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java

+3
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ public class CodegenConstants {
7777
public static final String MODEL_PROPERTY_NAMING = "modelPropertyNaming";
7878
public static final String MODEL_PROPERTY_NAMING_DESC = "Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name";
7979

80+
public static final String DOTNET_FRAMEWORK = "targetFramework";
81+
public static final String DOTNET_FRAMEWORK_DESC = "The target .NET framework version.";
82+
8083
public static enum MODEL_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case, original}
8184

8285
}

‎modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java

+58-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.swagger.codegen.languages;
22

3+
import com.google.common.collect.ImmutableBiMap;
4+
import com.google.common.collect.ImmutableMap;
35
import io.swagger.codegen.CodegenConfig;
46
import io.swagger.codegen.CodegenConstants;
57
import io.swagger.codegen.CodegenType;
@@ -25,6 +27,8 @@
2527
public class CSharpClientCodegen extends AbstractCSharpCodegen {
2628
@SuppressWarnings({"unused", "hiding"})
2729
private static final Logger LOGGER = LoggerFactory.getLogger(CSharpClientCodegen.class);
30+
private static final String NET45 = "v4.5";
31+
private static final String NET35 = "v3.5";
2832

2933
protected String packageGuid = "{" + java.util.UUID.randomUUID().toString().toUpperCase() + "}";
3034
protected String packageTitle = "Swagger Library";
@@ -34,6 +38,13 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
3438
protected String packageCopyright = "No Copyright";
3539
protected String clientPackage = "IO.Swagger.Client";
3640

41+
protected String targetFramework = NET45;
42+
protected String targetFrameworkNuget = "net45";
43+
protected boolean supportsAsync = Boolean.TRUE;
44+
45+
46+
protected final Map<String, String> frameworks;
47+
3748
public CSharpClientCodegen() {
3849
super();
3950
modelTemplateFiles.put("model.mustache", ".cs");
@@ -64,6 +75,18 @@ public CSharpClientCodegen() {
6475
CodegenConstants.OPTIONAL_PROJECT_GUID_DESC,
6576
null);
6677

78+
CliOption framework = new CliOption(
79+
CodegenConstants.DOTNET_FRAMEWORK,
80+
CodegenConstants.DOTNET_FRAMEWORK_DESC
81+
);
82+
frameworks = new ImmutableMap.Builder<String, String>()
83+
.put(NET35, ".NET Framework 3.5 compatible")
84+
.put(NET45, ".NET Framework 4.5+ compatible")
85+
.build();
86+
framework.defaultValue(this.targetFramework);
87+
framework.setEnum(frameworks);
88+
cliOptions.add(framework);
89+
6790
// CLI Switches
6891
addSwitch(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG,
6992
CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC,
@@ -111,6 +134,24 @@ public void processOpts() {
111134
additionalProperties.put("packageCompany", packageCompany);
112135
additionalProperties.put("packageCopyright", packageCopyright);
113136

137+
if (additionalProperties.containsKey(CodegenConstants.DOTNET_FRAMEWORK)) {
138+
setTargetFramework((String) additionalProperties.get(CodegenConstants.DOTNET_FRAMEWORK));
139+
}
140+
141+
if (NET35.equals(this.targetFramework)) {
142+
setTargetFrameworkNuget("net35");
143+
setSupportsAsync(Boolean.FALSE);
144+
if(additionalProperties.containsKey("supportsAsync")){
145+
additionalProperties.remove("supportsAsync");
146+
}
147+
} else {
148+
setTargetFrameworkNuget("net45");
149+
setSupportsAsync(Boolean.TRUE);
150+
additionalProperties.put("supportsAsync", this.supportsAsync);
151+
}
152+
153+
additionalProperties.put("targetFrameworkNuget", this.targetFrameworkNuget);
154+
114155
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_PROJECT_FILE)) {
115156
setOptionalProjectFileFlag(Boolean.valueOf(
116157
additionalProperties.get(CodegenConstants.OPTIONAL_PROJECT_FILE).toString()));
@@ -141,7 +182,7 @@ public void processOpts() {
141182
String binRelativePath = "..\\";
142183
for (int i = 0; i < packageDepth; i = i + 1)
143184
binRelativePath += "..\\";
144-
binRelativePath += "bin\\";
185+
binRelativePath += "vendor\\";
145186
additionalProperties.put("binRelativePath", binRelativePath);
146187

147188
supportingFiles.add(new SupportingFile("Configuration.mustache",
@@ -153,8 +194,6 @@ public void processOpts() {
153194
supportingFiles.add(new SupportingFile("ApiResponse.mustache",
154195
clientPackageDir, "ApiResponse.cs"));
155196

156-
supportingFiles.add(new SupportingFile("Newtonsoft.Json.dll", "bin", "Newtonsoft.Json.dll"));
157-
supportingFiles.add(new SupportingFile("RestSharp.dll", "bin", "RestSharp.dll"));
158197
supportingFiles.add(new SupportingFile("compile.mustache", "", "compile.bat"));
159198
supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "compile-mono.sh"));
160199
supportingFiles.add(new SupportingFile("packages.config.mustache", "vendor" + java.io.File.separator, "packages.config"));
@@ -222,4 +261,20 @@ public void setPackageGuid(String packageGuid) {
222261
this.packageGuid = packageGuid;
223262
}
224263

264+
public void setTargetFramework(String dotnetFramework) {
265+
if(!frameworks.containsKey(dotnetFramework)){
266+
LOGGER.warn("Invalid .NET framework version, defaulting to " + this.targetFramework);
267+
} else {
268+
this.targetFramework = dotnetFramework;
269+
}
270+
LOGGER.info("Generating code for .NET Framework " + this.targetFramework);
271+
}
272+
273+
public void setTargetFrameworkNuget(String targetFrameworkNuget) {
274+
this.targetFrameworkNuget = targetFrameworkNuget;
275+
}
276+
277+
public void setSupportsAsync(Boolean supportsAsync){
278+
this.supportsAsync = supportsAsync;
279+
}
225280
}

‎modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache

+3-3
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ namespace {{packageName}}.Client
146146
var response = RestClient.Execute(request);
147147
return (Object) response;
148148
}
149-
149+
{{#supportsAsync}}
150150
/// <summary>
151151
/// Makes the asynchronous HTTP request.
152152
/// </summary>
@@ -171,7 +171,7 @@ namespace {{packageName}}.Client
171171
pathParams, contentType);
172172
var response = await RestClient.ExecuteTaskAsync(request);
173173
return (Object)response;
174-
}
174+
}{{/supportsAsync}}
175175

176176
/// <summary>
177177
/// Escape string (url-encoded).
@@ -367,7 +367,7 @@ namespace {{packageName}}.Client
367367
/// <param name="source">Object to be casted</param>
368368
/// <param name="dest">Target type</param>
369369
/// <returns>Casted object</returns>
370-
public static dynamic ConvertType(dynamic source, Type dest)
370+
{{#supportsAsync}}public static dynamic ConvertType(dynamic source, Type dest){{/supportsAsync}}{{^supportsAsync}}public static object ConvertType<T>(T source, Type dest) where T : class{{/supportsAsync}}
371371
{
372372
return Convert.ChangeType(source, dest);
373373
}

‎modules/swagger-codegen/src/main/resources/csharp/ApiException.mustache

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace {{packageName}}.Client
1717
/// Gets or sets the error content (body json object)
1818
/// </summary>
1919
/// <value>The error content (Http response body).</value>
20-
public dynamic ErrorContent { get; private set; }
20+
public {{#supportsAsync}}dynamic{{/supportsAsync}}{{^supportsAsync}}object{{/supportsAsync}} ErrorContent { get; private set; }
2121

2222
/// <summary>
2323
/// Initializes a new instance of the <see cref="ApiException"/> class.
@@ -40,7 +40,7 @@ namespace {{packageName}}.Client
4040
/// <param name="errorCode">HTTP status code.</param>
4141
/// <param name="message">Error message.</param>
4242
/// <param name="errorContent">Error content.</param>
43-
public ApiException(int errorCode, string message, dynamic errorContent = null) : base(message)
43+
public ApiException(int errorCode, string message, {{#supportsAsync}}dynamic{{/supportsAsync}}{{^supportsAsync}}object{{/supportsAsync}} errorContent = null) : base(message)
4444
{
4545
this.ErrorCode = errorCode;
4646
this.ErrorContent = errorContent;

‎modules/swagger-codegen/src/main/resources/csharp/AssemblyInfo.mustache

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Reflection;
22
using System.Runtime.InteropServices;
3-
using System.Windows;
43

54
// General Information about an assembly is controlled through the following
65
// set of attributes. Change these attribute values to modify the information
Binary file not shown.

‎modules/swagger-codegen/src/main/resources/csharp/Project.mustache

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<AppDesignerFolder>Properties</AppDesignerFolder>
99
<RootNamespace>{{packageTitle}}</RootNamespace>
1010
<AssemblyName>{{packageTitle}}</AssemblyName>
11-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11+
<TargetFrameworkVersion>{{targetFramework}}</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
</PropertyGroup>
1414
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -41,10 +41,10 @@
4141
<Reference Include="System.Xml" />
4242
<Reference Include="Newtonsoft.Json">
4343
<SpecificVersion>False</SpecificVersion>
44-
<HintPath>{{binRelativePath}}Newtonsoft.Json.dll</HintPath>
44+
<HintPath>{{binRelativePath}}/Newtonsoft.Json.8.0.2/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll</HintPath>
4545
</Reference>
4646
<Reference Include="RestSharp">
47-
<HintPath>{{binRelativePath}}RestSharp.dll</HintPath>
47+
<HintPath>{{binRelativePath}}/RestSharp.105.2.3/lib/{{targetFrameworkNuget}}/RestSharp.dll</HintPath>
4848
</Reference>
4949
</ItemGroup>
5050
<ItemGroup>

‎modules/swagger-codegen/src/main/resources/csharp/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
- [RestSharp] (https://www.nuget.org/packages/RestSharp) - 105.1.0 or later
77
- [Json.NET] (https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later
88

9-
NOTE: The DLLs included in the package may not be the latest version. We recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
9+
The DLLs included in the package may not be the latest version. We recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
1010
```
1111
Install-Package RestSharp
1212
Install-Package Newtonsoft.Json
1313
```
1414

15+
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
16+
1517
## Installation
1618
Run the following command to generate the DLL
1719
- [Mac/Linux] compile-mono.sh
Binary file not shown.

‎modules/swagger-codegen/src/main/resources/csharp/api.mustache

+11-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace {{packageName}}.Api
1616
/// </summary>
1717
public interface I{{classname}}
1818
{
19+
#region Synchronous Operations
1920
{{#operation}}
2021
/// <summary>
2122
/// {{summary}}
@@ -36,7 +37,11 @@ namespace {{packageName}}.Api
3637
{{#allParams}}/// <param name="{{paramName}}">{{description}}</param>
3738
{{/allParams}}/// <returns>ApiResponse of {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Object(void){{/returnType}}</returns>
3839
ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}> {{operationId}}WithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
39-
40+
{{/operation}}
41+
#endregion Synchronous Operations
42+
{{#supportsAsync}}
43+
#region Asynchronous Operations
44+
{{#operation}}
4045
/// <summary>
4146
/// {{summary}}
4247
/// </summary>
@@ -57,6 +62,8 @@ namespace {{packageName}}.Api
5762
{{/allParams}}/// <returns>Task of ApiResponse{{#returnType}} ({{returnType}}){{/returnType}}</returns>
5863
System.Threading.Tasks.Task<ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>> {{operationId}}AsyncWithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
5964
{{/operation}}
65+
#endregion Asynchronous Operations
66+
{{/supportsAsync}}
6067
}
6168

6269
/// <summary>
@@ -245,7 +252,8 @@ namespace {{packageName}}.Api
245252
response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
246253
null);{{/returnType}}
247254
}
248-
255+
256+
{{#supportsAsync}}
249257
/// <summary>
250258
/// {{summary}} {{notes}}
251259
/// </summary>
@@ -349,7 +357,7 @@ namespace {{packageName}}.Api
349357
{{^returnType}}return new ApiResponse<Object>(statusCode,
350358
response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
351359
null);{{/returnType}}
352-
}
360+
}{{/supportsAsync}}
353361
{{/operation}}
354362
}
355363
{{/operations}}

‎modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
#!/usr/bin/env bash
2+
frameworkVersion={{targetFrameworkNuget}}
3+
netfx=${frameworkVersion#net}
4+
25
wget -nc https://nuget.org/nuget.exe;
36
mozroots --import --sync
47
mono nuget.exe install vendor/packages.config -o vendor;
58
mkdir -p bin;
6-
mcs -sdk:45 -r:vendor/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll,\
7-
vendor/RestSharp.105.2.3/lib/net45/RestSharp.dll,\
9+
10+
cp vendor/Newtonsoft.Json.8.0.2/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll;
11+
cp vendor/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll bin/RestSharp.dll;
12+
13+
mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\
14+
bin/RestSharp.dll,\
815
System.Runtime.Serialization.dll \
916
-target:library \
1017
-out:bin/{{packageName}}.dll \
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319
2-
%CSCPATH%\csc /reference:bin/Newtonsoft.Json.dll;bin/RestSharp.dll /target:library /out:bin/{{packageName}}.dll /recurse:src\*.cs /doc:bin/{{packageName}}.xml
1+
@echo off
2+
3+
{{#supportsAsync}}SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319{{/supportsAsync}}
4+
{{^supportsAsync}}SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v3.5{{/supportsAsync}}
5+
6+
if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://nuget.org/nuget.exe', '.\nuget.exe')"
7+
.\nuget.exe install vendor/packages.config -o vendor
38

9+
cp vendor/Newtonsoft.Json.8.0.2/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll
10+
cp vendor/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll bin/RestSharp.dll
11+
12+
%CSCPATH%\csc /reference:bin/Newtonsoft.Json.dll;bin/RestSharp.dll /target:library /out:bin/{{packageName}}.dll /recurse:src\*.cs /doc:bin/{{packageName}}.xml
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="RestSharp" version="105.2.3" targetFramework="net45" developmentDependency="true" />
4-
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net45" developmentDependency="true" />
3+
<package id="RestSharp" version="105.1.0" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
4+
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
55
</packages>

‎modules/swagger-codegen/src/test/java/io/swagger/codegen/options/CSharpClientOptionsProvider.java

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public Map<String, String> createOptions() {
3131
.put(CodegenConstants.RETURN_ICOLLECTION, "false")
3232
.put(CodegenConstants.OPTIONAL_PROJECT_FILE, "true")
3333
.put(CodegenConstants.OPTIONAL_PROJECT_GUID, PACKAGE_GUID_VALUE)
34+
.put(CodegenConstants.DOTNET_FRAMEWORK, "4.x")
3435
.build();
3536
}
3637

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor/Newtonsoft.Json.8.0.2/
2+
vendor/RestSharp.105.2.3/

‎samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
#!/usr/bin/env bash
2+
frameworkVersion=net45
3+
netfx=${frameworkVersion#net}
4+
25
wget -nc https://nuget.org/nuget.exe;
36
mozroots --import --sync
47
mono nuget.exe install vendor/packages.config -o vendor;
58
mkdir -p bin;
6-
mcs -sdk:45 -r:vendor/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll,\
7-
vendor/RestSharp.105.2.3/lib/net45/RestSharp.dll,\
9+
10+
cp vendor/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll;
11+
cp vendor/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll;
12+
13+
mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\
14+
bin/RestSharp.dll,\
815
System.Runtime.Serialization.dll \
916
-target:library \
1017
-out:bin/IO.Swagger.dll \
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
@echo off
2+
13
SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319
2-
%CSCPATH%\csc /reference:bin/Newtonsoft.Json.dll;bin/RestSharp.dll /target:library /out:bin/IO.Swagger.dll /recurse:src\*.cs /doc:bin/IO.Swagger.xml
34

5+
6+
if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://nuget.org/nuget.exe', '.\nuget.exe')"
7+
.\nuget.exe install vendor/packages.config -o vendor
8+
9+
cp vendor/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll
10+
cp vendor/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll
11+
12+
%CSCPATH%\csc /reference:bin/Newtonsoft.Json.dll;bin/RestSharp.dll /target:library /out:bin/IO.Swagger.dll /recurse:src\*.cs /doc:bin/IO.Swagger.xml

‎samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs

+208-191
Large diffs are not rendered by default.

‎samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs

+73-62
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace IO.Swagger.Api
1515
/// </summary>
1616
public interface IStoreApi
1717
{
18+
#region Synchronous Operations
1819

1920
/// <summary>
2021
/// Returns pet inventories by status
@@ -33,24 +34,6 @@ public interface IStoreApi
3334
/// </remarks>
3435
/// <returns>ApiResponse of Dictionary&lt;string, int?&gt;</returns>
3536
ApiResponse<Dictionary<string, int?>> GetInventoryWithHttpInfo ();
36-
37-
/// <summary>
38-
/// Returns pet inventories by status
39-
/// </summary>
40-
/// <remarks>
41-
/// Returns a map of status codes to quantities
42-
/// </remarks>
43-
/// <returns>Task of Dictionary&lt;string, int?&gt;</returns>
44-
System.Threading.Tasks.Task<Dictionary<string, int?>> GetInventoryAsync ();
45-
46-
/// <summary>
47-
/// Returns pet inventories by status
48-
/// </summary>
49-
/// <remarks>
50-
/// Returns a map of status codes to quantities
51-
/// </remarks>
52-
/// <returns>Task of ApiResponse (Dictionary&lt;string, int?&gt;)</returns>
53-
System.Threading.Tasks.Task<ApiResponse<Dictionary<string, int?>>> GetInventoryAsyncWithHttpInfo ();
5437

5538
/// <summary>
5639
/// Place an order for a pet
@@ -71,26 +54,6 @@ public interface IStoreApi
7154
/// <param name="body">order placed for purchasing the pet</param>
7255
/// <returns>ApiResponse of Order</returns>
7356
ApiResponse<Order> PlaceOrderWithHttpInfo (Order body = null);
74-
75-
/// <summary>
76-
/// Place an order for a pet
77-
/// </summary>
78-
/// <remarks>
79-
///
80-
/// </remarks>
81-
/// <param name="body">order placed for purchasing the pet</param>
82-
/// <returns>Task of Order</returns>
83-
System.Threading.Tasks.Task<Order> PlaceOrderAsync (Order body = null);
84-
85-
/// <summary>
86-
/// Place an order for a pet
87-
/// </summary>
88-
/// <remarks>
89-
///
90-
/// </remarks>
91-
/// <param name="body">order placed for purchasing the pet</param>
92-
/// <returns>Task of ApiResponse (Order)</returns>
93-
System.Threading.Tasks.Task<ApiResponse<Order>> PlaceOrderAsyncWithHttpInfo (Order body = null);
9457

9558
/// <summary>
9659
/// Find purchase order by ID
@@ -111,26 +74,6 @@ public interface IStoreApi
11174
/// <param name="orderId">ID of pet that needs to be fetched</param>
11275
/// <returns>ApiResponse of Order</returns>
11376
ApiResponse<Order> GetOrderByIdWithHttpInfo (string orderId);
114-
115-
/// <summary>
116-
/// Find purchase order by ID
117-
/// </summary>
118-
/// <remarks>
119-
/// For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
120-
/// </remarks>
121-
/// <param name="orderId">ID of pet that needs to be fetched</param>
122-
/// <returns>Task of Order</returns>
123-
System.Threading.Tasks.Task<Order> GetOrderByIdAsync (string orderId);
124-
125-
/// <summary>
126-
/// Find purchase order by ID
127-
/// </summary>
128-
/// <remarks>
129-
/// For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
130-
/// </remarks>
131-
/// <param name="orderId">ID of pet that needs to be fetched</param>
132-
/// <returns>Task of ApiResponse (Order)</returns>
133-
System.Threading.Tasks.Task<ApiResponse<Order>> GetOrderByIdAsyncWithHttpInfo (string orderId);
13477

13578
/// <summary>
13679
/// Delete purchase order by ID
@@ -151,7 +94,69 @@ public interface IStoreApi
15194
/// <param name="orderId">ID of the order that needs to be deleted</param>
15295
/// <returns>ApiResponse of Object(void)</returns>
15396
ApiResponse<Object> DeleteOrderWithHttpInfo (string orderId);
97+
98+
#endregion Synchronous Operations
99+
100+
#region Asynchronous Operations
101+
102+
/// <summary>
103+
/// Returns pet inventories by status
104+
/// </summary>
105+
/// <remarks>
106+
/// Returns a map of status codes to quantities
107+
/// </remarks>
108+
/// <returns>Task of Dictionary&lt;string, int?&gt;</returns>
109+
System.Threading.Tasks.Task<Dictionary<string, int?>> GetInventoryAsync ();
154110

111+
/// <summary>
112+
/// Returns pet inventories by status
113+
/// </summary>
114+
/// <remarks>
115+
/// Returns a map of status codes to quantities
116+
/// </remarks>
117+
/// <returns>Task of ApiResponse (Dictionary&lt;string, int?&gt;)</returns>
118+
System.Threading.Tasks.Task<ApiResponse<Dictionary<string, int?>>> GetInventoryAsyncWithHttpInfo ();
119+
120+
/// <summary>
121+
/// Place an order for a pet
122+
/// </summary>
123+
/// <remarks>
124+
///
125+
/// </remarks>
126+
/// <param name="body">order placed for purchasing the pet</param>
127+
/// <returns>Task of Order</returns>
128+
System.Threading.Tasks.Task<Order> PlaceOrderAsync (Order body = null);
129+
130+
/// <summary>
131+
/// Place an order for a pet
132+
/// </summary>
133+
/// <remarks>
134+
///
135+
/// </remarks>
136+
/// <param name="body">order placed for purchasing the pet</param>
137+
/// <returns>Task of ApiResponse (Order)</returns>
138+
System.Threading.Tasks.Task<ApiResponse<Order>> PlaceOrderAsyncWithHttpInfo (Order body = null);
139+
140+
/// <summary>
141+
/// Find purchase order by ID
142+
/// </summary>
143+
/// <remarks>
144+
/// For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
145+
/// </remarks>
146+
/// <param name="orderId">ID of pet that needs to be fetched</param>
147+
/// <returns>Task of Order</returns>
148+
System.Threading.Tasks.Task<Order> GetOrderByIdAsync (string orderId);
149+
150+
/// <summary>
151+
/// Find purchase order by ID
152+
/// </summary>
153+
/// <remarks>
154+
/// For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
155+
/// </remarks>
156+
/// <param name="orderId">ID of pet that needs to be fetched</param>
157+
/// <returns>Task of ApiResponse (Order)</returns>
158+
System.Threading.Tasks.Task<ApiResponse<Order>> GetOrderByIdAsyncWithHttpInfo (string orderId);
159+
155160
/// <summary>
156161
/// Delete purchase order by ID
157162
/// </summary>
@@ -172,6 +177,8 @@ public interface IStoreApi
172177
/// <returns>Task of ApiResponse</returns>
173178
System.Threading.Tasks.Task<ApiResponse<Object>> DeleteOrderAsyncWithHttpInfo (string orderId);
174179

180+
#endregion Asynchronous Operations
181+
175182
}
176183

177184
/// <summary>
@@ -326,7 +333,8 @@ public void AddDefaultHeader(string key, string value)
326333
(Dictionary<string, int?>) Configuration.ApiClient.Deserialize(response, typeof(Dictionary<string, int?>)));
327334

328335
}
329-
336+
337+
330338
/// <summary>
331339
/// Returns pet inventories by status Returns a map of status codes to quantities
332340
/// </summary>
@@ -484,7 +492,8 @@ public ApiResponse< Order > PlaceOrderWithHttpInfo (Order body = null)
484492
(Order) Configuration.ApiClient.Deserialize(response, typeof(Order)));
485493

486494
}
487-
495+
496+
488497
/// <summary>
489498
/// Place an order for a pet
490499
/// </summary>
@@ -635,7 +644,8 @@ public ApiResponse< Order > GetOrderByIdWithHttpInfo (string orderId)
635644
(Order) Configuration.ApiClient.Deserialize(response, typeof(Order)));
636645

637646
}
638-
647+
648+
639649
/// <summary>
640650
/// Find purchase order by ID For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
641651
/// </summary>
@@ -787,7 +797,8 @@ public ApiResponse<Object> DeleteOrderWithHttpInfo (string orderId)
787797
response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
788798
null);
789799
}
790-
800+
801+
791802
/// <summary>
792803
/// Delete purchase order by ID For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
793804
/// </summary>

‎samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs

+147-132
Large diffs are not rendered by default.

‎samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public Object CallApi(
146146
var response = RestClient.Execute(request);
147147
return (Object) response;
148148
}
149-
149+
150150
/// <summary>
151151
/// Makes the asynchronous HTTP request.
152152
/// </summary>

‎samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Properties/AssemblyInfo.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Reflection;
22
using System.Runtime.InteropServices;
3-
using System.Windows;
43

54
// General Information about an assembly is controlled through the following
65
// set of attributes. Change these attribute values to modify the information
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="RestSharp" version="105.2.3" targetFramework="net45" developmentDependency="true" />
3+
<package id="RestSharp" version="105.1.0" targetFramework="net45" developmentDependency="true" />
44
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net45" developmentDependency="true" />
55
</packages>

0 commit comments

Comments
 (0)
Please sign in to comment.