forked from loafle/openapi-generator-original
[csharp] Making example code snippet compilable (#3019)
* fix(okhttp-gson): Updating example * fix(csharp): Updating example * fix(csharp): Updating pet project * fix(csharp): Updating example
This commit is contained in:
parent
499c8ac5c1
commit
0a037ae111
@ -102,7 +102,6 @@ Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-p
|
||||
## Getting Started
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using {{packageName}}.{{apiPackage}};
|
||||
using {{packageName}}.Client;
|
||||
@ -112,9 +111,10 @@ namespace Example
|
||||
{
|
||||
public class {{operationId}}Example
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
|
||||
Configuration.Default.BasePath = "{{{basePath}}}";
|
||||
{{#hasAuthMethods}}
|
||||
{{#authMethods}}
|
||||
{{#isBasic}}
|
||||
@ -135,7 +135,7 @@ namespace Example
|
||||
{{/authMethods}}
|
||||
|
||||
{{/hasAuthMethods}}
|
||||
var apiInstance = new {{classname}}();
|
||||
var apiInstance = new {{classname}}(Configuration.Default);
|
||||
{{#allParams}}
|
||||
{{#isPrimitiveType}}
|
||||
var {{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||
@ -153,9 +153,11 @@ namespace Example
|
||||
{{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
|
||||
Debug.WriteLine(result);{{/returnType}}
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ Method | HTTP request | Description
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using {{packageName}}.{{apiPackage}};
|
||||
using {{packageName}}.Client;
|
||||
@ -33,8 +32,9 @@ namespace Example
|
||||
{
|
||||
public class {{operationId}}Example
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
Configuration.Default.BasePath = "{{{basePath}}}";
|
||||
{{#hasAuthMethods}}
|
||||
{{#authMethods}}
|
||||
{{#isBasic}}
|
||||
@ -55,7 +55,7 @@ namespace Example
|
||||
{{/authMethods}}
|
||||
|
||||
{{/hasAuthMethods}}
|
||||
var apiInstance = new {{classname}}();
|
||||
var apiInstance = new {{classname}}(Configuration.Default);
|
||||
{{#allParams}}
|
||||
{{#isPrimitiveType}}
|
||||
var {{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||
@ -73,9 +73,11 @@ namespace Example
|
||||
{{#returnType}}{{returnType}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
|
||||
Debug.WriteLine(result);{{/returnType}}
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,6 @@ Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-p
|
||||
## Getting Started
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -74,10 +73,11 @@ namespace Example
|
||||
{
|
||||
public class Example
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
|
||||
var apiInstance = new AnotherFakeApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new AnotherFakeApi(Configuration.Default);
|
||||
var body = new ModelClient(); // ModelClient | client model
|
||||
|
||||
try
|
||||
@ -86,9 +86,11 @@ namespace Example
|
||||
ModelClient result = apiInstance.Call123TestSpecialTags(body);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ To test special tags and operation ID starting with number
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -29,9 +28,10 @@ namespace Example
|
||||
{
|
||||
public class Call123TestSpecialTagsExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new AnotherFakeApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new AnotherFakeApi(Configuration.Default);
|
||||
var body = new ModelClient(); // ModelClient | client model
|
||||
|
||||
try
|
||||
@ -40,9 +40,11 @@ namespace Example
|
||||
ModelClient result = apiInstance.Call123TestSpecialTags(body);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ this route creates an XmlItem
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -41,9 +40,10 @@ namespace Example
|
||||
{
|
||||
public class CreateXmlItemExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new FakeApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var xmlItem = new XmlItem(); // XmlItem | XmlItem Body
|
||||
|
||||
try
|
||||
@ -51,9 +51,11 @@ namespace Example
|
||||
// creates an XmlItem
|
||||
apiInstance.CreateXmlItem(xmlItem);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeApi.CreateXmlItem: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -97,7 +99,6 @@ Test serialization of outer boolean types
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -107,9 +108,10 @@ namespace Example
|
||||
{
|
||||
public class FakeOuterBooleanSerializeExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new FakeApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var body = true; // bool? | Input boolean as post body (optional)
|
||||
|
||||
try
|
||||
@ -117,9 +119,11 @@ namespace Example
|
||||
bool? result = apiInstance.FakeOuterBooleanSerialize(body);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,7 +167,6 @@ Test serialization of object with outer number type
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -173,9 +176,10 @@ namespace Example
|
||||
{
|
||||
public class FakeOuterCompositeSerializeExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new FakeApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var body = new OuterComposite(); // OuterComposite | Input composite as post body (optional)
|
||||
|
||||
try
|
||||
@ -183,9 +187,11 @@ namespace Example
|
||||
OuterComposite result = apiInstance.FakeOuterCompositeSerialize(body);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerialize: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -229,7 +235,6 @@ Test serialization of outer number types
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -239,9 +244,10 @@ namespace Example
|
||||
{
|
||||
public class FakeOuterNumberSerializeExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new FakeApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var body = 8.14; // decimal? | Input number as post body (optional)
|
||||
|
||||
try
|
||||
@ -249,9 +255,11 @@ namespace Example
|
||||
decimal? result = apiInstance.FakeOuterNumberSerialize(body);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerialize: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -295,7 +303,6 @@ Test serialization of outer string types
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -305,9 +312,10 @@ namespace Example
|
||||
{
|
||||
public class FakeOuterStringSerializeExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new FakeApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var body = body_example; // string | Input string as post body (optional)
|
||||
|
||||
try
|
||||
@ -315,9 +323,11 @@ namespace Example
|
||||
string result = apiInstance.FakeOuterStringSerialize(body);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeApi.FakeOuterStringSerialize: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -361,7 +371,6 @@ For this test, the body for this request much reference a schema named `File`.
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -371,18 +380,21 @@ namespace Example
|
||||
{
|
||||
public class TestBodyWithFileSchemaExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new FakeApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var body = new FileSchemaTestClass(); // FileSchemaTestClass |
|
||||
|
||||
try
|
||||
{
|
||||
apiInstance.TestBodyWithFileSchema(body);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -424,7 +436,6 @@ No authorization required
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -434,9 +445,10 @@ namespace Example
|
||||
{
|
||||
public class TestBodyWithQueryParamsExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new FakeApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var query = query_example; // string |
|
||||
var body = new User(); // User |
|
||||
|
||||
@ -444,9 +456,11 @@ namespace Example
|
||||
{
|
||||
apiInstance.TestBodyWithQueryParams(query, body);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeApi.TestBodyWithQueryParams: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -491,7 +505,6 @@ To test \"client\" model
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -501,9 +514,10 @@ namespace Example
|
||||
{
|
||||
public class TestClientModelExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new FakeApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var body = new ModelClient(); // ModelClient | client model
|
||||
|
||||
try
|
||||
@ -512,9 +526,11 @@ namespace Example
|
||||
ModelClient result = apiInstance.TestClientModel(body);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeApi.TestClientModel: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -558,7 +574,6 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -568,13 +583,14 @@ namespace Example
|
||||
{
|
||||
public class TestEndpointParametersExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
// Configure HTTP basic authorization: http_basic_test
|
||||
Configuration.Default.Username = "YOUR_USERNAME";
|
||||
Configuration.Default.Password = "YOUR_PASSWORD";
|
||||
|
||||
var apiInstance = new FakeApi();
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var number = 8.14; // decimal? | None
|
||||
var _double = 1.2D; // double? | None
|
||||
var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None
|
||||
@ -595,9 +611,11 @@ namespace Example
|
||||
// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
apiInstance.TestEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -654,7 +672,6 @@ To test enum parameters
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -664,9 +681,10 @@ namespace Example
|
||||
{
|
||||
public class TestEnumParametersExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new FakeApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var enumHeaderStringArray = enumHeaderStringArray_example; // List<string> | Header parameter enum test (string array) (optional)
|
||||
var enumHeaderString = enumHeaderString_example; // string | Header parameter enum test (string) (optional) (default to -efg)
|
||||
var enumQueryStringArray = enumQueryStringArray_example; // List<string> | Query parameter enum test (string array) (optional)
|
||||
@ -681,9 +699,11 @@ namespace Example
|
||||
// To test enum parameters
|
||||
apiInstance.TestEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeApi.TestEnumParameters: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -734,7 +754,6 @@ Fake endpoint to test group parameters (optional)
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -744,9 +763,10 @@ namespace Example
|
||||
{
|
||||
public class TestGroupParametersExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new FakeApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var requiredStringGroup = 56; // int? | Required String in group parameters
|
||||
var requiredBooleanGroup = true; // bool? | Required Boolean in group parameters
|
||||
var requiredInt64Group = 789; // long? | Required Integer in group parameters
|
||||
@ -759,9 +779,11 @@ namespace Example
|
||||
// Fake endpoint to test group parameters (optional)
|
||||
apiInstance.TestGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeApi.TestGroupParameters: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -808,7 +830,6 @@ test inline additionalProperties
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -818,9 +839,10 @@ namespace Example
|
||||
{
|
||||
public class TestInlineAdditionalPropertiesExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new FakeApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var param = new Dictionary<string, string>(); // Dictionary<string, string> | request body
|
||||
|
||||
try
|
||||
@ -828,9 +850,11 @@ namespace Example
|
||||
// test inline additionalProperties
|
||||
apiInstance.TestInlineAdditionalProperties(param);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeApi.TestInlineAdditionalProperties: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -872,7 +896,6 @@ test json serialization of form data
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -882,9 +905,10 @@ namespace Example
|
||||
{
|
||||
public class TestJsonFormDataExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new FakeApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var param = param_example; // string | field1
|
||||
var param2 = param2_example; // string | field2
|
||||
|
||||
@ -893,9 +917,11 @@ namespace Example
|
||||
// test json serialization of form data
|
||||
apiInstance.TestJsonFormData(param, param2);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeApi.TestJsonFormData: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ To test class name in snake case
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -29,14 +28,15 @@ namespace Example
|
||||
{
|
||||
public class TestClassnameExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
// Configure API key authorization: api_key_query
|
||||
Configuration.Default.AddApiKey("api_key_query", "YOUR_API_KEY");
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
// Configuration.Default.AddApiKeyPrefix("api_key_query", "Bearer");
|
||||
|
||||
var apiInstance = new FakeClassnameTags123Api();
|
||||
var apiInstance = new FakeClassnameTags123Api(Configuration.Default);
|
||||
var body = new ModelClient(); // ModelClient | client model
|
||||
|
||||
try
|
||||
@ -45,9 +45,11 @@ namespace Example
|
||||
ModelClient result = apiInstance.TestClassname(body);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassname: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ Add a new pet to the store
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -35,12 +34,13 @@ namespace Example
|
||||
{
|
||||
public class AddPetExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
|
||||
|
||||
var apiInstance = new PetApi();
|
||||
var apiInstance = new PetApi(Configuration.Default);
|
||||
var body = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
|
||||
try
|
||||
@ -48,9 +48,11 @@ namespace Example
|
||||
// Add a new pet to the store
|
||||
apiInstance.AddPet(body);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling PetApi.AddPet: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -92,7 +94,6 @@ Deletes a pet
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -102,12 +103,13 @@ namespace Example
|
||||
{
|
||||
public class DeletePetExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
|
||||
|
||||
var apiInstance = new PetApi();
|
||||
var apiInstance = new PetApi(Configuration.Default);
|
||||
var petId = 789; // long? | Pet id to delete
|
||||
var apiKey = apiKey_example; // string | (optional)
|
||||
|
||||
@ -116,9 +118,11 @@ namespace Example
|
||||
// Deletes a pet
|
||||
apiInstance.DeletePet(petId, apiKey);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,7 +167,6 @@ Multiple status values can be provided with comma separated strings
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -173,12 +176,13 @@ namespace Example
|
||||
{
|
||||
public class FindPetsByStatusExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
|
||||
|
||||
var apiInstance = new PetApi();
|
||||
var apiInstance = new PetApi(Configuration.Default);
|
||||
var status = status_example; // List<string> | Status values that need to be considered for filter
|
||||
|
||||
try
|
||||
@ -187,9 +191,11 @@ namespace Example
|
||||
List<Pet> result = apiInstance.FindPetsByStatus(status);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -233,7 +239,6 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -243,12 +248,13 @@ namespace Example
|
||||
{
|
||||
public class FindPetsByTagsExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
|
||||
|
||||
var apiInstance = new PetApi();
|
||||
var apiInstance = new PetApi(Configuration.Default);
|
||||
var tags = new List<string>(); // List<string> | Tags to filter by
|
||||
|
||||
try
|
||||
@ -257,9 +263,11 @@ namespace Example
|
||||
List<Pet> result = apiInstance.FindPetsByTags(tags);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -303,7 +311,6 @@ Returns a single pet
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -313,14 +320,15 @@ namespace Example
|
||||
{
|
||||
public class GetPetByIdExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
// Configure API key authorization: api_key
|
||||
Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY");
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
// Configuration.Default.AddApiKeyPrefix("api_key", "Bearer");
|
||||
|
||||
var apiInstance = new PetApi();
|
||||
var apiInstance = new PetApi(Configuration.Default);
|
||||
var petId = 789; // long? | ID of pet to return
|
||||
|
||||
try
|
||||
@ -329,9 +337,11 @@ namespace Example
|
||||
Pet result = apiInstance.GetPetById(petId);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -373,7 +383,6 @@ Update an existing pet
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -383,12 +392,13 @@ namespace Example
|
||||
{
|
||||
public class UpdatePetExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
|
||||
|
||||
var apiInstance = new PetApi();
|
||||
var apiInstance = new PetApi(Configuration.Default);
|
||||
var body = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
|
||||
try
|
||||
@ -396,9 +406,11 @@ namespace Example
|
||||
// Update an existing pet
|
||||
apiInstance.UpdatePet(body);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -440,7 +452,6 @@ Updates a pet in the store with form data
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -450,12 +461,13 @@ namespace Example
|
||||
{
|
||||
public class UpdatePetWithFormExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
|
||||
|
||||
var apiInstance = new PetApi();
|
||||
var apiInstance = new PetApi(Configuration.Default);
|
||||
var petId = 789; // long? | ID of pet that needs to be updated
|
||||
var name = name_example; // string | Updated name of the pet (optional)
|
||||
var status = status_example; // string | Updated status of the pet (optional)
|
||||
@ -465,9 +477,11 @@ namespace Example
|
||||
// Updates a pet in the store with form data
|
||||
apiInstance.UpdatePetWithForm(petId, name, status);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -511,7 +525,6 @@ uploads an image
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -521,12 +534,13 @@ namespace Example
|
||||
{
|
||||
public class UploadFileExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
|
||||
|
||||
var apiInstance = new PetApi();
|
||||
var apiInstance = new PetApi(Configuration.Default);
|
||||
var petId = 789; // long? | ID of pet to update
|
||||
var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional)
|
||||
var file = BINARY_DATA_HERE; // System.IO.Stream | file to upload (optional)
|
||||
@ -537,9 +551,11 @@ namespace Example
|
||||
ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -583,7 +599,6 @@ uploads an image (required)
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -593,12 +608,13 @@ namespace Example
|
||||
{
|
||||
public class UploadFileWithRequiredFileExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
|
||||
|
||||
var apiInstance = new PetApi();
|
||||
var apiInstance = new PetApi(Configuration.Default);
|
||||
var petId = 789; // long? | ID of pet to update
|
||||
var requiredFile = BINARY_DATA_HERE; // System.IO.Stream | file to upload
|
||||
var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional)
|
||||
@ -609,9 +625,11 @@ namespace Example
|
||||
ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -32,9 +31,10 @@ namespace Example
|
||||
{
|
||||
public class DeleteOrderExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new StoreApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new StoreApi(Configuration.Default);
|
||||
var orderId = orderId_example; // string | ID of the order that needs to be deleted
|
||||
|
||||
try
|
||||
@ -42,9 +42,11 @@ namespace Example
|
||||
// Delete purchase order by ID
|
||||
apiInstance.DeleteOrder(orderId);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -88,7 +90,6 @@ Returns a map of status codes to quantities
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -98,14 +99,15 @@ namespace Example
|
||||
{
|
||||
public class GetInventoryExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
// Configure API key authorization: api_key
|
||||
Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY");
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
// Configuration.Default.AddApiKeyPrefix("api_key", "Bearer");
|
||||
|
||||
var apiInstance = new StoreApi();
|
||||
var apiInstance = new StoreApi(Configuration.Default);
|
||||
|
||||
try
|
||||
{
|
||||
@ -113,9 +115,11 @@ namespace Example
|
||||
Dictionary<string, int?> result = apiInstance.GetInventory();
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -156,7 +160,6 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -166,9 +169,10 @@ namespace Example
|
||||
{
|
||||
public class GetOrderByIdExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new StoreApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new StoreApi(Configuration.Default);
|
||||
var orderId = 789; // long? | ID of pet that needs to be fetched
|
||||
|
||||
try
|
||||
@ -177,9 +181,11 @@ namespace Example
|
||||
Order result = apiInstance.GetOrderById(orderId);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -221,7 +227,6 @@ Place an order for a pet
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -231,9 +236,10 @@ namespace Example
|
||||
{
|
||||
public class PlaceOrderExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new StoreApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new StoreApi(Configuration.Default);
|
||||
var body = new Order(); // Order | order placed for purchasing the pet
|
||||
|
||||
try
|
||||
@ -242,9 +248,11 @@ namespace Example
|
||||
Order result = apiInstance.PlaceOrder(body);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ This can only be done by the logged in user.
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -36,9 +35,10 @@ namespace Example
|
||||
{
|
||||
public class CreateUserExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new UserApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new UserApi(Configuration.Default);
|
||||
var body = new User(); // User | Created user object
|
||||
|
||||
try
|
||||
@ -46,9 +46,11 @@ namespace Example
|
||||
// Create user
|
||||
apiInstance.CreateUser(body);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -90,7 +92,6 @@ Creates list of users with given input array
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -100,9 +101,10 @@ namespace Example
|
||||
{
|
||||
public class CreateUsersWithArrayInputExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new UserApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new UserApi(Configuration.Default);
|
||||
var body = new List<User>(); // List<User> | List of user object
|
||||
|
||||
try
|
||||
@ -110,9 +112,11 @@ namespace Example
|
||||
// Creates list of users with given input array
|
||||
apiInstance.CreateUsersWithArrayInput(body);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -154,7 +158,6 @@ Creates list of users with given input array
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -164,9 +167,10 @@ namespace Example
|
||||
{
|
||||
public class CreateUsersWithListInputExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new UserApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new UserApi(Configuration.Default);
|
||||
var body = new List<User>(); // List<User> | List of user object
|
||||
|
||||
try
|
||||
@ -174,9 +178,11 @@ namespace Example
|
||||
// Creates list of users with given input array
|
||||
apiInstance.CreateUsersWithListInput(body);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -220,7 +226,6 @@ This can only be done by the logged in user.
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -230,9 +235,10 @@ namespace Example
|
||||
{
|
||||
public class DeleteUserExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new UserApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new UserApi(Configuration.Default);
|
||||
var username = username_example; // string | The name that needs to be deleted
|
||||
|
||||
try
|
||||
@ -240,9 +246,11 @@ namespace Example
|
||||
// Delete user
|
||||
apiInstance.DeleteUser(username);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -284,7 +292,6 @@ Get user by user name
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -294,9 +301,10 @@ namespace Example
|
||||
{
|
||||
public class GetUserByNameExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new UserApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new UserApi(Configuration.Default);
|
||||
var username = username_example; // string | The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
try
|
||||
@ -305,9 +313,11 @@ namespace Example
|
||||
User result = apiInstance.GetUserByName(username);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -349,7 +359,6 @@ Logs user into the system
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -359,9 +368,10 @@ namespace Example
|
||||
{
|
||||
public class LoginUserExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new UserApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new UserApi(Configuration.Default);
|
||||
var username = username_example; // string | The user name for login
|
||||
var password = password_example; // string | The password for login in clear text
|
||||
|
||||
@ -371,9 +381,11 @@ namespace Example
|
||||
string result = apiInstance.LoginUser(username, password);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -416,7 +428,6 @@ Logs out current logged in user session
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -426,18 +437,21 @@ namespace Example
|
||||
{
|
||||
public class LogoutUserExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new UserApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new UserApi(Configuration.Default);
|
||||
|
||||
try
|
||||
{
|
||||
// Logs out current logged in user session
|
||||
apiInstance.LogoutUser();
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -478,7 +492,6 @@ This can only be done by the logged in user.
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Org.OpenAPITools.Api;
|
||||
using Org.OpenAPITools.Client;
|
||||
@ -488,9 +501,10 @@ namespace Example
|
||||
{
|
||||
public class UpdateUserExample
|
||||
{
|
||||
public void main()
|
||||
public static void Main()
|
||||
{
|
||||
var apiInstance = new UserApi();
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new UserApi(Configuration.Default);
|
||||
var username = username_example; // string | name that need to be deleted
|
||||
var body = new User(); // User | Updated user object
|
||||
|
||||
@ -499,9 +513,11 @@ namespace Example
|
||||
// Updated user
|
||||
apiInstance.UpdateUser(username, body);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user